温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:高校教师档案管理系统项目源码
当前文件:
TeacherFileProject/SubjectBuild/Subject_List.aspx.cs,打开代码结构图
TeacherFileProject/SubjectBuild/Subject_List.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 SubjectBuild_SubjectList : System.Web.UI.Page 13
{ 14
PersonRecordClass prObj = new PersonRecordClass(); 15
SubjectBuildClass sbObj = new SubjectBuildClass(); 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 = sbObj.GetASLCmd(); 67
prObj.GVBind(myCmd, gvList, "ASL"); 68
} 69
else 70
{ 71
SqlCommand myCmd = sbObj.GetSSLCmd(Convert.ToInt32(Session["UID"])); 72
prObj.GVBind(myCmd, gvList, "SSL"); 73
} 74
75
} 76
77
} 78
//============================================================= 79
// 事 件 名: gvList_RowDeleting() 80
// 功能描述: 对GridView中的某行进行删除 81
// ============================================================== 82
protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e) 83
{ 84
int P_Int_id = Convert.ToInt32(gvList.DataKeys[e.RowIndex].Value); 85
sbObj.DeleteSLInfo(P_Int_id); 86
gvListBind(); 87
} 88
//============================================================= 89
// 事 件 名: gvList_RowUpdating() 90
// 功能描述: 对GridView中的某行进行修改时,修改表显示其修改内容 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 = sbObj.ReturnSLDs(P_Int_id, "SLInfo"); 101
txtName.Text = ds.Tables["SLInfo"].Rows[0][0].ToString(); 102
txtUStartEndTime.Text = ds.Tables["SLInfo"].Rows[0][1].ToString(); 103
txtUWorkContent.Text = ds.Tables["SLInfo"].Rows[0][2].ToString(); 104
txtULessonName.Text = ds.Tables["SLInfo"].Rows[0][3].ToString(); 105
txtUClass.Text = ds.Tables["SLInfo"].Rows[0][4].ToString(); 106
txtUPeriod.Text = ds.Tables["SLInfo"].Rows[0][5].ToString(); 107
txtUPersons.Text = ds.Tables["SLInfo"].Rows[0][6].ToString(); 108
ddlUYearInfo.SelectedItem.Text = ds.Tables["SLInfo"].Rows[0][7].ToString(); 109
} 110
//============================================================= 111
// 事 件 名: btnReset_Click() 112
// 功能描述: 在添加表上,单击重置按钮时,重新填写教师的教学工作资料 113
// ============================================================== 114
protected void btnReset_Click(object sender, EventArgs e) 115
{ 116
txtAStartEndTime.Text = ""; 117
txtAWorkContent.Text = ""; 118
txtAClass.Text = ""; 119
txtALessonName.Text = ""; 120
txtAPeriod.Text = ""; 121
txtAPersons.Text = ""; 122
ddlAYearInfo.SelectedIndex = 0; 123
} 124
//============================================================= 125
// 事 件 名: btnUpdate_Click() 126
// 功能描述: 在修改表上,单击修改按钮时,修改教师的教学工作资料 127
// ============================================================== 128
protected void btnUpdate_Click(object sender, EventArgs e) 129
{ 130
131
if (Session["Username"] == null) 132
{ 133
Response.Write("<script>parent.location='../Default.aspx';</script>"); 134
} 135
else 136
{ 137
if (txtUStartEndTime.Text.Trim() == "") 138
{ 139
Response.Write("<script>alert('请填写起止年月!');</script>"); 140
141
} 142
else if (txtUWorkContent.Text.Trim() == "") 143
{ 144
Response.Write("<script>alert('请填写工作内容!');</script>"); 145
} 146
else if (txtULessonName.Text.Trim() == "") 147
{ 148
Response.Write("<script>alert('请填写课程或实验、实习名称!');</script>"); 149
} 150
else if (txtUClass.Text.Trim() == "") 151
{ 152
Response.Write("<script>alert('请填写授课专业!');</script>"); 153
} 154
else if (txtUPeriod.Text.Trim() == "") 155
{ 156
Response.Write("<script>alert('请填写学时或周数!');</script>"); 157
} 158
else if (txtUPersons.Text.Trim() == "") 159
{ 160
Response.Write("<script>alert('请填写人数!');</script>"); 161
} 162
else 163
{ 164
sbObj.UpdateSLInfo(Convert.ToInt32(labValue.Text.Trim()), txtUStartEndTime.Text.Trim(), txtUWorkContent.Text.Trim(), txtULessonName.Text.Trim(), txtUClass.Text.Trim(), txtUPeriod.Text.Trim(), txtUPersons.Text.Trim(), Convert.ToString(Session["Username"]), Convert.ToInt32(ddlUYearInfo.SelectedItem.ToString()), Convert.ToInt32(Session["UID"])); 165
Response.Redirect("~/SubjectBuild/Subject_List.aspx"); 166
} 167
} 168
} 169
//============================================================= 170
// 事 件 名: btnAdd_Click() 171
// 功能描述: 在添加表上,单击添加按钮时,将教学工作资料添加到表tb_teaching中 172
// ============================================================== 173
protected void btnAdd_Click(object sender, EventArgs e) 174
{ 175
if (Session["Username"] == null) 176
{ 177
Response.Write("<script>parent.location='../Default.aspx';</script>"); 178
} 179
else 180
{ 181
if (ddlAName.SelectedIndex == 0) 182
{ 183
Response.Write("<script>alert('请选择需要添加资料的姓名!');</script>"); 184
185
} 186
else if (txtAStartEndTime.Text.Trim() == "") 187
{ 188
Response.Write("<script>alert('请填写起止时间!');</script>"); 189
190
} 191
else if (txtAWorkContent.Text.Trim() == "") 192
{ 193
Response.Write("<script>alert('请填写工作内容!');</script>"); 194
} 195
else if (txtALessonName.Text.Trim() == "") 196
{ 197
Response.Write("<script>alert('请填写课程或实验、实习名称!');</script>"); 198
199
} 200
else if (txtAClass.Text.Trim() == "") 201
{ 202
Response.Write("<script>alert('请填写授课专业!');</script>"); 203
} 204
else if (txtAPeriod.Text.Trim() == "") 205
{ 206
Response.Write("<script>alert('请填写学时或周数!');</script>"); 207
} 208
else if (txtAPersons.Text.Trim() == "") 209
{ 210
Response.Write("<script>alert('请填写人数!');</script>"); 211
} 212
else if (ddlAYearInfo.SelectedIndex == 0) 213
{ 214
Response.Write("<script>alert('请选择填写年度!');</script>"); 215
} 216
else 217
{ 218
sbObj.AddSLInfo(txtAStartEndTime.Text.Trim(),txtAWorkContent.Text.Trim(),txtALessonName.Text.Trim(),txtAClass.Text.Trim(),txtAPeriod.Text.Trim(),txtAPersons.Text.Trim(), Convert.ToInt32(ddlAName.SelectedValue), Convert.ToString(Session["Username"]), "", Convert.ToInt32(ddlAYearInfo.SelectedItem.ToString()),Convert.ToInt32(Session["UID"])); 219
Response.Redirect("~/SubjectBuild/Subject_List.aspx"); 220
} 221
} 222
} 223
//============================================================= 224
// 事 件 名: btnAddList_Click() 225
// 功能描述: 当用户单击添加按钮,添加表显示 226
// ============================================================== 227
protected void btnAddList_Click(object sender, EventArgs e) 228
{ 229
tabAdd.Visible = true; 230
tabList.Visible = false; 231
tabUpdate.Visible = false; 232
prObj.DDLBind(ddlAYearInfo); 233
prObj.DDLNameBind(ddlAName, "userInfo"); 234
if ((Session["isOpen"] == null) && (Session["Admin"] == null)) 235
{ 236
Response.Write("<script>parent.location='../Default.aspx';</script>"); 237
} 238
else 239
{ 240
if (Convert.ToInt32(Session["Admin"]) == 1) 241
{ } 242
else 243
{ 244
ddlAName.SelectedValue = Convert.ToString(Session["UID"]); 245
ddlAName.Enabled = false; 246
247
} 248
} 249
} 250
protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e) 251
{ 252
gvList.PageIndex = e.NewPageIndex; 253
gvListBind(); 254
} 255
} 256




PersonRecordClass prObj 
}
}