示例#1
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("user_list", OSEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.users.users bll = new BLL.users.users();
            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(OSEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!",
                       Utils.CombUrlTxt("user_list.aspx", "group_id={0}&keywords={1}", this.group_id.ToString(), this.keywords), "Success");
        }
示例#2
0
        private void validate_username(HttpContext context)
        {
            string user_name = OSRequest.GetString("param");

            //如果为Null,退出
            if (string.IsNullOrEmpty(user_name))
            {
                context.Response.Write("{ \"info\":\"请输入用户名\", \"status\":\"n\" }");
                return;
            }
            Model.configs.userconfig userConfig = new BLL.configs.userconfig().loadConfig();
            //过滤注册用户名字符
            string[] strArray = userConfig.regkeywords.Split(',');
            foreach (string s in strArray)
            {
                if (s.ToLower() == user_name.ToLower())
                {
                    context.Response.Write("{ \"info\":\"用户名不可用\", \"status\":\"n\" }");
                    return;
                }
            }
            BLL.users.users bll = new BLL.users.users();
            //查询数据库
            if (bll.Exists(user_name.Trim()))
            {
                context.Response.Write("{ \"info\":\"用户名已重复\", \"status\":\"n\" }");
                return;
            }
            context.Response.Write("{ \"info\":\"用户名可用\", \"status\":\"y\" }");
            return;
        }
示例#3
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("user_list", OSEnums.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.users.users bll = new BLL.users.users();
     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(OSEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!",
         Utils.CombUrlTxt("user_list.aspx", "group_id={0}&keywords={1}", this.group_id.ToString(), this.keywords), "Success");
 }
示例#4
0
 //审核通过
 protected void btnAudit_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("user_audit", OSEnums.ActionEnum.Audit.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.users.users bll = new BLL.users.users();
     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.UpdateField(id, "status=0") > 0)
             {
                 sucCount += 1;
             }
             else
             {
                 errorCount += 1;
             }
         }
     }
     AddAdminLog(OSEnums.ActionEnum.Audit.ToString(), "审核用户成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("审核通过" + sucCount + "条,失败" + errorCount + "条!",
         Utils.CombUrlTxt("user_audit.aspx", "keywords={0}", this.keywords), "Success");
 }
示例#5
0
        //审核通过
        protected void btnAudit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("user_audit", OSEnums.ActionEnum.Audit.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.users.users bll = new BLL.users.users();
            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.UpdateField(id, "status=0") > 0)
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(OSEnums.ActionEnum.Audit.ToString(), "审核用户成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("审核通过" + sucCount + "条,失败" + errorCount + "条!",
                       Utils.CombUrlTxt("user_audit.aspx", "keywords={0}", this.keywords), "Success");
        }
示例#6
0
        private bool DoAdd()
        {
            bool result = false;

            Model.users.users model = new Model.users.users();
            BLL.users.users   bll   = new BLL.users.users();

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.status   = int.Parse(rblStatus.SelectedValue);
            //检测用户名是否重复
            if (bll.Exists(txtUserName.Text.Trim()))
            {
                return(false);
            }
            //model.user_name = Utils.DropHTML(txtUserName.Text.Trim());
            model.user_name = Utils.GetUserNumber(model.group_id.ToString());
            //检测用户名是否重复
            if (bll.Exists(model.user_name.Trim()))
            {
                model.user_name = Utils.GetUserNumber(model.group_id.ToString());
            }
            //获得6位的salt加密字符串
            model.salt = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password  = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            model.email     = Utils.DropHTML(txtEmail.Text);
            model.nick_name = Utils.DropHTML(txtNickName.Text);
            model.avatar    = Utils.DropHTML(txtAvatar.Text);
            model.sex       = rblSex.SelectedValue;
            DateTime _birthday;

            if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            {
                model.birthday = _birthday;
            }
            model.telphone = Utils.DropHTML(txtTelphone.Text.Trim());
            model.mobile   = Utils.DropHTML(txtMobile.Text.Trim());

            model.universities = txtUniversities.Text;
            model.professional = txtProfessional.Text;
            model.goodat       = txtGoodat.Text;
            model.workat       = txtWorkat.Text;
            model.industry     = txtIndustry.Text;

            model.qq       = Utils.DropHTML(txtQQ.Text);
            model.address  = Utils.DropHTML(txtAddress.Text.Trim());
            model.amount   = decimal.Parse(txtAmount.Text.Trim());
            model.point    = int.Parse(txtPoint.Text.Trim());
            model.exp      = int.Parse(txtExp.Text.Trim());
            model.reg_time = DateTime.Now;
            model.reg_ip   = OSRequest.GetIP();

            if (bll.Add(model) > 0)
            {
                AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name);                 //记录日志
                result = true;
            }
            return(result);
        }
