Beispiel #1
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 #2
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;
        }