public ActionResult EmployeeDashboard() { //Session["auth"] = 3; if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { int userid = Convert.ToInt32(Session["auth"]); Employee tempemp = db.Employees.FirstOrDefault(res => res.EmployeeID == userid); TempData["UserName"] = tempemp.EmployeeName; var tables = new OneForAll { resident = db.Residents.ToList(), employee = db.Employees.ToList(), visitor = db.Visitors.ToList(), service = db.Services.ToList(), friendsAndFamily = db.FriendsAndFamilies.ToList(), DashboardPost = db.DashboardPosts.OrderByDescending(post => post.PostID).ToList() }; return(View(tables)); } }
public void TestHacerQueOruMaitoLePaseSuQuirkAArturoMidorilla() { OneForAll ofa = new OneForAll(oruMaito); ofa.cambiarDeDueño(arturoMidorilla); Assert.AreEqual(ofa.Dueño, arturoMidorilla); }
public ActionResult VieworDeleteVisitor() { //Session["auth"] = 12; if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { int userid = Convert.ToInt32(Session["auth"]); Resident tempr = db.Residents.FirstOrDefault(res => res.ResidentID == userid); TempData["UserName"] = tempr.ResidentName; int count = db.Visitors.Count(vis => vis.ResidentID == userid); if (count > 0) { var tables = new OneForAll { visitor = db.Visitors.Where(vis => vis.ResidentID == userid).ToList() }; return(View(tables)); } else { return(RedirectToAction("NoRecords")); } } }
public ActionResult ApproveRegistrations() { if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { TempData["LoginType"] = "the Chief Security Officer"; if ((db.Residents.Count(res => res.isApproved == null) == 0) && (db.Employees.Count(emp => emp.isApproved == null) == 0)) { return(RedirectToAction("NoApprovals")); } else { var tables = new OneForAll { resident = db.Residents.Where(res => res.isApproved == null).ToList(), employee = db.Employees.Where(emp => emp.isApproved == null).ToList() }; return(View(tables)); } } }
public ActionResult ResidentDashboard() { if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { int userid = Convert.ToInt32(Session["auth"]); Resident tempr = db.Residents.FirstOrDefault(res => res.ResidentID == userid); TempData["UserName"] = tempr.ResidentName; var tables = new OneForAll { resident = db.Residents.ToList(), employee = db.Employees.ToList(), visitor = db.Visitors.ToList(), service = db.Services.ToList(), friendsAndFamily = db.FriendsAndFamilies.ToList(), DashboardPost = db.DashboardPosts.OrderByDescending(post => post.PostID).ToList() }; DateTime MyDate = DateTime.Now; int Year = MyDate.Year; int Month = MyDate.Month; int Day = MyDate.Day; TimeSpan t = (new DateTime(Year, Month, 24) - DateTime.Now); int days = (int)t.TotalDays + 1; TempData["LoginType"] = "Resident"; TempData["property1"] = "Maintainance Fee Due in"; TempData["quantity1"] = days; TempData["property2"] = "Unresolved Complaints"; TempData["quantity2"] = db.Complaints.Count(comp => comp.ComplaintStatus == "Raised" && comp.ResidentID == userid); TempData["property3"] = "Services Scheduled Today"; TempData["quantity3"] = db.Services.Count(ser => ser.AppointmentDateTime.Value.Year == DateTime.Now.Year && ser.AppointmentDateTime.Value.Month == DateTime.Now.Month && ser.AppointmentDateTime.Value.Day == DateTime.Now.Day && ser.ResidentID == userid && ser.ServiceApproval != "requested" && ser.ServiceApproval != "paid" ); TempData["property4"] = "Total Visitors"; TempData["quantity4"] = db.Visitors.Count(vis => vis.ResidentID == userid); return(View(tables)); } }
public OneForAll GetResidentAtAGlance(List <VisitorsViewModel> visitor, List <ComplaintsViewModel> complaint, List <PaymentsViewModel> payment) { var tables = new OneForAll { visitors = visitor, complaints = complaint, payments = payment }; return(tables); }
public void Test() { OneForAll ofa = new OneForAll(AllMight); ofa.cambiarPortador(ArturoMirodilla); Assert.AreEqual(2, ArturoMirodilla.Quirks.Count()); Heroe portadorAleatorio = new Heroe(PiroQuinesis); ofa.cambiarPortador(portadorAleatorio); Assert.AreEqual(1, ArturoMirodilla.Quirks.Count()); }
public ActionResult SecurityDashboard() { Session["auth"] = 3; if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { int userid = Convert.ToInt32(Session["auth"]); Employee emp = db.Employees.Single(x => x.EmployeeID == userid); TempData["UserName"] = emp.EmployeeName; if (Session["auth"] == null) { return(RedirectToAction("Login", "Login")); } else { var tables = new OneForAll { resident = db.Residents.ToList(), employee = db.Employees.ToList(), visitor = db.Visitors.ToList(), service = db.Services.ToList(), friendsAndFamily = db.FriendsAndFamilies.ToList(), DashboardPost = db.DashboardPosts.OrderByDescending(post => post.PostID).ToList() }; TempData["property1"] = "Visitors Inside"; TempData["quantity1"] = db.Visitors.Count(vis => vis.VisitorEntryStatus == "Inside Premises"); TempData["property2"] = "Unresolved Complaints"; TempData["quantity2"] = db.Complaints.Count(comp => comp.ComplaintStatus == "Raised"); TempData["property3"] = "Services Scheduled Today"; TempData["quantity3"] = db.Services.Count(vis => vis.AppointmentDateTime.Value.Year == DateTime.Now.Year && vis.AppointmentDateTime.Value.Month == DateTime.Now.Month && vis.AppointmentDateTime.Value.Day == DateTime.Now.Day ); TempData["property4"] = "Total Visitors"; TempData["quantity4"] = db.Visitors.Count(); return(View(tables)); } } }
public ActionResult ApproveRegistrations(OneForAll oneForAll) { if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { TempData["LoginType"] = "the Chief Security Officer"; return(View()); } }
public ActionResult ComplaintView() { if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { TempData["LoginType"] = "the Chief Security Officer"; var tables = new OneForAll { complaint = db.Complaints.ToList() }; return(View(tables)); } }
public ActionResult FriendsandFamilyView() { if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { TempData["LoginType"] = "the Chief Security Officer"; var tables = new OneForAll { friendsAndFamily = db.FriendsAndFamilies.ToList() }; return(View(tables)); } }
public ActionResult FriendsandFamilyView() { Session["auth"] = 3; if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { int userid = Convert.ToInt32(Session["auth"]); Employee emp = db.Employees.Single(x => x.EmployeeID == userid); TempData["UserName"] = emp.EmployeeName; var tables = new OneForAll { friendsAndFamily = db.FriendsAndFamilies.ToList() }; return(View(tables)); } }
public ActionResult AllTables() { if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { TempData["LoginType"] = "the Chief Security Officer"; var tables = new OneForAll { resident = db.Residents.ToList(), employee = db.Employees.ToList(), visitor = db.Visitors.ToList(), service = db.Services.ToList(), friendsAndFamily = db.FriendsAndFamilies.ToList() }; return(View(tables)); } }
public ActionResult AllTables() { Session["auth"] = 3; if (Session["auth"] == null) { return(RedirectToAction("Logout", "Logout")); } else { int userid = Convert.ToInt32(Session["auth"]); Employee emp = db.Employees.Single(x => x.EmployeeID == userid); TempData["UserName"] = emp.EmployeeName; var tables = new OneForAll { resident = db.Residents.ToList(), employee = db.Employees.ToList(), visitor = db.Visitors.ToList(), service = db.Services.ToList(), friendsAndFamily = db.FriendsAndFamilies.ToList() }; return(View(tables)); } }
public async Task <IActionResult> SecurityDashboard() { TempData["UserID"] = 1002; int UserID = Convert.ToInt32(TempData.Peek("UserID")); _log4net.Info("Home Page was called For Security with Id " + UserID); //Get Resident Details try { using (var client = new HttpClient()) { client.BaseAddress = new Uri(baseUrlForEmployeeAPI); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage Res = await client.GetAsync("api/Employees/" + UserID); if (Res.IsSuccessStatusCode) { var Response = Res.Content.ReadAsStringAsync().Result; employee = JsonConvert.DeserializeObject <Employees>(Response); } } } catch (Exception) { ViewBag.Message = "Employee API Not Reachable. Please Try Again Later."; } try { TempData["UserEmail"] = employee.EmployeeEmail; } catch (Exception) { TempData["UserEmail"] = "API not reachable"; } //NoticeBoard try { List <DashBoardPosts> dashBoardPostList = new List <DashBoardPosts>(); using (var client = new HttpClient()) { client.BaseAddress = new Uri(BaseurlForDashboardAPI); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage Res = await client.GetAsync("api/Dashboard/"); var model = new List <DashBoardPosts>(); if (Res.IsSuccessStatusCode) { var Response = Res.Content.ReadAsStringAsync().Result; dashBoardPostList = JsonConvert.DeserializeObject <List <DashBoardPosts> >(Response); var tables = new OneForAll { DashboardPosts = dashBoardPostList.OrderByDescending(post => post.DashItemId).ToList() }; return(View(tables)); } } } catch (Exception) { ViewBag.Message = "DashBoard API Not Reachable. Please Try Again Later."; } return(View()); }