void btnReg_Click(object sender, EventArgs e) { //判断用户名是否存在,判断Email是否存在 SiteMember siteMember = new SiteMember(); if (siteMember.Exists(this.txtUserName.Text, this.txtEmail.Text)) { this.ltMsg.Text = "用户名或Email已存在!"; return; } //审核通过(普通用户) siteMember.Company = this.txtCompany.Text; siteMember.Email = this.txtEmail.Text; siteMember.Fax = this.txtFax.Text; siteMember.InterestProduct = this.txtInterestProduct.Text; siteMember.IsPass = true; siteMember.IsReceiveNewProductEmail = this.cbResive.Checked; siteMember.Phone = this.txtPhone.Text; siteMember.RealName = this.txtRealName.Text; siteMember.UserName = this.txtUserName.Text; siteMember.UserPwd = this.txtPwd.Text; int userId = siteMember.Update(); //Update UserRole Roles.AddUsersToRole(new string[] { siteMember.UserName }, "SiteMember"); this.ltMsg.Text = "注册成功!"; }
void btn_Update_Click(object sender, EventArgs e) { //首先检查Email是否有重复 if (sm.Email != this.txtEmail.Text) { //检查除了自己本身之外是否重复 if (MemberManage.ExistsEmailExceptUser(this.txtEmail.Text, sm.UserId)) { this.ltMsg.Text = "Email重复!"; return; } sm.Email = this.txtEmail.Text; } sm.Company = this.txtCompany.Text; sm.Fax = this.txtFax.Text; sm.InterestProduct = this.txtInterestProduct.Text; sm.IsReceiveNewProductEmail = this.cbResive.Checked; sm.Phone = this.txtPhone.Text; sm.RealName = this.txtRealName.Text; sm.Update(); this.ltMsg.Text = "更新成功!"; }
void btn_Update_Click(object sender, EventArgs e) { SiteMember sm = new SiteMember(User.Identity.Name); if (sm.UserPwd != this.txtOldPwd.Text) { this.ltMsg.Text = "旧密码不正确,请重新输入!"; return; } sm.UserPwd = this.txtConfirmNewPwd.Text; sm.Update(); this.ltMsg.Text = "修改成功,请牢记!"; }
void btnSave_Click(object sender, EventArgs e) { SiteMember sm = new SiteMember(userId); sm.IsPass = cbIsPass.Checked; sm.Update(); DataRow dr = MemberManage.GetUserInfo(userId); if (cbIsPass.Checked) { Roles.AddUsersToRoles(new string[] { dr["UserName"].ToString() }, new string[] { "Admin" }); } }
void btnSave_Click(object sender, EventArgs e) { SiteMember sm = new SiteMember(User.Identity.Name); if (sm.UserPwd != this.txtUserPwd.Text) { this.ltMsg.Text = "您的旧密码不匹配,请重试"; return; } sm.UserPwd = this.txtNewConfirmUserPwd.Text; sm.Update(); this.ltMsg.Text = "已更新"; }
void btnSave_Click(object sender, EventArgs e) { SiteMember sm = new SiteMember(User.Identity.Name); if (!sm.ExistsEmail(this.txtNewEmail.Text)) { sm.Email = txtNewEmail.Text; sm.Update(); this.ltMsg.Text = "已更新"; } else { this.ltMsg.Text = "此Email已存在,请选择其他Email"; return; } }
void btnRegister_Click(object sender, EventArgs e) { if (MemberManage.Exists(this.txtUserName.Text, this.txtUserEmail.Text)) { this.ltMsg.Text = "用户名或Email已存在"; return; } SiteMember sm = new SiteMember(); sm.Email = this.txtUserEmail.Text; sm.UserName = this.txtUserName.Text; sm.UserPwd = this.txtConfirmUserPwd.Text; int i = sm.Update(); if (i > 0) { this.ltMsg.Text = "用户已经创建,请等待审核!"; } }
public static int UpdateMember(SiteMemberInfo model) { return(dal.Update(model)); }