// GET: /LedgerHeader/Create public ActionResult Create(int id, int PersonId)//DocumentTypeId { CollectionViewModel p = new CollectionViewModel(); PropertyHeaderViewModel propertyheader = _PropertyHeaderService.GetPropertyHeader(PersonId); p = Mapper.Map <PropertyHeaderViewModel, CollectionViewModel>(propertyheader); p.DocDate = DateTime.Now; p.CreatedDate = DateTime.Now; p.DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; p.SiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; p.DocTypeId = id; p.AgentDocTypeId = Constants.DocumentTypeIdConstants.Agent; PrepareViewBag(id); var settings = _CollectionSettingsService.GetCollectionSettingsForDocument(id); p.CollectionSettings = Mapper.Map <CollectionSettings, CollectionSettingsViewModel>(settings); p.DocNo = _documentTypeService.FGetNewDocNo("DocNo", ConfigurationManager.AppSettings["DataBaseSchema"] + ".LedgerHeaders", p.DocTypeId, p.DocDate, p.DivisionId, p.SiteId); ViewBag.Mode = "Add"; ViewBag.Name = _documentTypeService.Find(id).DocumentTypeName; ViewBag.id = id; return(View(p)); }
public ActionResult Detail(int id, string IndexType, string transactionType, int?DocLineId) { if (DocLineId.HasValue) { ViewBag.DocLineId = DocLineId; } //Saving ViewBag Data:: ViewBag.transactionType = transactionType; ViewBag.IndexStatus = IndexType; PropertyHeaderViewModel s = _PropertyHeaderService.GetPropertyHeader(id); PrepareViewBag(s.DocTypeId); if (s == null) { return(HttpNotFound()); } if (String.IsNullOrEmpty(transactionType) || transactionType == "detail") { _PropertyHeaderService.LogDetailInfo(s); } return(View("Create", s)); }
private void PrepareViewBag(PropertyLineViewModel vm) { if (vm != null) { PropertyHeaderViewModel H = _PropertyHeaderService.GetPropertyHeader(vm.PersonId); ViewBag.DocNo = H.Code; } }
// GET: /Person/Edit/5 private ActionResult Edit(int id, string IndexType) { ViewBag.IndexStatus = IndexType; PropertyHeaderViewModel s = _PropertyHeaderService.GetPropertyHeader(id); #region DocTypeTimeLineValidation try { TimePlanValidation = _documentValidation.ValidateDocument(Mapper.Map <DocumentUniqueId>(s), 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 })); } List <DocumentTypeAttributeViewModel> tem = _PropertyHeaderService.GetAttributeForPerson(id).ToList(); s.DocumentTypeAttributes = tem; PrepareViewBag(s.DocTypeId); if (s == null) { return(HttpNotFound()); } ViewBag.Mode = "Edit"; ViewBag.transactionType = ""; ViewBag.Name = _documentTypeService.Find(s.DocTypeId).DocumentTypeName; ViewBag.id = s.DocTypeId; if (!(System.Web.HttpContext.Current.Request.UrlReferrer.PathAndQuery).Contains("Create")) { _PropertyHeaderService.LogDetailInfo(s); } return(View("Create", s)); }
// GET: /Person/Create public ActionResult Create(int id)//DocumentTypeId { PropertyHeaderViewModel p = new PropertyHeaderViewModel(); p.CreatedDate = DateTime.Now; p.DivisionIds = System.Web.HttpContext.Current.Session["DivisionId"].ToString(); p.SiteIds = System.Web.HttpContext.Current.Session["SiteId"].ToString(); p.DocTypeId = id; PrepareViewBag(id); List <DocumentTypeAttributeViewModel> tem = _PropertyHeaderService.GetAttributeForDocumentType(id).ToList(); p.DocumentTypeAttributes = tem; //p.Code = _PropertyHeaderService.FGetNewPersonCode(p.DocTypeId); ViewBag.Mode = "Add"; ViewBag.Name = _documentTypeService.Find(id).DocumentTypeName; ViewBag.id = id; return(View(p)); }
private ActionResult _Modify(int id) { PropertyLineViewModel temp = _PropertyLineService.GetProductBuyer(id); PropertyHeaderViewModel H = _PropertyHeaderService.GetPropertyHeader(temp.PersonId); //Getting Settings if (temp == null) { return(HttpNotFound()); } PrepareViewBag(temp); #region DocTypeTimeLineValidation try { TimePlanValidation = _validator.ValidateDocumentLine(new DocumentUniqueId { 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"; } return(PartialView("_Create", temp)); }
public ActionResult _Create(int Id, DateTime?date, bool?IsProdBased) //Id ==>Sale Order Header Id { PropertyHeaderViewModel H = _PropertyHeaderService.GetPropertyHeader(Id); PropertyLineViewModel s = new PropertyLineViewModel(); s.DateOfConsutruction = DateTime.Now.Date; s.WEF = DateTime.Now.Date; s.PersonId = H.PersonID; ViewBag.Status = H.Status; DiscountType D = _DiscountTypeService.Find("NA"); s.DiscountTypeId = D.DiscountTypeId; s.DiscountRate = D.Rate; PrepareViewBag(s); ViewBag.LineMode = "Create"; return(PartialView("_Create", s)); }
public ActionResult Post(PropertyHeaderViewModel svm) { bool BeforeSave = true; int SiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; svm.Code = _PropertyHeaderService.FGetNewPersonCode(SiteId, svm.GodownId, svm.BinLocationId); svm.Suffix = svm.Code; #region DocTypeTimeLineValidation try { if (svm.PersonID <= 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 && BeforeSave && (TimePlanValidation || Continue)) { //CreateLogic #region CreateRecord if (svm.PersonID <= 0) { try { _PropertyHeaderService.Create(svm, User.Identity.Name); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXC"] += message; PrepareViewBag(svm.DocTypeId); ViewBag.Mode = "Add"; return(View("Create", svm)); } return(RedirectToAction("Modify", "PropertyHeader", new { Id = svm.PersonID }).Success("Data saved successfully")); } #endregion //EditLogic #region EditRecord else { try { _PropertyHeaderService.Update(svm, User.Identity.Name); } catch (Exception ex) { string message = _exception.HandleException(ex); PrepareViewBag(svm.DocTypeId); TempData["CSEXC"] += message; ViewBag.id = svm.DocTypeId; ViewBag.Mode = "Edit"; return(View("Create", svm)); } return(RedirectToAction("Index", new { id = svm.DocTypeId }).Success("Data saved successfully")); } #endregion } PrepareViewBag(svm.DocTypeId); ViewBag.Mode = "Add"; return(View("Create", svm)); }