protected void Button1_Click(object sender, EventArgs e) { string pwd = Common.getMD5.MD5(this.txtOldPwd.Text); string newPwd = this.txtNewPwd2.Text; string uname = userseesion.UserName.ToString(); string oldpwd = dal.GetModel(HttpUtility.UrlDecode(uname)).PassWord; if (pwd != oldpwd) { JScript.alertBack("a", "旧密码不正确", this.Page); } else { if (Regex.IsMatch(newPwd, @"^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,12}$") == false) { JScript.alertBack("ok", "请填写英文数字组合密码(长度8-12位)", this.Page); return; } Model.UserInfoModel model = new Model.UserInfoModel(); model.UserName = HttpUtility.UrlDecode(uname); model.PassWord = getMD5.MD5(newPwd); if (dal.UpdatePwd(model) > 0) { JScript.alert("a", "修改成功", "../default/login.aspx", this.Page); } } }
protected void Button1_Click(object sender, EventArgs e) { string menu_list_id = Request["menu_select_id"]; int id = Common.TypeHelper.ObjectToInt(this.hidId.Value, 0); if (id > 0) { Model.UserInfoGroupModel model = new Model.UserInfoGroupModel(); model.GroupName = this.txtgroupName.Text; model.GroupId = id; if (string.IsNullOrEmpty(menu_list_id) == false) { string[] menu_arr_list = menu_list_id.Split(','); Model.PermissionModel m = null; foreach (var item in menu_arr_list) { int mid = Common.TypeHelper.ObjectToInt(item, 0); int mbid = dal.GetModel(mid).Bid; m = new Model.PermissionModel(); m.MenuId = mid; m.MenuBid = mbid; model.PerList.Add(m); } } int j = group.Update(model); if (j > 0) { JScript.alert("ok", "操作成功", "Admin_Group.aspx?id=" + id + "&action=update", this.Page); } else { JScript.alert("ok", "出现异常", this.Page); } } else { if (menu_list_id == "") { JScript.alertBack("ok", "请选择菜单", this.Page); } else { Model.UserInfoGroupModel model = new Model.UserInfoGroupModel(); model.GroupName = this.txtgroupName.Text; string[] menu_arr_list = menu_list_id.Split(','); Model.PermissionModel m = null; foreach (var item in menu_arr_list) { int mid = Common.TypeHelper.ObjectToInt(item, 0); int mbid = dal.GetModel(mid).Bid; m = new Model.PermissionModel(); m.MenuId = mid; m.MenuBid = mbid; model.PerList.Add(m); } int j = group.Add(model); if (j > 0) { JScript.alert("ok", "操作成功", "Admin_Group.aspx?", this.Page); } else { JScript.alert("ok", "出现异常", this.Page); } } } }
protected void Button1_Click(object sender, EventArgs e) { ///要跳转回的菜单 menuUrl = menuUrl + dl.GeMenuSid("../User/Admin_UserInfo.aspx", Request["menubid"]); Model.UserInfoModel model = new Model.UserInfoModel(); int id = Common.TypeHelper.ObjectToInt(this.hidId.Value, 0); model.UserId = id; model.UserName = this.txtUserName.Text; if (this.txtPassWord.Text == "") { model.PassWord = this.txtPassWord2.Text; } else { model.PassWord = this.txtPassWord.Text; } if (Regex.IsMatch(model.PassWord, @"^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,12}$") == false) { JScript.alertBack("ok", "请填写英文数字组合密码(长度8-12位)", this.Page); return; } model.PassWord = Common.getMD5.MD5(model.PassWord); model.Email = ""; // this.txtEmail.Text; model.CreateTime = DateTime.Now; model.LevelId = 0; // Common.TypeHelper.ObjectToInt(this.ddlLevelId.SelectedValue, 0); model.Mob = ""; // this.txtMob.Text; model.RealName = this.txtUserName.Text; model.StatusId = Common.TypeHelper.ObjectToInt(this.ddlStatusId.SelectedValue, 0); model.GroupId = Common.TypeHelper.ObjectToInt(this.ddlGroupId.SelectedValue, 0); model.PostId = 0; // Common.TypeHelper.ObjectToInt(this.ddlPostId.SelectedValue, 0); model.RoleId = 0; // Common.TypeHelper.ObjectToInt(this.ddlRoleId.SelectedValue, 0); model.LoginCount = 0; if (id > 0) { if (dal.Update(model) > 0) { JScript.alert("ok", "修改成功,点击确定返回列表", "Admin_UserInfo.aspx?", this.Page); } } else { if (dal.Exists(model.RealName) == true) { JScript.alertBack("ok", "已存在的用户名", this.Page); } else { if (dal.Add(model) > 0) { if (userseesion.GroupId == 22) { JScript.alertBack("ok", "添加成功", this.Page); } else { JScript.alert("ok", "添加成功,点击确定返回列表", "Admin_UserInfo.aspx?", this.Page); } } } } }