ÎÂܰÌáʾ£º´úÂëÔÚÏßä¯ÀÀ¹¦ÄÜÖ»ÄÜ×öΪԴÂëä¯ÀÀ²Î¿¼£¬Èç¹ûÏë¸ü½øÒ»²½Á˽â¸Ã´úÂëÇëÏÂÔØ£º¸ßУ½Ìʦµµ°¸¹ÜÀíϵͳÏîĿԴÂë
µ±Ç°Îļþ£º
TeacherFileProject/SciResearch/Research_lzqk.aspx.cs£¬´ò¿ª´úÂë½á¹¹Í¼
TeacherFileProject/SciResearch/Research_lzqk.aspx.cs£¬´ò¿ª´úÂë½á¹¹Í¼1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using System.Data.SqlClient; 12
public partial class SciResearch_Research_lzqk : System.Web.UI.Page 13
{ 14
PersonRecordClass prObj = new PersonRecordClass(); 15
SciResearchClass srObj = new SciResearchClass(); 16
protected void Page_Load(object sender, EventArgs e) 17
{ 18
if (!IsPostBack) 19
{ 20
if ((Session["isOpen"] == null) && (Session["Admin"] == null)) 21
{ 22
Response.Write("<script>parent.location='../Default.aspx';</script>"); 23
} 24
else 25
{ 26
27
tabList.Visible = false; 28
tabAdd.Visible = false; 29
tabUpdate.Visible = false; 30
btnAddList.Visible = false; 31
if (Convert.ToInt32(Session["isOpen"]) == 1 || Convert.ToInt32(Session["Admin"]) == 1) 32
{ 33
tabList.Visible = true; 34
btnAddList.Visible = true; 35
gvListBind(); 36
37
38
} 39
else 40
{ 41
tabList.Visible = true; 42
btnAddList.Visible = false; 43
gvListBind(); 44
gvList.Columns[0].Visible = false; 45
gvList.Columns[1].Visible = false; 46
} 47
} 48
} 49
} 50
//============================================================= 51
// ·½ ·¨ Ãû£º gvListBind() 52
// ¹¦ÄÜÃèÊö£º ¶ÔGridView½øÐа󶨣¬ÏÔʾ¿ÆÑ§Ñо¿£¨·¢±íÂÛÎÄ£©µÄ×ÊÁÏ 53
// ÊäÈë²ÎÊý£º ÎÞ 54
// ·µ »Ø Öµ£º ÎÞ 55
// ============================================================== 56
public void gvListBind() 57
{ 58
if ((Session["isOpen"] == null) && (Session["Admin"] == null)) 59
{ 60
Response.Write("<script>parent.location='../Default.aspx';</script>"); 61
} 62
else 63
{ 64
if (Convert.ToInt32(Session["Admin"]) == 1) 65
{ 66
SqlCommand myCmd = srObj.GetASRCmd(3); 67
prObj.GVBind(myCmd, gvList, "ASR"); 68
} 69
else 70
{ 71
SqlCommand myCmd = srObj.GetSSRCmd(3, Convert.ToInt32(Session["UID"])); 72
prObj.GVBind(myCmd, gvList, "SSR"); 73
} 74
75
} 76
77
} 78
//============================================================= 79
// Ê ¼þ Ãû£º gvList_RowDeleting() 80
// ¹¦ÄÜÃèÊö£º ¶ÔGridViewÖеÄijÐнøÐÐɾ³ý 81
// ============================================================== 82
protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e) 83
{ 84
int P_Int_id = Convert.ToInt32(gvList.DataKeys[e.RowIndex].Value); 85
srObj.DeleteSRInfo(P_Int_id); 86
gvListBind(); 87
} 88
//============================================================= 89
// Ê ¼þ Ãû£º gvList_RowUpdating() 90
// ¹¦ÄÜÃèÊö£º ¶ÔGridViewÖеÄijÐнøÐÐÐÞ¸Äʱ£¬Ð޸ıíÏÔʾÆäÐÞ¸ÄÄÚÈÝ 91
// ============================================================== 92
protected void gvList_RowUpdating(object sender, GridViewUpdateEventArgs e) 93
{ 94
tabUpdate.Visible = true; 95
tabList.Visible = false; 96
tabAdd.Visible = false; 97
prObj.DDLBind(ddlUYearInfo); 98
int P_Int_id = Convert.ToInt32(gvList.DataKeys[e.RowIndex].Value); 99
labValue.Text = P_Int_id.ToString(); 100
DataSet ds = srObj.ReturnSRDs(3, P_Int_id, "SRInfo"); 101
txtName.Text = ds.Tables["SRInfo"].Rows[0][0].ToString(); 102
txtUName.Text = ds.Tables["SRInfo"].Rows[0][1].ToString(); 103
txtULessonName.Text = ds.Tables["SRInfo"].Rows[0][8].ToString(); 104
txtUAuthor.Text = ds.Tables["SRInfo"].Rows[0][5].ToString(); 105
txtUWorker.Text = ds.Tables["SRInfo"].Rows[0][6].ToString(); 106
txtUStartEndTime.Text = ds.Tables["SRInfo"].Rows[0][2].ToString(); 107
txtUFroming.Text = ds.Tables["SRInfo"].Rows[0][4].ToString(); 108
ddlUYearInfo.SelectedItem.Text = ds.Tables["SRInfo"].Rows[0][7].ToString(); 109
} 110
//============================================================= 111
// Ê ¼þ Ãû£º btnReset_Click() 112
// ¹¦ÄÜÃèÊö£º ÔÚÌí¼Ó±íÉÏ£¬µ¥»÷ÖØÖð´Å¥Ê±£¬ÖØÐÂÌîд½ÌʦµÄ½ÌѧÑо¿×ÊÁÏ 113
// ============================================================== 114
protected void btnReset_Click(object sender, EventArgs e) 115
{ 116
txtAName.Text = ""; 117
txtALessonName.Text = ""; 118
txtAFroming.Text = ""; 119
txtAAuthor.Text = ""; 120
txtAWorker.Text = ""; 121
ddlAYearInfo.SelectedIndex = 0; 122
txtAStartEndTime.Text = ""; 123
} 124
//============================================================= 125
// Ê ¼þ Ãû£º btnAdd_Click() 126
// ¹¦ÄÜÃèÊö£º ÔÚÌí¼Ó±íÉÏ£¬µ¥»÷Ìí¼Ó°´Å¥Ê±£¬½«½ÌѧÑо¿×ÊÁÏÌí¼Óµ½±ítb_jiaoyanÖÐ 127
// ============================================================== 128
protected void btnAdd_Click(object sender, EventArgs e) 129
{ 130
if (Session["Username"] == null) 131
{ 132
Response.Write("<script>parent.location='../Default.aspx';</script>"); 133
} 134
else 135
{ 136
if (ddlAName.SelectedIndex == 0) 137
{ 138
Response.Write("<script>alert('ÇëÑ¡ÔñÐèÒªÌí¼Ó×ÊÁϵÄÐÕÃû£¡');</script>"); 139
140
} 141
else if (txtAName.Text.Trim() == "") 142
{ 143
Response.Write("<script>alert('ÇëÌîдÂÛÖøÃû³Æ£¡');</script>"); 144
} 145
else if (txtALessonName.Text.Trim() == "") 146
{ 147
Response.Write("<script>alert('ÇëÌîд³ö°æÉ磡');</script>"); 148
} 149
else if (txtAAuthor.Text.Trim() == "") 150
{ 151
Response.Write("<script>alert('ÇëÌîдÖ÷±à£¡');</script>"); 152
} 153
else if (txtAWorker.Text.Trim() == "") 154
{ 155
Response.Write("<script>alert('ÇëÌîдºÏ×÷Õߣ¡');</script>"); 156
} 157
else if (txtAStartEndTime.Text.Trim() == "") 158
{ 159
Response.Write("<script>alert('ÇëÌîд³ö°æÊ±¼ä£¡');</script>"); 160
161
} 162
else if (txtAFroming.Text.Trim() == "") 163
{ 164
Response.Write("<script>alert('ÇëÌîд±¸×¢£¡');</script>"); 165
} 166
else if (ddlAYearInfo.SelectedIndex == 0) 167
{ 168
Response.Write("<script>alert('ÇëÑ¡ÔñÌîдÄê¶È£¡');</script>"); 169
} 170
else 171
{ 172
srObj.AddSRInfo(txtAName.Text.Trim(), txtALessonName.Text.Trim(), txtAAuthor.Text.Trim(), txtAWorker.Text.Trim(), txtAFroming.Text.Trim(), txtAStartEndTime.Text.Trim(), "", 3, Convert.ToInt32(ddlAName.SelectedValue), Convert.ToString(Session["Username"]), "", Convert.ToInt32(ddlAYearInfo.SelectedItem.ToString()),Convert.ToInt32(Session["UID"])); 173
Response.Redirect("~/SciResearch/Research_lzqk.aspx"); 174
} 175
} 176
} 177
//============================================================= 178
// Ê ¼þ Ãû£º btnAddList_Click() 179
// ¹¦ÄÜÃèÊö£º µ±Óû§µ¥»÷Ìí¼Ó°´Å¥£¬Ìí¼Ó±íÏÔʾ 180
// ============================================================== 181
protected void btnAddList_Click(object sender, EventArgs e) 182
{ 183
tabAdd.Visible = true; 184
tabList.Visible = false; 185
tabUpdate.Visible = false; 186
prObj.DDLBind(ddlAYearInfo); 187
prObj.DDLNameBind(ddlAName, "userInfo"); 188
if ((Session["isOpen"] == null) && (Session["Admin"] == null)) 189
{ 190
Response.Write("<script>parent.location='../Default.aspx';</script>"); 191
} 192
else 193
{ 194
if (Convert.ToInt32(Session["Admin"]) == 1) 195
{ } 196
else 197
{ 198
ddlAName.SelectedValue = Convert.ToString(Session["UID"]); 199
ddlAName.Enabled = false; 200
201
} 202
} 203
204
} 205
//============================================================= 206
// Ê ¼þ Ãû£º btnUpdate_Click() 207
// ¹¦ÄÜÃèÊö£º ÔÚÐ޸ıíÉÏ£¬µ¥»÷Ð޸ݴťʱ£¬Ð޸ĽÌʦµÄ½ÌѧÑо¿×ÊÁÏ 208
// ============================================================== 209
protected void btnUpdate_Click(object sender, EventArgs e) 210
{ 211
if (Session["Username"] == null) 212
{ 213
Response.Write("<script>parent.location='../Default.aspx';</script>"); 214
} 215
else 216
{ 217
if (txtUName.Text.Trim() == "") 218
{ 219
Response.Write("<script>alert('ÇëÌîдÂÛÖøÃû³Æ£¡');</script>"); 220
} 221
else if (txtULessonName.Text.Trim() == "") 222
{ 223
Response.Write("<script>alert('ÇëÌîд³ö°æÉ磡');</script>"); 224
} 225
else if (txtUAuthor.Text.Trim() == "") 226
{ 227
Response.Write("<script>alert('ÇëÌîдÖ÷±à£¡');</script>"); 228
} 229
else if (txtUWorker.Text.Trim() == "") 230
{ 231
Response.Write("<script>alert('ÇëÌîдºÏ×÷Õߣ¡');</script>"); 232
} 233
else if (txtUStartEndTime.Text.Trim() == "") 234
{ 235
Response.Write("<script>alert('ÇëÌîд³ö°æÊ±¼ä£¡');</script>"); 236
} 237
else if (txtUFroming.Text.Trim() == "") 238
{ 239
Response.Write("<script>alert('ÇëÌîд±¸×¢£¡');</script>"); 240
} 241
else 242
{ 243
srObj.UpdateSRInfo(Convert.ToInt32(labValue.Text.Trim()), txtUName.Text.Trim(), txtULessonName.Text.Trim(), txtUAuthor.Text.Trim(), txtUWorker.Text.Trim(), txtUFroming.Text.Trim(), txtUStartEndTime.Text.Trim(), "", Convert.ToString(Session["Username"]), Convert.ToInt32(ddlUYearInfo.SelectedItem.ToString()), Convert.ToInt32(Session["UID"])); 244
Response.Redirect("~/SciResearch/Research_lzqk.aspx"); 245
} 246
} 247
} 248
protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e) 249
{ 250
gvList.PageIndex = e.NewPageIndex; 251
gvListBind(); 252
} 253
} 254




PersonRecordClass prObj 
}
}