示例#7
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.users.users   bll   = new BLL.users.users();
            Model.users.users model = bll.GetModel(_id);
            if (model.status != int.Parse(rblStatus.SelectedValue) && int.Parse(rblStatus.SelectedValue) == 0)
            {
                flag = 1;
            }
            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.status   = int.Parse(rblStatus.SelectedValue);
            //判断密码是否更改
            if (txtPassword.Text.Trim() != defaultpassword)
            {
                //获取用户已生成的salt作为密钥加密
                model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            }
            model.email     = Utils.DropHTML(txtEmail.Text);
            model.nick_name = Utils.DropHTML(txtNickName.Text);
            model.avatar    = Utils.DropHTML(txtAvatar.Text);
            model.sex       = rblSex.SelectedValue;
            DateTime _birthday;

            if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            {
                model.birthday = _birthday;
            }
            model.universities = txtUniversities.Text;
            model.professional = txtProfessional.Text;
            model.goodat       = txtGoodat.Text;
            model.workat       = txtWorkat.Text;
            model.industry     = txtIndustry.Text;

            model.telphone = Utils.DropHTML(txtTelphone.Text.Trim());
            model.mobile   = Utils.DropHTML(txtMobile.Text.Trim());
            model.qq       = Utils.DropHTML(txtQQ.Text);
            model.address  = Utils.DropHTML(txtAddress.Text.Trim());
            model.amount   = Utils.StrToDecimal(txtAmount.Text.Trim(), 0);
            model.point    = Utils.StrToInt(txtPoint.Text.Trim(), 0);
            model.exp      = Utils.StrToInt(txtExp.Text.Trim(), 0);

            if (bll.Update(model))
            {
                AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "修改用户信息:" + model.user_name);                 //记录日志
                result = true;
            }
            return(result);
        }
示例#8
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page             = OSRequest.GetQueryInt("page", 1);
            this.txtKeywords.Text = this.keywords;
            BLL.users.users bll = new BLL.users.users();
            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("user_audit.aspx", "keywords={0}&page={1}",
                                              this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
示例#9
0
        private void ShowInfo(int _id)
        {
            BLL.users.users   bll   = new BLL.users.users();
            Model.users.users model = bll.GetModel(_id);

            ddlGroupId.SelectedValue = model.group_id.ToString();
            rblStatus.SelectedValue  = model.status.ToString();
            txtUserName.Text         = model.user_name;
            txtUserName.ReadOnly     = true;
            txtUserName.Attributes.Remove("ajaxurl");
            if (!string.IsNullOrEmpty(model.password))
            {
                txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword;
            }
            txtEmail.Text        = model.email;
            txtNickName.Text     = model.nick_name;
            txtAvatar.Text       = model.avatar;
            rblSex.SelectedValue = model.sex;
            if (model.birthday != null)
            {
                txtBirthday.Text = model.birthday.GetValueOrDefault().ToString("yyyy-MM-dd");
            }
            txtTelphone.Text = model.telphone;
            txtMobile.Text   = model.mobile;
            txtQQ.Text       = model.qq;
            txtAddress.Text  = model.address;
            txtAmount.Text   = model.amount.ToString();
            txtPoint.Text    = model.point.ToString();
            txtExp.Text      = model.exp.ToString();
            lblRegTime.Text  = model.reg_time.ToString();
            lblRegIP.Text    = model.reg_ip.ToString();


            txtUniversities.Text = model.universities;
            txtProfessional.Text = model.professional;
            txtGoodat.Text       = model.goodat;
            txtWorkat.Text       = model.workat;
            txtIndustry.Text     = model.industry;
            //查找最近登录信息
            Model.users.user_login_log logModel = new BLL.users.user_login_log().GetLastModel(model.user_name);
            if (logModel != null)
            {
                lblLastTime.Text = logModel.login_time.ToString();
                lblLastIP.Text   = logModel.login_ip;
            }
        }
示例#10
0
 //保存
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     if (action == OSEnums.ActionEnum.Edit.ToString())                   //修改
     {
         ChkAdminLevel("user_list", OSEnums.ActionEnum.Edit.ToString()); //检查权限
         if (!DoEdit(this.id))
         {
             JscriptMsg("保存过程中发生错误!", "", "Error");
             return;
         }
         if (flag != 0)
         {
             string strBody = txtNickName.Text + "(" + txtUserName.Text + ")" + ",您的注册信息已通过。登陆入口:http://chncra.org/login.aspx";
             OS.Common.OSMail.sendMail("smtp.exmail.qq.com", "*****@*****.**", "123456a", OS.Web.UI.BasePage.config.webcompany, "*****@*****.**", txtEmail.Text, "注册信息审核通过", strBody);
             JMsg("审核通过信息已发送到用户邮箱");
         }
         JscriptMsg("修改用户成功!", "user_list.aspx", "Success");
     }
     else                                                               //添加
     {
         ChkAdminLevel("user_list", OSEnums.ActionEnum.Add.ToString()); //检查权限
         if (!DoAdd())
         {
             BLL.users.users bllUser = null;
             //检测用户名是否重复
             if (bllUser.ExistsMobile(txtMobile.Text.Trim()))
             {
                 JMsg("手机号码已注册请使用未注册手机号"); return;
             }
             //检测用户名是否重复
             if (bllUser.ExistsEmail(txtEmail.Text.Trim()))
             {
                 JMsg("邮箱已注册请使用未注册邮箱"); return;
             }
             JscriptMsg("保存过程中发生错误!", "", "Error");
             return;
         }
         JscriptMsg("添加用户成功!", "user_list.aspx", "Success");
     }
 }
