protected void Btn_save_Click(object sender, EventArgs e) { sr_User users = new sr_User(); string UserID = Session["UserID"].ToString(); string UserName = TB_UserName.Text.ToString().Trim(); string Sex = DropDL_Sex.SelectedValue; string Unit = TB_Unit.SelectedValue; string Education = DropDL_Degree.SelectedValue; string ZhiCheng = TB_ZhiCheng.SelectedValue; string Telephone = TB_Telephone.Text.ToString().Trim(); string InOffice = DropDL_Job.SelectedIndex.ToString();//... string Email = TB_Email.Text.ToString().Trim(); if (users.UpdateGeRenXinXi(UserName, Sex, Unit, Education, ZhiCheng, Telephone, InOffice, Email, UserID)) { Response.Write("<script>alert('信息更新成功')</script>"); users.UpdateLogins(UserID); //更新登录次数 } else { Response.Write("<script>alert('信息更新失败')</script>"); return; } Session["UserName"] = users.GetUserName(Session["UserID"].ToString()); //完善完信息后再将UserName保存到session string Role = Session["Role"].ToString(); //完善完信息后再根据角色跳到不通的页面。 Session["Unit"] = users.GetUserUnit(Session["UserID"].ToString()); switch (Role) { case "教师": Response.Redirect("../Teacher.aspx"); break; case "管理员": Response.Redirect("../Secretary.aspx"); break; case "系统管理员": Response.Redirect("../KeYuan.aspx"); break; case "超级管理员": Response.Redirect("../Chief.aspx"); break; default: break; } }
protected void Btn_save_Click(object sender, EventArgs e) { //if (TB_UserName.Text == "") //{ // Response.Write("<script>alert('用户姓名不能为空')</script>"); // TB_UserName.Focus(); // return; //} sr_User users = new sr_User(); string UserID = Session["UserID"].ToString(); string UserName = TB_UserName.Text.ToString().Trim(); string Sex = DropDL_Sex.SelectedValue; string Unit = TB_Unit.SelectedValue; string Education = DropDL_Degree.SelectedValue; string ZhiCheng = TB_ZhiCheng.SelectedValue; string Telephone = TB_Telephone.Text.ToString().Trim(); string InOffice = DropDL_Job.SelectedIndex.ToString();//... string Email = TB_Email.Text.ToString().Trim(); if (users.UpdateGeRenXinXi(UserName, Sex, Unit, Education, ZhiCheng, Telephone, InOffice, Email, UserID)) { Response.Write("<script>alert('信息更新成功')</script>"); } else { Response.Write("<script>alert('信息更新失败')</script>"); return; } TB_UserName.Focus(); TB_UserName.Text = ""; TB_Telephone.Text = ""; TB_Email.Text = ""; Session["UserName"] = users.GetUserName(Session["UserID"].ToString()); //更新完信息后再将UserName保存到session }