public void btnSave_Click(object sender, EventArgs e) { hm.BLL.users bll = new hm.BLL.users(); string strErr = ""; if (this.txtuserName.Text.Trim().Length == 0) { strErr += "用户名不能为空!\\n"; } if (this.txtTrueName.Text.Trim().Length == 0) { strErr += "用户名不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int userId = int.Parse(this.lbluserId.Text); string userName = this.txtuserName.Text; string trueName = this.txtTrueName.Text; int deptId = int.Parse(this.ddrDept.SelectedValue); string deptName = this.ddrDept.Items[ddrDept.SelectedIndex].Text; int roleId = int.Parse(this.ddrRole.SelectedValue); string roleName = this.ddrRole.Items[ddrRole.SelectedIndex].Text; int sex = int.Parse(this.rblSex.SelectedValue); string tel = this.txttel.Text; string email = this.txtemail.Text; string qq = this.txtqq.Text; DateTime addTime = DateTime.Now; DateTime lastLoginTime = DateTime.Now; int status = int.Parse(this.ddrStatus.SelectedValue); hm.Model.users model = bll.GetModel(userId); model.userName = userName; model.trueName = trueName; model.roleId = roleId; model.roleName = roleName; model.sex = sex; model.tel = tel; model.email = email; model.qq = qq; model.addTime = addTime; model.lastLoginTime = lastLoginTime; model.status = status; bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
public void btnSave_Click(object sender, EventArgs e) { hm.BLL.users bllUser = new hm.BLL.users(); HttpCookie cookie = Request.Cookies["userId"]; if (null == cookie) { Response.Write("<script language=javascript>window.parent.location='../Login.aspx';</script>");// } else { string userId = cookie.Value; string oldPass = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(txtPassword.Text.Trim(), ConfigHelper.GetConfigString("PassWordEncrypt")); string newPass = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(txtNewPass.Text.Trim(), ConfigHelper.GetConfigString("PassWordEncrypt")); string reNewPass = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(txtReNewPass.Text.Trim(), ConfigHelper.GetConfigString("PassWordEncrypt")); if (!newPass.Equals(reNewPass)) { MessageBox.Show(this, "新密码两次输入的不一致!"); return; } DataSet ds = bllUser.GetList("userId=" + userId + " and [password]='" + oldPass + "'"); if (ds.Tables[0].Rows.Count > 0) { Model.users model = bllUser.GetModel(int.Parse(userId)); if (model != null) { model.password = newPass; model.nickName = ""; model.address = ""; model.studyType = 1; model.score = 0; bllUser.Update(model); MessageBox.Show(this, "修改成功!"); } } else { MessageBox.Show(this, "密码输入错误,请重新输入!"); } } }
public void btnSave_Click(object sender, EventArgs e) { hm.BLL.users bllUser = new hm.BLL.users(); string userId = Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_UserId); if (string.IsNullOrEmpty(userId)) { Response.Write("<script language=javascript>window.parent.location='../Login.aspx';</script>");// } else { string oldPass = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(txtPassword.Text.Trim(), ConfigHelper.GetConfigString("PassWordEncrypt")); string newPass = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(txtNewPass.Text.Trim(), ConfigHelper.GetConfigString("PassWordEncrypt")); string reNewPass = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(txtReNewPass.Text.Trim(), ConfigHelper.GetConfigString("PassWordEncrypt")); if (!newPass.Equals(reNewPass)) { MessageBox.Show(this, "新密码两次输入的不一致!"); return; } DataSet ds = bllUser.GetList("userId='" + userId + "' and password='******'"); if (ds.Tables[0].Rows.Count > 0) { Model.users model = bllUser.GetModel(int.Parse(userId)); if (model != null) { model.password = newPass; bllUser.Update(model); MessageBox.Show(this, "修改成功!"); } } else { MessageBox.Show(this, "密码输入错误,请重新输入!"); } } }
public void btnSave_Click(object sender, EventArgs e) { hm.BLL.users bll = new hm.BLL.users(); string strErr=""; if (this.txtuserName.Text.Trim().Length == 0) { strErr += "用户名不能为空!\\n"; } if (this.txtTrueName.Text.Trim().Length == 0) { strErr += "真实姓名不能为空!\\n"; } if (this.ddrPlace.SelectedValue == "0") { strErr += "请选择所属区域!\\n"; } if (this.ddrRole.SelectedValue == "0") { strErr += "请选择角色!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int userId=int.Parse(this.lbluserId.Text); string userName = this.txtuserName.Text; string trueName = this.txtTrueName.Text; int placeId = int.Parse(this.ddrPlace.SelectedValue); string placeName = this.ddrPlace.Items[ddrPlace.SelectedIndex].Text; int roleId = int.Parse(this.ddrRole.SelectedValue); string roleName = this.ddrRole.Items[ddrRole.SelectedIndex].Text; int sex = int.Parse(this.rblSex.SelectedValue); string tel = this.txtuserName.Text; string email = this.txtemail.Text; string qq = this.txtqq.Text; int status = int.Parse(this.ddrStatus.SelectedValue); string password = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(txtpassword.Text, ConfigHelper.GetConfigString("PassWordEncrypt")); hm.Model.users model = bll.GetModel(userId); model.userName=userName; model.trueName = trueName; model.deptId = placeId; model.deptName = placeName; model.roleId=roleId; model.roleName=roleName; model.sex=sex; model.tel=tel; model.email=email; model.qq=qq; model.status=status; model.tel = txttel.Text; model.password = password; bll.Update(model); string backurl = "list"; if (Request.Params["backurl"] != null && Request.Params["backurl"].Trim() != "") { backurl = Request.Params["backurl"].ToString(); } Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", backurl + ".aspx"); }