public ActionResult Edit(AccountValueViewModel model) { if (ModelState.IsValid) { try { if (model.Value.Length != model.ValueChar) { ModelState.AddModelError("Error", "Invalid Value character length."); } else if (model.StartDate != null && model.StartDate > model.EndDate) { ModelState.AddModelError("Error", "End Date should be greater than StartDate."); } else { string result = AccountValueHelper.SaveChartOfAccountValue(model); return(RedirectToAction("Index", new { id = SessionHelper.SOBId })); } } catch (Exception ex) { ModelState.AddModelError("Error", ex.InnerException.InnerException.Message); } } return(View(model)); }
public ActionResult Edit(string id) { AccountCreateViewModel model = AccountHelper.GetAccount(id); List <AccountValueViewModel> accountValues = AccountValueHelper.GetAccountValuesbyChartId(Convert.ToInt64(id), SessionHelper.SOBId); if (accountValues.Any()) { throw new Exception("Edit Error", new Exception { Source = "Accounts having values cannot be edited" }); } List <Core.Entities.CodeCombinition> codeCombinitions = CodeCombinationHelper.GetCodeCombinations(model.SOBId, AuthenticationHelper.CompanyId.Value); if (codeCombinitions.Any()) { throw new Exception("Edit Error", new Exception { Source = "Accounts having code combinitions cannot be edited" }); } model.SOBId = SessionHelper.SOBId; return(View(model)); }
public ActionResult Delete(string id) { if (!AccountValueHelper.CheckAccountValue(id)) { throw new Exception("Delete Error", new Exception { Source = "Values having code combinitions cannot be deleted" }); } AccountValueHelper.Delete(id); return(RedirectToAction("Index", new { id = SessionHelper.SOBId })); }
public ActionResult AccountValuesPartial(string segment) { if (string.IsNullOrEmpty(segment)) { segment = SessionHelper.SelectedValue; } else { SessionHelper.SelectedValue = segment; } List <AccountValueViewModel> accountValuesList = AccountValueHelper.GetAccountValues(AccountHelper.GetAccountBySOBId(SessionHelper.SOBId.ToString()).Id, SessionHelper.SOBId, segment); return(PartialView("_List", accountValuesList)); }
public ActionResult Edit(string id) { if (!AccountValueHelper.CheckAccountValue(id)) { throw new Exception("Edit Error", new Exception { Source = "Values having code combinitions cannot be edited" }); } AccountValueViewModel model = AccountValueHelper.GetAccountValue(id); model.SetOfBook = SetOfBookHelper.GetSetOfBook(SessionHelper.SOBId.ToString()).Name; model.ValueChar = AccountHelper.GetSegmentCharacters(model.Segment, AccountHelper.GetAccountBySOBId(SessionHelper.SOBId.ToString())); return(View(model)); }
public ActionResult Delete(string id) { List <AccountValueViewModel> accountValues = AccountValueHelper.GetAccountValuesbyChartId(Convert.ToInt64(id), SessionHelper.SOBId); if (accountValues.Any()) { throw new Exception("Delete Error", new Exception { Source = "Accounts having values cannot be deleted" }); } List <Core.Entities.CodeCombinition> codeCombinitions = CodeCombinationHelper.GetCodeCombinations(SessionHelper.SOBId, AuthenticationHelper.CompanyId.Value); if (codeCombinitions.Any()) { throw new Exception("Delete Error", new Exception { Source = "Accounts having code combinitions cannot be edited" }); } AccountHelper.Delete(id); return(RedirectToAction("Index")); }