public ActionResult UpdateOpenBalance(OpenBal OpnBal) { RBACUser rUser = new RBACUser(Session["UserName"].ToString()); if (!rUser.HasPermission("GL_OpenBal_Update")) { return(Json("U", JsonRequestBehavior.AllowGet)); } var defAc = LoadDropDown.GetDefAc(); string eCode = ""; string isAsset = OpnBal.Accode.Substring(0, 1); if (isAsset == defAc.AssAc) { OpnBal.OpenBalance = OpnBal.OpenBalance; } else if (isAsset == defAc.LiaAc) { OpnBal.OpenBalance = OpnBal.OpenBalance * (-1); } using (var transaction = new TransactionScope()) { try { OpenBal UpOpnBal = new OpenBal(); UpOpnBal = _pR_OpenBalanceService.All().ToList().FirstOrDefault(x => x.Id == OpnBal.Id); if (UpOpnBal != null) { OpnBal.FinYear = Session["FinYear"].ToString(); Misclns.CopyPropertiesTo(OpnBal, UpOpnBal); _pR_OpenBalanceService.Update(UpOpnBal); _pR_OpenBalanceService.Save(); var THolidayID = UpOpnBal.Id; TransactionLogService.SaveTransactionLog(_transactionLogService, "OpenBal", "Update", THolidayID.ToString(), Session["UserName"].ToString()); eCode = "1"; } else { eCode = "2"; } transaction.Complete(); return(Json(eCode, JsonRequestBehavior.AllowGet)); } catch (Exception) { transaction.Dispose(); return(Json("0", JsonRequestBehavior.AllowGet)); } } }
public ActionResult Save(RateChart RateChart) { //RBACUser rUser = new RBACUser(Session["UserName"].ToString()); //if (!rUser.HasPermission("")) //{ // return Json("X", JsonRequestBehavior.AllowGet); //} string eCode = ""; using (var transaction = new TransactionScope()) { try { // query for check existing data and then if null go to transaction var objRateChart = _RateChartService.All().ToList() .Where(x => x.ItemCode == RateChart.ItemCode && x.CustCode == RateChart.CustCode).ToList(); //if (objRateChart.Count == 0) if (objRateChart.Count == 0) { RateChart SaveRateChart = new RateChart(); Misclns.CopyPropertiesTo(RateChart, SaveRateChart); _RateChartService.Add(SaveRateChart); _RateChartService.Save(); TransactionLogService.SaveTransactionLog(_transactionLogService, "RateChart", "Save", DateTime.Now.ToString(), Session["UserName"].ToString()); eCode = "1"; } else { eCode = "2"; } transaction.Complete(); return(Json(eCode, JsonRequestBehavior.AllowGet)); } catch (Exception) { transaction.Dispose(); return(Json("0", JsonRequestBehavior.AllowGet)); } } }
public ActionResult UpdateRateChart(RateChart RateChart) { RBACUser rUser = new RBACUser(Session["UserName"].ToString()); if (!rUser.HasPermission("GL_OpenBal_Update")) { return(Json("U", JsonRequestBehavior.AllowGet)); } string eCode = ""; // Checking and operation Data for save database using (var transaction = new TransactionScope()) { try { RateChart UpRateChart = new RateChart(); UpRateChart = _RateChartService.All().ToList().FirstOrDefault(x => x.RateChartId == RateChart.RateChartId); if (UpRateChart != null) { Misclns.CopyPropertiesTo(RateChart, UpRateChart); _RateChartService.Update(UpRateChart); _RateChartService.Save(); eCode = "1"; } else { eCode = "2"; } transaction.Complete(); return(Json(eCode, JsonRequestBehavior.AllowGet)); } catch (Exception) { transaction.Dispose(); return(Json("0", JsonRequestBehavior.AllowGet)); } } }
public ActionResult SaveVM_BIN(VM_BIN VM_BIN) { //RBACUser rUser = new RBACUser(Session["UserName"].ToString()); //if (!rUser.HasPermission("GL_VM_BIN_Insert")) //{ // return Json("X", JsonRequestBehavior.AllowGet); //} string eCode = ""; if (VM_BIN.ProjCode == "-1") { VM_BIN.ProjCode = "1"; } if (VM_BIN.BranchCode == "-1") { VM_BIN.BranchCode = "1"; } //string proj = VM_BIN.ProjCode.Substring(0, 1); using (var transaction = new TransactionScope()) { try { // query for check existing data and then if null go to transaction var objVM_BIN = _pR_VM_BINService.All() .Where(x => x.ProjCode == VM_BIN.ProjCode && x.BranchCode == VM_BIN.BranchCode).ToList(); if (objVM_BIN.Count == 0) { VM_BIN SaveVM_BIN = new VM_BIN(); Misclns.CopyPropertiesTo(VM_BIN, SaveVM_BIN); if (SaveVM_BIN.ProjCode == "-1") { SaveVM_BIN.ProjCode = "1"; } if (SaveVM_BIN.BranchCode == "-1") { SaveVM_BIN.BranchCode = "1"; } _pR_VM_BINService.Add(SaveVM_BIN); _pR_VM_BINService.Save(); var VM_BINID = 1; // not defined TransactionLogService.SaveTransactionLog(_transactionLogService, "SaveVM_BIN", "Save", VM_BINID.ToString(), Session["UserName"].ToString()); eCode = "1"; } else { eCode = "2"; } transaction.Complete(); return(Json(eCode, JsonRequestBehavior.AllowGet)); } catch (Exception) { transaction.Dispose(); return(Json("0", JsonRequestBehavior.AllowGet)); } } }