Esempio n. 1
0
        public ActionResult CreatePlotterRoll(string returnUrl)
        {
            //Load each type of base
            ViewBag.TypeOfTaskList = typeOfTaskRepository.GetAll().Where(y => y.CodCategoryOfTask == "STAMPA");

            ViewBag.ReturnUrl = returnUrl;
            ViewBag.ReturnCodTypeOfTask = "STAMPAMORBIDO";

            //this feature is needed when in the view there are more than one input (submit button) form
            //Action Method
            ViewBag.ActionMethod = "CreatePlotterRoll";
            var x = new PlotterRoll();

            x.FormatMax = "0x0";
            x.FormatMin = "0x0";
            x.CodTypeOfTask = "STAMPAMORBIDO";
            return View(x);
        }
Esempio n. 2
0
        public ActionResult EditPlotterRoll(string id, string returnUrl)
        {
            //return url
            ViewBag.ReturnUrl = returnUrl;
            ViewBag.ReturnCodTypeOfTask = "STAMPAMORBIDO";

            PlotterRoll tskEx = new PlotterRoll();
            tskEx = (PlotterRoll)taskExecutorRepository.GetSingle(id);

            if (tskEx == null)
                return HttpNotFound();

            //Load each type of base
            ViewBag.TypeOfTaskList = typeOfTaskRepository.GetAll().Where(y => y.CodCategoryOfTask == "STAMPA");



            //is used to know where we are from and go
            ViewBag.ActionMethod = "EditPlotterRoll";
            return View(tskEx);
        }
Esempio n. 3
0
        public ActionResult EditPlotterRoll(PlotterRoll c, string returnUrl, string returnCodTypeOfTask)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    taskExecutorRepository.Edit(c);
                    taskExecutorRepository.Save();
                    return Json(new { redirectUrl = Url.Action(returnUrl, new { codTypeOfTask = returnCodTypeOfTask }) });
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError(string.Empty, "Something went wrong. Message: " + ex.Message);
                }
            }

            //If we come here, something went wrong. Return it back. 


            ViewBag.ReturnUrl = returnUrl;
            ViewBag.ReturnCodTypeOfTask = returnCodTypeOfTask;
            //multi submit
            ViewBag.ActionMethod = "EditPlotterRoll";
            return PartialView("_EditAndCreatePlotterRoll", c);
        }
Esempio n. 4
0
        public ActionResult CreatePlotterRoll(PlotterRoll c, string returnUrl, string returnCodTypeOfTask)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    //if code is empty then sistem has to assign one
                    //                    if (c.Article.CodArticle == null)
                    {
                        c.CodTaskExecutor = taskExecutorRepository.GetNewCode(c);
                    }

                    c.TimeStampTable = DateTime.Now;
                    taskExecutorRepository.Add(c);
                    taskExecutorRepository.Save();

                    //hooray it passed - go back to index
                    return Json(new { redirectUrl = Url.Action(returnUrl, new { codTypeOfTask = returnCodTypeOfTask }) });

                }
                catch (Exception ex)
                {
                    ModelState.AddModelError(string.Empty, "Something went wrong. Message: " + ex.Message);
                }
            }

            //Load each type of base
            ViewBag.TypeOfTaskList = typeOfTaskRepository.GetAll().Where(y => y.CodCategoryOfTask == "STAMPA");

            ViewBag.ReturnUrl = returnUrl;
            ViewBag.ReturnCodTypeOfTask = returnCodTypeOfTask;

            //view name is needed for reach right view because to using more than one submit we have to use "Action" in action method name
            ViewBag.ActionMethod = "CreatePlotterRoll";
            return PartialView("_EditAndCreatePlotterRoll", c);
        }