温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:高校教师档案管理系统项目源码
当前文件:
TeacherFileProject/SciResearch/Research_hjqk.aspx.cs,打开代码结构图
TeacherFileProject/SciResearch/Research_hjqk.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
//该源码下载自www.51aspx.com(51aspx.com) 13
public partial class SciResearch_Research_hjqk : System.Web.UI.Page 14
{ 15
PersonRecordClass prObj = new PersonRecordClass(); 16
SciResearchClass srObj = new SciResearchClass(); 17
protected void Page_Load(object sender, EventArgs e) 18
{ 19
if (!IsPostBack) 20
{ 21
if ((Session["isOpen"] == null) && (Session["Admin"] == null)) 22
{ 23
Response.Write("<script>parent.location='../Default.aspx';</script>"); 24
} 25
else 26
{ 27
28
tabList.Visible = false; 29
tabAdd.Visible = false; 30
tabUpdate.Visible = false; 31
btnAddList.Visible = false; 32
if (Convert.ToInt32(Session["isOpen"]) == 1 || Convert.ToInt32(Session["Admin"]) == 1) 33
{ 34
tabList.Visible = true; 35
btnAddList.Visible = true; 36
gvListBind(); 37
38
39
} 40
else 41
{ 42
tabList.Visible = true; 43
btnAddList.Visible = false; 44
gvListBind(); 45
gvList.Columns[0].Visible = false; 46
gvList.Columns[1].Visible = false; 47
} 48
} 49
} 50
} 51
//============================================================= 52
// 方 法 名: gvListBind() 53
// 功能描述: 对GridView进行绑定,显示科学研究(在线课题)的资料 54
// 输入参数: 无 55
// 返 回 值: 无 56
// ============================================================== 57
public void gvListBind() 58
{ 59
if ((Session["isOpen"] == null) && (Session["Admin"] == null)) 60
{ 61
Response.Write("<script>parent.location='../Default.aspx';</script>"); 62
} 63
else 64
{ 65
if (Convert.ToInt32(Session["Admin"]) == 1) 66
{ 67
SqlCommand myCmd = srObj.GetASRCmd(4); 68
prObj.GVBind(myCmd, gvList, "AJY"); 69
} 70
else 71
{ 72
SqlCommand myCmd = srObj.GetSSRCmd(4, Convert.ToInt32(Session["UID"])); 73
prObj.GVBind(myCmd, gvList, "SJY"); 74
} 75
76
} 77
78
} 79
//============================================================= 80
// 事 件 名: gvList_RowDeleting() 81
// 功能描述: 对GridView中的某行进行删除 82
// ============================================================== 83
protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e) 84
{ 85
int P_Int_id = Convert.ToInt32(gvList.DataKeys[e.RowIndex].Value); 86
srObj.DeleteSRInfo(P_Int_id); 87
gvListBind(); 88
} 89
//============================================================= 90
// 事 件 名: gvList_RowUpdating() 91
// 功能描述: 对GridView中的某行进行修改时,修改表显示其修改内容 92
// ============================================================== 93
protected void gvList_RowUpdating(object sender, GridViewUpdateEventArgs e) 94
{ 95
tabUpdate.Visible = true; 96
tabList.Visible = false; 97
tabAdd.Visible = false; 98
prObj.DDLBind(ddlUYearInfo); 99
int P_Int_id = Convert.ToInt32(gvList.DataKeys[e.RowIndex].Value); 100
labValue.Text = P_Int_id.ToString(); 101
DataSet ds = srObj.ReturnSRDs(4, P_Int_id, "JYInfo"); 102
txtName.Text = ds.Tables["JYInfo"].Rows[0][0].ToString(); 103
txtUName.Text = ds.Tables["JYInfo"].Rows[0][1].ToString(); 104
txtULessonName.Text = ds.Tables["JYInfo"].Rows[0][8].ToString(); 105
txtUStartEndTime.Text = ds.Tables["JYInfo"].Rows[0][2].ToString(); 106
txtUUnit.Text = ds.Tables["JYInfo"].Rows[0][3].ToString(); 107
txtUFroming.Text = ds.Tables["JYInfo"].Rows[0][4].ToString(); 108
txtUAuthor.Text = ds.Tables["JYInfo"].Rows[0][5].ToString(); 109
txtUWorker.Text = ds.Tables["JYInfo"].Rows[0][6].ToString(); 110
ddlUYearInfo.SelectedItem.Text = ds.Tables["JYInfo"].Rows[0][7].ToString(); 111
112
} 113
//============================================================= 114
// 事 件 名: btnReset_Click() 115
// 功能描述: 在添加表上,单击重置按钮时,重新填写教师的科学研究资料 116
// ============================================================== 117
protected void btnReset_Click(object sender, EventArgs e) 118
{ 119
txtAName.Text = ""; 120
txtALessonName.Text = ""; 121
txtAStartEndTime.Text = ""; 122
txtAUnit.Text = ""; 123
txtAFroming.Text = ""; 124
txtAAuthor.Text = ""; 125
txtAWorker.Text = ""; 126
ddlAYearInfo.SelectedIndex = 0; 127
} 128
//============================================================= 129
// 事 件 名: btnUpdate_Click() 130
// 功能描述: 在修改表上,单击修改按钮时,修改教师的科学研究资料 131
// ============================================================== 132
protected void btnUpdate_Click(object sender, EventArgs e) 133
{ 134
if (Session["Username"] == null) 135
{ 136
Response.Write("<script>parent.location='../Default.aspx';</script>"); 137
} 138
else 139
{ 140
if (txtUName.Text.Trim() == "") 141
{ 142
Response.Write("<script>alert('请填写获奖名称!');</script>"); 143
} 144
if (txtULessonName.Text.Trim() == "") 145
{ 146
Response.Write("<script>alert('请填写获奖项目名称!');</script>"); 147
} 148
else if (txtUStartEndTime.Text.Trim() == "") 149
{ 150
Response.Write("<script>alert('请填写时间!');</script>"); 151
152
} 153
else if (txtUUnit.Text.Trim() == "") 154
{ 155
Response.Write("<script>alert('请填写授予单位!');</script>"); 156
} 157
else if (txtUFroming.Text.Trim() == "") 158
{ 159
Response.Write("<script>alert('请填写备注!');</script>"); 160
} 161
else if (txtUAuthor.Text.Trim() == "") 162
{ 163
Response.Write("<script>alert('请填写主持人!');</script>"); 164
} 165
else if (txtUWorker.Text.Trim() == "") 166
{ 167
Response.Write("<script>alert('请填写合作人!');</script>"); 168
} 169
else 170
{ 171
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(), txtUUnit.Text.Trim(), Convert.ToString(Session["Username"]), Convert.ToInt32(ddlUYearInfo.SelectedItem.ToString()),Convert.ToInt32(Session["UID"])); 172
Response.Redirect("~/SciResearch/Research_hjqk.aspx"); 173
} 174
} 175
} 176
//============================================================= 177
// 事 件 名: btnAdd_Click() 178
// 功能描述: 在添加表上,单击添加按钮时,将科学研究资料添加到表tb_jiaoyan中 179
// ============================================================== 180
protected void btnAdd_Click(object sender, EventArgs e) 181
{ 182
if (Session["Username"] == null) 183
{ 184
Response.Write("<script>parent.location='../Default.aspx';</script>"); 185
} 186
else 187
{ 188
if (ddlAName.SelectedIndex == 0) 189
{ 190
Response.Write("<script>alert('请选择需要添加资料的姓名!');</script>"); 191
192
} 193
else if (txtAName.Text.Trim() == "") 194
{ 195
Response.Write("<script>alert('请填写获奖名称!');</script>"); 196
} 197
else if (txtALessonName.Text.Trim() == "") 198
{ 199
Response.Write("<script>alert('请填写获奖项目名称!');</script>"); 200
} 201
else if (txtAStartEndTime.Text.Trim() == "") 202
{ 203
Response.Write("<script>alert('请填写起止时间!');</script>"); 204
205
} 206
else if (txtAUnit.Text.Trim() == "") 207
{ 208
Response.Write("<script>alert('请填写授予单位!');</script>"); 209
210
} 211
else if (txtAFroming.Text.Trim() == "") 212
{ 213
Response.Write("<script>alert('请填写备注!');</script>"); 214
} 215
else if (txtAAuthor.Text.Trim() == "") 216
{ 217
Response.Write("<script>alert('请填写主持人!')</script>"); 218
} 219
else if (txtAWorker.Text.Trim() == "") 220
{ 221
Response.Write("<script>alert('请填写合作人!')</script>"); 222
} 223
else if (ddlAYearInfo.SelectedIndex == 0) 224
{ 225
Response.Write("<script>alert('请选择填写年度!');</script>"); 226
} 227
else 228
{ 229
srObj.AddSRInfo(txtAName.Text.Trim(), txtALessonName.Text.Trim(), txtAAuthor.Text.Trim(), txtAWorker.Text.Trim(), txtAFroming.Text.Trim(), txtAStartEndTime.Text.Trim(), txtAUnit.Text.Trim(), 4, Convert.ToInt32(ddlAName.SelectedValue), Convert.ToString(Session["Username"]), "", Convert.ToInt32(ddlAYearInfo.SelectedItem.ToString()),Convert.ToInt32(Session["UID"])); 230
Response.Redirect("~/SciResearch/Research_hjqk.aspx"); 231
} 232
} 233
234
} 235
//============================================================= 236
// 事 件 名: btnAddList_Click() 237
// 功能描述: 当用户单击添加按钮,添加表显示 238
// ============================================================== 239
protected void btnAddList_Click1(object sender, EventArgs e) 240
{ 241
tabAdd.Visible = true; 242
tabList.Visible = false; 243
tabUpdate.Visible = false; 244
prObj.DDLBind(ddlAYearInfo); 245
prObj.DDLNameBind(ddlAName, "userInfo"); 246
if ((Session["isOpen"] == null) && (Session["Admin"] == null)) 247
{ 248
Response.Write("<script>parent.location='../Default.aspx';</script>"); 249
} 250
else 251
{ 252
if (Convert.ToInt32(Session["Admin"]) == 1) 253
{ } 254
else 255
{ 256
ddlAName.SelectedValue = Convert.ToString(Session["UID"]); 257
ddlAName.Enabled = false; 258
259
} 260
} 261
} 262
protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e) 263
{ 264
gvList.PageIndex = e.NewPageIndex; 265
gvListBind(); 266
} 267
} 268




PersonRecordClass prObj 
}
}