-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy of PresentationPages.aspx.cs.exclude
executable file
·191 lines (165 loc) · 6.06 KB
/
Copy of PresentationPages.aspx.cs.exclude
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Web.Security;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
public partial class Master_PresentationPages : System.Web.UI.Page
{
SqlConnection c = new SqlConnection(ConfigurationManager.ConnectionStrings["terrible1ConnectionString"].ToString());
int PresentationID = 0;
protected void Page_Load(object sender, EventArgs e)
{
//for cover
DataView dvSql = (DataView)dsCover.Select(DataSourceSelectArguments.Empty);
foreach (DataRowView drvSql in dvSql)
{
int cID = Convert.ToInt32(drvSql["CoverID"].ToString());
if ((cID == 0))
{
Content.Visible = true;
ViewContent.Visible = false;
ContentEdit.Visible = false;
}
else
{
Content.Visible = false;
ViewContent.Visible = true;
loadCover(cID);
ContentEdit.Visible = false;
HiddenFieldCoverID.Value = Convert.ToInt32 (cID).ToString();
}
}
if (!IsPostBack)
{
SetDefaultView();
PresentationID = Convert.ToInt32(Request.QueryString.Get("PresentationID"));
}
}
private void loadCover(int CoverID)
{
Cover myCover;
myCover = clscover.getCover(CoverID);
DivContent.InnerHtml = HttpUtility.HtmlDecode(myCover.CoverPage.ToString());
}
private void SetDefaultView()
{
MultiView1.ActiveViewIndex = 0;
}
protected void lnkTab1_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 0;
}
protected void lnkTab2_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 1;
}
protected void lnkTab3_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 2;
}
protected void BtnSave_Click(object sender, System.EventArgs e)
{
//save Cover
PresentationID = Convert.ToInt32(Request.QueryString.Get("PresentationID"));
PreviewButton_Click(null, EventArgs.Empty);
string UserSignature = TextPreview.InnerHtml;
c.Open();
using (SqlCommand cmd = c.CreateCommand())
{
cmd.Parameters.Clear();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sp_InsertCover";
cmd.Parameters.Add("@CoverPage", SqlDbType.NVarChar).Value = System.Convert.ToString(UserSignature);
cmd.Parameters.Add("@PresentationID", SqlDbType.Int).Value = PresentationID;
cmd.ExecuteNonQuery();
}
c.Close();
//create cover file
string pathToCreate = "~/CoverPages/" + PresentationID;
Directory.CreateDirectory(Server.MapPath(pathToCreate));
FileInfo f = new FileInfo(Server.MapPath(pathToCreate) + "1.html");
TextWriter tw = f.CreateText();
tw.Write(string.Format("<head><title></title></head><body >{0}</body></html>", UserSignature));
tw.Close();
Response.Redirect("PresentationGridMaster.aspx", false);
}
protected void BtnCancel_Click(object sender, System.EventArgs e)
{
Response.Redirect("PresentationGridMaster.aspx", false);
}
protected void PreviewButton_Click(object sender, EventArgs e)
{
switch (Selections.SelectedValue)
{
case "Formatted":
TextPreview.InnerHtml = Editor.Text;
break;
case "Html":
TextPreview.InnerText = Editor.Text;
break;
default:
break;
}
}
protected void ClearButton_Click(object sender, EventArgs e)
{
Editor.Text = String.Empty;
}
//for edit
protected void ClearButtonEdit_Click(object sender, EventArgs e)
{
Editor.Text = String.Empty;
}
protected void PreviewButtonEdit_Click(object sender, EventArgs e)
{
switch (Selections.SelectedValue)
{
case "Formatted":
TextPreviewEdit.InnerHtml = Editor.Text;
break;
case "Html":
TextPreviewEdit.InnerText = Editor.Text;
break;
default:
break;
}
}
protected void BtnUpdateEdit_Click(object sender, System.EventArgs e)
{
//Cover myCover;
//myCover = new Cover();
//myCover.CoverID = System.Convert.ToInt32(txtCoverID.Text);
//myCover.CoverTitle = System.Convert.ToString(txtCoverTitle.Text);
//myCover.CoverPage = System.Convert.ToString(txtCoverPage.Text);
//myCover.CoverFileName = System.Convert.ToString(txtCoverFileName.Text);
//myCover.CreatedBy = System.Convert.ToString(txtCreatedBy.Text);
//myCover.CreatedDate = System.Convert.ToDateTime(calCreatedDate.SelectedDate);
//myCover.ModifiedBy = System.Convert.ToString(txtModifiedBy.Text);
//myCover.ModifiedDate = System.Convert.ToDateTime(calModifiedDate.SelectedDate);
//clscover.Update(myCover);
//Response.Redirect("CoverGrid.aspx", false);
}
protected void BtnCancelEdit_Click(object sender, System.EventArgs e)
{
Response.Redirect("PresentationGridMaster.aspx", false);
}
protected void btnEditCover_Click(object sender, EventArgs e)
{
ContentEdit.Visible = true;
ViewContent.Visible = false;
Content.Visible = false;
EditCover(Convert.ToInt32(HiddenFieldCoverID.Value));
}
private void EditCover(int CoverID)
{
Cover myCover;
myCover = clscover.getCover(CoverID);
EditorEdit.Text = HttpUtility.HtmlDecode(myCover.CoverPage.ToString());
}
}