public ActionResult _Edit(int id)
        {
            var ProdProcess = new ProductProcessService(_unitOfWork).Find(id);

            if (ProdProcess.ProcessId != null)
            {
                var Process = new ProcessService(_unitOfWork).Find((int)ProdProcess.ProcessId);
                ViewBag.ProcessName = Process.ProcessName;
            }
            else
            {
                ViewBag.ProcessName = "";
            }



            ProductProcessViewModel vm = new ProductProcessViewModel();

            vm.Instructions       = ProdProcess.Instructions;
            vm.ProcessId          = ProdProcess.ProcessId;
            vm.ProductId          = ProdProcess.ProductId;
            vm.ProductProcessId   = ProdProcess.ProductProcessId;
            vm.ProductRateGroupId = ProdProcess.ProductRateGroupId;
            vm.QAGroupId          = ProdProcess.QAGroupId;
            vm.Sr = ProdProcess.Sr;

            return(PartialView("_Create", vm));
        }
Esempio n. 2
0
        public ActionResult UpdateDesignRate(int ProductGroupId, int ProductRateGroupId, int RateListHeaderId)
        {
            XElement Modifications;
            bool     Flag = new ProductProcessService(_unitOfWork).UpdateProductRateGroupForDesign(ProductGroupId, ProductRateGroupId, RateListHeaderId, User.Identity.Name, out Modifications);

            if (Flag)
            {
                LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                {
                    DocTypeId       = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.RateListHeader).DocumentTypeId,
                    ActivityType    = (int)ActivityTypeContants.Modified,
                    xEModifications = Modifications,
                }));
            }

            return(Json(new { Success = Flag }));

            //return View();
        }
        public ActionResult DeleteConfirmed(ReasonViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var temp = _FinishedProductService.Find(vm.id);

                List <ProductSizeViewModel> sizelist    = new ProductSizeService(_unitOfWork).GetProductSizeForProduct(vm.id).ToList();
                List <ProductProcess>       ProcessList = new ProductProcessService(_unitOfWork).GetProductProcessIdListByProductId(vm.id).ToList();
                List <FinishedProductConsumptionLineViewModel> BOMDetailList = new  BomDetailService(_unitOfWork).GetFinishedProductConsumptionForIndex(vm.id).ToList();
                List <ProductSiteDetail> SiteDetail = new ProductSiteDetailService(_unitOfWork).GetSiteDetailForProduct(vm.id).ToList();


                foreach (var item in sizelist)
                {
                    new ProductSizeService(_unitOfWork).Delete(item.ProductSizeId);
                }

                foreach (var item in ProcessList)
                {
                    new ProductProcessService(_unitOfWork).Delete(item.ProductProcessId);
                }
                foreach (var item in BOMDetailList)
                {
                    new BomDetailService(_unitOfWork).Delete(item.BomDetailId);
                }
                foreach (var item in SiteDetail)
                {
                    new ProductSiteDetailService(_unitOfWork).Delete(item.ProductSiteDetailId);
                }

                ActivityLog al = new ActivityLog()
                {
                    ActivityType = (int)ActivityTypeContants.Deleted,
                    CreatedBy    = User.Identity.Name,
                    CreatedDate  = DateTime.Now,
                    DocId        = vm.id,
                    UserRemark   = vm.Reason,
                    Narration    = "Product is deleted with Name:" + temp.ProductName,
                    DocTypeId    = new DocumentTypeService(_unitOfWork).FindByName(TransactionDocCategoryConstants.SaleOrder).DocumentTypeId,
                    UploadDate   = DateTime.Now,
                };
                new ActivityLogService(_unitOfWork).Create(al);


                _FinishedProductService.Delete(vm.id);

                try
                {
                    _unitOfWork.Save();
                }

                catch (Exception ex)
                {
                    string message = _exception.HandleException(ex);
                    ModelState.AddModelError("", message);
                    return(PartialView("_Reason", vm));
                }


                return(Json(new { success = true }));
            }
            return(PartialView("_Reason", vm));
        }