Esempio n. 1
0
        private int saveAccount(string username, string mobile, string email, string password)
        {
            UsersBLL bll  = new UsersBLL();
            UserInfo item = new UserInfo();

            item.UserName    = username;
            item.Mobile      = mobile;
            item.Email       = email;
            item.NickName    = "";
            item.UserPass    = Utils.MD5Encrypt32(password);
            item.Gender      = 0;
            item.Birthday    = "";
            item.Address     = ",,||2";
            item.Utype       = 0;
            item.ShopId      = 0;
            item.TotalPoint  = 8888;
            item.PromotionId = 0;

            if (bll.AddUser(item) > 0)
            {
                return(0);
            }
            else
            {
                return(-1);
            }
        }
Esempio n. 2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (Session["Verifycode"].ToString().CompareTo(txtCode.Value) != 0)
            {
                Utils.alert("验证码输入错误!", "register.aspx");
                return;
            }
            else
            {
                UsersBLL bll      = new UsersBLL();
                string   UserName = txtUserName.Value;
                UserInfo item     = new UserInfo();
                item.UserName = UserName;
                item.NickName = "";
                item.UserPass = Utils.MD5Encrypt32(txtPass.Value);
                if (RadioButtonListGender.SelectedValue != "")
                {
                    item.Gender = Convert.ToInt32(RadioButtonListGender.SelectedValue);
                }
                else
                {
                    item.Gender = 0;
                }

                item.Mobile   = txtMobile.Value;
                item.Birthday = "";
                item.Email    = txtEmail.Value;
                item.Address  = ",,||2";
                item.Utype    = 0;
                item.ShopId   = 0;



                if (promotionid == 0)
                {
                    string promotion = Utils.GetCookie("promotion");
                    if (!string.IsNullOrEmpty(promotion))
                    {
                        promotionid = Convert.ToInt32(promotion);
                    }
                }
                item.PromotionId = promotionid;
                item.TotalPoint  = 8888;
                int UserID = bll.AddUser(item);
                if (UserID > 0)
                {
                    UserInfo item2 = bll.GetUserByID(UserID);
                    Session["cudoUser"] = item2;
                    Response.Redirect("/index.aspx");
                }
                else
                {
                    Utils.alert("注册失败,请稍后重试!", "register.aspx");
                }
            }
        }
Esempio n. 3
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        UsersBLL user = new UsersBLL();

        if (user.AddUser(AccountNameTextBox.Text, DisplayNameTextBox.Text, EmailTextBox.Text, Convert.ToInt32(DefaultViewDropDownList.SelectedValue), null, ActiveCheckBox.Checked, Convert.ToInt32(ManagerIDDropDownList.SelectedValue), Convert.ToInt32(SectionIDDropDownList.SelectedValue)))
        {
            InfoBarLabel.Text = "User Added!!";
            UsersGridView.DataBind();
        }
        else
            InfoBarLabel.Text = "Error: User not added.";
    }
Esempio n. 4
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        UsersBLL user = new UsersBLL();

        if (user.AddUser(AccountNameTextBox.Text, DisplayNameTextBox.Text, EmailTextBox.Text, Convert.ToInt32(DefaultViewDropDownList.SelectedValue), null, ActiveCheckBox.Checked, Convert.ToInt32(ManagerIDDropDownList.SelectedValue), Convert.ToInt32(SectionIDDropDownList.SelectedValue)))
        {
            InfoBarLabel.Text = "User Added!!";
            UsersGridView.DataBind();
        }
        else
        {
            InfoBarLabel.Text = "Error: User not added.";
        }
    }
Esempio n. 5
0
        public IHttpActionResult AddUser([FromBody] User newUser)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                _usersBLL.AddUser(newUser);
                return(Ok("User created successfully!"));
            }
            catch (Exception exception)
            {
                return(BadRequest(exception.Message));
            }
        }