public ActionResult _Create(int Id) //Id ==>Sale Order Header Id { ProductContentHeader H = new ProductContentHeaderService(_unitOfWork).Find(Id); ProductContentLine s = new ProductContentLine(); s.ProductContentHeaderId = H.ProductContentHeaderId; return(PartialView("_Create", s)); }
public ActionResult _Edit(int id) { ProductContentLine temp = _ProductContentLineService.GetProductContentLine(id); if (temp == null) { return(HttpNotFound()); } return(PartialView("_Create", temp)); }
public ActionResult DeletePost(ProductContentLine vm) { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); ProductContentLine ProductContentLine = _ProductContentLineService.GetProductContentLine(vm.ProductContentLineId); LogList.Add(new LogTypeViewModel { ExObj = ProductContentLine, }); _ProductContentLineService.Delete(vm.ProductContentLineId); XElement Modifications = new ModificationsCheckService().CheckChanges(LogList); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(PartialView("EditLine", vm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.ProductContent).DocumentTypeId, DocId = vm.ProductContentHeaderId, DocLineId = vm.ProductContentLineId, ActivityType = (int)ActivityTypeContants.Deleted, xEModifications = Modifications, })); return(Json(new { success = true })); }
public ActionResult _CreatePost(ProductContentLine svm) { if (svm.ProductGroupId <= 0) { ModelState.AddModelError("ProductGroupId", "Please select ProductGroup"); } if (ModelState.IsValid) { if (svm.ProductContentLineId == 0) { svm.CreatedDate = DateTime.Now; svm.ModifiedDate = DateTime.Now; svm.CreatedBy = User.Identity.Name; svm.ModifiedBy = User.Identity.Name; svm.ObjectState = Model.ObjectState.Added; _ProductContentLineService.Create(svm); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(PartialView("_Create", svm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.ProductContent).DocumentTypeId, DocId = svm.ProductContentHeaderId, DocLineId = svm.ProductContentLineId, ActivityType = (int)ActivityTypeContants.Added, })); return(RedirectToAction("_Create", new { id = svm.ProductContentHeaderId })); } else { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); ProductContentLine temp1 = _ProductContentLineService.Find(svm.ProductContentLineId); ProductContentLine ExRec = Mapper.Map <ProductContentLine>(temp1); //End of Tracking the Modifications:: temp1.ProductGroupId = svm.ProductGroupId; temp1.ContentPer = svm.ContentPer; temp1.ModifiedDate = DateTime.Now; temp1.ModifiedBy = User.Identity.Name; _ProductContentLineService.Update(temp1); LogList.Add(new LogTypeViewModel { ExObj = ExRec, Obj = temp1, }); XElement Modifications = new ModificationsCheckService().CheckChanges(LogList); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(PartialView("_Create", svm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.ProductContent).DocumentTypeId, DocId = temp1.ProductContentHeaderId, DocLineId = temp1.ProductContentLineId, ActivityType = (int)ActivityTypeContants.Modified, xEModifications = Modifications, })); return(Json(new { success = true })); } } return(PartialView("_Create", svm)); }
public void Update(ProductContentLine s) { s.ObjectState = ObjectState.Modified; _unitOfWork.Repository <ProductContentLine>().Update(s); }
public void Delete(ProductContentLine s) { _unitOfWork.Repository <ProductContentLine>().Delete(s); }
public ProductContentLine Create(ProductContentLine S) { S.ObjectState = ObjectState.Added; _unitOfWork.Repository <ProductContentLine>().Insert(S); return(S); }