public ActionResult _StockItemGridBind(int id)
        {
            var si = _stockInvSvc.GetInvoice(id).Items;
            var vm = AutoMapperSetup.MapList <StockInvoiceItem, StockInvoiceItemVM>(si);

            return(View(new GridModel(vm)));
        }
        public ActionResult _MakePayment(int id)
        {
            var vm = new MakePaymentVM();

            var cust = _customerService.GetCustomer(id);

            if (!DoesCustomerHaveAccounts(id))
            {
                vm.IsError      = true;
                vm.ErrorMessage = "Payments can only be collected on Customers with existing Accounts";
            }
            else
            {
                var rolledTransactions =
                    _paymentService.GetRolledTransactions(id).Where(s => s.Amount != 0).OrderBy(s => s.BillCycle.Date);
                vm = new MakePaymentVM
                {
                    CustomerId = id,
                    PreferredPaymentSourceId = cust.PreferredPaymentSourceId,
                    Balance            = _transactionsService.GetBalanceForCustomer(id),
                    RolledTransactions =
                        AutoMapperSetup.MapList <PaymentService.RolledTransaction, RolledTransactionVM>(
                            rolledTransactions).ToList(),
                    CreditedAccountId = cust.CustomerAccounts.Min(c => c.CustomerAccountId),
                    CustomerAccounts  = cust.CustomerAccounts
                };
            }
            return(PartialView(vm));
        }
        public ActionResult _CustomerAccountPaymentsGridBind(int id)
        {
            ViewBag.CustomerId = id;
            var pymnts = _paymentService.GetPaymentsForCustomer(id).OrderByDescending(o => o.PaymentDate);

            return(View(new GridModel(AutoMapperSetup.MapList <Payment, PaymentVM>(pymnts).ToList())));
        }
        public ActionResult _GetModelSpecificContracts(int id)
        {
            var modelContracts   = _svc.GetModel(id).ModelSpecificContracts;
            var modelContractsVM =
                AutoMapperSetup.MapList <ModelSpecificContract, ModelSpecificContractVM>(modelContracts);

            return(View(new GridModel(modelContractsVM)));
        }
        public virtual ActionResult _DisplayPurchaseUnitContracts(int unitId, bool showExpired = false)
        {
            var uc          = _purchaseUnitAndContracts.GetPurchaseUnitContracts(unitId).Where(c => (!c.IsExpiredToday() && !showExpired) || showExpired);
            var contractVms = AutoMapperSetup.MapList <ServiceContract, ServiceContractVM>(uc).ToList();

            contractVms.ForEach(c => c.ExpiryWarning = ExpiryWarning(c.ExpiryDate));
            return(View(new GridModel(contractVms)));
        }
        public ActionResult _DisplayRentedUnits(int id, bool?showRemoved)
        {
            ViewBag.CustomerAccountId = id;
            var pred  = (showRemoved != null && showRemoved.Value) ? new Func <RentedUnit, bool>(c => true) : (c => c.RemovalDate == null);
            var units = ((RentalAccount)_accountService.GetAccount(id)).RentedUnits.Where(pred);

            return(View(new GridModel(AutoMapperSetup.MapList <RentedUnit, RentedUnitVM>(units).ToList())));
        }
示例#7
0
        public ActionResult _SelectAvailableStock(int id)
        {
            var selForInvVM = new SelectStockForInvoiceVM
            {
                StockInvoiceId = id,
                SelectedStock  = AutoMapperSetup.MapList <Stock, SelectableStockVM>(_stockInvSvc.GetSelectableStock()).ToList()
            };

            Session["_availableForStock"] = selForInvVM.SelectedStock;
            return(PartialView(selForInvVM));
        }
        public ActionResult _DisplayRentalContracts(int id, bool?showExpired)
        {
            var cu   = _contractService.GetCustomerAccount(id);
            var pred = (showExpired != null && showExpired.Value) ? new Func <Contract, bool>(c => true) : (c => c.ExpiryDate >= DateTime.Today || c.ExpiryDate == null);

            return
                (View(
                     new GridModel(
                         AutoMapperSetup.MapList <RentalContract, EditRentedContractVM>(
                             cu.AttachedContracts.Where(pred).ToList().ConvertAll(c => (RentalContract)c)))));
        }
        public ActionResult _EditAttachedStock(int id)
        {
            var stkInvItm = _stockInvSvc.GetInvoiceItem(id);
            var invAttStk = new StockInvoiceItemAttachedStockVM
            {
                StockInvoiceItemId = id,
                IsOpen             = (stkInvItm.Invoice.DateProcessed == null),
                SelectableStock    = AutoMapperSetup.MapList <Stock, SelectableStockVM>(stkInvItm.StockItems).ToList()
            };

            return(PartialView(invAttStk));
        }
        public ActionResult _GetPaidUntilForRentals(int customerId)
        {
            var rentedUnits    = new List <RentedUnit>();
            var f              = _customerService.GetCustomer(customerId).CustomerAccounts;
            var rentalAccounts = f.OfType <RentalAccount>().Select(customerAccount => customerAccount).ToList();

            foreach (var rentalAccount in rentalAccounts)
            {
                rentedUnits.AddRange(rentalAccount.RentedUnits.Where(c => c.RemovalDate == null));
            }

            return(View(new GridModel(AutoMapperSetup.MapList <RentedUnit, RentedUnitVM>(rentedUnits))));
        }
        public ActionResult _StockModelsGridBind()
        {
            var mdl = FilterVM == null?_svc.GetModels() : _svc.GetModels().Where(m => m.ModelCode.ToUpper().StartsWith(FilterVM.ModelCode == null?"":FilterVM.ModelCode.ToUpper()) &&
                                                                                 (FilterVM.ManufacturerFilterId == -1 || m.ManufacturerId == FilterVM.ManufacturerFilterId) &&
                                                                                 (FilterVM.CategoryFilterId == -1 || m.CategoryId == FilterVM.CategoryFilterId));

            var vm       = AutoMapperSetup.MapList <Model, ModelVM>(mdl);
            var modelVms = vm as List <ModelVM> ?? vm.ToList();

            foreach (var modelVm in modelVms)
            {
                modelVm.NoInStock = GetStockForModel(modelVm.ModelId);
            }
            return(View(new GridModel(modelVms)));
        }
        public ActionResult _CustomerGrdBind()
        {
            var mdl = _customerService.GetCustomers();

            if (FilterVM != null)
            {
                if (FilterVM.SearchString.HasValue())
                {
                    var srchStr = FilterVM.SearchString.ToUpper();
                    mdl = _customerService.GetCustomers().Where(m => m.CustomerId.ToString() == srchStr ||
                                                                (m.Surname.HasValue() && m.Surname.ToUpper().Contains(srchStr)) ||
                                                                (m.Surname.HasValue() && m.FirstName.ToUpper().Contains(srchStr)) ||
                                                                (m.Address.AddressLine1.HasValue() && m.Address.AddressLine1.ToUpper().Contains(srchStr)));
                }
            }

            var vm = AutoMapperSetup.MapList <Customer, CustomerListVM>(mdl);

            return(View(new GridModel(vm)));
        }
        public ActionResult _StockInvoiceGridBind()
        {
            var vm = AutoMapperSetup.MapList <StockInvoice, StockInvoiceVM>(_stockInvSvc.GetAllInvoices());

            return(View(new GridModel(vm)));
        }
