Beispiel #1
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            // TODO: validate all fields.
            if (PasswordTextBox1.Text != PasswordTextBox2.Text)
            {
                return;
            }

            // Silly hack until we create a proper numeric-only textbox.
            decimal payRate = 0;

            Decimal.TryParse(PayrateTextBox.Text, out payRate);

            var user = new User();

            user.Active      = true; // If we're creating them, they are likely active.
            user.Email       = EmailTextBox.Text;
            user.FirstName   = FirstNameTextBox.Text;
            user.LastName    = LastNameTextBox.Text;
            user.PayRate     = payRate;
            user.Role        = Sprocs.GetRoleType(RoleDropDown.SelectedValue);
            user.PayInterval = Sprocs.GetPayInterval(PayIntervalDropDown.SelectedValue);
            user.UserName    = UserNameTextBox.Text;
            user.Account     = Sprocs.GetUserAccount(CurrentSession.AspId); // it's the same account we're creating the user from.

            Sprocs.CreateUser(user, PasswordTextBox1.Text);

            Response.Redirect("/");
        }