예제 #1
0
        public ActionResult Index()
        {
            User user = new User();

            user = (User)Session["user"];

            HoursViewModel hoursViewModel = new HoursViewModel
                {
                    UserName = user.LastName + ", " + user.FirstName
                };

            HierarchyController hierarchyController = new HierarchyController();

            LocationController locationController = new LocationController();

            IQueryable<CountryViewModel> countryViewModels = hierarchyController.GetAllCountries();
            ViewData["countries"] = countryViewModels;

            IQueryable<LocationViewModel> locationViewModels = locationController.GetAllLocations();
            ViewData["locations"] = locationViewModels;

            IQueryable<EntityViewModel> entityViewModels = hierarchyController.GetAllEntitiesWithDetails();
            ViewData["entityViewModels"] = entityViewModels;

            return View(hoursViewModel);
        }
예제 #2
0
        public ActionResult Index()
        {
            User user = new User();

            user = (User) Session["user"];

            IncidentViewModel incidentViewModel = new IncidentViewModel
                {
                    UserName = user.LastName + ", " + user.FirstName
                };

            string safetyUsers = ConfigurationManager.AppSettings.Get("SafetyUsers");

            string[] safetyUserList = safetyUsers.Split(Convert.ToChar("|"));

            foreach (string safetyUser in safetyUserList.Where(safetyUser => user.UserName == safetyUser))
            {
                incidentViewModel.AccessToSafetyIncidentApplication = true;
            }

            HierarchyController hierarchyController = new HierarchyController();
            LocationController locationController = new LocationController();

            IQueryable<CountryViewModel> countryViewModels = hierarchyController.GetAllCountries();
            ViewData["countries"] = countryViewModels;

            IQueryable<EntityViewModel> entityViewModels = hierarchyController.GetAllEntitiesWithDetails();
            ViewData["entityViewModels"] = entityViewModels;

            IQueryable<LocationViewModel> locationViewModels = locationController.GetAllLocationsWithStatus();
            ViewData["locations"] = locationViewModels;

            PopulateStatuss();
            PopulateSiteCategories();
            PopulateUnsafeActs();
            PopulateCauseCategories();
            PopulateCauses();
            PopulateTypes();
            PopulateOutcomes();
            PopulateEmployeeTypes();

            return View(incidentViewModel);
        }