/// <summary> /// 用户登录 /// </summary> private void LoginOn() { DataTable dt = _UserBLL.SelectUserBase(string.Format(" AND UA01002 = '{0}' AND UA01003 = '{1}'", this.txtUserName.Text.Trim(), SafetyHandler.GetMD5(this.txtPassWord.Text.Trim()))); if (dt.Rows.Count > 0) { UserBase _UserBase = new UserBase(); _UserBase.UA01001 = Convert.ToInt32(dt.Rows[0]["UA01001"]); _UserBase.UA01004 = dt.Rows[0]["UA01004"].ToString(); _UserBase.UA01005 = dt.Rows[0]["UA01005"].ToString(); _UserBase.UA01024 = Convert.ToInt32(dt.Rows[0]["UA01024"]); _UserBase.UA01013 = dt.Rows[0]["UA01013"].ToString(); _UserBase.UA01009 = Convert.ToInt32(dt.Rows[0]["UA01009"]); //用户职位 HttpCookie cookie = new HttpCookie("UserName"); cookie.Value = this.txtUserName.Text.Trim(); cookie.Expires = DateTime.Now.AddDays(10); HttpContext.Current.Response.Cookies.Add(cookie); cookie = new HttpCookie("PassWord"); cookie.Value = SafetyHandler.GetMD5(this.txtPassWord.Text.Trim()); cookie.Expires = DateTime.Now.AddDays(10); HttpContext.Current.Response.Cookies.Add(cookie); Session["USER_SESSION"] = _UserBase; Response.Redirect("/Index.aspx"); } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('用户名或密码不正确!');</script>"); } }
protected void btnSave_Click(object sender, EventArgs e) { UserBase _UserBase = new UserBase(); _UserBase.UA01001 = (Session["USER_SESSION"] as UserBase).UA01001; _UserBase.UA01003 = SafetyHandler.GetMD5(this.txtNewUA01003.Text); int num = _UserBLL.UpdatePwd(_UserBase); new Sinoo.Common.MessageShow().UpdateMessage(this, num, string.Format("window.location.href='{0}'", "Login.aspx")); }
/// <summary> /// 检查旧密码是否正确 /// </summary> private Dictionary <string, string> CheckOldPwd(string value, HttpContext context) { Dictionary <string, string> d = new Dictionary <string, string>(); string strMd5 = SafetyHandler.GetMD5(value); DataTable dt = _UserBLL.SelectUserBaseByID(Convert.ToInt32((context.Session["USER_SESSION"] as UserBase).UA01001), strMd5); if (dt.Rows.Count > 0) { d.Add("ok", ""); } else { d.Add("error", "旧密码输入不正确"); } return(d); }
/// <summary> /// 编辑保存 /// </summary> private void DataSave() { UserBase _UserBase = new UserBase(); _UserBase.UA01001 = Convert.ToInt32(Request.QueryString["UA01001"]); _UserBase.UA01002 = this.txtUA01002.Text.Trim(); if (!string.IsNullOrEmpty(this.txtUA01003.Text.Trim())) { _UserBase.UA01003 = SafetyHandler.GetMD5(this.txtUA01003.Text.Trim()); } else { _UserBase.UA01003 = ViewState["password"].ToString(); } _UserBase.UA01004 = this.txtUA01004.Text.Trim(); _UserBase.UA01005 = this.txtUA01005.Text.Trim(); _UserBase.UA01006 = this.txtUA01006.Text.Trim(); _UserBase.UA01007 = this.txtUA01007.Text.Trim(); if (!string.IsNullOrEmpty(this.ddlUA01009.SelectedValue)) { _UserBase.UA01009 = Convert.ToInt32(this.ddlUA01009.SelectedValue); } _UserBase.UA01010 = this.txtUA01010.Text.Trim(); _UserBase.UA01011 = this.txtUA01011.Text.Trim(); _UserBase.UA01012 = this.txtUA01012.Text.Trim(); _UserBase.UA01013 = this.ddlUA01013.SelectedValue; _UserBase.UA01014 = this.txtUA01014.Text.Trim(); _UserBase.UA01015 = this.txtUA01015.Text.Trim(); _UserBase.UA01018 = this.txtUA01018.Text.Trim(); _UserBase.UA01021 = this.txtUA01021.Text.Trim(); _UserBase.UA01024 = Convert.ToInt32(this.ddlUA01024.SelectedValue); _UserBase.UA01025 = this.ddlUA01025.SelectedValue; if (this.rbtnUA01008Famale.Checked) { _UserBase.UA01008 = false; } else { _UserBase.UA01008 = true; } if (!string.IsNullOrEmpty(this.txtUA01016.Text.Trim())) { _UserBase.UA01016 = Convert.ToDateTime(this.txtUA01016.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtUA01017.Text.Trim())) { _UserBase.UA01017 = Convert.ToDateTime(this.txtUA01017.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtUA01019.Text.Trim())) { _UserBase.UA01019 = Convert.ToDateTime(this.txtUA01019.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtUA01020.Text.Trim())) { _UserBase.UA01020 = Convert.ToDateTime(this.txtUA01020.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtUA01022.Text.Trim())) { _UserBase.UA01022 = Convert.ToDateTime(this.txtUA01022.Text.Trim()); } int result = _UserBLL.UpdateUserBase(_UserBase); //成功失败提示 new Sinoo.Common.MessageShow().UpdateMessage(this.Page, result, string.Format("window.location.href='{0}'", GetReturnUrl())); }
/// <summary> /// 保存数据方法 /// </summary> private void DataSave() { UserBase _UserBase = new UserBase(); _UserBase.UA01002 = this.txtUA01002.Text.Trim(); _UserBase.UA01003 = SafetyHandler.GetMD5(this.txtUA01003.Text.Trim()); _UserBase.UA01004 = this.txtUA01004.Text.Trim(); _UserBase.UA01005 = this.txtUA01005.Text.Trim(); _UserBase.UA01006 = this.txtUA01006.Text.Trim(); _UserBase.UA01007 = this.txtUA01007.Text.Trim(); if (!string.IsNullOrEmpty(this.ddlUA01009.SelectedValue)) { _UserBase.UA01009 = Convert.ToInt32(this.ddlUA01009.SelectedValue); } _UserBase.UA01010 = this.txtUA01010.Text.Trim(); _UserBase.UA01011 = this.txtUA01011.Text.Trim(); _UserBase.UA01012 = this.txtUA01012.Text.Trim(); _UserBase.UA01013 = this.ddlUA01013.SelectedValue; _UserBase.UA01014 = this.txtUA01014.Text.Trim(); _UserBase.UA01015 = this.txtUA01015.Text.Trim(); _UserBase.UA01018 = this.txtUA01018.Text.Trim(); _UserBase.UA01021 = this.txtUA01021.Text.Trim(); _UserBase.UA01023 = true; _UserBase.UA01024 = Convert.ToInt32(this.ddlUA01024.SelectedValue); _UserBase.UA01025 = this.ddlUA01025.SelectedValue; if (this.rbtnUA01008Famale.Checked) { _UserBase.UA01008 = false; } else { _UserBase.UA01008 = true; } if (!string.IsNullOrEmpty(this.txtUA01016.Text.Trim())) { _UserBase.UA01016 = Convert.ToDateTime(this.txtUA01016.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtUA01017.Text.Trim())) { _UserBase.UA01017 = Convert.ToDateTime(this.txtUA01017.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtUA01019.Text.Trim())) { _UserBase.UA01019 = Convert.ToDateTime(this.txtUA01019.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtUA01020.Text.Trim())) { _UserBase.UA01020 = Convert.ToDateTime(this.txtUA01020.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtUA01022.Text.Trim())) { _UserBase.UA01022 = Convert.ToDateTime(this.txtUA01022.Text.Trim()); } int result = _UserBLL.InsertUserBase(_UserBase); //成功失败提示 new Sinoo.Common.MessageShow().InsertMessage(this.Page, result, "DataClear();"); }