public async Task <IActionResult> Map() { // start db calls var workStyles = db.WorkStyles.ToListAsync(); var allFloors = db.Floors.ToListAsync(); // assign results var vm = new LegendViewModel { AllWorkStyles = await workStyles }; var AllFloorsList = await allFloors; vm.AllFloors = AllFloorsList.OrderBy(f => f.SortName).Select(f => new SelectListItem { Text = f.Name, Value = f.ID.ToString() }); if (Request.Cookies["mapFloor"] != null) { ViewBag.DefaultFloor = Request.Cookies["mapFloor"].ToString(); } else { ViewBag.DefaultFloor = AllFloorsList.FirstOrDefault().ID.ToString(); } return(View(vm)); }
public virtual ActionResult IntervieweeDetails(int questionnaireId, int?ageId, int?sexId, int?educationId, int?martialStatusId, int?materialStatusId, int?placeOfResidenceId, int?seniorityId, int?workplaceId) { var intervieweesIds = _intervieweesRepository.GetList( ageId: ageId, educationId: educationId, martialStatusId: martialStatusId, materialStatusId: materialStatusId, placeOfResidenceId: placeOfResidenceId, seniorityId: seniorityId, sexId: sexId, workplaceId: workplaceId) .Select(x => x.IntervieweeId) .ToList(); var model = GetIntervieweeResultBasicViewModel( ageId: ageId, educationId: educationId, martialStatusId: martialStatusId, materialStatusId: materialStatusId, placeOfResidenceId: placeOfResidenceId, seniorityId: seniorityId, sexId: sexId, workplaceId: workplaceId); model.IntervieweeDetails = _resultsRepository.GetIntervieweeDetails(questionnaireId, intervieweesIds); model.Legend = LegendViewModel.Details(); ViewBag.QuestionnaireName = _questionnairesRepository.GetById(questionnaireId).Name; return(View(model)); }
public LegendUserControl() { try { InitializeComponent(); ViewModel = new LegendViewModel(); } catch (Exception ex) { ErrorHelper.OnError(MethodBase.GetCurrentMethod().DeclaringType.Name, "Error initializing Legend", ex); } }
public void TestToString() { var l = new LegendViewModel(30, 0); var Expectlist = l.ListOfLagendItems.ToList(); var str = l.ToString(); var Getslist = l.PopulateTableFromString(str); Getslist.ForEach(x => { Assert.AreEqual(Expectlist[Getslist.IndexOf(x)], x); }); }
public void TestToStringSaveToFile() { var l = new LegendViewModel(30, 0); var Expectlist = l.ListOfLagendItems.ToList(); var str = l.ToString(); var path = @"F:\scale.scl"; LoadSaveFromToTextFile.SaveFile(str, path); Assert.IsTrue(File.Exists(path)); TempFileManager.DeleteTmpFile(path); }
public void OpenLegendWindow(LegendViewModel legendViewModel) { var openWindow = currentOpenLegendWindows.Where(lw => ((LegendViewModel)lw.DataContext).LegendName == legendViewModel.LegendName); if (openWindow.Count() == 0) { var legendWindow = new LegendWindow { DataContext = legendViewModel }; currentOpenLegendWindows.Add(legendWindow); legendWindow.Closed += LegendWindowClosed; legendWindow.Show(); } else { openWindow.Single().Focus(); } }
public virtual ActionResult General() { var model = new ResultsListViewModel() { Title = "Wyniki wg ankiet", Results = new List <ResultsViewModel>(), PearsonCorrelations = ResultsViewModel.Initialize(0, "Korelacja liniowa Pearsona", _resultsRepository.GetResultsPearsonCorrelations()), Legend = LegendViewModel.General() }; foreach (var questionnaire in _questionnairesRepository.GetList()) { model.Results.Add(ResultsViewModel.Initialize( questionnaireId: questionnaire.QuestionnaireId, questionnaireName: questionnaire.Name, results: _resultsRepository.GetResultsGeneral(questionnaire.QuestionnaireId))); } return(View(MVC.Application.Results.Views.Results, model)); }
public void TestReadAndPopulateFromFile() { var l = new LegendViewModel(30, 0); var Expectlist = l.ListOfLagendItems.ToList(); var str = l.ToString(); var path = @"F:\scale.scl"; LoadSaveFromToTextFile.SaveFile(str, path); var Getslist = l.PopulateTableFromString(LoadSaveFromToTextFile.ReadFile(path)); TempFileManager.DeleteTmpFile(path); Getslist.ForEach(x => { Assert.AreEqual(Expectlist[Getslist.IndexOf(x)], x); }); }
public static IHtmlContent GovUkLegend( this IHtmlHelper htmlHelper, LegendViewModel legendViewModel) { return(htmlHelper.Partial("/GovUkDesignSystemComponents/Legend.cshtml", legendViewModel)); }
public virtual ActionResult Details(int questionnaireId) { var results = _resultsRepository.GetResultDetails(questionnaireId); var model = new ResultsListViewModel() { Title = _questionnairesRepository.GetById(questionnaireId).Name, Results = new List <ResultsViewModel>(), Legend = LegendViewModel.Details() }; var questionsIds = results.Select(x => x.QuestionId).Distinct(); foreach (var questionId in questionsIds) { var question = _questionsRepository.GetById(questionId); var questionResults = new ResultsViewModel() { Id = questionId, Text = $"{question.OrderNumber}. {question.Text}", Options = _answersRepository.GetDescriptions(questionId), DictionaryGroups = new List <DictionaryGroupViewModel>() }; var dictionaryGroupNames = results.Select(x => x.DictionaryTypeName).Distinct(); foreach (var dictionaryType in dictionaryGroupNames) { var dictionaryGroup = new DictionaryGroupViewModel() { GroupName = dictionaryType, DictionaryItems = new List <DictionaryItemViewModel>() }; var dictionaryItemsIds = results.Where(x => x.DictionaryTypeName == dictionaryType).Select(x => x.BaseDictionaryId).Distinct(); foreach (var itemId in dictionaryItemsIds) { var dictionaryItem = new DictionaryItemViewModel() { ItemName = _dictionariesRepository.GetById(itemId).Value, Badge = results.First(x => x.BaseDictionaryId == itemId).IntervieweeCount.ToString(), Values = new List <ValueViewModel>() }; var answersIdList = results.Where(x => x.QuestionId == questionId).Select(x => x.AnswerId).Distinct(); foreach (var answerId in answersIdList) { var resultItem = results .Where(x => x.QuestionId == questionId) .Where(x => x.BaseDictionaryId == itemId) .Where(x => x.AnswerId == answerId) .FirstOrDefault(); var value = new ValueViewModel() { Badge = resultItem.AnswersCount.ToString(), Count = resultItem.AnswersCount, TotalCount = resultItem.TotalAnswersCount }; value.SetValueByPercentage(); dictionaryItem.Values.Add(value); } dictionaryGroup.DictionaryItems.Add(dictionaryItem); } questionResults.DictionaryGroups.Add(dictionaryGroup); } model.Results.Add(questionResults); } return(View(MVC.Application.Results.Views.Results, model)); }
public static IHtmlContent GovUkLegend( this IHtmlHelper htmlHelper, LegendViewModel legendViewModel) { return(htmlHelper.Partial("~/Partials/Legend.cshtml", legendViewModel)); }
public LegendController(LegendViewModel LegendViewModel) { this.isEditMode = true; this.legendViewlModel = LegendViewModel; }