public ActionResult DeletePost(CalculationHeaderLedgerAccountViewModel vm) { CalculationHeaderLedgerAccount CalculationHeaderLedgerAccount = _CalculationHeaderLedgerAccountService.Find(vm.CalculationHeaderLedgerAccountId); _CalculationHeaderLedgerAccountService.Delete(CalculationHeaderLedgerAccount); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(PartialView("_Create", vm)); } return(Json(new { success = true })); }
public ActionResult _CreatePost(CalculationHeaderLedgerAccountViewModel svm) { CalculationHeaderLedgerAccount s = Mapper.Map <CalculationHeaderLedgerAccountViewModel, CalculationHeaderLedgerAccount>(svm); if (ModelState.IsValid) { if (svm.CalculationHeaderLedgerAccountId <= 0) { s.CreatedDate = DateTime.Now; s.ModifiedDate = DateTime.Now; s.CreatedBy = User.Identity.Name; s.ModifiedBy = User.Identity.Name; s.SiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; s.DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; s.ObjectState = Model.ObjectState.Added; _CalculationHeaderLedgerAccountService.Create(s); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); return(PartialView("_Create", svm)); } return(Json(new { success = true })); //return RedirectToAction("_Create", new { CalculationId = s.CalculationId, DocTypeId=s.DocTypeId }); } else { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); CalculationHeaderLedgerAccount temp1 = _CalculationHeaderLedgerAccountService.Find(svm.CalculationHeaderLedgerAccountId); CalculationHeaderLedgerAccount ExRec = Mapper.Map <CalculationHeaderLedgerAccount>(temp1); temp1.CalculationFooterId = s.CalculationFooterId; temp1.CostCenterId = s.CostCenterId; temp1.LedgerAccountCrId = s.LedgerAccountCrId; temp1.LedgerAccountDrId = s.LedgerAccountDrId; temp1.ContraLedgerAccountId = s.ContraLedgerAccountId; temp1.ModifiedDate = DateTime.Now; temp1.ModifiedBy = User.Identity.Name; temp1.ObjectState = Model.ObjectState.Modified; _CalculationHeaderLedgerAccountService.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(new DocumentTypeService(_unitOfWork).Find(MasterDocTypeConstants.CalculationLedgerAccount).DocumentTypeId, //temp1.CalculationHeaderLedgerAccountId, //null, //(int)ActivityTypeContants.Modified, //"", //User.Identity.Name, "", Modifications); return(Json(new { success = true })); } } return(PartialView("_Create", svm)); }
public void Update(CalculationHeaderLedgerAccount pt) { pt.ObjectState = ObjectState.Modified; _unitOfWork.Repository <CalculationHeaderLedgerAccount>().Update(pt); }
public CalculationHeaderLedgerAccount Add(CalculationHeaderLedgerAccount pt) { _unitOfWork.Repository <CalculationHeaderLedgerAccount>().Insert(pt); return(pt); }
public void Delete(CalculationHeaderLedgerAccount pt) { _unitOfWork.Repository <CalculationHeaderLedgerAccount>().Delete(pt); }
public CalculationHeaderLedgerAccount Create(CalculationHeaderLedgerAccount pt) { pt.ObjectState = ObjectState.Added; _unitOfWork.Repository <CalculationHeaderLedgerAccount>().Insert(pt); return(pt); }
public void Update(CalculationHeaderLedgerAccount pt) { pt.ObjectState = ObjectState.Modified; _CalculationHeaderLedgerAccountRepository.Update(pt); }
public void Delete(CalculationHeaderLedgerAccount pt) { _CalculationHeaderLedgerAccountRepository.Delete(pt); }
public CalculationHeaderLedgerAccount Create(CalculationHeaderLedgerAccount pt) { pt.ObjectState = ObjectState.Added; _CalculationHeaderLedgerAccountRepository.Add(pt); return(pt); }