Exemplo n.º 1
0
 public int SaveAccount(AccountsMainSet account)
 {
     if (account.Id == 0)
     {
         _accountsMainRepository.Add(account);
         _accountsStatusRepository.Add(new AccountsStatusDetailsSet() { AccountMainId = account.Id, AccountStatus = Statuses.InWork, AccountStatusDate = DateTime.Now });
     }
     else
     {
         _accountsMainRepository.Update(account);
     }
     return account.Id;
 }
 public void Repository_AddAccount_CallsServiceAddAccountAndAddStatus()
 {
     var account = new AccountsMainSet
     {
         AccountAmount = 45423.34M,
         AccountCompany = "Company4",
         AccountDate = Convert.ToDateTime("2015-12-23"),
         AccountMcdType = "ООО",
         AccountNumber = "456",
         AccountType = "Сервис",
         AccountYear = 2015,
         Id = 67
     };
     var status = new AccountsStatusDetailsSet
     {
         AccountMainId = 67,
         AccountStatus = "В обработке",
         Id = 1
     };
     _accountService.AddAccount(account);
     _accountsRepo.Verify(a => a.Add(account), Times.Once());
     _accountsStatusRepo.Verify(a => a.Add(status), Times.Once());
 }
Exemplo n.º 3
0
 public void RemoveAccount(AccountsMainSet resultAccount)
 {
     //var acc = _accountsMainRepository.GetSingle(a => a.Id == resultAccount.Id);
     _accountsMainRepository.Remove(resultAccount);
 }
Exemplo n.º 4
0
 public override void OnNavigatedTo(NavigationContext navigationContext)
 {
     Account = GetAccount(navigationContext);
     if(Account != null)
     {
         AccountsTabItemHeader = "Ред. информации по сч. " + Account.AccountNumber;     
     }
     else
     {
         AccountsTabItemHeader = "Новый счет";
         Account = new AccountsMainSet();
         Account.AccountYear = DateTime.Now.Year;
         Account.AccountDate = DateTime.Now;
     }
 }
Exemplo n.º 5
0
 public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
 {
     if (navigationContext.Uri == null)
     {
         ConfirmationRequest.Raise(
             new Confirmation { Content = "Закрыть без сохранения?", Title = "Закрытие вкладки" },
             c => {
                 Account = new AccountsMainSet
                 {
                     AccountYear = DateTime.Now.Year,
                     AccountDate = DateTime.Now
                 };
                 continuationCallback(c.Confirmed);
             });
     }
     else
     {
         continuationCallback(true);
     }
 }
Exemplo n.º 6
0
 void SaveCommand()
 {
     var id = _accountsService.SaveAccount(Account);            
     AdditionalInfoConfirmationRequest.Raise(new Confirmation { Content = "Счет сохранен. Перейти к редактированию доп. информации?", Title = "Редактирование счета" },
                                      c =>
                                      {
                                          var singleView = _regionManager.Regions[RegionNames.AccountsTabRegion].ActiveViews.FirstOrDefault();
                                          _regionManager.Regions[RegionNames.AccountsTabRegion].Remove(singleView);
                                          if (c.Confirmed)
                                          {                                                     
                                              var parameters = new NavigationParameters();
                                              parameters.Add(AccountKey, Account);
                                              _regionManager.RequestNavigate(RegionNames.AccountsTabRegion, new Uri(AdditionalInfoViewKey, UriKind.Relative), parameters);
                                          }
                                      });
     Account = new AccountsMainSet
     {
         AccountYear = DateTime.Now.Year,
         AccountDate = DateTime.Now
     };
 }
 public override void OnNavigatedTo(NavigationContext navigationContext)
 {
     Companies = _companiesService.GetCompanies();
     Types = _typesService.GetTypes();
     Account = GetAccount(navigationContext);
     if (Account != null)
     {
         AccountsTabItemHeader = "Ред. информации по сч. " + Account.AccountNumber;
         IsAdditinalInfoEnabled = true;
     }
     else
     {
         AccountsTabItemHeader = "Новый счет";
         Account = new AccountsMainSet
         {
             AccountYear = DateTime.Now.Year,
             AccountDate = DateTime.Now
         };
         IsAdditinalInfoEnabled = false;
         IsInEditMode = true;
         AvailableSum = 0M;               
     }
     _worker.RunWorkerAsync();
 }