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);
        }
        // Get the selector value
        private int MobileGetSelectorValue(Evaluation evaluation)
        {
            DemographicsInTest d = new DemographicsInTestsServices().GetSelector(evaluation.Test_Id);
            List <int>         listOfId;
            IQueryable <DemographicSelectorDetail> listDSD = new DemographicSelectorDetailsServices().GetByTest(evaluation.Test_Id);

            if (d.FOT_Id.HasValue)
            {
                listOfId = new List <int>();
                for (int k = 0; k < Selected_FO[0].Length; k++)
                {
                    listOfId.Add(Selected_FO[k][1]);
                }
            }
            else
            {
                listOfId = MobileGeneratesID(evaluation);
            }
            foreach (DemographicSelectorDetail dsd in listDSD)
            {
                if (listOfId.Contains(dsd.SelectorValue_Id))
                {
                    return(dsd.SelectorValue_Id);
                }
            }
            return(0);
        }
        private static int GetQuestionnaireIdFromEvaluation(Evaluation evaluation)
        {
            Test test = new TestsServices().GetById(evaluation.Test_Id);
            DemographicsInTest demographicInTest = new DemographicsInTestsServices().GetSelector(test.Id);
            int selectorFromEvaluation           = GetSelectorId(evaluation, test, demographicInTest);
            int questionnaire_id = new DemographicSelectorDetailsServices().GetQuestionnaireIdByDemographicSelectorDetailValues(test.Id, demographicInTest.Demographic_Id, selectorFromEvaluation);

            return(questionnaire_id);
        }
        private int GetQuestionnaireIdByRequest()
        {
            DemographicsInTest demographicInTest = new DemographicsInTestsServices().GetSelector(test.Id);

            return(new DemographicSelectorDetailsServices().GetQuestionnaireIdByDemographicSelectorDetailValues(test.Id, demographicInTest.Demographic_Id, IdSelectorValue));
        }