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)); }