示例#11
0
        //发送手机短信
        protected void btnSmsPost_Click(object sender, EventArgs e)
        {
            BLL.users.users bll = new BLL.users.users();
            StringBuilder str = new StringBuilder();

            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)
                {
                    Model.users.users model = bll.GetModel(id);
                    if (model != null && !string.IsNullOrEmpty(model.mobile))
                    {
                        str.Append(model.mobile + ",");
                    }
                }
            }
            if (!string.IsNullOrEmpty(str.ToString()))
            {
                Response.Redirect("user_sms.aspx?mobiles=" + Utils.UrlEncode(Utils.DelLastComma(str.ToString())));
            }
        }
示例#12
0
        //发送手机短信
        protected void btnSmsPost_Click(object sender, EventArgs e)
        {
            BLL.users.users bll = new BLL.users.users();
            StringBuilder   str = new StringBuilder();

            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)
                {
                    Model.users.users model = bll.GetModel(id);
                    if (model != null && !string.IsNullOrEmpty(model.mobile))
                    {
                        str.Append(model.mobile + ",");
                    }
                }
            }
            if (!string.IsNullOrEmpty(str.ToString()))
            {
                Response.Redirect("user_sms.aspx?mobiles=" + Utils.UrlEncode(Utils.DelLastComma(str.ToString())));
            }
        }
