// GET: Profile/Details/5 public ActionResult Details(int id) { if (_rolesManager.SetCurrentEmployee(_employeeDataAccess, GetCurrentUserEmail())) { var accessLevel = _rolesManager.IdentifyRole(); if (accessLevel == "FullAccess" || accessLevel == "FullView" || accessLevel == "TeamView") { var employee = new Employee(); if (!_rolesManager.GetEmployeeDetails(_employeeDataAccess, ref employee, id)) { ViewBag.ErrorMsg = "You are not authorized to view this page"; return(View("Error")); } if (employee != null) { if (employee.Profile == null) { employee.Profile = new Profile { Id = employee.Id }; _profileDataAccess.CreateProfile(employee.Profile); ViewBag.Access = accessLevel; return(RedirectToAction("Details", id)); // HACK: reload to avoid ununderstandable Null exception!! } ViewBag.Access = accessLevel; ViewBag.ProfilePic = _rolesManager.LoggedInEmployee.Profile.ProfilePic; return(View(employee)); } ViewBag.ErrorMsg = "No such page exists."; return(View("Error")); } ViewBag.ErrorMsg = "You are not authorized to view this page"; return(View("Error")); } ViewBag.ErrorMsg = "You are not registered on our system. Plz contact the system administrator if u think this is wrong."; return(View("Error")); }
// GET: PowerBI public ActionResult Index() { if (_rolesManager.SetCurrentEmployee(_employeeDataAccess, GetCurrentUserEmail())) { var accessLevel = _rolesManager.IdentifyRole(); if (accessLevel == "FullAccess" || accessLevel == "FullView" || accessLevel == "TeamView") { ViewBag.Access = accessLevel; ViewBag.ProfilePic = _rolesManager.LoggedInEmployee.Profile.ProfilePic; return(View()); } ViewBag.ErrorMsg = "You are not authorized to view this page"; return(View("Error")); } ViewBag.ErrorMsg = "You are not registered in our system"; return(View("Error")); }
public ActionResult About() { if (_rolesManager.SetCurrentEmployee(_employeeDataAccess, ClaimsPrincipal.Current.FindFirst(ClaimTypes.Email).Value)) { var accessLevel = _rolesManager.IdentifyRole(); if (accessLevel == "FullAccess" || accessLevel == "FullView" || accessLevel == "TeamView") { ViewBag.ProfilePic = _rolesManager.LoggedInEmployee.Profile.ProfilePic; ViewBag.Access = accessLevel; return(View("About")); } ViewBag.ErrorMsg = "You are not authorized to view this page"; return(View("Error")); } ViewBag.ErrorMsg = "You are not registered on our system. Plz contact the system administrator if u think this is wrong."; return(View("Error")); }
// GET: Dashboard public ActionResult Index() { if (_rolesManager.SetCurrentEmployee(_employeeDataAccess, ClaimsPrincipal.Current.FindFirst(ClaimTypes.Email).Value)) { var accessLevel = _rolesManager.IdentifyRole(); switch (accessLevel) { case "FullAccess": case "FullView": var notificationVeiwModel = new NotificationViewModel { ResignedEmployees = GetEmployeesByNearResigndate(), HiringEmployees = GetEmployeesByNearHiredate(), UncompletedProfiles = GetProfilesByMissingItems() }; ViewBag.ProfilePic = _rolesManager.LoggedInEmployee.Profile.ProfilePic; ViewBag.Access = accessLevel; return(View(notificationVeiwModel)); case "TeamView": ViewBag.ProfilePic = _rolesManager.LoggedInEmployee.Profile.ProfilePic; ViewBag.Access = accessLevel; return(View()); case "EmployeeView": return(RedirectToAction("Index", "Profile")); default: ViewBag.ErrorMsg = "You are not authorized to view this page"; return(View("Error")); } } ViewBag.ErrorMsg = "You are not registered on our system. Plz contact the system administrator if u think this is wrong."; return(View("Error")); }
public ActionResult Index() { if (_rolesManager.SetCurrentEmployee(_employeeDataAccess, GetCurrentUserEmail())) { var accessLevel = _rolesManager.IdentifyRole(); if (accessLevel == "FullAccess" || accessLevel == "FullView") { ViewBag.ProfilePic = _rolesManager.LoggedInEmployee.Profile.ProfilePic; ViewBag.Access = accessLevel; return(View(_workloadDataDataAccess.GetAllWorkloads())); } ViewBag.ErrorMsg = "You are not authorized to view this page"; return(View("Error")); } ViewBag.ErrorMsg = "You are not registered on our system. Plz contact the system administrator if u think this is wrong."; return(View("Error")); }