protected void bt_SaveResetPwd_Click(object sender, EventArgs e) { if (tbx_ConfirmPwd.Text.Length < 6) { MessageBox.Show(this, "密码长度必需大于6!"); return; } CM_DIMembershipBLL shipbll = new CM_DIMembershipBLL((int)ViewState["ShipID"]); if (shipbll.Model.IsLockedOut==1) { MessageBox.Show(this, "请先解锁该帐户再修改密码!"); return; } string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_Pwd.Text, "md5");//MCSFramework.Common.DataEncrypter.EncrypteString(tbx_Pwd.Text); shipbll.Model.Password = pwd; if (shipbll.Update()<0) { MessageBox.Show(this, "输入的密码无效,密码修改失败!"); return; } else MessageBox.ShowAndRedirect(this, "密码重置成功!", "DIUserList.aspx"); }
protected void bt_SaveResetPwd_Click(object sender, EventArgs e) { if (tbx_ConfirmPwd.Text.Length < 6) { MessageBox.Show(this, "密码长度必需大于6!"); return; } CM_DIMembershipBLL shipbll = new CM_DIMembershipBLL((int)ViewState["ShipID"]); if (shipbll.Model.IsLockedOut == 1) { MessageBox.Show(this, "请先解锁该帐户再修改密码!"); return; } string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_Pwd.Text, "md5");//MCSFramework.Common.DataEncrypter.EncrypteString(tbx_Pwd.Text); shipbll.Model.Password = pwd; if (shipbll.Update() < 0) { MessageBox.Show(this, "输入的密码无效,密码修改失败!"); return; } else { MessageBox.ShowAndRedirect(this, "密码重置成功!", "DIUserList.aspx"); } }
protected void bt_Approve_Click(object sender, EventArgs e) { CM_DIMembershipBLL shipbll = new CM_DIMembershipBLL((int)ViewState["ShipID"]); shipbll.Model.IsApproved = 1; shipbll.Update(); BindData(); }
protected void bt_OK_Click(object sender, EventArgs e) { CM_DIMembershipBLL ship = new CM_DIMembershipBLL(); if (CM_DIMembershipBLL.GetByUserName(UserName.Text.Trim()).Rows.Count > 0) { MessageBox.Show(this, "用户名重复,请重新键入其他用户名!"); return; } if (select_Client.SelectValue == "" || select_Client.SelectValue == "0") { MessageBox.Show(this, "请选择账号所属经销商!"); return; } ship.Model.UserName = UserName.Text.Trim(); ship.Model.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(Password.Text, "md5"); ship.Model.IsApproved = 1; ship.Model.IsLockedOut = 0; int shipid = ship.Add(); if (shipid > 0) { CM_DIUsersBLL BLL = new CM_DIUsersBLL(); BLL.Model.Client = int.Parse(select_Client.SelectValue); BLL.Model.ShipID = shipid; if (BLL.Add() > 0) MessageBox.ShowAndRedirect(this, "创建成功!", "DIUserList.aspx"); } else MessageBox.Show(this, "账号创建出错,请联系管理员!"); }
protected void bt_OK_Click(object sender, EventArgs e) { CM_DIMembershipBLL ship = new CM_DIMembershipBLL(); if (CM_DIMembershipBLL.GetByUserName(UserName.Text.Trim()).Rows.Count > 0) { MessageBox.Show(this, "用户名重复,请重新键入其他用户名!"); return; } if (select_Client.SelectValue == "" || select_Client.SelectValue == "0") { MessageBox.Show(this, "请选择账号所属经销商!"); return; } ship.Model.UserName = UserName.Text.Trim(); ship.Model.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(Password.Text, "md5"); ship.Model.IsApproved = 1; ship.Model.IsLockedOut = 0; int shipid = ship.Add(); if (shipid > 0) { CM_DIUsersBLL BLL = new CM_DIUsersBLL(); BLL.Model.Client = int.Parse(select_Client.SelectValue); BLL.Model.ShipID = shipid; if (BLL.Add() > 0) { MessageBox.ShowAndRedirect(this, "创建成功!", "DIUserList.aspx"); } } else { MessageBox.Show(this, "账号创建出错,请联系管理员!"); } }
protected void bt_Unlock_Click(object sender, EventArgs e) { CM_DIMembershipBLL shipbll = new CM_DIMembershipBLL((int)ViewState["ShipID"]); shipbll.Model.IsLockedOut = 0; shipbll.Update(); BindData(); }
protected void bt_UnApprove_Click(object sender, EventArgs e) { CM_DIMembershipBLL shipbll = new CM_DIMembershipBLL((int)ViewState["ShipID"]); shipbll.Model.IsApproved = 0; shipbll.Update(); BindData(); Response.Redirect("DIUserList.aspx"); }
private void BindGrid() { if (tbx_Find.Text.Trim() == "") { gv_List.DataSource = CM_DIMembershipBLL.GetByUserName(""); } else { gv_List.DataSource = CM_DIMembershipBLL.GetByUserName(tbx_Find.Text.Trim()); } gv_List.DataBind(); }
private void BindData() { if ((int)ViewState["ShipID"] > 0) { CM_DIMembershipBLL shipbll = new CM_DIMembershipBLL((int)ViewState["ShipID"]); lb_Username.Text = shipbll.Model.UserName; lb_IsApproved.Text = shipbll.Model.IsApproved == 1 ? "启用" : "停用"; lb_IsLockedOut.Text = shipbll.Model.IsLockedOut == 1 ? "已锁定" : "未锁定"; bt_Approve.Visible = !(shipbll.Model.IsApproved == 1); bt_UnApprove.Visible = (shipbll.Model.IsApproved == 1); bt_Unlock.Visible = shipbll.Model.IsLockedOut == 1; } else { MessageBox.ShowAndRedirect(this, "用户名不存在!", "UserList.aspx"); } }
protected void bt_OK_Click(object sender, EventArgs e) { CM_DIUsersBLL user = new CM_DIUsersBLL((int)Session["ClientUserID"]); CM_DIMembershipBLL ship = new CM_DIMembershipBLL(user.Model.ShipID); if (!DataEncrypter.Compare(ship.Model.Password,tbx_OrgPassword.Text)) Literal1.Text = "原密码输入错误!"; else { ship.Model.Password = DataEncrypter.EncrypteString(tbx_NewPassword.Text); ship.Update(); Literal1.Text = ""; tbx_NewPassword.Text = ""; tbx_OrgPassword.Text = ""; tbx_RePassword.Text = ""; MessageBox.Show(this, "密码修改成功!"); } }
protected void bt_OK_Click(object sender, EventArgs e) { CM_DIUsersBLL user = new CM_DIUsersBLL((int)Session["ClientUserID"]); CM_DIMembershipBLL ship = new CM_DIMembershipBLL(user.Model.ShipID); if (!DataEncrypter.Compare(ship.Model.Password, tbx_OrgPassword.Text)) { Literal1.Text = "原密码输入错误!"; } else { ship.Model.Password = DataEncrypter.EncrypteString(tbx_NewPassword.Text); ship.Update(); Literal1.Text = ""; tbx_NewPassword.Text = ""; tbx_OrgPassword.Text = ""; tbx_RePassword.Text = ""; MessageBox.Show(this, "密码修改成功!"); } }