public ActionResult Index(int page = 1) { int pageSize = 10; var paymentsSent = PaymentService.FindSentPayments(User.Identity.GetUserId(), pageSize, page).ToList(); var paymentsReceive = PaymentService.FindReceivedPayments(User.Identity.GetUserId(), pageSize, page).ToList(); var mapper = new MapperConfiguration(cfg => { cfg.CreateMap <PaymentDTO, PaymentViewModel>(); cfg.CreateMap <AccountDTO, AccountViewModel>(); }).CreateMapper(); var paymentsSentViewModel = mapper.Map <List <PaymentDTO>, List <PaymentViewModel> >(paymentsSent); var paymentsReceiveViewModel = mapper.Map <List <PaymentDTO>, List <PaymentViewModel> >(paymentsReceive); PageInfo pageInfoSent = new PageInfo { PageNumber = page, PageSize = pageSize, TotalItems = paymentsSentViewModel.Count }; PageInfo pageInfoReceive = new PageInfo { PageNumber = page, PageSize = pageSize, TotalItems = paymentsReceiveViewModel.Count }; PaymentListViewModel model = new PaymentListViewModel() { PaymentsSent = paymentsSentViewModel, PaymentsReceived = paymentsReceiveViewModel, PageInfoSent = pageInfoSent, PageInfoReceive = pageInfoReceive }; return(View(model)); }
public async Task Init_PassAccountId_AccountIdSet() { // Arrange crudService.Setup(x => x.ReadSingleAsync <AccountViewModel>(It.IsAny <int>())) .ReturnsAsync(new AccountViewModel()); balanceCalculatorService.Setup(x => x.GetEndOfMonthBalanceForAccount(It.IsAny <AccountViewModel>())) .Returns(0); var vm = new PaymentListViewModel(crudService.Object, paymentService.Object, dialogService.Object, settingsFacade.Object, balanceCalculatorService.Object, backupService.Object, navigationService.Object, messenger.Object, logProvider.Object); // Act vm.Prepare(new PaymentListParameter(42)); await vm.Initialize(); // Assert Assert.Equal(42, vm.AccountId); }
public async void Init_NullPassAccountId_AccountIdSet() { // Arrange accountService.Setup(x => x.GetById(It.IsAny <int>())) .ReturnsAsync(new Account()); balanceCalculatorManager.Setup(x => x.GetEndOfMonthBalanceForAccount(It.IsAny <Account>())) .ReturnsAsync(0); var vm = new PaymentListViewModel(accountService.Object, paymentService.Object, dialogService.Object, settingsManager.Object, balanceCalculatorManager.Object, backupManager.Object, navigationService.Object, messenger.Object, logProvider.Object); // Act vm.Prepare(new PaymentListParameter()); await vm.Initialize(); // Assert Assert.Equal(0, vm.AccountId); }
public async Task Init_PassAccountId_AccountIdSet() { // Arrange int accountId = 42; crudService.Setup(x => x.ReadSingleAsync <AccountViewModel>(It.IsAny <int>())) .ReturnsAsync(new AccountViewModel()); balanceCalculatorService.Setup(x => x.GetEndOfMonthBalanceForAccount(It.IsAny <AccountViewModel>())) .ReturnsAsync(0); var vm = new PaymentListViewModel(crudService.Object, paymentService.Object, dialogService.Object, settingsFacade.Object, balanceCalculatorService.Object, backupService.Object, navigationService.Object); vm.AccountId = accountId; // Act await vm.InitializeCommand.ExecuteAsync(); // Assert Assert.Equal(accountId, vm.AccountId); }
public Payments(Order order) { InitializeComponent(); AddToolbarItem.Icon = Device.RuntimePlatform == Device.UWP ? "Assets/add_new.png" : "add_new.png"; MessageStackLayout.IsVisible = false; RefreshStackLayout.IsVisible = true; MainSearchBar.IsVisible = true; _vm = new PaymentListViewModel(order); BindingContext = _vm; if (Device.RuntimePlatform == Device.Android) { PaymentList.IsPullToRefreshEnabled = true; PaymentList.RefreshCommand = _vm.RefreshCommand; PaymentList.SetBinding(ListView.IsRefreshingProperty, nameof(_vm.IsRefreshing)); } else if (Device.RuntimePlatform == Device.UWP) { PaymentList.RowHeight = PaymentList.RowHeight * 2; } PaymentList.ItemSelected += (sender, e) => { Navigation.PushAsync(new PaymentPage(((ListView)sender).SelectedItem as Payment)); }; }
public async Task ViewAppearing_DialogShown() { // Arrange dialogService.Setup(x => x.ShowLoadingDialog(It.IsAny <string>())); dialogService.Setup(x => x.HideLoadingDialog()); crudService.Setup(x => x.ReadManyNoTracked <AccountViewModel>()) .Returns(new List <AccountViewModel>() .AsQueryable() .BuildMock() .Object); crudService.Setup(x => x.ReadSingleAsync <AccountViewModel>(It.IsAny <int>())) .ReturnsAsync(new AccountViewModel()); var vm = new PaymentListViewModel(crudService.Object, paymentService.Object, dialogService.Object, settingsFacade.Object, balanceCalculatorService.Object, backupService.Object, navigationService.Object, messenger.Object, logProvider.Object); await vm.Initialize(); // Act vm.ViewAppearing(); // Assert dialogService.Verify(x => x.ShowLoadingDialog(It.IsAny <string>()), Times.Once); }
public ActionResult Index(PaymentListViewModel model, string message = "") { ViewBag.ErrorMessage = message; SessionHelper.Payment = null; model.SOBId = SessionHelper.SOBId; return(View(model)); }
// GET: Payment public ActionResult Index() { PaymentListViewModel model = new PaymentListViewModel() { Payments = _paymentService.GetAll() }; return(View(model)); }
public static PaymentListViewModel GetPayments(long sobId, long bankId, long vendorId, long periodId) { PaymentListViewModel model = new PaymentListViewModel(); model.Payments = service.GetAll(AuthenticationHelper.CompanyId.Value, vendorId, bankId, sobId, periodId).ToList() .Select(x => new PaymentViewModel(x)).ToList(); return(model); }
public void Init_NullPassAccountId_AccountIdSet() { var vm = new PaymentListViewModel(accountRepository.Object, paymentRepository.Object, recPaymentRepository.Object, paymentManager.Object, null); vm.Init(0); vm.AccountId.ShouldBe(0); }
public void Init_PassAccountId_AccountIdSet() { var vm = new PaymentListViewModel(accountRepository.Object, paymentRepository.Object, recPaymentRepository.Object, paymentManager.Object, null, settingsManager.Object, endOfMonthManager.Object); vm.Init(42); vm.AccountId.ShouldBe(42); }
public async Task <IActionResult> Index() { var payments = (_paymentService.GetPayments(new GetAllPaymentInput() { })).Items; var model = new PaymentListViewModel { Payments = payments }; return(View(model)); }
public ActionResult Index(int rentalId) { var viewModel = new PaymentListViewModel() { Items = new List <PaymentViewModel>() }; var result = paymentService.GetAllPayments(rentalId); viewModel.RentalId = rentalId; result.ForEach(u => viewModel.Items.Add(ViewModelMapper.Mapper.Map <PaymentViewModel>(u))); ViewBag.Errors = TempData["Errors"]; return(View(viewModel)); }
public void Init_NullPassAccountId_AccountIdSet() { var vm = new PaymentListViewModel(accountRepository.Object, paymentRepository.Object, paymentManager.Object, null, settingsManager.Object, endOfMonthManager.Object, backupManager.Object, modifyDialogService.Object); vm.Init(0); vm.AccountId.ShouldBe(0); }
public void Init_NullPassAccountId_AccountIdSet() { // Arrange var vm = new PaymentListViewModel(accountService.Object, paymentService.Object, dialogService.Object, settingsManager.Object, balanceCalculatorManager.Object, backupManager.Object, modifyDialogService.Object); // Act vm.Init(0); // Assert Assert.Equal(0, vm.AccountId); }
public IActionResult Withdraw(string name, string str) { ViewBag.str = null; if (str != null) { ViewBag.str = str; } IQueryable <Payment> payments = db.Payments; if (!String.IsNullOrEmpty(name)) { payments = payments.Where(p => p.FullName.Contains(name)); } PaymentListViewModel plvm = new PaymentListViewModel { Payments = payments, FullName = name }; return(View(plvm)); }
public ActionResult PaymentPartial(PaymentListViewModel model) { return(PartialView("_List", PaymentHelper.GetPayments(SessionHelper.SOBId, model.BankId, model.VendorId, model.PeriodId))); }
private void PaymentList_OnClosing(object sender, CancelEventArgs e) { PaymentListViewModel.CleanUp(); }