예제 #1
0
        //[ValidateAntiForgeryToken]
        ///<summary>
        /// Retrieves form for the given absence selected
        /// </summary>
        public ActionResult UpdateAbsenceEntry(IAbsenceDO iAbsence, int pointBankID)
        {
            ActionResult oResponse = null;
            var          userPO    = (IUserPO)Session["UserModel"];

            if (userPO.Email != null && userPO.RoleID_FK >= (int)RoleEnum.Administrator && userPO.RoleID_FK <= (int)RoleEnum.Team_Lead)
            {
                var absenceVM = new AbsenceViewModel();

                // Retrieve selected absence
                var absenceDO = PointsDataAccess.GetAbsenceByID(pointBankID);
                ViewBag.Name = "Modify Employee Absence";

                // Maps absence DO to PO
                absenceVM.Absence = AbsenceMapper.MapAbsenceDOtoPO(absenceDO);

                oResponse = View(absenceVM);
            }
            else
            {
                // User doesn't have priveleges redirect home
                oResponse = RedirectToAction("Index", "Home");
            }

            return(oResponse);
        }
예제 #2
0
        ///<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);
        }