Beispiel #1
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            // Nothing is validated.

            // Silly hack until we create a proper numeric-only textbox.
            int zipCode = 0, companyId = 0;

            Int32.TryParse(ZipCodeTextBox.Text, out zipCode);
            Int32.TryParse(CompanyDropDown.SelectedValue, out companyId);

            // 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 location.
            var location = new Location();

            location.Adderess = adderess;
            location.Name     = LocationNameTextBox.Text;
            location.Company  = Sprocs.GetCompany(companyId);

            Sprocs.CreateLocation(location);

            Response.Redirect("/");
        }