예제 #1
0
        public TaskViewModel CreateGenericTaskForm(int definitionId)
        {
            IList <SelectOptionViewModel> languages = new LanguageListBuilder().CreateSelectedLanguageList("0");
            TaskViewModel viewModel = new TaskViewModel(languages)
            {
                DefinitionId = definitionId
            };

            viewModel.Roles.Add(new SelectOptionViewModel(TaskResources.SelectOne, "0"));
            foreach (Role role in _roleDAO.GetAllFilteredByCurrentCulture())
            {
                // We want separate handling for rotation tasks, as the view should be quite different
                if (role.RoleType != RoleTypeEnum.Rotation)
                {
                    viewModel.Roles.Add(new SelectOptionViewModel(role.Title, role.Id.ToString(CultureInfo.InvariantCulture)));
                }
            }

            viewModel.NoiseProtections.Add(new SelectOptionViewModel(TaskResources.SelectOne, "0"));
            foreach (NoiseProtection noiseProtection in _noiseProtectionDAO.GetAllFilteredByCurrentCulture())
            {
                viewModel.NoiseProtections.Add(new SelectOptionViewModel(noiseProtection.Title, noiseProtection.Id.ToString(CultureInfo.InvariantCulture)));
            }

            return(viewModel);
        }
예제 #2
0
        public PartialViewResult EditTaskHelideck(int id)
        {
            var selectedTask = _selectedTaskDAO.Get(id);

            var helicopterTask = _helicopterTaskDAO.Get(selectedTask.HelicopterTaskId);

            var viewModel = new HelideckViewModel
            {
                NoiseProtectionId = selectedTask.NoiseProtectionId,
                TaskId            = selectedTask.Task.Id,
                SelectedTaskId    = selectedTask.Id,
                Title             = selectedTask.Task.Title,
                Role         = selectedTask.Task.Role.Title,
                RoleType     = RoleTypeEnum.Helideck.ToString(),
                HelicopterId = helicopterTask.HelicopterType.Id,
                NoiseLevel   = helicopterTask.NoiseLevel
            };

            viewModel.Helicopters.Add(new SelectListItem {
                Text = TaskResources.SelectOne, Value = "0"
            });
            foreach (var type in _helicopterTypeDAO.GetAll())
            {
                var selectListItem = new SelectListItem {
                    Text = type.Title, Value = type.Id.ToString()
                };
                if (viewModel.HelicopterId == type.Id)
                {
                    selectListItem.Selected = true;
                }

                viewModel.Helicopters.Add(selectListItem);
            }

            viewModel.NoiseProtection.Add(new SelectListItem {
                Text = TaskResources.SelectOne, Value = "0"
            });
            foreach (var noiseProtection in _noiseProtectionDAO.GetAllFilteredByCurrentCulture())
            {
                var selectListItem = new SelectListItem {
                    Text = noiseProtection.Title, Value = noiseProtection.Id.ToString()
                };
                if (viewModel.NoiseProtectionId == noiseProtection.Id)
                {
                    selectListItem.Selected = true;
                }

                viewModel.NoiseProtection.Add(selectListItem);
            }

            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            return(PartialView("_EditHelideckTask", viewModel));
        }
예제 #3
0
        public PartialViewResult AddTaskRegular(int id)
        {
            var task = _taskDAO.GetFilteredByCurrentCulture(id);

            var noiseLevelGuideLine = task.NoiseLevelGuideline.ToString(CultureInfo.InvariantCulture);

            if (noiseLevelGuideLine.IndexOf(".", StringComparison.Ordinal) > 0)
            {
                noiseLevelGuideLine = noiseLevelGuideLine.Substring(0, noiseLevelGuideLine.IndexOf(".", StringComparison.Ordinal));
            }

            if (task.SortOrder >= 1001)
            {
                return(null);
            }

            var viewModel = new RegularViewModel
            {
                TaskId              = task.Id,
                Title               = task.Title,
                Role                = task.Role.Title,
                RoleType            = task.Role.RoleType.ToString(),
                NoiseLevelGuideline = noiseLevelGuideLine,
                NoiseProtectionId   = task.NoiseProtection.Id,
                RadioNoiseMeassuredNoCheckedAttr = InputChecked,
                RadioTimeCheckedAttr             = InputChecked,
                ButtonPressed = task.ButtonPressed,
                NoiseProtectionDefinitionId = task.NoiseProtection.NoiseProtectionDefinition.Id
            };

            viewModel.NoiseProtection.Add(new SelectListItem {
                Text = TaskResources.SelectOne, Value = "0"
            });
            foreach (var noiseProtection in _noiseProtectionDAO.GetAllFilteredByCurrentCulture())
            {
                var selectListItem = new SelectListItem {
                    Text = noiseProtection.Title, Value = noiseProtection.Id.ToString(CultureInfo.InvariantCulture)
                };

                if (viewModel.NoiseProtectionDefinitionId == noiseProtection.NoiseProtectionDefinition.Id)
                {
                    selectListItem.Selected = true;
                }

                if (task.Role.RoleType.ToString() == "AreaNoise")
                {
                    if (!selectListItem.Selected)
                    {
                        if (task.Title.Contains("80") || task.Title.Contains("85") || task.Title.Contains("90"))
                        {
                            if (noiseProtection.NoiseProtectionDefinition.Id != 3) // Quietpro
                            {
                                continue;
                            }
                        }
                        else
                        {
                            if (noiseProtection.NoiseProtectionDefinition.Id != 3 && noiseProtection.NoiseProtectionDefinition.Id != 2) // Quietpro and double hearing
                            {
                                continue;
                            }
                        }
                    }
                }

                if (task.TaskDefinition.Id != 1070 && //"Ultra-High Pressure (UHP) water jetting"
                    task.TaskDefinition.Id != 1071 && //"Sponging"
                    task.TaskDefinition.Id != 1074 && //"Sandblasting"
                    task.TaskDefinition.Id != 1073)   //"Slurry blasting"

                {
                    if (noiseProtection.NoiseProtectionDefinition.Id == 6 || noiseProtection.NoiseProtectionDefinition.Id == 7)
                    {
                        // Skumpropp tas ikke med i vanlige operasjoner

                        continue;
                    }
                }

                viewModel.NoiseProtection.Add(selectListItem);
            }

            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            return(PartialView("_CreateRegularTask", viewModel));
        }