public ActionResult Reviewed(int Id, string IndexType, string UserRemark, string IsContinue) { DispatchWaybillHeader pd = new DispatchWaybillHeaderService(_unitOfWork).Find(Id); if (ModelState.IsValid) { pd.ReviewCount = (pd.ReviewCount ?? 0) + 1; pd.ReviewBy += User.Identity.Name + ", "; _DispatchWaybillHeaderService.Update(pd); _unitOfWork.Save(); LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = pd.DocTypeId, DocId = pd.DispatchWaybillHeaderId, ActivityType = (int)ActivityTypeContants.Reviewed, UserRemark = UserRemark, DocNo = pd.DocNo, DocDate = pd.DocDate, DocStatus = pd.Status, })); return(RedirectToAction("Index", new { id = pd.DocTypeId, IndexType = IndexType }).Success("Record reviewed successfully.")); } return(RedirectToAction("Index", new { id = pd.DocTypeId, IndexType = IndexType }).Warning("Error in reviewing.")); }
public ActionResult _Create(int Id) //Id ==>Sale Invoice Header Id { DispatchWaybillHeader H = new DispatchWaybillHeaderService(_unitOfWork).GetDispatchWaybillHeader(Id); DispatchWaybillLineViewModel s = new DispatchWaybillLineViewModel(); s.DispatchWaybillHeaderId = H.DispatchWaybillHeaderId; ViewBag.DocNo = H.DocNo; ViewBag.Status = H.Status; PrepareViewBag(null); ViewBag.LineMode = "Create"; return(PartialView("_Create", s)); }
public ActionResult DeletePost(DispatchWaybillLineViewModel vm) { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); DispatchWaybillLine DispatchWaybillLine = _DispatchWaybillLineService.GetDispatchWaybillLineForLineId(vm.DispatchWaybillLineId); LogList.Add(new LogTypeViewModel { Obj = Mapper.Map <JobOrderLine>(DispatchWaybillLine), }); _DispatchWaybillLineService.Delete(vm.DispatchWaybillLineId); DispatchWaybillHeader DispatchWaybillheader = new DispatchWaybillHeaderService(_unitOfWork).Find(DispatchWaybillLine.DispatchWaybillHeaderId); if (DispatchWaybillheader.Status != (int)StatusConstants.Drafted) { DispatchWaybillheader.Status = (int)StatusConstants.Modified; new DispatchWaybillHeaderService(_unitOfWork).Update(DispatchWaybillheader); } XElement Modifications = new ModificationsCheckService().CheckChanges(LogList); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXCL"] += message; ViewBag.LineMode = "Delete"; return(PartialView("_Create", vm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = DispatchWaybillheader.DocTypeId, DocId = DispatchWaybillheader.DispatchWaybillHeaderId, DocLineId = DispatchWaybillLine.DispatchWaybillLineId, ActivityType = (int)ActivityTypeContants.Deleted, DocNo = DispatchWaybillheader.DocNo, xEModifications = Modifications, DocDate = DispatchWaybillheader.DocDate, DocStatus = DispatchWaybillheader.Status, })); return(Json(new { success = true })); }
private ActionResult _Modify(int id) { DispatchWaybillLine temp = _DispatchWaybillLineService.GetDispatchWaybillLineForLineId(id); if (temp == null) { return(HttpNotFound()); } #region DocTypeTimeLineValidation try { TimePlanValidation = DocumentValidation.ValidateDocumentLine(new DocumentUniqueId { LockReason = temp.LockReason }, User.Identity.Name, out ExceptionMsg, out Continue); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXCL"] += message; TimePlanValidation = false; } if (!TimePlanValidation) { TempData["CSEXCL"] += ExceptionMsg; } #endregion if ((TimePlanValidation || Continue)) { ViewBag.LineMode = "Edit"; } DispatchWaybillHeader H = new DispatchWaybillHeaderService(_unitOfWork).GetDispatchWaybillHeader(temp.DispatchWaybillHeaderId); ViewBag.DocNo = H.DocNo; DispatchWaybillLineViewModel s = _DispatchWaybillLineService.GetDispatchWaybillLineViewModelForLineId(id); PrepareViewBag(s); return(PartialView("_Create", s)); }
public ActionResult Submitted(int Id, string IndexType, string UserRemark, string IsContinue) { DispatchWaybillHeader pd = new DispatchWaybillHeaderService(_unitOfWork).Find(Id); if (ModelState.IsValid) { if (User.Identity.Name == pd.ModifiedBy || UserRoles.Contains("Admin")) { pd.Status = (int)StatusConstants.Submitted; pd.ReviewBy = null; _DispatchWaybillHeaderService.Update(pd); _unitOfWork.Save(); LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = pd.DocTypeId, DocId = pd.DispatchWaybillHeaderId, ActivityType = pd.Status, UserRemark = UserRemark, DocNo = pd.DocNo, DocDate = pd.DocDate, DocStatus = pd.Status, })); //SendEmail_PODrafted(Id); return(RedirectToAction("Index", new { id = pd.DocTypeId, IndexType = IndexType }).Success("Record Submitted successfully.")); } else { return(RedirectToAction("Index", new { id = pd.DocTypeId, IndexType = IndexType }).Warning("Record can be submitted by user " + pd.ModifiedBy + " only.")); } } return(View()); }
public ActionResult _CreatePost(DispatchWaybillLineViewModel svm) { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); DispatchWaybillHeader DispatchWaybillheader = new DispatchWaybillHeaderService(_unitOfWork).Find(svm.DispatchWaybillHeaderId); string DataValidationMsg = DataValidation(svm); if (DataValidationMsg != "") { PrepareViewBag(svm); TempData["CSEXCL"] += DataValidationMsg; return(PartialView("_Create", svm)); } if (svm.DispatchWaybillLineId <= 0) { ViewBag.LineMode = "Create"; } else { ViewBag.LineMode = "Edit"; } if (ModelState.IsValid) { if (svm.DispatchWaybillLineId == 0) { DispatchWaybillLine DispatchWaybillline = Mapper.Map <DispatchWaybillLineViewModel, DispatchWaybillLine>(svm); DispatchWaybillline.CreatedDate = DateTime.Now; DispatchWaybillline.ModifiedDate = DateTime.Now; DispatchWaybillline.CreatedBy = User.Identity.Name; DispatchWaybillline.ModifiedBy = User.Identity.Name; DispatchWaybillline.ObjectState = Model.ObjectState.Added; _DispatchWaybillLineService.Create(DispatchWaybillline); if (DispatchWaybillheader.Status != (int)StatusConstants.Drafted) { DispatchWaybillheader.Status = (int)StatusConstants.Modified; new DispatchWaybillHeaderService(_unitOfWork).Update(DispatchWaybillheader); } try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXCL"] += message; return(PartialView("_Create", svm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = DispatchWaybillheader.DocTypeId, DocId = DispatchWaybillheader.DispatchWaybillHeaderId, DocLineId = DispatchWaybillline.DispatchWaybillLineId, ActivityType = (int)ActivityTypeContants.Added, DocNo = DispatchWaybillheader.DocNo, DocDate = DispatchWaybillheader.DocDate, DocStatus = DispatchWaybillheader.Status, })); return(RedirectToAction("_Create", new { id = DispatchWaybillline.DispatchWaybillHeaderId })); } else { DispatchWaybillLine DispatchWaybillline = _DispatchWaybillLineService.GetDispatchWaybillLineForLineId(svm.DispatchWaybillLineId); int status = DispatchWaybillheader.Status; DispatchWaybillLine ExTempLine = new DispatchWaybillLine(); ExTempLine = Mapper.Map <DispatchWaybillLine>(DispatchWaybillline); DispatchWaybillline.ReceiveDateTime = svm.ReceiveDateTime; DispatchWaybillline.ReceiveRemark = svm.ReceiveRemark; DispatchWaybillline.ForwardingDateTime = svm.ForwardingDateTime; DispatchWaybillline.ForwardedBy = svm.ForwardedBy; DispatchWaybillline.ForwardingRemark = svm.ForwardingRemark; DispatchWaybillline.ModifiedDate = DateTime.Now; DispatchWaybillline.ModifiedBy = User.Identity.Name; _DispatchWaybillLineService.Update(DispatchWaybillline); DispatchWaybillheader.Status = (int)StatusConstants.Modified; new DispatchWaybillHeaderService(_unitOfWork).Update(DispatchWaybillheader); LogList.Add(new LogTypeViewModel { ExObj = ExTempLine, Obj = DispatchWaybillline }); XElement Modifications = new ModificationsCheckService().CheckChanges(LogList); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXCL"] += message; return(PartialView("_Create", svm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = DispatchWaybillheader.DocTypeId, DocId = DispatchWaybillheader.DispatchWaybillHeaderId, DocLineId = DispatchWaybillline.DispatchWaybillLineId, ActivityType = (int)ActivityTypeContants.Modified, DocNo = DispatchWaybillheader.DocNo, xEModifications = Modifications, DocDate = DispatchWaybillheader.DocDate, DocStatus = DispatchWaybillheader.Status, })); return(Json(new { success = true })); } } ViewBag.Status = DispatchWaybillheader.Status; PrepareViewBag(svm); return(PartialView("_Create", svm)); }