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




PersonRecordClass prObj 
}
}