示例#13
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = OSRequest.GetQueryInt("page", 1);
            this.txtKeywords.Text = this.keywords;
            BLL.users.users bll = new BLL.users.users();
            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("user_audit.aspx", "keywords={0}&page={1}",
                this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
示例#14
0
 private void validate_username(HttpContext context)
 {
     string user_name = OSRequest.GetString("param");
     //如果为Null,退出
     if (string.IsNullOrEmpty(user_name))
     {
         context.Response.Write("{ \"info\":\"请输入用户名\", \"status\":\"n\" }");
         return;
     }
     Model.configs.userconfig userConfig = new BLL.configs.userconfig().loadConfig();
     //过滤注册用户名字符
     string[] strArray = userConfig.regkeywords.Split(',');
     foreach (string s in strArray)
     {
         if (s.ToLower() == user_name.ToLower())
         {
             context.Response.Write("{ \"info\":\"用户名不可用\", \"status\":\"n\" }");
             return;
         }
     }
     BLL.users.users bll = new BLL.users.users();
     //查询数据库
     if (bll.Exists(user_name.Trim()))
     {
         context.Response.Write("{ \"info\":\"用户名已重复\", \"status\":\"n\" }");
         return;
     }
     context.Response.Write("{ \"info\":\"用户名可用\", \"status\":\"y\" }");
     return;
 }
示例#15
0
        private void ShowInfo(int _id)
        {
            BLL.users.users bll = new BLL.users.users();
            Model.users.users model = bll.GetModel(_id);

            ddlGroupId.SelectedValue = model.group_id.ToString();
            rblStatus.SelectedValue = model.status.ToString();
            txtUserName.Text = model.user_name;
            txtUserName.ReadOnly = true;
            txtUserName.Attributes.Remove("ajaxurl");
            if (!string.IsNullOrEmpty(model.password)) {
                txtPassword.Attributes["value"] = txtPassword1.Attributes["value"] = defaultpassword;
            }
            txtEmail.Text = model.email;
            txtNickName.Text = model.nick_name;
            txtAvatar.Text = model.avatar;
            rblSex.SelectedValue = model.sex;
            if (model.birthday != null) {
                txtBirthday.Text = model.birthday.GetValueOrDefault().ToString("yyyy-MM-dd");
            }
            txtTelphone.Text = model.telphone;
            txtMobile.Text = model.mobile;
            txtQQ.Text = model.qq;
            txtAddress.Text = model.address;
            txtAmount.Text = model.amount.ToString();
            txtPoint.Text = model.point.ToString();
            txtExp.Text = model.exp.ToString();
            lblRegTime.Text = model.reg_time.ToString();
            lblRegIP.Text = model.reg_ip.ToString();

            txtUniversities.Text = model.universities;
            txtProfessional.Text = model.professional;
            txtGoodat.Text = model.goodat;
            txtWorkat.Text = model.workat;
            txtIndustry.Text = model.industry;
            //查找最近登录信息
            Model.users.user_login_log logModel = new BLL.users.user_login_log().GetLastModel(model.user_name);
            if (logModel != null) {
                lblLastTime.Text = logModel.login_time.ToString();
                lblLastIP.Text = logModel.login_ip;
            }
        }
示例#16
0
        private bool DoEdit(int _id)
        {
            bool result = false;
            BLL.users.users bll = new BLL.users.users();
            Model.users.users model = bll.GetModel(_id);
            if (model.status != int.Parse(rblStatus.SelectedValue) && int.Parse(rblStatus.SelectedValue) == 0) {
                flag = 1;
            }
            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.status = int.Parse(rblStatus.SelectedValue);
            //判断密码是否更改
            if (txtPassword.Text.Trim() != defaultpassword) {
                //获取用户已生成的salt作为密钥加密
                model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            }
            model.email = Utils.DropHTML(txtEmail.Text);
            model.nick_name = Utils.DropHTML(txtNickName.Text);
            model.avatar = Utils.DropHTML(txtAvatar.Text);
            model.sex = rblSex.SelectedValue;
            DateTime _birthday;
            if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday)) {
                model.birthday = _birthday;
            }
            model.universities = txtUniversities.Text;
            model.professional = txtProfessional.Text;
            model.goodat = txtGoodat.Text;
            model.workat = txtWorkat.Text;
            model.industry = txtIndustry.Text;

            model.telphone = Utils.DropHTML(txtTelphone.Text.Trim());
            model.mobile = Utils.DropHTML(txtMobile.Text.Trim());
            model.qq = Utils.DropHTML(txtQQ.Text);
            model.address = Utils.DropHTML(txtAddress.Text.Trim());
            model.amount = Utils.StrToDecimal(txtAmount.Text.Trim(), 0);
            model.point = Utils.StrToInt(txtPoint.Text.Trim(), 0);
            model.exp = Utils.StrToInt(txtExp.Text.Trim(), 0);

            if (bll.Update(model)) {
                AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "修改用户信息:" + model.user_name); //记录日志
                result = true;
            }
            return result;
        }
示例#17
0
        private bool DoAdd()
        {
            bool result = false;
            Model.users.users model = new Model.users.users();
            BLL.users.users bll = new BLL.users.users();

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.status = int.Parse(rblStatus.SelectedValue);
            //检测用户名是否重复
            if (bll.Exists(txtUserName.Text.Trim())) {
                return false;
            }
            //model.user_name = Utils.DropHTML(txtUserName.Text.Trim());
            model.user_name = Utils.GetUserNumber(model.group_id.ToString());
            //检测用户名是否重复
            if (bll.Exists(model.user_name.Trim())) {
                model.user_name = Utils.GetUserNumber(model.group_id.ToString());
            }
            //获得6位的salt加密字符串
            model.salt = Utils.GetCheckCode(6);
            //以随机生成的6位字符串做为密钥加密
            model.password = DESEncrypt.Encrypt(txtPassword.Text.Trim(), model.salt);
            model.email = Utils.DropHTML(txtEmail.Text);
            model.nick_name = Utils.DropHTML(txtNickName.Text);
            model.avatar = Utils.DropHTML(txtAvatar.Text);
            model.sex = rblSex.SelectedValue;
            DateTime _birthday;
            if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday)) {
                model.birthday = _birthday;
            }
            model.telphone = Utils.DropHTML(txtTelphone.Text.Trim());
            model.mobile = Utils.DropHTML(txtMobile.Text.Trim());

            model.universities = txtUniversities.Text;
            model.professional = txtProfessional.Text;
            model.goodat = txtGoodat.Text;
            model.workat = txtWorkat.Text;
            model.industry = txtIndustry.Text;

            model.qq = Utils.DropHTML(txtQQ.Text);
            model.address = Utils.DropHTML(txtAddress.Text.Trim());
            model.amount = decimal.Parse(txtAmount.Text.Trim());
            model.point = int.Parse(txtPoint.Text.Trim());
            model.exp = int.Parse(txtExp.Text.Trim());
            model.reg_time = DateTime.Now;
            model.reg_ip = OSRequest.GetIP();

            if (bll.Add(model) > 0) {
                AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加用户:" + model.user_name); //记录日志
                result = true;
            }
            return result;
        }