Example #1
0
        public ActionResult ShowImportMovements()
        {
            var expenseTypes   = _expenditureTypeService.GetExpenditureTypes();
            var currentAccount = _bankAccountService.GetById(GetCurrentAccount());
            var lastMovement   = _expenditureService.GetExpenditures(new ExpenditureGetListSearchParameters()
            {
                AccountId = currentAccount.Id
            }).OrderByDescending(x => x.DateExpenditure).FirstOrDefault();
            var paymentMethods = _paymentMethodService.GetPaymentMethods();
            var importTypes    = Enum.GetValues(typeof(ImportTypes)).Cast <ImportTypes>();

            var model = new ImportMovementModel
            {
                AccountId             = currentAccount.Id,
                AccountCurrentBalance = currentAccount.CurrentBalance,
                AccountCurrencySymbol = currentAccount.CurrencySymbol,
                ExpenseTypes          = expenseTypes.Select(x => new SelectListItem()
                {
                    Text = x.Name, Value = x.Id.ToString()
                }).ToList(),
                ImportTypes = importTypes.Select(x => new SelectListItem()
                {
                    Text = EnumHelper.GetEnumDescription(x), Value = EnumHelper.GetEnumDescription(x)
                }).ToList(),
                LastMovementRegistered      = lastMovement?.DateExpenditure,
                PaymentMethods              = new List <SelectListItem>(),
                MovementPropertyDefinitions = new List <MovementPropertyDefinition>()
                {
                    new MovementPropertyDefinition()
                    {
                        PropertyName = "Date", HasConfig = false
                    },
                    new MovementPropertyDefinition()
                    {
                        PropertyName = "Description", HasConfig = false
                    },
                    new MovementPropertyDefinition()
                    {
                        PropertyName = "Cost", HasConfig = false
                    },
                    new MovementPropertyDefinition()
                    {
                        PropertyName = "Payment Method", HasConfig = true
                    }
                }
            };

            model.PaymentMethods.Add(new SelectListItem()
            {
                Text = "Not Applicable"
            });
            model.PaymentMethods.AddRange(paymentMethods.Where(x => x.Name != "Cash" && x.Name != "Internal Transfer").Select(x => new SelectListItem()
            {
                Text = x.Name, Value = x.Id.ToString()
            }).ToList());

            return(View(model));
        }
 private void PopulateDropDownLists(ExpenditureEditModel expenditureModel)
 {
     expenditureModel.AvailableInternalAccounts = _bankAccountService.GetAccountsByUser(CurrentUser).Where(x => x.Id != GetCurrentAccount()).Select(x => new SelectListItem()
     {
         Value = x.Id.ToString(), Text = x.Name
     }).ToList();
     expenditureModel.AvailableExpenditureTypes = _expenditureTypeService.GetExpenditureTypes().Select(x => new SelectListItem()
     {
         Value = x.Id.ToString(), Text = x.Name
     }).OrderBy(x => x.Text).ToList();
     expenditureModel.AvailablePaymentMethods = _paymentMethodService.GetPaymentMethods().ToList();
     expenditureModel.AvailableAtmWithdraws   = _atmWithdrawService.GetAtmWithdrawsByAccountId(GetCurrentAccount()).Where(x => !x.IsClosed).OrderBy(x => x.DateExpenditure).Select(x => new SelectListItem()
     {
         Value = x.Id.ToString(), Text = x.Description
     }).ToList();
 }
        /// <summary>
        /// Return the list of payment methods.
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var model = _paymentMethodService.GetPaymentMethods();

            return(View(model));
        }
Example #4
0
 public IEnumerable <PaymentMethodList> GetList()
 {
     return(_PaymentMethodService.GetPaymentMethods());
 }