public bool CheckForChargeGroupPersonCalculationExists(int DocTypeId, int?ChargeGroupPersonId, int?SiteId, int?DivisionId) { ChargeGroupPersonCalculation Vm = (from H in db.ChargeGroupPersonCalculation where H.DocTypeId == DocTypeId && H.ChargeGroupPersonId == ChargeGroupPersonId && H.SiteId == SiteId && H.DivisionId == DivisionId select H).FirstOrDefault(); if (Vm != null) { return(true); } else { return(false); } }
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 void Update(ChargeGroupPersonCalculation pt) { pt.ObjectState = ObjectState.Modified; _unitOfWork.Repository <ChargeGroupPersonCalculation>().Update(pt); }
public void Delete(ChargeGroupPersonCalculation pt) { _unitOfWork.Repository <ChargeGroupPersonCalculation>().Delete(pt); }
public ChargeGroupPersonCalculation Create(ChargeGroupPersonCalculation pt) { pt.ObjectState = ObjectState.Added; _unitOfWork.Repository <ChargeGroupPersonCalculation>().Insert(pt); return(pt); }
public ChargeGroupPersonCalculation Add(ChargeGroupPersonCalculation pt) { _unitOfWork.Repository <ChargeGroupPersonCalculation>().Insert(pt); return(pt); }
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)); }