예제 #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;
     }
 }