Пример #1
0
        private void saveCustomerAddressButton_Click(object sender, EventArgs e)
        {
            Address newAddress = new Address()
            {
                AddressLine1 = addressLine1TextBox.Text,
                AddressLine2 = addressLine2TextBox.Text,
                City = cityTextBox.Text,
                CountryRegion = countryRegionTextBox.Text,
                PostalCode = postalCodeTextBox.Text,
                ModifiedDate = DateTime.Now,
                rowguid = Guid.NewGuid(),
                StateProvince = stateProvinceTextBox.Text
            };

            (new AddressController()).Save(newAddress);

            CustomerAddress newCustomerAddress = new CustomerAddress()
                {
                    AddressType = addressTypeTextBox.Text,
                    CustomerID = (int)customerFilterComboBox.SelectedValue,
                    AddressID = newAddress.AddressID,
                    ModifiedDate = DateTime.Now,
                    rowguid = Guid.NewGuid()
                };

            (new CustomerAddressController()).Save(newCustomerAddress);
        }
Пример #2
0
        private void saveButton_Click(object sender, EventArgs e)
        {   //save
            Address newAddress = new Address()
            {
                AddressID = currentAddress.AddressID,
                AddressLine1 = addressLine1TextBox.Text,
                AddressLine2 = addressLine2TextBox.Text,
                City = cityTextBox.Text,
                StateProvince = stateProvinceTextBox.Text, 
                CountryRegion = countryRegionTextBox.Text,
                PostalCode = postalCodeTextBox.Text,
                rowguid = Guid.NewGuid(),
                ModifiedDate = DateTime.Now
            };

            (new AddressController()).Update(newAddress);
        }
 partial void DeleteAddress(Address instance);
 partial void UpdateAddress(Address instance);
 partial void InsertAddress(Address instance);
Пример #6
0
 public void Save(Address newAddress)
 {
     DataContextFactory<AdventureWorksDataContext>.DataContext.Addresses.InsertOnSubmit(newAddress);
     DataContextFactory<AdventureWorksDataContext>.DataContext.SubmitChanges();
 }
Пример #7
0
 public EditAddressData(Address address)
 {
     InitializeComponent();
     currentAddress = address;
     InitializeDataFields();
 }