/// <summary>
        /// Delete the given customer
        /// </summary>
        public void DeleteCustomer(CustomerDataObject customer)
        {
            // find the row which this data object maps to
            NorthwindDataSet.CustomersRow customerRow = NorthWindDataProvider.NorthwindDataSet.Customers.FindByCustomerID(customer.ID);

            // remove this object
            customerRow.Delete();

            // use the table adapter to write to the database
            adapter.Update(NorthWindDataProvider.NorthwindDataSet.Customers);
        }
        /// <summary>
        /// Updates or adds the given customer
        /// </summary>
        public void UpdateCustomer(CustomerDataObject customer)
        {
            // find the row which this data object maps to
            NorthwindDataSet.CustomersRow customerRow = NorthWindDataProvider.NorthwindDataSet.Customers.FindByCustomerID(customer.ID);

            // if we cannot find this customer - it must be a new instance
            if (customerRow == null)
            {
                // create a new row and populate the columns
                customerRow = NorthWindDataProvider.NorthwindDataSet.Customers.NewCustomersRow();
                DataRowFromBusinessObject(customerRow, customer);

                // add it to the table
                NorthWindDataProvider.NorthwindDataSet.Customers.Rows.Add(customerRow);
            }
            else
            {
                // map changes
                DataRowFromBusinessObject(customerRow, customer);
            }

            // use the table adapter to write to the database
            adapter.Update(NorthWindDataProvider.NorthwindDataSet.Customers);
        }
 private void DataRowFromBusinessObject(NorthwindDataSet.CustomersRow row, CustomerDataObject dataObject)
 {
     row.CustomerID = dataObject.ID;
     row.ContactName = dataObject.ContactName;
     row.CompanyName = dataObject.CompanyName;
 }