Exemple #1
0
        public ActionResult GetTransactionsBySearchNameFilters(string bankAccountId, string name, string fromDate, string toDate,
                                                               int?selectedItemsForPage, int?selectedFilterId, int page = 1)
        {
            if (!String.IsNullOrEmpty(bankAccountId) && !String.IsNullOrEmpty(name))
            {
                var bankAccount       = _readBankAccount.GetBankAccountById(bankAccountId);
                var binder            = new ToTransactionListViewModel();
                var currencyLogic     = new CurrencyLogic();
                var filterLogic       = new FiltersLogic();
                var filterName        = "";
                var filterValue       = "";
                var fromDateConverted = filterLogic.GetDateTimeByDateStringWithDots(fromDate);
                var toDateConverted   = filterLogic.GetEndDateTimeDateStringWithDots(toDate);
                filterLogic.GetFilterNameFilterValueById(selectedFilterId, out filterName, out filterValue);
                var itemsForPage = filterLogic.GetItemsForPageById(selectedItemsForPage);


                var transactions          = _readTransaction.GetSearchTransactionsByFilters(bankAccountId, fromDateConverted, toDateConverted, filterName, filterValue, name);
                var viewModelTransactions = binder.GetTransactions(transactions,
                                                                   currencyLogic.GetCurrencyIconById(bankAccount.Currency)).ToPagedList(page, itemsForPage);

                return(PartialView("TransactionList", viewModelTransactions));
            }
            else
            {
                return(new JsonResult
                {
                    Data = "Wystąpił błąd podczas operacji.",
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
        }
Exemple #2
0
        public ActionResult LoadTransactionBySearchName(string name, string bankAccountId)
        {
            if (Request.IsAjaxRequest() && !String.IsNullOrEmpty(bankAccountId) && !String.IsNullOrEmpty(name))
            {
                var currencyLogic = new CurrencyLogic();
                var binder        = new ToTransactionListViewModel();

                var bankAccount = _readBankAccount.GetBankAccountById(bankAccountId);
                var transaction = _readTransaction.GetTransactionByName(name, bankAccountId);

                var viewModelTransaction =
                    binder.GetTransactions(transaction, currencyLogic.GetCurrencyIconById(bankAccount.Currency)).ToPagedList(1, 1);

                return(PartialView("TransactionList", viewModelTransaction));
            }

            return(new JsonResult()
            {
                Data = "Wystąpił błąd podczas operacji wczytywania transakcji po nazwie.",
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemple #3
0
        public ActionResult GetTransactionsByBankAccountId(string bankAccountId, int page = 1, int selectedItemsForPage = 1)
        {
            if (!String.IsNullOrEmpty(bankAccountId))
            {
                var bankAccount           = _readBankAccount.GetBankAccountById(bankAccountId);
                var binder                = new ToTransactionListViewModel();
                var currencyLogic         = new CurrencyLogic();
                var filterLogic           = new FiltersLogic();
                var itemsForPage          = filterLogic.GetItemsForPageById(selectedItemsForPage);
                var viewModelTransactions = binder.GetTransactions(bankAccount.Transactions,
                                                                   currencyLogic.GetCurrencyIconById(bankAccount.Currency)).ToPagedList(page, itemsForPage);

                return(PartialView("TransactionList", viewModelTransactions));
            }
            else
            {
                return(new JsonResult
                {
                    Data = "Wystąpił błąd podczas operacji.",
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
        }