示例#1
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            // Silly hack until we create a proper numeric-only textbox.
            int zipCode = 0;

            Int32.TryParse(ZipCodeTextBox.Text, out zipCode);

            // Create address.
            var adderess = new Adderess();

            adderess.City           = CityTextBox.Text;
            adderess.Country        = CountryTextBox.Text;
            adderess.State          = StateTextBox.Text;
            adderess.StreetAdderess = StreetAdderessTextBox.Text;
            adderess.Suite          = SuiteTextBox.Text;
            adderess.ZipCode        = zipCode;

            // Create company.
            var company = new Company();

            company.Name     = CompanyNameTextBox.Text;
            company.Adderess = adderess;
            company.Account  = Sprocs.GetUserAccount(CurrentSession.AspId); // it's the same account we're creating the user from.

            Sprocs.CreateCompany(company);

            Response.Redirect("/");
        }
示例#2
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("/");
        }