Exemple #1
0
        public ActionResult newManufacturingTime()
        {
            // get Line list
            List <Line> lines = getLines();
            List <Part> parts = getParts();


            /*
             * var lineData = LineProcessor.LoadLine();
             *
             * foreach (var row in lineData)
             * {
             *  lines.Add(new Line
             *  {
             *      lineId = row.lineId,
             *      lineName = row.lineName,
             *
             *  });
             * }
             */
            // get part list

            /*
             * var partData = PartProcessor.LoadPart();
             *
             * foreach (var row in partData)
             * {
             *  parts.Add(new Part
             *  {
             *      partId = row.partId,
             *      partName = row.partName,
             *
             *  });
             * }
             */
            PartLineManufacturingViewModel PLViewModel = new PartLineManufacturingViewModel();

            PLViewModel.lines = lines;
            PLViewModel.parts = parts;


            return(View(PLViewModel));
        }
Exemple #2
0
        public ActionResult updateManufacturingTime(int selectedLine, int selectedPart, int manufacturingTIme)
        {
            List <Line> lines = getLines();


            // get part list
            List <Part> parts = getParts();


            PartLineManufacturingViewModel PLViewModel = new PartLineManufacturingViewModel();

            PLViewModel.lines = lines;
            PLViewModel.parts = parts;

            PLViewModel.selectedLine      = selectedLine;
            PLViewModel.selectedPart      = selectedPart;
            PLViewModel.manufacturingTIme = manufacturingTIme;

            return(View(PLViewModel));
        }
Exemple #3
0
        public ActionResult updateManufacturingTimePost(int selectedLine, int selectedPart, int manufacturingTIme)
        {
            int updated = 0;

            if (manufacturingTIme <= 0 || manufacturingTIme > 10000)
            {
                ModelState.AddModelError("", "Error");

                ModelState.AddModelError(string.Empty, "Please enter a valid Manufacturing Time from 1-9999");
            }



            if (ModelState.IsValid)
            {
                try
                {
                    updated = manufacturingTimeProcessor.updateMT(
                        selectedLine,
                        selectedPart,
                        manufacturingTIme);



                    //TempData["newOrderResult"] = created;


                    if (updated == 1)
                    {
                        TempData["ManufacturingResult"] = 3;
                    }
                    else if (updated == 0)
                    {
                        TempData["ManufacturingResult"] = 0;
                    }



                    return(RedirectToAction("ViewManufacturing"));
                }
                catch (Exception ex)
                {
                    //  TempData["newOrderResult"] = created;
                    //return RedirectToAction("ViewOrders");
                    return(View(ex.Message));
                }
            }



            PartLineManufacturingViewModel PLViewModel = new PartLineManufacturingViewModel();


            List <Line> lines = getLines();
            List <Part> parts = getParts();

            PLViewModel.lines = lines;
            PLViewModel.parts = parts;

            PLViewModel.selectedLine      = selectedLine;
            PLViewModel.selectedPart      = selectedPart;
            PLViewModel.manufacturingTIme = manufacturingTIme;

            return(View(PLViewModel));
        }
Exemple #4
0
        public ActionResult newManufacturingTime(int selectedLine, int selectedPart, int manufacturingTIme)
        {
            int created = 0;

            if (manufacturingTIme <= 0 || manufacturingTIme > 10000)
            {
                ModelState.AddModelError("", "Error");

                ModelState.AddModelError(string.Empty, "Please enter a valid Manufacturing Time from 1-9999");
            }


            bool result = CheckManufacturingTimeExistBool(selectedLine, selectedPart);

            if (result != false)
            {
                ModelState.AddModelError("", "Error");

                ModelState.AddModelError(string.Empty, "Manufacturing Time already exist");
            }

            if (ModelState.IsValid)
            {
                try
                {
                    created = manufacturingTimeProcessor.CreateMT(
                        selectedLine,
                        selectedPart,
                        manufacturingTIme);



                    //TempData["newOrderResult"] = created;


                    if (created == 1)
                    {
                        TempData["ManufacturingResult"] = 1;
                    }
                    else if (created == 0)
                    {
                        TempData["ManufacturingResult"] = 0;
                    }



                    return(RedirectToAction("ViewManufacturing"));
                }
                catch (Exception ex)
                {
                    //  TempData["newOrderResult"] = created;
                    //return RedirectToAction("ViewOrders");
                    return(View(ex.Message));
                }
            }

            // ModelState.AddModelError("", "Error");

            // get Line list
            List <Line> lines = getLines();


            // get part list
            List <Part> parts = getParts();


            PartLineManufacturingViewModel PLViewModel = new PartLineManufacturingViewModel();

            PLViewModel.lines = lines;
            PLViewModel.parts = parts;


            return(View(PLViewModel));
        }