public ActionResult Form(long? id) { try { if (id == null) { user = (OCCUSER)Session["User"]; ViewBag.BRANCHCODE = new SelectList(db.BRANCHINFO, "ID", "BRANCHNAME"); CARDCHEREUISITION ccreq = new CARDCHEREUISITION(); //if (user.BRANCH != null) //{ // ccreq.BRANCHCODE = (long)user.BRANCH; //} long status = db.OCCENUMERATION.Where(x => x.Name == "applied").Select(x => x.ID).FirstOrDefault(); ViewBag.STATUSID = new SelectList(db.OCCENUMERATION.Where(x => x.Type == "chequereq"), "ID", "Name", status); ViewBag.STATUS = status; ccreq.CREATEDON = DateTime.Now; return View(ccreq); } CARDCHEREUISITION cardchereuisition = db.CARDCHEREUISITION.Find(id); if (cardchereuisition == null) { return HttpNotFound(); } ViewBag.BRANCHCODE = new SelectList(db.BRANCHINFO, "ID", "BRANCHNAME", cardchereuisition.BRANCHCODE); ViewBag.STATUSID = new SelectList(db.OCCENUMERATION.Where(x => x.Type == "chequereq"), "ID", "Name", cardchereuisition.STATUS); return View(cardchereuisition); } catch (Exception) { return RedirectToAction("Error", "Home", new { Area = "" }); } }
public ActionResult Form(CARDCHEREUISITION cardchereuisition) { try { user = (OCCUSER)Session["User"]; int adminFlag = 0; if (cardchereuisition.ID == 0) { cardchereuisition.LEAFNO = 10; cardchereuisition.ISACTIVE = false; cardchereuisition.ISDELETE = false; cardchereuisition.CREATEDBY = user.ID; if (ModelState.IsValid) { db.CARDCHEREUISITION.Add(cardchereuisition); db.SaveChanges(); if (user.TYPE == 1) { adminFlag = 1; } string msg = "Successfully Saved"; return Json(new { msg, adminFlag }, JsonRequestBehavior.AllowGet); } ViewBag.BRANCH = new SelectList(db.BRANCHINFO, "ID", "BRANCHNAME", user.BRANCH); CARDCHEREUISITION ccreq = new CARDCHEREUISITION(); if (user.BRANCH != null) { ccreq.BRANCHCODE = (long)user.BRANCH; } long status = db.OCCENUMERATION.Where(x => x.Name == "applied").Select(x => x.ID).FirstOrDefault(); ViewBag.STATUSID = new SelectList(db.OCCENUMERATION.Where(x => x.Type == "chequereq"), "ID", "Name", status); cardchereuisition.STATUS = status; return View(cardchereuisition); } else { var modifiedcardCheque = db.CARDCHEREUISITION.Find(cardchereuisition.ID); modifiedcardCheque.REMARKS = cardchereuisition.REMARKS; modifiedcardCheque.REFERENCENO = cardchereuisition.REFERENCENO; modifiedcardCheque.MODIFIEDBY = user.ID; modifiedcardCheque.MODIFIEDON = DateTime.Now; db.Entry(modifiedcardCheque).State = EntityState.Modified; db.SaveChanges(); string msg = "Successfully Updated"; return Json(new { msg, adminFlag }, JsonRequestBehavior.AllowGet); } } catch (Exception exception) { return RedirectToAction("Error", "Home", new { Area = "" }); } }
// // GET: /Payment/List/ public ActionResult Index(int?BRANCH,string CARDNO,DateTime? CREATEDON,int? page,int? serial) { int pageSize = ConstantConfig.PageSizes; int pageNumber = (page ?? 1); user = (OCCUSER) Session["User"]; try { var list = db.DEPOSIT.Where(x => x.CREATEDBY == user.ID).Where(x=>x.ISDELETE==false).OrderByDescending(x=>x.ID).ToList(); var branch = db.BRANCHINFO.Select(x => new {x.BRANCHNAME, x.ID}).OrderBy(x=>x.BRANCHNAME); ViewBag.BRANCH = new SelectList(branch, "ID", "BRANCHNAME"); if (serial != null) { @ViewBag.Sln = (pageNumber*pageSize)-9; } else { @ViewBag.Sln = 1; } if (BRANCH != null) { list = list.Where(x => x.BRANCH == BRANCH).ToList(); ViewBag.BRANCH = new SelectList(branch, "ID", "BRANCHNAME",BRANCH); ViewBag.currentBranch = BRANCH; } if (!String.IsNullOrEmpty(CARDNO)) { CARDNO = CARDNO.Trim(); list = list.Where(x => x.CARDNUMBER == CARDNO).ToList(); ViewBag.CARDNO = CARDNO; } if (CREATEDON != null) { list = list.Where(x => x.CREATEDON == CREATEDON).ToList(); ViewBag.CREATEDON = CREATEDON; } return View(list.ToPagedList(pageNumber, pageSize)); // return View(list); } catch (Exception exception) { return RedirectToAction("Error", "Home", new {Area = ""}); } }
// GET: /ChequeRequisition/Home/ public ActionResult Index(int? STATUS, string CARDNO, DateTime? CREATEDON, int? page) { try { user = (OCCUSER)Session["User"]; Dictionary<int, string> statusID = new Dictionary<int, string>() { {4,"applied"},{5,"authorized"} }; ViewBag.STATUS = new SelectList(statusID, "Key", "Value"); var List = db.CARDCHEREUISITION.Include(c => c.BRANCHINFO).Where(x => x.ISDELETE == false).Where(x => x.CREATEDBY == user.ID).OrderByDescending(x => x.ID).ToList(); if (STATUS != null) { List = List.Where(x => x.STATUS == STATUS).ToList(); ViewBag.STATUS = new SelectList(statusID, "Key", "Value", statusID.Where(x => x.Key == STATUS)); ViewBag.currsts = STATUS; // ViewBag.STATUS = new SelectList(statusID, "Key", "Value", statusID.Where(x => x.Key == STATUS)); } if (!String.IsNullOrEmpty(CARDNO)) { CARDNO = CARDNO.Trim(); List = List.Where(x => x.CARDNO.Contains(CARDNO)).ToList(); ViewBag.CARDNO = CARDNO; } if (CREATEDON != null) { List = List.Where(x => x.CREATEDON == CREATEDON).ToList(); ViewBag.CREATEDON = CREATEDON; } int pageSize = ConstantConfig.PageSizes; int pageNumber = ((page ?? 1)); return View(List.ToPagedList(pageNumber, pageSize)); } catch (Exception ex) { return RedirectToAction("Error", "Home", new { Area = "" }); } }
public ActionResult LogIn(OCCUSER aUser, string PASSWORD) { WebRef.OBLAPP oblApp=new WebRef.OBLAPP(); try { var isValid = oblApp.GetByUserIDCheck(aUser.EMPLOYEEID, PASSWORD); if (isValid == "Valid") { ViewBag.flag = ""; if (IsUserInSystem(aUser.EMPLOYEEID)) { var user = GetByEmpId(aUser.EMPLOYEEID); if (user != null) { FormsAuthentication.SetAuthCookie(Convert.ToString(user.ID), false); Session["User"] = user; if (user.TYPE == 1) { return RedirectToAction("Index", "Home", new { Area = "Admin" }); } if (user.TYPE == 3) { return RedirectToAction("Index", "Home", new { Area = "Authorizer" }); } if (user.TYPE == 2) { return RedirectToAction("Index", "Home", new { Area = "Teller" }); } if (user.TYPE == 9) { return RedirectToAction("Index", "Home",new {Area="Establishment"}); } if (user.TYPE == 15) { return RedirectToAction("Index", "Home", new { Area = "CallCenter" }); } if (user.TYPE == 17) { return RedirectToAction("Index", "Home", new { Area = "Dispatcher" }); } } } else { ViewBag.flag = "User is not in the system"; } } else if (isValid == "Invalid") { ViewBag.flag = "Invalid User"; return View(); } else if (isValid == "NotFound") { ViewBag.flag = "User Not Found"; return View(); } return View(); } catch (Exception exception) { ViewBag.flag = "Something is wrong "+exception.Message; return View(); } }