protected void confirm_Click(object sender, EventArgs e) { string code = (string)Session["VerifyCode"]; string inputCode = Request["VerifyCodeText"]; if (code != inputCode) { Response.Write("<script Language='JavaScript'>alert('验证码错误!');window.location.href ='Login.aspx'</script>"); } else { Users user = Users.VerifyIdentity(Username.Text.Trim(), Request["Password"]); if (user != null) { Session["Identify"] = user; if (BasicInfo.HasBasicInfo(user.UserID) && BasicInfo.GetDepartment(user.UserID) != null) { Response.Redirect("~/Account/ApplyListPage.aspx"); } else { Response.Write("<script Language='JavaScript'>alert('请先完善个人基本信息!');window.location.href ='BasicInfoEdit.aspx'</script>"); } } else { ErrorSpan.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) {//初次加载 DataSet allDep = Department.GetAllDepartment(); depList.DataSource = allDep.Tables[0].DefaultView; depList.DataTextField = "DepartmentName"; //depList.DataValueField = "DepartmentID"; depList.DataValueField = "DepartmentName"; depList.DataBind(); DataSet allPos = Roles.GetAllRoles(); posList.DataSource = allPos.Tables[0].DefaultView; posList.DataTextField = "RoleName"; //posList.DataValueField = "RoleID"; posList.DataValueField = "RoleName"; posList.DataBind(); Users user = (Users)Session["Identify"]; int UserID = Convert.ToInt32(Request["UserID"] == null ? "-1" : Request["UserID"]); BasicInfo bi = null; if (-1 == UserID) { if (BasicInfo.HasBasicInfo(user.UserID)) { bi = new BasicInfo(); bi = BasicInfo.GetBasicInfoByID(user.UserID); initializePage(bi); } } else { bi = new BasicInfo(); bi = BasicInfo.GetBasicInfoByID(UserID); initializePage(bi); posList.Enabled = true; onJob.Enabled = true; } } }