public ActionResult Create(int?LedgerAccountGroupId, int?LedgerAccountId, string returnUrl) { if (LedgerAccountGroupId.HasValue && LedgerAccountGroupId.Value > 0) { System.Web.HttpContext.Current.Session["LedgerAccountGroupId"] = LedgerAccountGroupId.Value; } if (LedgerAccountId.HasValue && LedgerAccountId.Value > 0) { System.Web.HttpContext.Current.Session["LedgerAccountId"] = LedgerAccountId.Value; } if (returnUrl != null) { System.Web.HttpContext.Current.Session["returnUrl"] = returnUrl; } string UserName = User.Identity.Name; var Settings = _TrialBalanceSettingService.GetTrailBalanceSetting(UserName); PrepareViewBag(); if (Settings == null) { TrialBalanceSetting settings = new TrialBalanceSetting(); settings.UserName = UserName; settings.ToDate = DateTime.Now; settings.SiteIds = Convert.ToString((int)System.Web.HttpContext.Current.Session["SiteId"]); settings.FromDate = new DocumentTypeService(_unitOfWork).GetFinYearStart(); return(View("Create", settings)); } else { return(View("Create", Settings)); } }
public ActionResult CreatePost(TrialBalanceSetting vm) { int? LedgerAccountGroupId = null; int? LedgerAccountId = null; string returnUrl = ""; if (System.Web.HttpContext.Current.Session["LedgerAccountGroupId"] != null) { LedgerAccountGroupId = (int)System.Web.HttpContext.Current.Session["LedgerAccountGroupId"]; } if (System.Web.HttpContext.Current.Session["LedgerAccountId"] != null) { LedgerAccountId = (int)System.Web.HttpContext.Current.Session["LedgerAccountId"]; } if (System.Web.HttpContext.Current.Session["returnUrl"] != null) { returnUrl = (string)System.Web.HttpContext.Current.Session["returnUrl"]; } if (!vm.FromDate.HasValue) { ModelState.AddModelError("FromDate", "From date field is required."); } if (!vm.ToDate.HasValue) { ModelState.AddModelError("ToDate", "To date field is required."); } if (ModelState.IsValid) { if (vm.TrialBalanceSettingId <= 0) { vm.ObjectState = Model.ObjectState.Added; _TrialBalanceSettingService.Create(vm); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); PrepareViewBag(); return(View("Create", vm)); } //System.Web.HttpContext.Current.Session.Remove("LedgerAccountGroupId"); //System.Web.HttpContext.Current.Session.Remove("LedgerAccountId"); return(Redirect(System.Configuration.ConfigurationManager.AppSettings["CurrentDomain"] + returnUrl)); //if (LedgerAccountGroupId.HasValue && LedgerAccountGroupId.Value > 0) // return RedirectToAction("GetSubTrialBalance", "TrialBalance", new { id = LedgerAccountGroupId }).Success("Data saved successfully"); //else if (LedgerAccountId.HasValue && LedgerAccountId.Value > 0) // return RedirectToAction("GetLedgerBalance", "TrialBalance", new { id = LedgerAccountId }).Success("Data saved successfully"); //else // return RedirectToAction("GetTrialBalance", "TrialBalance").Success("Data saved successfully"); } else { vm.ObjectState = Model.ObjectState.Modified; _TrialBalanceSettingService.Update(vm); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); PrepareViewBag(); return(View("Create", vm)); } //System.Web.HttpContext.Current.Session.Remove("LedgerAccountGroupId"); //System.Web.HttpContext.Current.Session.Remove("LedgerAccountId"); return(Redirect(System.Configuration.ConfigurationManager.AppSettings["CurrentDomain"] + returnUrl)); //if (LedgerAccountGroupId.HasValue && LedgerAccountGroupId.Value > 0) // return RedirectToAction("GetSubTrialBalance", "TrialBalance", new { id = LedgerAccountGroupId }).Success("Data saved successfully"); //else if (LedgerAccountId.HasValue && LedgerAccountId.Value > 0) // return RedirectToAction("GetLedgerBalance", "TrialBalance", new { id = LedgerAccountId }).Success("Data saved successfully"); //else // return RedirectToAction("GetTrialBalance", "TrialBalance").Success("Data saved successfully"); } } else { PrepareViewBag(); return(View("Create", vm)); } }
public TrialBalanceSetting Add(TrialBalanceSetting pt) { _unitOfWork.Repository <TrialBalanceSetting>().Insert(pt); return(pt); }
public void Update(TrialBalanceSetting pt) { pt.ObjectState = ObjectState.Modified; _unitOfWork.Repository <TrialBalanceSetting>().Update(pt); }
public void Delete(TrialBalanceSetting pt) { _unitOfWork.Repository <TrialBalanceSetting>().Delete(pt); }
public TrialBalanceSetting Create(TrialBalanceSetting pt) { pt.ObjectState = ObjectState.Added; _unitOfWork.Repository <TrialBalanceSetting>().Insert(pt); return(pt); }