protected void submit_Click(object sender, EventArgs e) { XtmUser userM = new XtmUser(); userM.UserCode = this.txtUsername.Text.Trim(); userM.UserPwd = Encry.Encode(this.txtUserpwd.Text.Trim()); BaseDao baseDao = new BaseDao(); IList <XtmUser> userL = baseDao.List <XtmUser>(userM); if (userL != null && userL.Count > 0) { userM = userL[0]; if (userM.Status != "x") { Page.RegisterStartupScript("onclick", "<script>alert('账号已停用')</script>"); } else { CoreCache.SetCache("SysDepartId", userM.DepartId); CoreCache.SetCache("SysUserType", userM.UserType); CoreCache.SetCache("SysUserId", userM.Did); CoreCache.SetCache("SysUserCode", userM.UserCode); CoreCache.SetCache("SysUserName", userM.UserName); Response.Redirect("Index/content.htm"); } } else { Page.RegisterStartupScript("onclick", "<script>alert('账号或密码错误')</script>"); } }
protected void butSave_Click(object sender, EventArgs e) { string errmsg = ""; if (this.xmm.Text == "") { this.laberr.Text = "新密码不能为空"; return; } if (this.qrmm.Text == "") { this.laberr.Text = "确认密码不能为空"; return; } if (this.xmm.Text.Trim() != this.qrmm.Text.Trim()) { this.laberr.Text = "新密码和确认密码不一致"; return; } if (this.ymm.Text.Trim() == "") { this.laberr.Text = "原密码不能为空"; return; } BaseDao baseDao = new BaseDao(); XtmUser user = new XtmUser(); user.Did = int.Parse(user.SysUserId); user = baseDao.Get(user); if (user != null) { string encryymm = Encry.Encode(this.ymm.Text.Trim()); if (user.UserPwd != encryymm) { this.laberr.Text = "原密码不正确"; } else { user.UserPwd = Encry.Encode(this.xmm.Text.Trim()); baseDao.Update(user); Page.RegisterStartupScript("close", "<script language='javascript'>alert('修改成功');window.close();</script>"); } } else { this.laberr.Text = "取用户资料出错"; } }