private void MobileInitializeViewsForDemographics(string code, int?previousEvaluationId) { //Evaluation previousEvaluation = previousEvaluationId.HasValue ? _evaluationService.GetById(previousEvaluationId.Value) : null; Evaluation previousEvaluation = new Evaluation(); Evaluation evaluation = new Evaluation(); Test test = new TestsServices().GetByCode(code); evaluation.Test_Id = test.Id; SelectList agesList = new SelectList(new AgesServices().GetAgesForDropDownList(test.Company_Id), "Key", "Value"); SelectList senioritiesList = new SelectList(new SenioritiesServices().GetSenioritiesForDropDownList(test.Company_Id), "Key", "Value"); SelectList instructionLevelsList = new SelectList(new InstructionLevelsServices().GetInstructionLevelsForDropDownList(test.Company_Id), "Key", "Value"); SelectList positionLevelsList = new SelectList(new PositionLevelsServices().GetPositionLevelsForDropDownList(test.Company_Id), "Key", "Value"); SelectList locationsList = new SelectList(new LocationsServices().GetLocationsForDropDownList(test.Company_Id), "Key", "Value"); IQueryable <DemographicsInTest> dem = new DemographicsInTestsServices().GetByTest(test.Id).Where(d => d.FOT_Id.HasValue); List <int> dems = new List <int>(); foreach (DemographicsInTest d in dem) { dems.Add(d.FOT_Id.Value); } IQueryable <FunctionalOrganizationType> FOTypes = new FunctionalOrganizationTypesServices().GetByCompany(test.Company_Id).Where(d => dems.Contains(d.Id)); SelectList FOrganizations = new SelectList(new FunctionalOrganizationsServices().GetEmptyDictionary()); SelectList performanceEvaluationsList = new SelectList(new PerformanceEvaluationsServices().GetPerformanceEvaluationsForDropDownList(test.Company_Id), "Key", "Value"); _evaluationViewModel = new EvaluationViewModel(evaluation, agesList, senioritiesList, instructionLevelsList, positionLevelsList, locationsList, FOTypes, FOrganizations, performanceEvaluationsList, test, previousEvaluation); }
public List <string> GetDemographicsWhereThereIsAssociation() { List <string> demographicsWithAssociation = new List <string>(); List <int> FOT = new FunctionalOrganizationTypesServices().GetByCompany(Test.Company_Id).Select(fot => fot.Id).ToList(); //List<int> countriesId = new CountriesServices().GetCountriesByTest(Test); CountriesServices countryService = new CountriesServices(); FunctionalOrganizationTypesServices FOTService = new FunctionalOrganizationTypesServices(); ChiSquare cs; foreach (string demographic in DemographicNames.Keys) //recorro los demograficos { if (demographic == "FunctionalOrganizationType") //si el demografico actual es una estructura funcional { foreach (int type in FOT) { cs = new ChiSquare(Test, demographic, null, null, null, null, type, 0.05, country, state, region); GetConclusion(demographicsWithAssociation, cs, demographic, FOTService.GetById(type).Name); } } else { cs = new ChiSquare(Test, demographic, null, null, null, 0.05, country, state, region); GetConclusion(demographicsWithAssociation, cs, demographic, ""); } } if (demographicsWithAssociation.Count > 0) { return(demographicsWithAssociation); } else { return(null); } }
private Evaluation MobileGenerateEvaluationObject(FormCollection collection) { Evaluation evaluation = new Evaluation(); evaluation.Test_Id = int.Parse(collection["evaluation.Test_Id"]); evaluation.IpAddress = Request.ServerVariables["REMOTE_ADDR"]; evaluation.RemoteHostName = GetMACAddress(); //collection["MacAddress"];//GetMACAddress(); //Request.ServerVariables["REMOTE_HOST"]; evaluation.RemoteUserName = GetMacAddress2(); //Request.ServerVariables["REMOTE_USER"]; Test test = new TestsServices().GetById(evaluation.Test_Id); List <string> demographics = test.DemographicsInTests.Select(d => d.Demographic.Name).ToList(); if (demographics.Contains("AgeRange")) { evaluation.Age_Id = int.Parse(collection["evaluation.Age_Id"]); } if (demographics.Contains("InstructionLevel")) { evaluation.InstructionLevel_Id = int.Parse(collection["evaluation.InstructionLevel_Id"]); } if (demographics.Contains("PositionLevel")) { evaluation.PositionLevel_Id = int.Parse(collection["evaluation.PositionLevel_Id"]); } if (demographics.Contains("Seniority")) { evaluation.Seniority_Id = int.Parse(collection["evaluation.Seniority_Id"]); } if (demographics.Contains("Location")) { evaluation.Location_Id = int.Parse(collection["evaluation.Location_Id"]); } if (demographics.Contains("Performance")) { evaluation.Performance_Id = int.Parse(collection["evaluation.Performance_Id"]); } if (demographics.Contains("Gender")) { evaluation.Sex = GetGender(collection["evaluation.Sex"].ToString()); } Dictionary <int, string> FO = new FunctionalOrganizationTypesServices().GetFunctionalOrganizationTypesForDropDownList(test.Company_Id); for (int i = 0; i < 2; i++) { Selected_FO[i] = new int[FO.Count]; } int j = 0; foreach (var v in FO) { Selected_FO[0][j] = v.Key; // Functional Organization Id Selected_FO[1][j] = int.Parse(collection["FO" + j + ""]); // Select Functional Organization j++; } evaluation.CreationDate = DateTime.Now; ValidateEvaluationModel(evaluation); return(evaluation); }
/* * */ public JsonResult MobileRemoveFOTChildren(int fotId) { List <FunctionalOrganizationType> data = new List <FunctionalOrganizationType>(); var FOTS = new FunctionalOrganizationTypesServices().GetAllRecords().Where(g => g.FOTParent_Id == fotId); foreach (var child in FOTS) { data.Add( new FunctionalOrganizationType { Id = child.Id }); } return(Json(data)); }
private void InitializeViewsForDemographics(string code, int?previousEvaluationId) { Evaluation evaluation; Test test; SelectList agesList; SelectList senioritiesList; SelectList instructionLevelsList; SelectList positionLevelsList; SelectList locationsList; SelectList performanceEvaluationsList; IQueryable <FunctionalOrganizationType> FOTypes; SelectList FOrganizations; Evaluation previousEvaluation = previousEvaluationId.HasValue ? _evaluationService.GetById(previousEvaluationId.Value) : null; evaluation = new Evaluation(); //if (previousEvaluationId.HasValue) //{ // evaluation.Age_Id = previousEvaluation.Age_Id; // evaluation.InstructionLevel_Id = previousEvaluation.InstructionLevel_Id; // evaluation.Location_Id = previousEvaluation.Location_Id; // evaluation.Performance_Id = previousEvaluation.Performance_Id; // evaluation.PositionLevel_Id = previousEvaluation.PositionLevel_Id; // evaluation.Seniority_Id = previousEvaluation.Seniority_Id; // evaluation.Sex = previousEvaluation.Sex; // evaluation.EvaluationFOs = previousEvaluation.EvaluationFOs; //} test = new TestsServices().GetByCode(code); evaluation.Test_Id = test.Id; agesList = new SelectList(new AgesServices().GetAgesForDropDownList(test.Company_Id), "Key", "Value"); senioritiesList = new SelectList(new SenioritiesServices().GetSenioritiesForDropDownList(test.Company_Id), "Key", "Value"); instructionLevelsList = new SelectList(new InstructionLevelsServices().GetInstructionLevelsForDropDownList(test.Company_Id), "Key", "Value"); positionLevelsList = new SelectList(new PositionLevelsServices().GetPositionLevelsForDropDownList(test.Company_Id), "Key", "Value"); locationsList = new SelectList(new LocationsServices().GetLocationsForDropDownList(test.Company_Id), "Key", "Value"); FOTypes = new FunctionalOrganizationTypesServices().GetByCompanyToDoTest(test.Company_Id); FOTypes = new FunctionalOrganizationTypesServices().OrderByCompany(FOTypes); FOrganizations = new SelectList(new FunctionalOrganizationsServices().GetEmptyDictionary()); performanceEvaluationsList = new SelectList(new PerformanceEvaluationsServices().GetPerformanceEvaluationsForDropDownList(test.Company_Id), "Key", "Value"); _evaluationViewModel = new EvaluationViewModel(evaluation, agesList, senioritiesList, instructionLevelsList, positionLevelsList, locationsList, FOTypes, FOrganizations, performanceEvaluationsList, test, previousEvaluation); }
private Evaluation GetEvaluationFromExisting(FormCollection collection) { Evaluation evaluation = new Evaluation(); Evaluation existing = new EvaluationsServices().GetById(int.Parse(collection["EvaluationId"])); evaluation.Test_Id = int.Parse(collection["evaluation.Test_Id"]); evaluation.IpAddress = Request.ServerVariables["REMOTE_ADDR"]; evaluation.RemoteHostName = GetMACAddress(); //collection["MacAddress"];//GetMACAddress(); //Request.ServerVariables["REMOTE_HOST"]; evaluation.RemoteUserName = GetMacAddress2(); //Request.ServerVariables["REMOTE_USER"]; Test test = new TestsServices().GetById(evaluation.Test_Id); List <string> demographics = test.DemographicsInTests.Select(d => d.Demographic.Name).ToList(); if (demographics.Contains("AgeRange")) { evaluation.Age_Id = existing.Age_Id; } if (demographics.Contains("InstructionLevel")) { evaluation.InstructionLevel_Id = existing.InstructionLevel_Id; } if (demographics.Contains("PositionLevel")) { evaluation.PositionLevel_Id = existing.PositionLevel_Id; } if (demographics.Contains("Seniority")) { evaluation.Seniority_Id = existing.Seniority_Id; } if (demographics.Contains("Location")) { evaluation.Location_Id = existing.Location_Id; } if (demographics.Contains("Performance")) { evaluation.Performance_Id = existing.Performance_Id; } if (demographics.Contains("Gender")) { evaluation.Sex = existing.Sex; } Dictionary <int, string> FO = new FunctionalOrganizationTypesServices().GetFunctionalOrganizationTypesForDropDownList(test.Company_Id); for (int i = 0; i < 2; i++) { Selected_FO[i] = new int[FO.Count]; } int j = 0; foreach (var v in FO) { if (test.DemographicsInTests.Where(f => f.FOT_Id == v.Key).Count() == 1) { Selected_FO[0][j] = v.Key; Selected_FO[1][j] = existing.EvaluationFOs.Where(t => t.FunctionalOrganization.Type_Id == v.Key).FirstOrDefault().FunctionalOrganization_Id; // Select Functional Organization j++; } } evaluation.CreationDate = DateTime.Now; ValidateEvaluationModel(evaluation); return(evaluation); }
public FunctionalOrganizationTypesController(FunctionalOrganizationTypesServices _typeService) { this._typeService = _typeService; }
public FunctionalOrganizationTypesController() { _typeService = new FunctionalOrganizationTypesServices(); }