Ejemplo n.º 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);
        }