public void BindData() { #region //if (!Context.User.Identity.IsAuthenticated) //{ // return; //} //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (user.HasPermissionID(PermId_Modify)) //{ // gridView.Columns[6].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // gridView.Columns[7].Visible = true; //} #endregion string roleId = ""; if (Request.QueryString["roleId"] != null) { roleId = Request.QueryString["roleId"].ToString(); string rId = ""; if (roleId.IndexOf(',') >= 0) { rId = roleId.Split(',')[0]; } else { rId = roleId; } try { roleName = new BLL.role().GetModel(int.Parse(rId)).roleName; } catch { } } else { MessageBox.ShowAndRedirect(this, "参数丢失!", "../Controls/Main.aspx"); } DataSet ds = new DataSet(); StringBuilder strWhere = new StringBuilder(); strWhere.Append("roleid in (" + roleId + ")"); if (txtKeyword.Text.Trim() != "") { strWhere.AppendFormat(" and userName like '%{0}%'", txtKeyword.Text.Trim()); } ds = bll.GetList(strWhere.ToString()); gridView.DataSource = ds; gridView.DataBind(); }
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 BindData() { #region //if (!Context.User.Identity.IsAuthenticated) //{ // return; //} //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (user.HasPermissionID(PermId_Modify)) //{ // gridView.Columns[6].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // gridView.Columns[7].Visible = true; //} #endregion DataSet ds = new DataSet(); StringBuilder strWhere = new StringBuilder(); strWhere.Append("roleId=2 "); if (txtKeyword.Text.Trim() != "") { strWhere.AppendFormat(" and userName like '%{0}%'", txtKeyword.Text.Trim()); } if (Request.Cookies["isAdmin"].Value != "1") { BLL.dept pBll = new BLL.dept(); strWhere.Append(" and deptId in (" + pBll.GetAllChild(int.Parse(Request.Cookies["deptId"].Value)) + ") "); } ds = bll.GetList(strWhere.ToString()); string[] arr = { "冻结", "正常" }; Common.CommonHelper.AddDtColumns(ds.Tables[0], "status", arr); gridView.DataSource = ds; gridView.DataBind(); }
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, "密码输入错误,请重新输入!"); } } }
protected 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.txtpassword.Text.Trim().Length == 0) { strErr += "密码不能为空!\\n"; } if (this.ddrPlace.SelectedValue == "0") { strErr += "请选择所属区域!\\n"; } if (this.ddrRole.SelectedValue == "0") { strErr += "请选择角色!\\n"; } if (bll.GetList("userName='******'").Tables[0].Rows.Count > 0) { strErr += "用户名重复!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string userName = this.txtuserName.Text; string password = this.txtpassword.Text; string trueName = this.txtTrueName.Text; int placeId = int.Parse(this.ddrPlace.SelectedValue); string placeName = this.ddrPlace.Items[ddrPlace.SelectedIndex].Text.Replace("┣", "").Replace("╍", "").Replace("?", ""); 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 = new hm.Model.users(); model.userName = userName; model.password = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(password, ConfigHelper.GetConfigString("PassWordEncrypt")); 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.addTime = addTime; model.lastLoginTime = lastLoginTime; model.status = status; //model.address = txtAddress.Text; if (this.ddrRole.Items[ddrRole.SelectedIndex].Text.Equals("管理员")) { model.isAdmin = 1; } model.score = 0; bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["act"] == null) { if (Request.QueryString["userId"] == null) { MessageBox.ShowAndRedirect(this, "缺少参数", "/admin/users/userlist.aspx"); return; } else { string userId = Request.QueryString["userId"].ToString(); if (bll.GetList("userId=" + userId).Tables[0].Rows.Count > 0) { MessageBox.ShowAndRedirect(this, "此用户已经开通过店铺!", "/admin/users/userlist.aspx"); return; } hm.BLL.users ubll = new hm.BLL.users(); if (ubll.GetList("userId=" + userId).Tables[0].Rows.Count == 0) { MessageBox.ShowAndRedirect(this, "无此用户!", "/admin/users/userlist.aspx"); return; } } BLL.sysItem catBll = new BLL.sysItem(); ddrCat.DataTextField = "itemName"; ddrCat.DataValueField = "siId"; ddrCat.DataSource = ClassHelper.GetSystemItem(StatusHelpercs.Default_Item_StoreType); ddrCat.DataBind(); ddrCat.Items.Insert(0, new ListItem("请选择", "0")); provinceHtml = ClassHelper.getProvinceOptions(); } } if (RequsetAjax("showCity")) { // try { string code = Request.Form["code"].ToString(); string result = ClassHelper.getCityOptions(code); Response.Write("{\"status\":1,\"result\":\"" + result + "\"}"); } catch { Response.Write("{\"status\":0,\"msg\":\"失败!\"}"); } Response.End(); } if (RequsetAjax("showDistinct")) { // try { string code = Request.Form["code"].ToString(); string result = ClassHelper.getDistinceOptions(code); Response.Write("{\"status\":1,\"result\":\"" + result + "\"}"); } catch { Response.Write("{\"status\":0,\"msg\":\"失败!\"}"); } Response.End(); } }
protected 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.txtpassword.Text.Trim().Length==0) { strErr+="密码不能为空!\\n"; } if (this.ddrPlace.SelectedValue == "0") { strErr += "请选择所属区域!\\n"; } if (this.ddrRole.SelectedValue == "0") { strErr += "请选择角色!\\n"; } if (bll.GetList("userName='******'").Tables[0].Rows.Count > 0) { strErr += "用户名重复!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } string userName=this.txtuserName.Text; string password=this.txtpassword.Text; string trueName = this.txtTrueName.Text; int placeId = int.Parse(this.ddrPlace.SelectedValue); string placeName = this.ddrPlace.Items[ddrPlace.SelectedIndex].Text.Replace("┣", "").Replace("╍", "").Replace("?", ""); 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 = StatusHelpercs.User_Status_Normal; hm.Model.users model=new hm.Model.users(); model.userName=userName; model.password = Maticsoft.Common.DEncrypt.DESEncrypt.Encrypt(password, ConfigHelper.GetConfigString("PassWordEncrypt")); 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.addTime=addTime; model.lastLoginTime=lastLoginTime; model.status=status; //model.address = txtAddress.Text; if (this.ddrRole.Items[ddrRole.SelectedIndex].Text.Equals("管理员")) { model.isAdmin = 1; } model.score = 0; bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx"); }