Пример #1
0
        private void OnAddContactExecute()
        {
            var newContact = new CustomerContactWrapper(new CustomerContact());

            newContact.PropertyChanged += CustomerContactWrapper_PropertyChanged;
            Contacts.Add(newContact);
            Customer.Model.CustomerContacts.Add(newContact.Model);
            newContact.Number = "";
        }
Пример #2
0
 private void OnRemoveContactExecute()
 {
     SelectedContact.PropertyChanged -= CustomerContactWrapper_PropertyChanged;
     _repository.RemovePhoneNumber(SelectedContact.Model);
     //Customer.Model.CustomerContacts.Remove(SelectedContact.Model);
     Contacts.Remove(SelectedContact);
     SelectedContact = null;
     HasChanges      = _repository.HasChanges();
     ((DelegateCommand)SaveCommand).RaiseCanExecuteChanged();
 }
Пример #3
0
 private void InitializeCustomerContacts(ICollection <CustomerContact> customerContacts)
 {
     foreach (var wrapper in Contacts)
     {
         wrapper.PropertyChanged -= CustomerContactWrapper_PropertyChanged;
     }
     Contacts.Clear();
     foreach (var item in customerContacts)
     {
         var wrapper = new CustomerContactWrapper(item);
         Contacts.Add(wrapper);
         wrapper.PropertyChanged += CustomerContactWrapper_PropertyChanged;
     }
 }