コード例 #1
0
        private void CustomersCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                foreach (object item in e.OldItems)
                {
                    CustomerUIObject customerObject = item as CustomerUIObject;

                    // use the data access layer to delete the wrapped data object
                    _dataAccessLayer.DeleteCustomer(customerObject.GetDataObject());
                }
            }
        }
コード例 #2
0
        private void CustomersOnItemEndEdit(IEditableObject sender)
        {
            CustomerUIObject customerObject = sender as CustomerUIObject;

            try
            {
                // use the data access layer to update the wrapped data object
                _dataAccessLayer.UpdateCustomer(customerObject.GetDataObject());
            }
            catch (Exception ex)
            {
                if (PersistenceError != null)
                {
                    PersistenceError(this, ex);
                }
            }
        }