public ActionResult Submit(int id, string IndexType, string TransactionType) { #region DocTypeTimeLineValidation PackingHeader s = db.PackingHeader.Find(id); try { TimePlanValidation = DocumentValidation.ValidateDocument(Mapper.Map <DocumentUniqueId>(s), DocumentTimePlanTypeConstants.Submit, User.Identity.Name, out ExceptionMsg, out Continue); TempData["CSEXC"] += ExceptionMsg; } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; TimePlanValidation = false; } if (!TimePlanValidation && !Continue) { return(RedirectToAction("Index", new { id = s.DocTypeId, IndexType = IndexType })); } #endregion return(RedirectToAction("Detail", new { id = id, IndexType = IndexType, transactionType = string.IsNullOrEmpty(TransactionType) ? "submit" : TransactionType })); }
private ActionResult Remove(int id) { ReasonViewModel rvm = new ReasonViewModel() { id = id, }; PackingHeader PackingHeader = db.PackingHeader.Find(id); if (new RolePermissionService(_unitOfWork).IsActionAllowed(UserRoles, PackingHeader.DocTypeId, null, this.ControllerContext.RouteData.Values["controller"].ToString(), "Remove") == false) { return(PartialView("~/Views/Shared/PermissionDenied_Modal.cshtml").Warning("You don't have permission to do this task.")); } #region DocTypeTimeLineValidation try { TimePlanValidation = DocumentValidation.ValidateDocument(Mapper.Map <DocumentUniqueId>(PackingHeader), DocumentTimePlanTypeConstants.Delete, User.Identity.Name, out ExceptionMsg, out Continue); TempData["CSEXC"] += ExceptionMsg; } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; TimePlanValidation = false; } if (!TimePlanValidation && !Continue) { return(PartialView("AjaxError")); } #endregion return(PartialView("_Reason", rvm)); }
public ActionResult Reviewed(int Id, string IndexType, string UserRemark, string IsContinue) { PackingHeader Dh = _PackingHeaderService.Find(Id); if (ModelState.IsValid) { Dh.ReviewCount = (Dh.ReviewCount ?? 0) + 1; Dh.ReviewBy += User.Identity.Name + ", "; _PackingHeaderService.Update(Dh); _unitOfWork.Save(); LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = Dh.DocTypeId, DocId = Dh.PackingHeaderId, ActivityType = (int)ActivityTypeContants.Reviewed, UserRemark = UserRemark, DocNo = Dh.DocNo, DocDate = Dh.DocDate, DocStatus = Dh.Status, })); return(RedirectToAction("Index", new { id = Dh.DocTypeId, IndexType = IndexType }).Success("Record reviewed successfully.")); } return(RedirectToAction("Index", new { id = Dh.DocTypeId, IndexType = IndexType }).Warning("Error in reviewing.")); }
public ActionResult PrintAfter_Approve(int id, string ReportFileType) { PackingHeader header = _PackingHeaderService.Find(id); if (header.Status == (int)StatusConstants.Approved) { return(RedirectToAction("DocPrint", new { id = id, ReportFileType = ReportFileType })); } else { return(HttpNotFound()); } }
public ActionResult ModifyAfter_Submit(int id, string IndexType) { PackingHeader header = _PackingHeaderService.Find(id); if (header.Status == (int)StatusConstants.Submitted || header.Status == (int)StatusConstants.Modified) { return(Edit(id, IndexType)); } else { return(HttpNotFound()); } }
public ActionResult DeleteAfter_Submit(int id) { PackingHeader header = _PackingHeaderService.Find(id); if (header.Status == (int)StatusConstants.Submitted || header.Status == (int)StatusConstants.Modified || header.Status == (int)StatusConstants.ModificationSubmitted) { return(Remove(id)); } else { return(HttpNotFound()); } }
public ActionResult DeleteAfter_Approve(int id) { PackingHeader header = _PackingHeaderService.Find(id); if (header.Status == (int)StatusConstants.Approved) { return(Remove(id)); } else { return(HttpNotFound()); } }
public ActionResult Delete(int id) { PackingHeader header = _PackingHeaderService.Find(id); if (header.Status == (int)StatusConstants.Drafted || header.Status == (int)StatusConstants.Import) { return(Remove(id)); } else { return(HttpNotFound()); } }
public JsonResult FIsDuplicateDocNo(string DocNo) { Boolean IsDuplicate; PackingHeader H = _PackingHeaderService.FindByDocNo(DocNo, (int)System.Web.HttpContext.Current.Session["DivisionId"], (int)System.Web.HttpContext.Current.Session["SiteId"]); if (H == null) { IsDuplicate = false; } else { IsDuplicate = true; } return(Json(new { returnvalue = IsDuplicate })); }
public ActionResult Detail(int id, string transactionType, string IndexType) { ViewBag.transactionType = transactionType; ViewBag.IndexStatus = IndexType; PackingHeader PackingHeader = _PackingHeaderService.Find(id); PackingHeaderViewModel vm = new PackingHeaderViewModel(); vm = Mapper.Map <PackingHeader, PackingHeaderViewModel>(PackingHeader); vm.BuyerId = PackingHeader.BuyerId; vm.GodownId = PackingHeader.GodownId; //Getting Settings var settings = new PackingSettingService(_unitOfWork).GetPackingSettingForDocument(PackingHeader.DocTypeId, PackingHeader.DivisionId, PackingHeader.SiteId); if (settings == null && UserRoles.Contains("SysAdmin")) { return(RedirectToAction("Create", "PackingSetting", new { id = id }).Warning("Please create Sale Dispatch settings")); } else if (settings == null && !UserRoles.Contains("SysAdmin")) { return(View("~/Views/Shared/InValidSettings.cshtml")); } vm.PackingSettings = Mapper.Map <PackingSetting, PackingSettingsViewModel>(settings); PrepareViewBag(PackingHeader.DocTypeId); if (String.IsNullOrEmpty(transactionType) || transactionType == "detail") { LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = PackingHeader.DocTypeId, DocId = PackingHeader.PackingHeaderId, ActivityType = (int)ActivityTypeContants.Detail, DocNo = PackingHeader.DocNo, DocDate = PackingHeader.DocDate, DocStatus = PackingHeader.Status, })); } return(View("Create", vm)); }
public ActionResult Submit(int id, string IndexType, string TransactionType) { PackingHeader s = db.PackingHeader.Find(id); if (new RolePermissionService(_unitOfWork).IsActionAllowed(UserRoles, s.DocTypeId, null, this.ControllerContext.RouteData.Values["controller"].ToString(), "Submit") == false) { return(View("~/Views/Shared/PermissionDenied.cshtml").Warning("You don't have permission to do this task.")); } #region DocTypeTimeLineValidation try { TimePlanValidation = Submitvalidation(id, out ExceptionMsg); TempData["CSEXC"] += ExceptionMsg; } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; TimePlanValidation = false; } try { TimePlanValidation = DocumentValidation.ValidateDocument(Mapper.Map <DocumentUniqueId>(s), DocumentTimePlanTypeConstants.Submit, User.Identity.Name, out ExceptionMsg, out Continue); TempData["CSEXC"] += ExceptionMsg; } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; TimePlanValidation = false; } if (!TimePlanValidation && !Continue) { return(RedirectToAction("Index", new { id = s.DocTypeId, IndexType = IndexType })); } #endregion return(RedirectToAction("Detail", new { id = id, IndexType = IndexType, transactionType = string.IsNullOrEmpty(TransactionType) ? "submit" : TransactionType })); }
public ActionResult Print(int id) { PackingHeader header = _PackingHeaderService.Find(id); if (header.Status == (int)StatusConstants.Drafted || header.Status == (int)StatusConstants.Import) { var SEttings = new PackingSettingService(_unitOfWork).GetPackingSettingForDocument(header.DocTypeId, header.DivisionId, header.SiteId); if (string.IsNullOrEmpty(SEttings.SqlProcDocumentPrint)) { throw new Exception("Document Print Not Configured"); } else { return(PrintOut(id, SEttings.SqlProcDocumentPrint)); } } else { return(HttpNotFound()); } }
private ActionResult Edit(int id, string IndexType) { ViewBag.IndexStatus = IndexType; PackingHeader PackingHeader = _PackingHeaderService.Find(id); if (new RolePermissionService(_unitOfWork).IsActionAllowed(UserRoles, PackingHeader.DocTypeId, null, this.ControllerContext.RouteData.Values["controller"].ToString(), "Edit") == false) { return(View("~/Views/Shared/PermissionDenied.cshtml").Warning("You don't have permission to do this task.")); } #region DocTypeTimeLineValidation try { TimePlanValidation = DocumentValidation.ValidateDocument(Mapper.Map <DocumentUniqueId>(PackingHeader), DocumentTimePlanTypeConstants.Modify, User.Identity.Name, out ExceptionMsg, out Continue); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; TimePlanValidation = false; } if (!TimePlanValidation) { TempData["CSEXC"] += ExceptionMsg; } #endregion if ((!TimePlanValidation && !Continue)) { return(RedirectToAction("DetailInformation", new { id = id, IndexType = IndexType })); } PackingHeaderViewModel vm = new PackingHeaderViewModel(); vm = Mapper.Map <PackingHeader, PackingHeaderViewModel>(PackingHeader); vm.BuyerId = PackingHeader.BuyerId; vm.GodownId = PackingHeader.GodownId; //Getting Settings var settings = new PackingSettingService(_unitOfWork).GetPackingSettingForDocument(PackingHeader.DocTypeId, vm.DivisionId, vm.SiteId); if (settings == null && UserRoles.Contains("SysAdmin")) { return(RedirectToAction("Create", "PackingSetting", new { id = PackingHeader.DocTypeId }).Warning("Please create Sale Dispatch settings")); } else if (settings == null && !UserRoles.Contains("SysAdmin")) { return(View("~/Views/Shared/InValidSettings.cshtml")); } if (settings != null) { vm.ProcessId = settings.ProcessId; } vm.PackingSettings = Mapper.Map <PackingSetting, PackingSettingsViewModel>(settings); PrepareViewBag(PackingHeader.DocTypeId); ViewBag.Mode = "Edit"; if (!(System.Web.HttpContext.Current.Request.UrlReferrer.PathAndQuery).Contains("Create")) { LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = PackingHeader.DocTypeId, DocId = PackingHeader.PackingHeaderId, ActivityType = (int)ActivityTypeContants.Detail, DocNo = PackingHeader.DocNo, DocDate = PackingHeader.DocDate, DocStatus = PackingHeader.Status, })); } return(View("Create", vm)); }
public ActionResult Submitted(int Id, string IndexType, string UserRemark, string IsContinue, string GenGatePass) { //int SaleAc = 6650; int ActivityType; bool BeforeSave = true; try { BeforeSave = PackingDocEvents.beforeHeaderSubmitEvent(this, new SaleEventArgs(Id), ref db); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; EventException = true; } if (!BeforeSave) { TempData["CSEXC"] += "Falied validation before submit."; } PackingHeader Dh = _PackingHeaderService.Find(Id); if (ModelState.IsValid && BeforeSave && !EventException) { if (User.Identity.Name == Dh.ModifiedBy || UserRoles.Contains("Admin")) { Dh.Status = (int)StatusConstants.Submitted; ActivityType = (int)ActivityTypeContants.Submitted; Dh.ReviewBy = null; PackingSetting Settings = new PackingSettingService(_unitOfWork).GetPackingSettingForDocument(Dh.DocTypeId, Dh.DivisionId, Dh.SiteId); _PackingHeaderService.Update(Dh); try { PackingDocEvents.onHeaderSubmitEvent(this, new SaleEventArgs(Id), ref db); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; EventException = true; } try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; return(RedirectToAction("Index", new { id = Dh.DocTypeId })); } try { PackingDocEvents.afterHeaderSubmitEvent(this, new SaleEventArgs(Id), ref db); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = Dh.DocTypeId, DocId = Dh.PackingHeaderId, ActivityType = ActivityType, UserRemark = UserRemark, DocNo = Dh.DocNo, DocDate = Dh.DocDate, DocStatus = Dh.Status, })); return(RedirectToAction("Index", new { id = Dh.DocTypeId, IndexType = IndexType }).Success("Record submitted successfully.")); } else { return(RedirectToAction("Index", new { id = Dh.DocTypeId, IndexType = IndexType }).Warning("Record can be submitted by user " + Dh.ModifiedBy + " only.")); } } return(View()); }
public ActionResult Create(PackingHeaderViewModel svm) { string DataValidationMsg = DataValidation(svm); if (DataValidationMsg != "") { PrepareViewBag(svm); return(View(svm).Danger(DataValidationMsg)); } #region DocTypeTimeLineValidation try { if (svm.PackingHeaderId <= 0) { TimePlanValidation = DocumentValidation.ValidateDocument(Mapper.Map <DocumentUniqueId>(svm), DocumentTimePlanTypeConstants.Create, User.Identity.Name, out ExceptionMsg, out Continue); } else { TimePlanValidation = DocumentValidation.ValidateDocument(Mapper.Map <DocumentUniqueId>(svm), DocumentTimePlanTypeConstants.Modify, User.Identity.Name, out ExceptionMsg, out Continue); } } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; TimePlanValidation = false; } if (!TimePlanValidation) { TempData["CSEXC"] += ExceptionMsg; } #endregion if (ModelState.IsValid && (TimePlanValidation || Continue)) { #region CreateRecord if (svm.PackingHeaderId == 0) { PackingHeader packingheader = Mapper.Map <PackingHeaderViewModel, PackingHeader>(svm); packingheader.CreatedDate = DateTime.Now; packingheader.ModifiedDate = DateTime.Now; packingheader.CreatedBy = User.Identity.Name; packingheader.ModifiedBy = User.Identity.Name; packingheader.Status = (int)StatusConstants.Drafted; _PackingHeaderService.Create(packingheader); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; PrepareViewBag(svm); ViewBag.Mode = "Add"; return(View("Create", svm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = packingheader.DocTypeId, DocId = packingheader.PackingHeaderId, ActivityType = (int)ActivityTypeContants.Added, DocNo = packingheader.DocNo, DocDate = packingheader.DocDate, DocStatus = packingheader.Status, })); return(RedirectToAction("Modify", new { id = packingheader.PackingHeaderId }).Success("Data saved Successfully")); } #endregion #region EditRecord else { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); PackingHeader packingheader = new PackingHeaderService(_unitOfWork).Find(svm.PackingHeaderId); PackingHeader ExRec = new PackingHeader(); ExRec = Mapper.Map <PackingHeader>(packingheader); StringBuilder logstring = new StringBuilder(); int status = packingheader.Status; if (packingheader.Status != (int)StatusConstants.Drafted) { packingheader.Status = (int)StatusConstants.Modified; } packingheader.DocNo = svm.DocNo; packingheader.DocDate = svm.DocDate; packingheader.BuyerId = svm.BuyerId; packingheader.GodownId = svm.GodownId; packingheader.DealUnitId = svm.DealUnitId; packingheader.Remark = svm.Remark; packingheader.JobWorkerId = svm.JobWorkerId; packingheader.BaleNoPattern = svm.BaleNoPattern; packingheader.ShipMethodId = svm.ShipMethodId; packingheader.ModifiedDate = DateTime.Now; packingheader.ModifiedBy = User.Identity.Name; _PackingHeaderService.Update(packingheader); LogList.Add(new LogTypeViewModel { ExObj = ExRec, Obj = packingheader, }); if (packingheader.StockHeaderId != null) { StockHeaderViewModel S = new StockHeaderViewModel(); S.StockHeaderId = (int)packingheader.StockHeaderId; S.DocTypeId = packingheader.DocTypeId; S.DocDate = packingheader.DocDate; S.DocNo = packingheader.DocNo; S.DivisionId = packingheader.DivisionId; S.SiteId = packingheader.SiteId; S.PersonId = packingheader.JobWorkerId; S.GodownId = packingheader.GodownId; S.Remark = packingheader.Remark; S.Status = packingheader.Status; S.ModifiedBy = packingheader.ModifiedBy; S.ModifiedDate = packingheader.ModifiedDate; new StockHeaderService(_unitOfWork).UpdateStockHeader(S); } XElement Modifications = new ModificationsCheckService().CheckChanges(LogList); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; ViewBag.Mode = "Edit"; return(View("Create", svm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = packingheader.DocTypeId, DocId = packingheader.PackingHeaderId, ActivityType = (int)ActivityTypeContants.Modified, DocNo = packingheader.DocNo, xEModifications = Modifications, DocDate = packingheader.DocDate, DocStatus = packingheader.Status, })); return(RedirectToAction("Index").Success("Data saved successfully")); } #endregion } PrepareViewBag(svm); ViewBag.Mode = "Add"; return(View("Create", svm)); }
public PackingHeader Create(PackingHeader s) { s.ObjectState = ObjectState.Added; _unitOfWork.Repository <PackingHeader>().Insert(s); return(s); }
public ActionResult Delete(ReasonViewModel vm) { if (ModelState.IsValid) { db.Configuration.AutoDetectChangesEnabled = false; PackingHeader Sd = (from H in db.PackingHeader where H.PackingHeaderId == vm.id select H).FirstOrDefault(); var PackingLine = (from L in db.PackingLine where L.PackingHeaderId == vm.id select L).ToList(); List <int> StockIdList = new List <int>(); int cnt = 0; foreach (var item in PackingLine) { if (item.StockIssueId != null) { StockIdList.Add((int)item.StockIssueId); } cnt = cnt + 1; try { item.ObjectState = Model.ObjectState.Deleted; db.PackingLine.Attach(item); db.PackingLine.Remove(item); } catch (Exception e) { string str = e.Message; } } foreach (var item in StockIdList) { if (item != null) { StockAdj Adj = (from L in db.StockAdj where L.StockOutId == item select L).FirstOrDefault(); if (Adj != null) { new StockAdjService(_unitOfWork).Delete(Adj); } new StockService(_unitOfWork).DeleteStockDB((int)item, ref db, true); } } int?StockHeaderId = null; StockHeaderId = Sd.StockHeaderId; Sd.ObjectState = Model.ObjectState.Deleted; db.PackingHeader.Attach(Sd); db.PackingHeader.Remove(Sd); if (StockHeaderId != null) { StockHeader StockHeader = (from H in db.StockHeader where H.StockHeaderId == StockHeaderId select H).FirstOrDefault(); StockHeader.ObjectState = Model.ObjectState.Deleted; db.StockHeader.Attach(StockHeader); db.StockHeader.Remove(StockHeader); } //Commit the DB try { db.SaveChanges(); db.Configuration.AutoDetectChangesEnabled = true; } catch (Exception ex) { string message = _exception.HandleException(ex); db.Configuration.AutoDetectChangesEnabled = true; TempData["CSEXC"] += message; PrepareViewBag(Sd.DocTypeId); return(PartialView("_Reason", vm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = Sd.DocTypeId, DocId = Sd.PackingHeaderId, ActivityType = (int)ActivityTypeContants.Deleted, UserRemark = vm.Reason, DocNo = Sd.DocNo, DocDate = Sd.DocDate, DocStatus = Sd.Status, })); return(Json(new { success = true })); } return(PartialView("_Reason", vm)); }
public void Delete(PackingHeader s) { _unitOfWork.Repository <PackingHeader>().Delete(s); }
public void Update(PackingHeader s) { s.ObjectState = ObjectState.Modified; _unitOfWork.Repository <PackingHeader>().Update(s); }
public ActionResult CreatePost(PackingHeaderViewModel vm) { #region DocTypeTimeLineValidation try { if (vm.PackingHeaderId <= 0) { TimePlanValidation = DocumentValidation.ValidateDocument(Mapper.Map <DocumentUniqueId>(vm), DocumentTimePlanTypeConstants.Create, User.Identity.Name, out ExceptionMsg, out Continue); } else { TimePlanValidation = DocumentValidation.ValidateDocument(Mapper.Map <DocumentUniqueId>(vm), DocumentTimePlanTypeConstants.Modify, User.Identity.Name, out ExceptionMsg, out Continue); } } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; TimePlanValidation = false; } if (!TimePlanValidation) { TempData["CSEXC"] += ExceptionMsg; } #endregion if (ModelState.IsValid && (TimePlanValidation || Continue)) { #region CreateRecord if (vm.PackingHeaderId == 0) { PackingHeader Packingheader = Mapper.Map <PackingHeaderViewModel, PackingHeader>(vm); Packingheader.BuyerId = vm.BuyerId; Packingheader.CreatedBy = User.Identity.Name; Packingheader.ModifiedBy = User.Identity.Name; Packingheader.CreatedDate = DateTime.Now; Packingheader.ModifiedDate = DateTime.Now; Packingheader.ObjectState = Model.ObjectState.Added; _PackingHeaderService.Create(Packingheader); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; PrepareViewBag(vm.DocTypeId); ViewBag.Mode = "Add"; return(View("Create", vm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = Packingheader.DocTypeId, DocId = Packingheader.PackingHeaderId, ActivityType = (int)ActivityTypeContants.Added, DocNo = Packingheader.DocNo, DocDate = Packingheader.DocDate, DocStatus = Packingheader.Status, })); return(RedirectToAction("Modify", new { id = Packingheader.PackingHeaderId }).Success("Data saved Successfully")); } #endregion #region EditRecord else { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); PackingHeader Packingheader = _PackingHeaderService.Find(vm.PackingHeaderId); PackingHeader ExRec = Mapper.Map <PackingHeader>(Packingheader); StockHeader StockHeader = new StockHeaderService(_unitOfWork).Find(Packingheader.StockHeaderId ?? 0); int status = Packingheader.Status; if (Packingheader.Status != (int)StatusConstants.Drafted) { Packingheader.Status = (int)StatusConstants.Modified; } Packingheader.DocNo = vm.DocNo; Packingheader.DocDate = vm.DocDate; Packingheader.BuyerId = vm.BuyerId; Packingheader.GodownId = vm.GodownId; Packingheader.Remark = vm.Remark; Packingheader.ModifiedDate = DateTime.Now; Packingheader.ModifiedBy = User.Identity.Name; _PackingHeaderService.Update(Packingheader); if (StockHeader != null) { StockHeader.DocDate = vm.DocDate; StockHeader.PersonId = vm.BuyerId; StockHeader.GodownId = vm.GodownId; StockHeader.Remark = vm.Remark; StockHeader.ModifiedDate = DateTime.Now; StockHeader.ModifiedBy = User.Identity.Name; new StockHeaderService(_unitOfWork).Update(StockHeader); } LogList.Add(new LogTypeViewModel { ExObj = ExRec, Obj = Packingheader, }); XElement Modifications = new ModificationsCheckService().CheckChanges(LogList); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; PrepareViewBag(vm.DocTypeId); ViewBag.Mode = "Edit"; return(View("Create", vm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = Packingheader.DocTypeId, DocId = Packingheader.PackingHeaderId, ActivityType = (int)ActivityTypeContants.Modified, DocNo = Packingheader.DocNo, xEModifications = Modifications, DocDate = Packingheader.DocDate, DocStatus = Packingheader.Status, })); return(RedirectToAction("Index", new { id = vm.DocTypeId }).Success("Data saved successfully")); } #endregion } PrepareViewBag(vm.DocTypeId); ViewBag.Mode = "Add"; return(View("Create", vm)); }