Beispiel #1
0
        private void ShowInfo(int _id)
        {
            litpwdtip.Text = "不填则不修改密码";
            BLL.dt_manager   bll   = new BLL.dt_manager();
            Model.dt_manager model = bll.GetModel(_id);
            ddlRoleId.SelectedValue  = model.role_id.ToString();
            ddlSection.SelectedValue = model.SectionId.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;
        }
Beispiel #2
0
        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.dt_manager   bll   = new BLL.dt_manager();
            Model.dt_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);
        }
Beispiel #3
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            BLL.dt_manager   bll   = new BLL.dt_manager();
            Model.dt_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.dt_manager NewModel = new Model.dt_manager();
            NewModel.id       = model.id;
            NewModel.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            if (!bll.Update(NewModel))
            {
                JscriptMsg("保存过程中发生错误!", "", "Error");
                return;
            }
            Session[MXKeys.SESSION_ADMIN_INFO] = null;
            JscriptMsg("密码修改成功!", "manager_pwd.aspx", "Success");
        }
Beispiel #4
0
 /// <summary>
 /// 判断管理员是否已经登录(解决Session超时问题)
 /// </summary>
 public bool IsAdminLogin()
 {
     //如果Session为Null
     if (Session[MXKeys.SESSION_ADMIN_INFO] != null)
     {
         return(true);
     }
     else
     {
         //检查Cookies
         string adminname = Utils.GetCookie("AdminName", "MxWeiXinPF");
         string adminpwd  = Utils.GetCookie("AdminPwd", "MxWeiXinPF");
         if (adminname != "" && adminpwd != "")
         {
             BLL.dt_manager   bll   = new BLL.dt_manager();
             Model.dt_manager model = bll.GetModel(adminname, adminpwd);
             if (model != null)
             {
                 Session[MXKeys.SESSION_ADMIN_INFO] = model;
                 return(true);
             }
         }
     }
     return(false);
 }
Beispiel #5
0
        private bool DoAdd()
        {
            //地区
            string prov = ddlProvince.SelectedItem.Value;
            string city = ddlCity.SelectedItem.Value;
            string dist = txtArea.Text.Trim();


            Model.dt_manager model = new Model.dt_manager();
            BLL.dt_manager   bll   = new BLL.dt_manager();
            model.role_id   = int.Parse(ddlRoleId.SelectedValue);
            model.SectionId = Convert.ToInt32(ddlSection.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.Insert(model) > 0)
            {
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志
                return(true);
            }
            return(false);
        }
Beispiel #6
0
        private bool DoEdit(int _id)
        {
            //地区
            string prov = ddlProvince.SelectedItem.Value;
            string city = ddlCity.SelectedItem.Value;
            string dist = txtArea.Text.Trim();


            bool result = false;

            BLL.dt_manager   bll   = new BLL.dt_manager();
            Model.dt_manager model = bll.GetModel(_id);
            model.id        = _id;
            model.SectionId = Convert.ToInt32(ddlSection.SelectedValue);
            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);
        }
Beispiel #7
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page        = MXRequest.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.dt_manager bll = new BLL.dt_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);
        }
Beispiel #8
0
        /// <summary>
        /// 绑定收料员
        /// </summary>
        /// <param name="ddl"></param>
        /// <param name="dType">数据字典类型</param>
        private void BindDDL_Person(DropDownList ddl)
        {
            string strWhere = "";//条件

            BLL.dt_manager bll = new BLL.dt_manager();
            DataTable      dt  = bll.GetDataTable(strWhere);

            ddl.Items.Clear();
            ddl.Items.Add(new ListItem("--不限--", "00"));
            foreach (DataRow dr in dt.Rows)
            {
                ddl.Items.Add(new ListItem(dr["real_name"].ToString(), dr["id"].ToString()));
            }
        }
Beispiel #9
0
        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.dt_manager bll = new BLL.dt_manager();

            Model.dt_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("index.aspx");
            return;
        }
Beispiel #10
0
        private void ShowInfo(int _id)
        {
            lblid.Text = _id.ToString();
            BLL.dt_manager   bll   = new BLL.dt_manager();
            Model.dt_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;
        }
Beispiel #11
0
        //批量删除
        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.dt_manager bll = new BLL.dt_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");
        }
Beispiel #12
0
        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.dt_manager bll = new BLL.dt_manager();
            if (bll.Exists(user_name))
            {
                context.Response.Write("{ \"info\":\"用户名已被占用,请更换!\", \"status\":\"n\" }");
                return;
            }
            context.Response.Write("{ \"info\":\"用户名可使用\", \"status\":\"y\" }");
            return;
        }
Beispiel #13
0
 private void ShowInfo(int _id)
 {
     BLL.dt_manager   bll   = new BLL.dt_manager();
     Model.dt_manager model = bll.GetModel(_id);
     lblUserName.Text = model.user_name;
 }