温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:高校教师档案管理系统项目源码
当前文件:
TeacherFileProject/SciResearch/Research_zykt.aspx.cs,打开代码结构图
TeacherFileProject/SciResearch/Research_zykt.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
13
public partial class SciResearch_Research_zykt : 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(1); 68
prObj.GVBind(myCmd, gvList, "ASR"); 69
} 70
else 71
{ 72
SqlCommand myCmd = srObj.GetSSRCmd(1, Convert.ToInt32(Session["UID"])); 73
prObj.GVBind(myCmd, gvList, "SSR"); 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(1, P_Int_id, "SRInfo"); 102
txtName.Text = ds.Tables["SRInfo"].Rows[0][0].ToString(); 103
txtUName.Text = ds.Tables["SRInfo"].Rows[0][1].ToString(); 104
txtUStartEndTime.Text = ds.Tables["SRInfo"].Rows[0][2].ToString(); 105
txtUUnit.Text = ds.Tables["SRInfo"].Rows[0][3].ToString(); 106
txtUFroming.Text = ds.Tables["SRInfo"].Rows[0][4].ToString(); 107
txtUAuthor.Text = ds.Tables["SRInfo"].Rows[0][5].ToString(); 108
txtUWorker.Text = ds.Tables["SRInfo"].Rows[0][6].ToString(); 109
ddlUYearInfo.SelectedItem.Text = ds.Tables["SRInfo"].Rows[0][7].ToString(); 110
111
} 112
113
//============================================================= 114
// 事 件 名: btnReset_Click() 115
// 功能描述: 在添加表上,单击重置按钮时,重新填写教师的科研资料 116
// ============================================================== 117
protected void btnReset_Click(object sender, EventArgs e) 118
{ 119
txtAName.Text = ""; 120
txtAStartEndTime.Text = ""; 121
txtAUnit.Text = ""; 122
txtAFroming.Text = ""; 123
txtAAuthor.Text = ""; 124
txtAWorker.Text = ""; 125
ddlAYearInfo.SelectedIndex = 0; 126
} 127
//============================================================= 128
// 事 件 名: btnUpdate_Click() 129
// 功能描述: 在修改表上,单击修改按钮时,修改教师的科学研究资料 130
// ============================================================== 131
protected void btnUpdate_Click(object sender, EventArgs e) 132
{ 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
else if (txtUStartEndTime.Text.Trim() == "") 145
{ 146
Response.Write("<script>alert('请填写起止年月!');</script>"); 147
148
} 149
else if (txtUUnit.Text.Trim() == "") 150
{ 151
Response.Write("<script>alert('请填写资助经额!');</script>"); 152
} 153
else if (txtUFroming.Text.Trim() == "") 154
{ 155
Response.Write("<script>alert('请填写项目来源!');</script>"); 156
} 157
else if (txtUAuthor.Text.Trim() == "") 158
{ 159
Response.Write("<script>alert('请填写主持人!');</script>"); 160
} 161
else if (txtUWorker.Text.Trim() == "") 162
{ 163
Response.Write("<script>alert('请填写合作人!');</script>"); 164
} 165
else 166
{ 167
srObj.UpdateSRInfo(Convert.ToInt32(labValue.Text.Trim()), txtUName.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"])); 168
Response.Redirect("~/SciResearch/Research_zykt.aspx"); 169
} 170
} 171
} 172
//============================================================= 173
// 事 件 名: btnAdd_Click() 174
// 功能描述: 在添加表上,单击添加按钮时,将教学研究资料添加到表tb_jiaoyan中 175
// ============================================================== 176
protected void btnAdd_Click(object sender, EventArgs e) 177
{ 178
if (Session["Username"] == null) 179
{ 180
Response.Write("<script>parent.location='../Default.aspx';</script>"); 181
} 182
else 183
{ 184
if (ddlAName.SelectedIndex == 0) 185
{ 186
Response.Write("<script>alert('请选择需要添加资料的姓名!');</script>"); 187
188
} 189
else if (txtAName.Text.Trim() == "") 190
{ 191
Response.Write("<script>alert('请填写项目名称!');</script>"); 192
} 193
else if (txtAStartEndTime.Text.Trim() == "") 194
{ 195
Response.Write("<script>alert('请填写起止时间!');</script>"); 196
197
} 198
else if (txtAUnit.Text.Trim() == "") 199
{ 200
Response.Write("<script>alert('请填写资助金费!');</script>"); 201
202
} 203
else if (txtAFroming.Text.Trim() == "") 204
{ 205
Response.Write("<script>alert('请填写项目来源!');</script>"); 206
} 207
else if (txtAAuthor.Text.Trim() == "") 208
{ 209
Response.Write("<script>alert('请填写主持人!')</script>"); 210
} 211
else if (txtAWorker.Text.Trim() == "") 212
{ 213
Response.Write("<script>alert('请填写合作人!')</script>"); 214
} 215
else if (ddlAYearInfo.SelectedIndex == 0) 216
{ 217
Response.Write("<script>alert('请选择填写年度!');</script>"); 218
} 219
else 220
{ 221
srObj.AddSRInfo(txtAName.Text.Trim(), "", txtAAuthor.Text.Trim(), txtAWorker.Text.Trim(), txtAFroming.Text.Trim(), txtAStartEndTime.Text.Trim(), txtAUnit.Text.Trim(), 1, Convert.ToInt32(ddlAName.SelectedValue), Convert.ToString(Session["Username"]), "", Convert.ToInt32(ddlAYearInfo.SelectedItem.ToString()), Convert.ToInt32(Session["UID"])); 222
Response.Redirect("~/SciResearch/Research_zykt.aspx"); 223
} 224
} 225
226
} 227
//============================================================= 228
// 事 件 名: btnAddList_Click() 229
// 功能描述: 当用户单击添加按钮,添加表显示 230
// ============================================================== 231
protected void btnAddList_Click(object sender, EventArgs e) 232
{ 233
tabAdd.Visible = true; 234
tabList.Visible = false; 235
tabUpdate.Visible = false; 236
prObj.DDLBind(ddlAYearInfo); 237
prObj.DDLNameBind(ddlAName, "userInfo"); 238
if ((Session["isOpen"] == null) && (Session["Admin"] == null)) 239
{ 240
Response.Write("<script>parent.location='../Default.aspx';</script>"); 241
} 242
else 243
{ 244
if (Convert.ToInt32(Session["Admin"]) == 1) 245
{ } 246
else 247
{ 248
ddlAName.SelectedValue = Convert.ToString(Session["UID"]); 249
ddlAName.Enabled = false; 250
251
} 252
} 253
} 254
protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e) 255
{ 256
gvList.PageIndex = e.NewPageIndex; 257
gvListBind(); 258
} 259
} 260




PersonRecordClass prObj 
}
}