Exemplo n.º 1
0
        private bool DoAdd()
        {
            bool result = true;
            Model.users model = new Model.users();
            BLL.users bll = new BLL.users();

            model.group_id = int.Parse(ddlGroupId.SelectedValue);
            model.is_lock = int.Parse(rblIsLock.SelectedValue);

            int number = bll.GetOnlyCodeNumber();

            model.user_name = "sxzh" + number.ToString();//txtUserName.Text.Trim();
            model.password = DESEncrypt.Encrypt(txtPassword.Text);
            model.email = txtEmail.Text;
            model.nick_name = txtNickName.Text;
            model.avatar = txtAvatar.Text;
            model.sex = rblSex.SelectedValue;
            DateTime _birthday;
            if (DateTime.TryParse(txtBirthday.Text.Trim(), out _birthday))
            {
                model.birthday = _birthday;
            }
            model.telphone = txtTelphone.Text.Trim();
            model.mobile = txtMobile.Text.Trim();
            model.qq = txtQQ.Text;
            model.address = txtAddress.Text.Trim();
            model.amount = decimal.Parse(txtAmount.Text.Trim());
            model.point = int.Parse(txtPoint.Text.Trim());
            model.exp = 0;// int.Parse(txtExp.Text.Trim());
            model.reg_time = DateTime.Now;
            model.reg_equ = txtRegEqu.Text.Trim();
            model.guid_card = txtGuidCard.Text.Trim();
            model.card = txtCard.Text.Trim();
            model.age = int.Parse(txtAge.Text.Trim());
            model.work_type = int.Parse(rblWorkType.SelectedValue);
            model.description = Utils.ToHtml(txtContent.Text.Trim());
            model.work_age = ddlWorkAge.SelectedValue.ToString();
            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return result;
        }