您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->高校教师档案管理系统项目源码>>Manager/UserAdmin.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:高校教师档案管理系统项目源码
当前文件:文件类型 TeacherFileProject/Manager/UserAdmin.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using System.Data.SqlClient; 12public partial class Manager_Useradmin : System.Web.UI.Page 13{ 14 ManagerClass mcObj = new ManagerClass(); 15 DBClass dbObj = new DBClass(); 16 PersonRecordClass prObj = new PersonRecordClass(); 17 protected void Page_Load(object sender, EventArgs e) 18 { 19 if (!IsPostBack) 20 { 21 if (Session["Admin"] == null) 22 { 23 Response.Write("<script>parent.location='../Default.aspx';</script>"); 24 } 25 else 26 { 27 28 tabList.Visible = true; 29 tabAdd.Visible = false; 30 tabUpdate.Visible = false; 31 btnListAdd.Visible = true; 32 gvListBind(); 33 34 35 } 36 } 37 38 } 39 /// <summary> 40 /// 显示所有用户基本资料信息 41 /// </summary> 42 public void gvListBind() 43 { 44 if (Session["Admin"] == null) 45 { 46 Response.Write("<script>parent.location='../Default.aspx';</script>"); 47 } 48 else 49 { 50 SqlCommand myCmd = mcObj.GetALCmd(); 51 prObj.GVBind(myCmd, gvList, "AUI"); 52 } 53 54 } 55 //============================================================= 56 // 事 件 名: gvList_RowDeleting() 57 // 功能描述: 对GridView中的某行进行删除 58 // ============================================================== 59 protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e) 60 { 61 int P_Int_id = Convert.ToInt32(gvList.DataKeys[e.RowIndex].Value); 62 mcObj.DeleteResumeInfo(P_Int_id); 63 gvListBind(); 64 } 65 //============================================================= 66 // 事 件 名: gvList_RowUpdating() 67 // 功能描述: 对GridView中的某行进行修改时,修改表显示其修改内容 68 // ============================================================== 69 protected void gvList_RowUpdating(object sender, GridViewUpdateEventArgs e) 70 { 71 tabUpdate.Visible = true; 72 tabList.Visible = false; 73 tabAdd.Visible = false; 74 int P_Int_id = Convert.ToInt32(gvList.DataKeys[e.RowIndex].Value); 75 labValue.Text = P_Int_id.ToString(); 76 DataSet ds = mcObj.ReturnTLDs(P_Int_id, "UI"); 77 txtUName.Text = ds.Tables["UI"].Rows[0][0].ToString(); 78 txtUUserPass.Text = ds.Tables["UI"].Rows[0][1].ToString(); 79 ddlASex.SelectedItem.Text = ds.Tables["UI"].Rows[0][2].ToString(); 80 txtUAge.Text = ds.Tables["UI"].Rows[0][3].ToString(); 81 txtUCollege.Text = ds.Tables["UI"].Rows[0][4].ToString(); 82 txtUClass.Text = ds.Tables["UI"].Rows[0][5].ToString(); 83 84 } 85 //============================================================= 86 // 事 件 名: btnAdd_Click() 87 // 功能描述: 在添加表上,单击添加按钮时,将教师的登录资料添加到表tb_userInfo中 88 // ============================================================== 89 protected void btnAdd_Click(object sender, EventArgs e) 90 { 91 if (txtAName.Text.Trim() == "") 92 { 93 Response.Write("<script>alert('请填写教师名!');</script>"); 94 } 95 else if (txtAUserPass.Text.Trim() == "") 96 { 97 Response.Write("<script>alert('请填写密码!');</script>"); 98 } 99 else if (txtAAge.Text.Trim() == "") 100 { 101 Response.Write("<script>alert('请填写年龄!');</script>"); 102 } 103 else if (txtACollege.Text.Trim() == "") 104 { 105 Response.Write("<script>alert('请填写所在单位!');</script>"); 106 } 107 else if (txtAClass.Text.Trim() == "") 108 { 109 Response.Write("<script>alert('请填写授课专业!');</script>"); 110 } 111 112 else 113 { 114 string P_Str_userId = txtAName.Text.Trim(); 115 SqlConnection myConn = dbObj.GetConnection(); 116 SqlCommand myCmd = new SqlCommand("Proc_GetUserInfo", myConn); 117 myCmd.CommandType = CommandType.StoredProcedure; 118 //添加参数 119 SqlParameter userId = new SqlParameter("@userid", SqlDbType.NVarChar, 50); 120 userId.Value = P_Str_userId; 121 myCmd.Parameters.Add(userId); 122 //执行过程 123 myConn.Open(); 124 SqlDataReader rd = myCmd.ExecuteReader(); 125 if (rd.Read()) 126 { 127 rd.Close(); 128 myCmd.Dispose(); 129 myConn.Close(); 130 Response.Write("<script>alert('该用户名已存在,请输入其它的用户名!');</script>"); 131 132 } 133 else 134 { 135 rd.Close(); 136 myCmd.Dispose(); 137 myConn.Close(); 138 bool P_BL_sex; 139 if(ddlASex.SelectedIndex ==0) 140 { 141 P_BL_sex =true ; 142 } 143 else 144 { 145 P_BL_sex =false ; 146 } 147 mcObj.AddTLInfo(txtAName.Text.Trim(), txtAUserPass.Text.Trim(), P_BL_sex, Convert.ToInt32(txtAAge.Text.Trim()), txtACollege.Text.Trim(), txtAClass.Text.Trim()); 148 Response.Redirect("~/Manager/UserAdmin.aspx"); 149 } 150 151 } 152 } 153 //============================================================= 154 // 事 件 名: btnReset_Click() 155 // 功能描述: 在添加表上,单击重置按钮时,重新填写教师的登录资料 156 // ============================================================== 157 protected void btnReset_Click(object sender, EventArgs e) 158 { 159 txtAName.Text = ""; 160 txtAUserPass.Text = ""; 161 txtAAge.Text = ""; 162 txtACollege.Text = ""; 163 txtAClass.Text = ""; 164 } 165 //============================================================= 166 // 事 件 名: btnUpdate_Click() 167 // 功能描述: 在修改表上,单击修改按钮时,修改教师的登录资料 168 // ============================================================== 169 protected void btnUpdate_Click(object sender, EventArgs e) 170 { 171 if (txtUName.Text.Trim() == "") 172 { 173 Response.Write("<script>alert('请填写教师名!');</script>"); 174 } 175 else if (txtUUserPass.Text.Trim() == "") 176 { 177 Response.Write("<script>alert('请填写密码!');</script>"); 178 } 179 else if (txtUAge.Text.Trim() == "") 180 { 181 Response.Write("<script>alert('请填写年龄!');</script>"); 182 } 183 else if (txtUCollege.Text.Trim() == "") 184 { 185 Response.Write("<script>alert('请填写所在单位!');</script>"); 186 } 187 else if (txtUClass.Text.Trim() == "") 188 { 189 Response.Write("<script>alert('请填写授课专业!');</script>"); 190 } 191 else 192 { 193 194 bool P_BL_sex; 195 if (ddlUSex.SelectedIndex == 0) 196 { 197 P_BL_sex = true; 198 } 199 else 200 { 201 P_BL_sex = false; 202 } 203 mcObj.UpdateTLInfo(Convert.ToInt32(labValue.Text.Trim()),txtUName.Text.Trim(), txtUUserPass.Text.Trim(), P_BL_sex, Convert.ToInt32(txtUAge.Text.Trim()), txtUCollege.Text.Trim(), txtUClass.Text.Trim()); 204 Session["Username"] = txtUName.Text.Trim(); 205 Response.Redirect("~/Manager/UserAdmin.aspx"); 206 207 208 } 209 } 210 //============================================================= 211 // 事 件 名: lnkbtnAdd_Click() 212 // 功能描述: 当用户单击添加按钮,添加表显示 213 // ============================================================== 214 protected void btnListAdd_Click(object sender, EventArgs e) 215 { 216 tabAdd.Visible = true; 217 tabList.Visible = false; 218 tabUpdate.Visible = false; 219 220 } 221 protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e) 222 { 223 gvList.PageIndex = e.NewPageIndex; 224 gvListBind(); 225 } 226} 227 228
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:高校教师档案管理系统项目源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号