Пример #1
0
        private ShopFloorModel CreateShopFloorModel(int id, string stocknumber)
        {
            ShopFloorModel model = new ShopFloorModel();

            if (id > 0)
            {
                model.Invoice = InvoiceServices.GetInvoice(id);
                if (model.Invoice == null)
                {
                    model.NoDataMessage = string.Format("We could not find an invoice with an id = {0}", id);
                }
            }
            else if (!string.IsNullOrEmpty(stocknumber))
            {
                model.Invoice = InvoiceServices.GetInvoice(stocknumber);
                if (model.Invoice == null)
                {
                    model.NoDataMessage = string.Format("We could not find an invoice with a stock number = {0}", stocknumber);
                }
            }
            else
            {
                model.NoDataMessage = "There are no vehicles logged into the shop at this time";
            }

            model.Services          = InvoiceServices.GetServices(base.LocationId, model.Invoice);
            model.VehiclesInShop    = NavigationServices.GetVehiclesInShop(base.LocationId).OrderBy(o => o.Id).ToList();
            model.VehiclesCompleted = NavigationServices.GetVehiclesCompletedToday(base.LocationId).OrderBy(o => o.Id).ToList();

            return(model);
        }
Пример #2
0
        public ActionResult GetInvoice(int id)
        {
            ShopFloorModel model = CreateShopFloorModel(id, null);

            ViewBag.ActiveEmployees   = EmployeeServices.GetActiveEmployees();
            ViewBag.SignedInEmployees = InvoiceServices.GetSignedInEmployeeSelectList(base.LocationId);

            if (model.Invoice == null)
            {
                return(View("Index_NoData", model));
            }

            if (!string.IsNullOrEmpty(model.Invoice.StockNumber))
            {
                model.Invoice.History = InvoiceServices.GetStockNumberHistory(model.Invoice);
            }

            return(View("Index", model));
        }