public JsonResult ConfirmDelOrder() { object result; Dictionary <int, Dictionary <int, int> > plannedlist = new Dictionary <int, Dictionary <int, int> >(); if (Session["plannedlist"] != null) { plannedlist = (Dictionary <int, Dictionary <int, int> >)Session["plannedlist"]; } //Check if the collected quant is tally with deliver plan Dictionary <int, int> collist = (Dictionary <int, int>)Session["collist"]; foreach (int itemId in collist.Keys) { int itemtotal = 0; foreach (int depId in plannedlist.Keys) { itemtotal += plannedlist[depId][itemId]; } if (itemtotal != collist[itemId]) { result = new { status = false }; return(Json(result, JsonRequestBehavior.AllowGet)); } } //Set ItemReq status and Dep Order status foreach (int depId in plannedlist.Keys) { bool notifystatus = false; foreach (int itemId in plannedlist[depId].Keys) { DepOrderData.SetCollected(depId, itemId, plannedlist[depId][itemId]); foreach (int empId in DepartmentData.GetAllEmpByDepId(depId).Select(x => x.Id)) { if (ReqItemData.SetReqItemCollected(empId, itemId) && notifystatus == false) { string emailaddress = EmployeeData.FindEmpById(empId).EmailAdd; Task task = Task.Run(() => { EmailNotification.SendNotificationEmailToEmployee(emailaddress, "Stationary Requisition Status Changed", "Your Stationary Requisition is under delivering"); }); notifystatus = true; } } } } result = new { status = true }; return(Json(result, JsonRequestBehavior.AllowGet)); }
//////////////////////////////////////////////////////delegate public ActionResult DelegateView() { Employee u = EmployeeData.FindByUserName((string)Session["username"]); int uId = u.Id; int dId = u.department.Id; List <Employee> lemp = DepartmentData.GetAllEmpByDepId(u.department.Id); List <Delegation> listdele = DelegationData.GetAllByManagerId(uId); ViewBag.listdeleg = listdele; ViewBag.listemp = lemp; return(View()); }
////////////////////////////////////////Manage Representative public ActionResult ManageRep() { Employee u = EmployeeData.FindByUserName((string)Session["username"]); int uId = u.Id; int dId = u.department.Id; Department dep = DepartmentData.GetDepById(dId); List <Employee> lemp = DepartmentData.GetAllEmpByDepId(u.department.Id); ViewBag.listemp = lemp; ViewBag.dep = dep; return(View()); }