コード例 #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
        private void InitializeViewData(AbsenceViewModel selectedTeamAbsences, UserPO userPO, List <IAbsenceDO> absences)
        {
            var smName = new StringBuilder(selectedTeamAbsences.User.FirstName, 25);

            ViewBag.Name = smName.Append(" " + selectedTeamAbsences.User.LastName);

            // Maps list of absences from DO to PO
            foreach (IAbsenceDO absence in absences)
            {
                selectedTeamAbsences.Absence = AbsenceMapper.MapAbsenceDOtoPO(absence);
            }
        }
コード例 #3
0
 private void MapAdminObjects(AbsenceViewModel selectedTeamAbsences, List <ITeamDO> allTeams, List <IAbsenceDO> absences)
 {
     // Map values to correct properties for view
     foreach (IAbsenceDO absence in absences)
     {
         selectedTeamAbsences.Absence = AbsenceMapper.MapAbsenceDOtoPO(absence);
         selectedTeamAbsences.ListOfPos.Add(selectedTeamAbsences.Absence);
     }
     foreach (ITeamDO team in allTeams)
     {
         selectedTeamAbsences.Team = TeamMapper.MapTeamDOtoPO(team);
     }
 }