コード例 #1
0
        /// <summary>
        /// Can Customer Save Command be executed
        /// </summary>
        /// <returns>True, wenn ein Customer existiert, Änderungen aufweist, valide ist
        /// und evtl. Marginkonten Eingaben valide sind</returns>
        protected override bool OnCommandSaveCanExecute()
        {
            return
                ((Customer != null) &&
                 (HasChanges == true) &&
                 (Customer.HasErrors == false)

                 && ListCustomerBankAccountWrapper.All(pn => pn.HasErrors == false));
        }
コード例 #2
0
        private void OnCommandAddAccount()
        {
            var newCustomerAccountWrapper = new CustomerBankAccountWrapper(new BankAccount());

            newCustomerAccountWrapper.PropertyChanged += CustomerAccountWrapper_PropertyChanged;
            ListCustomerBankAccountWrapper.Add(newCustomerAccountWrapper);

            Customer.Entity.BankAccounts.Add(newCustomerAccountWrapper.Entity);

            //Trigger Validation
            newCustomerAccountWrapper.AccountNo = "";
        }
コード例 #3
0
 private void InitializeListCustomerAccountWrapper(Customer customer)
 {
     foreach (var customerAccountWrapper in ListCustomerBankAccountWrapper)
     {
         customerAccountWrapper.PropertyChanged -= CustomerAccountWrapper_PropertyChanged;
     }
     ListCustomerBankAccountWrapper.Clear();
     foreach (var customerBankAccount in customer.BankAccounts)
     {
         var customerAccountWrapper = new CustomerBankAccountWrapper(customerBankAccount);
         ListCustomerBankAccountWrapper.Add(customerAccountWrapper);
         customerAccountWrapper.PropertyChanged += CustomerAccountWrapper_PropertyChanged;
     }
 }
コード例 #4
0
        /// <summary>
        /// After user confirmation delete Bank Account Entity from Customer repository and list of Bank Accounts. Check if repositoryhas changes.
        /// </summary>
        private void OnCommandDeleteAccount()
        {
            var result = MessageDialogService.ShowOkCancelDialog($"Do you really want to delete the Bank Account ?", "Delete");

            if (result == MessageDialogResult.OK)
            {
                SelectedBankAccount.PropertyChanged -= CustomerAccountWrapper_PropertyChanged;

                _repository.RemoveBankAccount(SelectedBankAccount.Entity);

                ListCustomerBankAccountWrapper.Remove(SelectedBankAccount);
                SelectedBankAccount = null;

                HasChanges = _repository.HasChanges();

                //Lt. Video:
                //((DelegateCommand)CommandSave).RaiseCanExecuteChanged();
            }
        }