public async Task <IActionResult> Edit(int id, [Bind("ModelId,TypeId,ModelName,Status,CreateBy,CreateDate,UpdateBy,UpdateDate")] MasterModels masterModels) { if (id != masterModels.ModelId) { return(NotFound()); } if (ModelState.IsValid) { try { int userId = int.Parse(masterModels.UpdateBy); masterModels.UpdateDate = DateTime.Now; masterModels.UpdateBy = _context.Users.SingleOrDefault(p => p.UserId == userId).UserName; _context.Update(masterModels); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MasterModelsExists(masterModels.ModelId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(nameof(Edit), masterModels)); }
public ActionResult ExpenseReport() { int paymentType = (int)PaymentTypes.Expense; ViewData.Model = MasterModels.GetPaymentList(paymentType); return(View()); }
public ActionResult ExpenseReport(string searchText) { int paymentType = (int)PaymentTypes.Expense; if (Request.IsAjaxRequest()) { return(PartialView("PaymentListUserControl", MasterModels.GetPaymentList(paymentType))); } return(View()); }
public ActionResult EditExpense(int id) { if (Session["ClientId"] != null) { int paymentType = 0; ViewData.Model = MasterModels.GetPaymentDetailsById(id, out paymentType); ViewData["ExpenseHeads"] = Utilities.GetExpenseHeadNameList((int)Session["ClientId"], paymentType); if (paymentType > 0) { switch (paymentType) { case 1: Session["LedgerType"] = "Expense"; break; case 2: Session["LedgerType"] = "Income"; break; } } if (!Roles.IsUserInRole("CenterManager")) { if (Session["RegionId"] != null) { ViewData["Branches"] = Utilities.GetBranchNameList((int)Session["ClientId"], (int)Session["RegionId"]); } else { ViewData["Branches"] = Utilities.GetBranchNameList((int)Session["ClientId"]); } } else { if (Session["BranchId"] != null) { ViewData["Branches"] = null;// Utilities.GetBlankBranchNameList(); } else { return(RedirectToAction("LogOff", "Account")); } } } else { if (Roles.IsUserInRole("SuperAdmin")) { return(RedirectToAction("List", "Client")); } } ViewData["PaymentModes"] = Utilities.GetPaymentModesNameList(); return(View()); }
public async Task <IActionResult> Create([Bind("ModelId,TypeId,ModelName,Status,CreateBy,CreateDate")] MasterModels masterModels) { int userId = int.Parse(masterModels.CreateBy); masterModels.CreateDate = DateTime.Now; masterModels.CreateBy = _context.Users.SingleOrDefault(p => p.UserId == userId).UserName; if (ModelState.IsValid) { _context.Add(masterModels); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(masterModels)); }
public ActionResult Ledgers(FormCollection form, EXPENSESHEAD ledger) { ViewData["LedgerTypes"] = Utilities.GetLedgerNameList(0); if (Session["ClientId"] != null) { ledger.ClientId = (int)Session["ClientId"]; ledger.OP_BAL = 0; if (!ModelState.IsValid) { ViewData["Message"] = "Missing entries. Please check and try again."; return(View()); } if (ledger.LedgerTypeId != null && !string.IsNullOrEmpty(ledger.CODE) && !string.IsNullOrEmpty(ledger.NAME)) { if (MasterModels.CreateLedger(ledger) > 0) { return(RedirectToAction("LedgersList")); } else { ViewData["Message"] = "Invalid Entry..(Please Check for Duplicate or Invalid Entry)."; } } else { ViewData["Message"] = "Missing entries. Please check and try again."; } } else { if (Roles.IsUserInRole("SuperAdmin")) { return(RedirectToAction("List", "Client")); } } return(View()); }
public ActionResult EditExpense(int id, FormCollection form, Payments payment) { // int paymentType = (int)PaymentTypes.Expense; if (Session["ClientId"] != null) { //ViewData["ExpenseHeads"] = Utilities.GetExpenseHeadNameList((int)Session["ClientId"], paymentType); if (!Roles.IsUserInRole("CenterManager")) { if (Session["RegionId"] != null) { ViewData["Branches"] = Utilities.GetBranchNameList((int)Session["ClientId"], (int)Session["RegionId"]); } else { ViewData["Branches"] = Utilities.GetBranchNameList((int)Session["ClientId"]); } } else { if (Session["BranchId"] != null) { payment.BranchId = (int)Session["BranchId"]; ViewData["Branches"] = null;// Utilities.GetBlankBranchNameList(); } else { return(RedirectToAction("LogOff", "Account")); } } if (!ModelState.IsValid) { ApplicationMessages msg = new ApplicationMessages("Missing entries. Please check and try again.", MessageType.Error); ViewData["Message"] = msg; return(View()); } if (payment.Date != null && payment.Amounts > 0) { int result = MasterModels.EditPayment(payment); if (result > 0) { // ViewData["ExpenseList"] = MasterModels.GetPaymentList((int)Session["ClientId"], paymentType).OrderByDescending(pl => pl.Id).Take(10).ToList(); ApplicationMessages msg = new ApplicationMessages("Record updated successfully.", MessageType.Success); ViewData["Message"] = msg; } if (result == -1) { // ViewData["ExpenseList"] = MasterModels.GetPaymentList((int)Session["ClientId"], paymentType).OrderByDescending(pl => pl.Id).Take(10).ToList(); ApplicationMessages msg = new ApplicationMessages("Same Voucher Number and Date already found, please modify and try again", MessageType.Information); ViewData["Message"] = msg; } if (result == 0) { ApplicationMessages msg = new ApplicationMessages("failed to update record, please try again", MessageType.Information); ViewData["Message"] = msg; } } else { ApplicationMessages msg = new ApplicationMessages("Missing entries. Please check and try again.", MessageType.Error); ViewData["Message"] = msg; return(View()); } //ViewData.Model = MasterModels.GetPaymentDetailsById(id); int paymentType = 0; ViewData.Model = MasterModels.GetPaymentDetailsById(id, out paymentType); ViewData["ExpenseHeads"] = Utilities.GetExpenseHeadNameList((int)Session["ClientId"], paymentType); } else { if (Roles.IsUserInRole("SuperAdmin")) { return(RedirectToAction("List", "Client")); } } ViewData["PaymentModes"] = Utilities.GetPaymentModesNameList(); return(View()); }
public JsonResult signup(MasterModels M000) { return(Json(new { id = 0, val = M000.signup(db) }, JsonRequestBehavior.AllowGet)); }