Пример #1
0
        public ActionResult Modify(int id, string IndexType)
        {
            JobOrderHeader header = _RecipeHeaderService.Find(id);

            if (header.Status == (int)StatusConstants.Drafted || header.Status == (int)StatusConstants.Import)
            {
                return(Edit(id, IndexType));
            }
            else
            {
                return(HttpNotFound());
            }
        }
Пример #2
0
        public SubRecipeViewModel Create(SubRecipeViewModel vmSubRecipe, string UserName)
        {
            _RecipeHeaderService.CreateProdOrder(vmSubRecipe.JobOrderHeaderId, UserName, vmSubRecipe.Qty);

            _unitOfWork.Save();

            JobOrderHeader Header = _RecipeHeaderService.Find(vmSubRecipe.JobOrderHeaderId);



            _logger.LogActivityDetail(logVm.Map(new ActiivtyLogViewModel
            {
                DocTypeId    = Header.DocTypeId,
                DocId        = Header.JobOrderHeaderId,
                ActivityType = (int)ActivityTypeContants.Modified,
                DocNo        = Header.DocNo,
                DocDate      = Header.DocDate,
                DocStatus    = Header.Status,
            }));



            return(vmSubRecipe);
        }
        //[ValidateAntiForgeryToken]
        public ActionResult _CreatePost(RecipeLineViewModel svm, string BulkMode)
        {
            bool           BeforeSave = true;
            JobOrderHeader temp       = _RecipeHeaderService.Find(svm.JobOrderHeaderId);


            if (svm.Qty <= 0)
            {
                ModelState.AddModelError("Qty", "The Qty is required");
            }

            if (_RecipeLineService.IsDuplicateLine(svm.StockHeaderId, svm.ProductId, svm.DyeingRatio, svm.StockLineId))
            {
                ModelState.AddModelError("ProductId", "Product is already entered in recipe.");
            }

            ViewBag.Status = temp.Status;


            if (svm.StockLineId <= 0)
            {
                ViewBag.LineMode = "Create";
            }
            else
            {
                ViewBag.LineMode = "Edit";
            }

            if (ModelState.IsValid && BeforeSave)
            {
                if (svm.StockLineId <= 0)
                {
                    try
                    {
                        _RecipeLineService.Create(svm, User.Identity.Name);
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        TempData["CSEXCL"] += message;
                        PrepareViewBag(svm);

                        return(PartialView("_Create", svm));
                    }

                    return(RedirectToAction("_Create", new { id = svm.JobOrderHeaderId }));
                }


                else
                {
                    try
                    {
                        _RecipeLineService.Update(svm, User.Identity.Name);
                    }

                    catch (Exception ex)
                    {
                        string message = _exception.HandleException(ex);
                        TempData["CSEXCL"] += message;
                        PrepareViewBag(svm);
                        return(PartialView("_Create", svm));
                    }

                    return(Json(new { success = true }));
                }
            }
            PrepareViewBag(svm);
            return(PartialView("_Create", svm));
        }