コード例 #1
0
        private void AddCustomer()
        {
            UOW.NAWCustomers.Add(NewCustomer.NAW_Klant.toModel());

            UOW.Customers.Add(NewCustomer.CustomerData);

            UOW.ContactPersons.Add(NewcontactPerson.ContactPersonData);


            try
            {
                UOW.Complete();
            }
            catch
            {
                MessageBox.Show("Er is iets fout gegaan", "Fout bij invoeren velden",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Customers                  = new ObservableCollection <CustomerVM>(UOW.Customers.GetAll().ToList().Select(a => new CustomerVM(a)));
            NewCustomer                = new CustomerVM();
            NewCustomer.NAW_Klant      = new NAW_KlantVM();
            NewCustomer.ContactPersons = new ObservableCollection <ContactPersonVM>();
            NewcontactPerson           = new ContactPersonVM();
            NewcontactPerson.customer  = NewCustomer;
            RaisePropertyChanged(() => NewCustomer);
            RaisePropertyChanged(() => NewCustomer.NAW_Klant);
            RaisePropertyChanged(() => NewCustomer.ContactPersons);
            RaisePropertyChanged(() => NewcontactPerson);
        }
コード例 #2
0
        public CRCustomerVM()
        {
            UOW = ViewModelLocator.UOW;

            NewCustomer      = new CustomerVM();
            NewcontactPerson = new ContactPersonVM();

            NewcontactPerson.customer = NewCustomer;


            UOW.Complete();

            Customers = new ObservableCollection <CustomerVM>(UOW.Customers.GetAll().ToList().Select(a => new CustomerVM(a)));

            AddCustomerCommand             = new RelayCommand(AddCustomer);
            EditCustomerCommand            = new RelayCommand(OpenEditCustomerWindow);
            EditCustomerDataCommand        = new RelayCommand(EditCustomerData);
            AddContactPersonCommand        = new RelayCommand(AddContactPerson);
            OpenContactPersonCreateWindow  = new RelayCommand(AddContactPersonWindow);
            EditContactPersonWindowCommand = new RelayCommand(EditContactPersonWindow);
            EditContactPersonDataCommand   = new RelayCommand(EditContactPersonData);
        }
コード例 #3
0
        private void AddContactPerson()
        {
            NewcontactPerson.ContactPersonData.Klant = SelectedCustomer.CustomerData;

            UOW.ContactPersons.Add(NewcontactPerson.ContactPersonData);
            try
            {
                UOW.Complete();
                MessageBox.Show("De aanpassingen zijn doorgevoerd", "De aanpassingen zijn doorgevoerd",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                _contactPersonCreateWindow.Close();
            }
            catch
            {
                MessageBox.Show("Er is iets fout gegaan", "Fout bij invoeren velden",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            NewcontactPerson = new ContactPersonVM();
            RaisePropertyChanged(() => NewcontactPerson);
        }