Beispiel #1
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);
        }
Beispiel #2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(int user_id, string user_name, string remark)
 {
     Model.users.user_login_log model = new Model.users.user_login_log();
     model.user_id    = user_id;
     model.user_name  = user_name;
     model.remark     = remark;
     model.login_ip   = OSRequest.GetIP();
     model.login_time = DateTime.Now;
     return(dal.Add(model));
 }
Beispiel #3
0
 /// <summary>
 /// 增加管理日志
 /// </summary>
 /// <param name="用户id"></param>
 /// <param name="用户名"></param>
 /// <param name="操作类型"></param>
 /// <param name="备注"></param>
 /// <returns></returns>
 public int Add(int user_id, string user_name, string action_type, string remark)
 {
     Model.managers.manager_log manager_log_model = new Model.managers.manager_log();
     manager_log_model.user_id     = user_id;
     manager_log_model.user_name   = user_name;
     manager_log_model.action_type = action_type;
     manager_log_model.remark      = remark;
     manager_log_model.user_ip     = OSRequest.GetIP();
     return(dal.Add(manager_log_model));
 }