public ActionResult _Create(int Id) //Id ==>Product Id { ChargeGroupPersonCalculationViewModel s = new ChargeGroupPersonCalculationViewModel(); s.ChargeGroupPersonId = Id; PrepareViewBag(s); return(PartialView("_Create", s)); }
public ActionResult DeletePost(ChargeGroupPersonCalculationViewModel vm) { ChargeGroupPersonCalculation ChargeGroupPersonCalculation = _ChargeGroupPersonCalculationService.Find(vm.ChargeGroupPersonCalculationId); _ChargeGroupPersonCalculationService.Delete(vm.ChargeGroupPersonCalculationId); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(PartialView("EditSize", vm)); } return(Json(new { success = true })); }
public ChargeGroupPersonCalculationViewModel GetChargeGroupPersonCalculationForEdit(int id) { ChargeGroupPersonCalculationViewModel Vm = (from H in db.ChargeGroupPersonCalculation where H.ChargeGroupPersonCalculationId == id select new ChargeGroupPersonCalculationViewModel { ChargeGroupPersonCalculationId = H.ChargeGroupPersonCalculationId, DocTypeId = H.DocTypeId, DocTypeName = H.DocType.DocumentTypeName, ChargeGroupPersonId = H.ChargeGroupPersonId, ChargeGroupPersonName = H.ChargeGroupPerson.ChargeGroupPersonName, CalculationId = H.CalculationId, CalculationName = H.Calculation.CalculationName, SiteId = H.SiteId, SiteName = H.Site.SiteName, DivisionId = H.DivisionId, DivisionName = H.Division.DivisionName, CreatedBy = H.CreatedBy, ModifiedBy = H.ModifiedBy }).FirstOrDefault(); return(Vm); }
public ActionResult _CreatePost(ChargeGroupPersonCalculationViewModel svm) { if (ModelState.IsValid) { if (svm.ChargeGroupPersonCalculationId == 0) { ChargeGroupPersonCalculation ChargeGroupPersonCalculation = new ChargeGroupPersonCalculation(); ChargeGroupPersonCalculation.ChargeGroupPersonId = svm.ChargeGroupPersonId; ChargeGroupPersonCalculation.DocTypeId = svm.DocTypeId; ChargeGroupPersonCalculation.DivisionId = svm.DivisionId; ChargeGroupPersonCalculation.SiteId = svm.SiteId; ChargeGroupPersonCalculation.CalculationId = svm.CalculationId; ChargeGroupPersonCalculation.CreatedDate = DateTime.Now; ChargeGroupPersonCalculation.ModifiedDate = DateTime.Now; ChargeGroupPersonCalculation.CreatedBy = User.Identity.Name; ChargeGroupPersonCalculation.ModifiedBy = User.Identity.Name; ChargeGroupPersonCalculation.ObjectState = Model.ObjectState.Added; _ChargeGroupPersonCalculationService.Create(ChargeGroupPersonCalculation); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(PartialView("_Create", svm)); } return(RedirectToAction("_Create", new { id = svm.ChargeGroupPersonId })); } else { ChargeGroupPersonCalculation ChargeGroupPersonCalculation = _ChargeGroupPersonCalculationService.Find(svm.ChargeGroupPersonCalculationId); StringBuilder logstring = new StringBuilder(); ChargeGroupPersonCalculation.ChargeGroupPersonId = svm.ChargeGroupPersonId; ChargeGroupPersonCalculation.DocTypeId = svm.DocTypeId; ChargeGroupPersonCalculation.DivisionId = svm.DivisionId; ChargeGroupPersonCalculation.SiteId = svm.SiteId; ChargeGroupPersonCalculation.CalculationId = svm.CalculationId; ChargeGroupPersonCalculation.ModifiedDate = DateTime.Now; ChargeGroupPersonCalculation.ModifiedBy = User.Identity.Name; ChargeGroupPersonCalculation.ObjectState = Model.ObjectState.Modified; _ChargeGroupPersonCalculationService.Update(ChargeGroupPersonCalculation); //Saving the Activity Log ActivityLog al = new ActivityLog() { ActivityType = (int)ActivityTypeContants.Modified, DocId = ChargeGroupPersonCalculation.ChargeGroupPersonCalculationId, CreatedDate = DateTime.Now, Narration = logstring.ToString(), CreatedBy = User.Identity.Name, //DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(TransactionDocCategoryConstants.ChargeGroupPersonCalculation).DocumentTypeId, }; new ActivityLogService(_unitOfWork).Create(al); //End of Saving the Activity Log try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(PartialView("_Create", svm)); } return(Json(new { success = true })); } } PrepareViewBag(svm); return(PartialView("_Create", svm)); }
private void PrepareViewBag(ChargeGroupPersonCalculationViewModel svm) { }