示例#14
0
        public ActionResult _EmployersGridBind()
        {
            var vm = AutoMapperSetup.MapList <Employer, EmployerVM>(_employerService.GetAllEmployers());

            return(View(new GridModel(vm)));
        }
        public virtual ActionResult _DisplayPurchasedUnits(int parentId)
        {
            var purchaseUnits = _purchaseUnitAndContracts.GetPurchaseUnits(parentId).Where(c => c.RemovalDate == null);

            return(View(new GridModel(AutoMapperSetup.MapList <PurchaseUnit, PurchasedUnitVM>(purchaseUnits))));
        }
 protected static List <ContractTypeVM> GetContractTypesVM(IEnumerable <ContractType> avilableContracts)
 {
     return(AutoMapperSetup.MapList <ContractType, ContractTypeVM>(avilableContracts).ToList());
 }
示例#17
0
        public ActionResult _DisplayPurchaseUnitContracts(int unitId)
        {
            var uc = _purchaseUnitAndContracts.GetPurchaseUnitContracts(unitId);

            return(View(new GridModel(AutoMapperSetup.MapList <ServiceContract, ServiceContractVM>(uc))));
        }
示例#18
0
        public ActionResult _BillCycleHistoryGridBind()
        {
            var vm = AutoMapperSetup.MapList <BillCycleRun, BillCycleRunVM>(_billCycleService.GetBillCycleHistory());

            return(View(new GridModel(vm)));
        }
 private IEnumerable <StockVM> GetStockListVM(Func <Stock, bool> predicate)
 {
     return(AutoMapperSetup.MapList <Stock, StockVM>(_svc.GetStocks().Where(predicate)));
 }
 public ActionResult _SuppliersGridBind()
 {
     return(View(new GridModel(AutoMapperSetup.MapList <Supplier, SupplierVM>(_svc.GetAllSuppliers()))));
 }
        private IEnumerable <AccountTransactionVM> MapCustomerAccountsToViewModel(int id)
        {
            var accs = _accountsService.GetTransactionsForCustomer(id);

            return(AutoMapperSetup.MapList <AccountTransaction, AccountTransactionVM>(accs));
        }
        public ActionResult _ManufacturerGridBind()
        {
            var vm = AutoMapperSetup.MapList <Manufacturer, ManufacturerVM>(_svc.GetAllManufacturers());

            return(View(new GridModel(vm)));
        }
        public ActionResult _GetCustomerDocuments(int id)
        {
            var docs = _customerService.GetCustomer(id).Documents;

            return(View(new GridModel(AutoMapperSetup.MapList <CustomerDocument, CustomerDocumentVM>(docs))));
        }
示例#24
0
        public ActionResult _DisplayRentedUnits()
        {
            var rentedUnits = GetRentalBasket().RentedUnits;

            return(View(new GridModel(AutoMapperSetup.MapList <RentedUnit, RentedUnitVM>(rentedUnits))));
        }
示例#25
0
        public ActionResult _DisplayPurchasedUnits(int accountId)
        {
            var purchaseUnits = _purchaseUnitAndContracts.GetPurchaseUnits(accountId);

            return(View(new GridModel(AutoMapperSetup.MapList <PurchaseUnit, PurchasedUnitVM>(purchaseUnits))));
        }
示例#26
0
 public override ReturnView DisplayAttachedContractsView()
 {
     return(new ReturnView("_DisplayPurchaseAccountContracts", AutoMapperSetup.MapList <ServiceContract, ServiceContractVM>(_contractUnit.AttachedContracts.ConvertAll(c => (ServiceContract)c))));
 }
示例#27
0
        public ActionResult _DisplayRentedUnits()
        {
            var rentedUnits = TempAccountAsAddRentAccountVM().RentedUnits;

            return(View(new GridModel(AutoMapperSetup.MapList <RentedUnit, RentedUnitVM>(rentedUnits))));
        }