コード例 #1
0
        public void Save(CustomerAddress customerAddress)
        {
            //DataContextFactory<AdventureWorksDataContext>.DataContext.Refresh();

            DataContextFactory<AdventureWorksDataContext>.DataContext.CustomerAddresses.InsertOnSubmit(customerAddress);
            DataContextFactory<AdventureWorksDataContext>.DataContext.SubmitChanges();
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: xs2ranjeet/13ns9-1spr
        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);
        }
コード例 #3
0
        partial void InsertCustomerAddress(CustomerAddress instance)
        {
#if TRACE
            Trace.WriteLine("Inserted new CustomerAddress instance");
#else
#endif

#if DEBUG
            string debugLogEntry = string.Format("Inserted new CustomerAddress instance with data:\n AddressLine1: {0}\n Customer FullName: {1}",
                instance.Address.AddressLine1, 
                instance.Customer.FullName);
            Debug.WriteLine(debugLogEntry, "Inserts");
#else
#endif
        }
コード例 #4
0
        partial void InsertCustomerAddress(CustomerAddress instance)
        {
#if TRACE
            Trace.WriteLine("Inserted new CustomerAddress instance");
#else
#endif

#if DEBUG
            string debugLogEntry = string.Format("Inserted new CustomerAddress instance with data:\n AddressLine1: {0}\n Customer FullName: {1}",
                                                 instance.Address.AddressLine1,
                                                 instance.Customer.FullName);
            Debug.WriteLine(debugLogEntry, "Inserts");
#else
#endif
        }
コード例 #5
0
		private void detach_CustomerAddresses(CustomerAddress entity)
		{
			this.SendPropertyChanging();
			entity.Customer = null;
		}
コード例 #6
0
 partial void DeleteCustomerAddress(CustomerAddress instance);
コード例 #7
0
 partial void UpdateCustomerAddress(CustomerAddress instance);
コード例 #8
0
 partial void InsertCustomerAddress(CustomerAddress instance);
コード例 #9
0
		private void attach_CustomerAddresses(CustomerAddress entity)
		{
			this.SendPropertyChanging();
			entity.Address = this;
		}
コード例 #10
0
 private void detach_CustomerAddresses(CustomerAddress entity)
 {
     this.SendPropertyChanging();
     entity.Customer = null;
 }
コード例 #11
0
 partial void DeleteCustomerAddress(CustomerAddress instance);
コード例 #12
0
 partial void UpdateCustomerAddress(CustomerAddress instance);
コード例 #13
0
 partial void InsertCustomerAddress(CustomerAddress instance);
コード例 #14
0
 private void attach_CustomerAddresses(CustomerAddress entity)
 {
     this.SendPropertyChanging();
     entity.Address = this;
 }