public ConsolidatedCurrentRawMaterialsAndRollsViewModel ConsolidatedCurrentRawMaterialsAndRollsViewModel_Get(string lineID)
        {
            ScrimType             scrimTypeBL = new ScrimType();
            List <ScrimTypeModel> scrimTypes  = scrimTypeBL.GetScrimTypeModels();

            scrimTypes.Insert(0, new ScrimTypeModel()
            {
                Code = "N/A"
            });
            GetRollTypesList();
            ViewBag.ScrimRoll = new SelectList(new List <TPO.Model.Scrim.TPOCurrentScrimModel>());
            ProductionLine prodLineBL = new ProductionLine();

            List <TPO.Model.Production.ProductionLineModel> lines = prodLineBL.GetProductionLines();

            //lines.Insert(0, new TPO.Model.Production.ProductionLineModel() { Code = "Select Line" });
            ViewBag.ProductionLine = new SelectList(lines, "Code", "Code");
            //ViewBag.productionLineSelectList = new SelectList(lines, "Code", "Code");
            TPOCurrentScrim bl = new TPOCurrentScrim();

            ConsolidatedCurrentRawMaterialsAndRollsViewModel model = new ConsolidatedCurrentRawMaterialsAndRollsViewModel();

            TPOCurrentScrimModel tpoCurrentModel = bl.GetTPOCurrentScrimModelByLineID(lineID);

            if (tpoCurrentModel == null)
            {
                tpoCurrentModel       = new TPOCurrentScrimModel();
                model.TPOCurrentScrim = tpoCurrentModel;
            }
            else
            {
                model.TPOCurrentScrim = tpoCurrentModel;
            }

            List <CurrentRawMaterialDTO>       currentDTOList = GetRawMaterailListing(lineID);
            List <CurrentRawMaterialViewModel> model2         = currentDTOList.Select(MapCurrentRawMaterialDTOToViewModel).ToList();

            if (!model2.Any())
            {
                model2 = new List <CurrentRawMaterialViewModel>();
                model.CurrentRawMaterialList = model2;
            }
            else
            {
                model.CurrentRawMaterialList = model2;
            }

            if (!model.CurrentRawMaterialList.Any() && model.TPOCurrentScrim.LineID == null)
            {
                model.CurrentRawMaterial        = new CurrentRawMaterialViewModel();
                model.CurrentRawMaterial.LineId = "1";
                model.TPOCurrentScrim.LineID    = "1";
            }
            else
            {
                model.CurrentRawMaterialList = model2;
            }

            return(model);
        }
        public JsonResult GridByType(string lineID)
        {
            var x = string.Empty;


            ConsolidatedCurrentRawMaterialsAndRollsViewModel gridInfo = new ConsolidatedCurrentRawMaterialsAndRollsViewModel();


            return(Json(gridInfo.CurrentRawMaterialList, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GridByType(string lineID, int rows, int page)
        {
            ConsolidatedCurrentRawMaterialsAndRollsViewModel gridInfo = new ConsolidatedCurrentRawMaterialsAndRollsViewModel();

            gridInfo = ConsolidatedCurrentRawMaterialsAndRollsViewModel_Get(lineID);

            //add logic for pagination
            //var z = testRecords.Skip((page - 1) * rows).Take(rows);

            //object[] results = new []
            //{

            //}


            return(Json(gridInfo.CurrentRawMaterialList, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Edit(ConsolidatedCurrentRawMaterialsAndRollsViewModel model)
        {
            TPOCurrentScrim bl     = new TPOCurrentScrim();
            string          lineID = model.LineID;

            model.TPOCurrentScrim.LineID = lineID;
            if (model.TPOCurrentScrim.ID > 0)
            {
                bl.UpdateTPOCurrentScrimModel(model.TPOCurrentScrim);
            }
            else
            {
                bl.InsertTPOCurrentScrimModel(model.TPOCurrentScrim);
            }
            TempData["ActionMessage"]     = MessageRepository.GetStringValue(MessageKeys.ResponseMessageSuccessSave);
            TempData["ActionMessageType"] = MessageRepository.GetStringValue(MessageKeys.ResponseTypeSuccess);
            return(RedirectToAction("Edit", new { lineID = lineID }));
        }