private void PrepareViewBag(PropertyLineViewModel vm) { if (vm != null) { PropertyHeaderViewModel H = _PropertyHeaderService.GetPropertyHeader(vm.PersonId); ViewBag.DocNo = H.Code; } }
private ActionResult _Delete(int id) { PropertyLineViewModel temp = _PropertyLineService.GetProductBuyer(id); Person H = _PropertyHeaderService.Find(temp.PersonId); //Getting Settings if (temp == null) { return(HttpNotFound()); } PrepareViewBag(temp); //ViewBag.LineMode = "Delete"; #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 = "Delete"; } 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)); }
//[ValidateAntiForgeryToken] public ActionResult DeletePost(PropertyLineViewModel vm) { bool BeforeSave = true; if (BeforeSave) { try { _PropertyLineService.Delete(vm, User.Identity.Name); } catch (Exception ex) { string message = _exception.HandleException(ex); TempData["CSEXCL"] += message; PrepareViewBag(vm); ViewBag.LineMode = "Delete"; return(PartialView("_Create", vm)); } } return(Json(new { success = true })); }
//[ValidateAntiForgeryToken] public ActionResult _CreatePost(PropertyLineViewModel svm, string BulkMode) { bool BeforeSave = true; Person temp = _PropertyHeaderService.Find(svm.PersonId); //if (_PropertyLineService.IsDuplicateLine(svm.PersonId,svm.ProductId, svm.Dimension1Id, svm.ProductBuyerId)) // ModelState.AddModelError("ProductId", "Product is already entered in Property."); ViewBag.Status = temp.Status; if (svm.ProductBuyerId <= 0) { ViewBag.LineMode = "Create"; } else { ViewBag.LineMode = "Edit"; } if (ModelState.IsValid && BeforeSave) { if (svm.ProductBuyerId <= 0) { try { _PropertyLineService.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.PersonId })); } else { try { _PropertyLineService.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)); }