//[ValidateAntiForgeryToken] ///<summary> /// Views all absences for all teams under a Service Manager -- Check to see if this already exists /// </summary> public ActionResult ViewAllAbsencesForSMTeams(int userID) { ActionResult oResponse = null; var selectedTeamAbsences = new AbsenceViewModel(); var userPO = (IUserPO)Session["UserModel"]; if (userPO.Email != null && userPO.RoleID_FK <= (int)RoleEnum.Service_Manager && userPO.RoleID_FK >= (int)RoleEnum.Administrator) { if (ModelState.IsValid) { try { var absences = new List <IAbsenceDO>(); // Stores list of absences by UserID absences = PointsDataAccess.ViewAbsencesByUserID(userID); InitializeViewData(selectedTeamAbsences, (UserPO)userPO, absences); oResponse = View(selectedTeamAbsences); } catch (Exception ex) { ErrorLogger.LogError(ex, "ViewAbsenceByTeamID", "Maint"); selectedTeamAbsences.ErrorMessage = "Something went wrong retrieving the list of absences. Please try again."; oResponse = View(selectedTeamAbsences); } } else { oResponse = View(selectedTeamAbsences); } } return(oResponse); }
///<summary> /// Views all teams(admin) /// </summary> public ActionResult TestViews() { ActionResult oResponse = null; var ViewAllTeamsVM = new TeamViewModel(); var userPO = (IUserPO)Session["UserModel"]; // Ensures authenticated if (userPO.Email != null && userPO.RoleID_FK == (int)RoleEnum.Administrator) { try { // Test for retrieves var allTeams = _TeamDataAccess.GetAllTeams(); var allSMTeams = _TeamDataAccess.GetAllSMTeams(); var team = _TeamDataAccess.GetTeamNameByID(5); var allSMTeamAbsences = _TeamDataAccess.GetAllSMTeamsByUserID(8); var viewUserAbsence = PointsDataAccess.GetAbsenceByID(4); var viewAllAbsences = PointsDataAccess.ViewAllAbsences(); var teamAbsences = PointsDataAccess.GetAbsencesByTeamID(5); var viewUserAbsences = PointsDataAccess.ViewAbsencesByUserID(8); // Maps from data objects to presentation objects. ViewAllTeamsVM.ListOfPos = TeamMapper.MapListOfDOsToListOfPOs(allTeams); oResponse = View(ViewAllTeamsVM); } catch (Exception ex) { ErrorLogger.LogError(ex, "ViewAllTeams", "Maint"); ViewAllTeamsVM.ErrorMessage = ""; // TODO: Add meaningful front end message } } else { oResponse = RedirectToAction("Index", "Home"); } return(oResponse); }
public ActionResult LeadDashboard() { // Emp Name-> Points-> Status // if ((UserPO)Session["UserModel"] != null) // { var loggedUSer = (IUserPO)Session["UserModel"]; List <DashboardViewModel> emps = AbsenceMapper.MapListOfPOsToListOfVMs(AbsenceMapper.MapListOfBOsToListOfPOs(AbsenceBusinessLogic.DetermineEmployeeAbsenceStatus(AbsenceMapper.MapListOfDOsToListOfBOs(PointsDataAccess.ViewAbsencesByUserID(loggedUSer.UserID))))); //TODO: Implement AutoMapper Mapper.Map<List<IAbsenceBO>, List<DashboardViewModel>>(AbsenceBusinessLogic.DetermineEmployeeAbsenceStatus(Mapper.Map<List<IAbsenceDO>, List<IAbsenceBO>>(PointsDataAccess.ViewAbsencesByUserID(loggedUSer.UserID)))); // } return(View(emps)); }