Пример #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("/");
        }