Example #1
0
        public JsonResult GetProductionLinesResult()
        {
            ProductionLineService     prodLineBL = new ProductionLineService();
            List <ProductionLinesDto> lines      = prodLineBL.GetAll();

            return(Json(lines, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetLines()
        {
            List <ProductionLinesModel> productionLines = new List <ProductionLinesModel>();

            using (ProductionLineService service = new ProductionLineService())
            {
                var dto = service.GetAll().OrderBy(r => r.LineDesc).ToList();
                productionLines.AddRange(Mapper.Map <List <ProductionLinesDto>, List <ProductionLinesModel> >(dto));
            }
            return(Json(productionLines, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Index()
        {
            EquipmentRunTimeModel model = new EquipmentRunTimeModel();

            using (ProductionLineService service = new ProductionLineService()) {
                model.ProductionLineList = new SelectList(service.GetAll().OrderBy(l => l.LineDesc), "ID", "LineDesc");
            }

            // should only show 15 weeks starting from 5 weeks ago
            DateTime theWeek            = GetFirstDayOfWeek(DateTime.Now).AddDays((5 * 7 * -1));
            List <SelectListItem> weeks = new List <SelectListItem>();

            for (int weekIdx = -5; weekIdx <= 10; weekIdx++)
            {
                SelectListItem listItem = new SelectListItem();
                listItem.Value = theWeek.ToShortDateString();
                listItem.Text  = theWeek.ToShortDateString();
                weeks.Add(listItem);

                theWeek = theWeek.AddDays(7);
            }
            model.WeekStartingList = new SelectList(weeks, "Value", "Text", GetFirstDayOfWeek(DateTime.Now).ToShortDateString());
            return(View(model));
        }