Exemplo n.º 1
0
        public static ITestReport CreateReport(EnumPTests test, human human, testresult testresult, pBaseEntities ge, fBaseEntities fe, bool withresult)
        {
            ITestReport _genreport = null;

            switch (test)
            {
            case EnumPTests.KettellC:
                _genreport = new KettellCTestReport(human, testresult, ge, fe, withresult);
                break;

            case EnumPTests.PNN:
                _genreport = new PNNTestReport(human, testresult, ge, fe);
                break;

            case EnumPTests.Adaptability:
                _genreport = new DTestReport(human, testresult, ge, fe, withresult);
                break;

            case EnumPTests.FPI:
                _genreport = new FPITestReport(human, testresult, ge, fe, withresult);
                break;

            case EnumPTests.KettellA:
                _genreport = new KettellATestReport(human, testresult, ge, fe, withresult);
                break;

            case EnumPTests.Modul2:
                _genreport = new MDTestReport(human, testresult, ge, fe, withresult);
                break;

            case EnumPTests.Contrasts:
                _genreport = new ContrastsTestReport(human, testresult, ge, fe);
                break;

            case EnumPTests.Prognoz:
                _genreport = new PTestReport(human, testresult, ge, fe, withresult);
                break;

            case EnumPTests.Addictive:
                _genreport = new ATestReport(human, testresult, ge, fe, withresult);
                break;

            case EnumPTests.NPNA:
                _genreport = new NPNTestReport(human, testresult, ge, fe, withresult);
                break;

            case EnumPTests.Leongard:
                _genreport = new LTestReport(human, testresult, ge, fe, withresult);
                break;
            }
            return(_genreport);
        }
Exemplo n.º 2
0
        private void Loading()
        {
            _tp = _ge.testsparams.First(t => t.idt == _testid);
            switch (_testid)
            {
            case (int)EnumPTests.KettellC:    //TODO:это все поместить в фабрику отчетов с функцие добавления пустых ответов
                //create fool kettellanswers
                KettellAnswers ka = new KettellAnswers();
                for (int a = 0; a < 104; a++)
                {
                    ka.Add(0, "", "", a, "");
                }
                XmlSerializer mySerializer = new XmlSerializer(typeof(KettellAnswers));
                StringWriter  myWriter     = new StringWriter();
                mySerializer.Serialize(myWriter, ka);
                _human = _fe.humans.First(h => h.idh == _humanid);
                KettellCTestReport kcr = new KettellCTestReport(_human, testresult.Createtestresult(0, _humanid, DateTime.Now, (int)EnumPTests.KettellC, myWriter.ToString(), "manual"), _ge, _fe, true);
                for (int i = 0; i < kcr.ListScales.Count(); i++)
                {
                    ScaleControl sc = new ScaleControl();
                    this.flp_parent.Controls.Add(sc);
                    sc.ControlScale = kcr.ListScales[i];
                }
                break;

            case (int)EnumPTests.PNN:
                PNNAnswers pa = new PNNAnswers();
                for (int a = 0; a < 104; a++)
                {
                    pa.Add(PnnSignalType.Green, PnnKeyType.AnyKey, DateTime.Now, 0);
                }
                XmlSerializer mySerializerp = new XmlSerializer(typeof(PNNAnswers));
                StringWriter  myWriterp     = new StringWriter();
                mySerializerp.Serialize(myWriterp, pa);
                _human = _fe.humans.First(h => h.idh == _humanid);
                PNNTestReport pnr = new PNNTestReport(_human, testresult.Createtestresult(0, _humanid, DateTime.Now, (int)EnumPTests.PNN, myWriterp.ToString(), "manual"), _ge, _fe);
                for (int i = 0; i < pnr.ListScales.Count(); i++)
                {
                    ScaleControl sc = new ScaleControl();
                    this.flp_parent.Controls.Add(sc);
                    sc.ControlScale = pnr.ListScales[i];
                }
                break;

            case (int)EnumPTests.Adaptability:
                DAnswers kd = new DAnswers();
                for (int a = 0; a < 165; a++)
                {
                    kd.Add(0, "", "", a, "");
                }
                XmlSerializer mySerializerd = new XmlSerializer(typeof(DAnswers));
                StringWriter  myWriterd     = new StringWriter();
                mySerializerd.Serialize(myWriterd, kd);
                _human = _fe.humans.First(h => h.idh == _humanid);
                DTestReport kdr = new DTestReport(_human, testresult.Createtestresult(0, _humanid, DateTime.Now, (int)EnumPTests.Adaptability, myWriterd.ToString(), "manual"), _ge, _fe, true);
                for (int i = 0; i < kdr.ListScales.Count(); i++)
                {
                    ScaleControl sc = new ScaleControl();
                    this.flp_parent.Controls.Add(sc);
                    sc.ControlScale = kdr.ListScales[i];
                }
                break;

            case (int)EnumPTests.FPI:
                FPIAnswers kfpi = new FPIAnswers();
                for (int a = 0; a < 114; a++)
                {
                    kfpi.Add(0, "", "", a, "");
                }
                XmlSerializer mySerializerfpi = new XmlSerializer(typeof(FPIAnswers));
                StringWriter  myWriterfpi     = new StringWriter();
                mySerializerfpi.Serialize(myWriterfpi, kfpi);
                _human = _fe.humans.First(h => h.idh == _humanid);
                FPITestReport kfr = new FPITestReport(_human, testresult.Createtestresult(0, _humanid, DateTime.Now, (int)EnumPTests.FPI, myWriterfpi.ToString(), "manual"), _ge, _fe, true);
                for (int i = 0; i < kfr.ListScales.Count(); i++)
                {
                    ScaleControl sc = new ScaleControl();
                    this.flp_parent.Controls.Add(sc);
                    sc.ControlScale = kfr.ListScales[i];
                }
                break;

            case (int)EnumPTests.KettellA:
                KettellAnswers kaa = new KettellAnswers();
                for (int a = 0; a < 185; a++)
                {
                    kaa.Add(0, "", "", a, "");
                }
                XmlSerializer mySerializera = new XmlSerializer(typeof(KettellAnswers));
                StringWriter  myWritera     = new StringWriter();
                mySerializera.Serialize(myWritera, kaa);
                _human = _fe.humans.First(h => h.idh == _humanid);
                KettellATestReport kar = new KettellATestReport(_human, testresult.Createtestresult(0, _humanid, DateTime.Now, (int)EnumPTests.KettellA, myWritera.ToString(), "manual"), _ge, _fe, true);
                for (int i = 0; i < kar.ListScales.Count(); i++)
                {
                    ScaleControl sc = new ScaleControl();
                    this.flp_parent.Controls.Add(sc);
                    sc.ControlScale = kar.ListScales[i];
                }
                break;

            case (int)EnumPTests.Contrasts:
                ContrastsAnswers mkd = new ContrastsAnswers();
                for (int a = 0; a < 6; a++)
                {
                    mkd.Add(DateTime.Now, 0);
                }
                XmlSerializer mySerializermd = new XmlSerializer(typeof(ContrastsAnswers));
                StringWriter  myWritermd     = new StringWriter();
                mySerializermd.Serialize(myWritermd, mkd);
                _human = _fe.humans.First(h => h.idh == _humanid);
                ContrastsTestReport mkdr = new ContrastsTestReport(_human, testresult.Createtestresult(0, _humanid, DateTime.Now, (int)EnumPTests.Contrasts, myWritermd.ToString(), "manual"), _ge, _fe);
                for (int i = 0; i < mkdr.ListScales.Count(); i++)
                {
                    ScaleControl sc = new ScaleControl();
                    this.flp_parent.Controls.Add(sc);
                    sc.ControlScale = mkdr.ListScales[i];
                }
                break;

            case (int)EnumPTests.Prognoz:
                PAnswers paa = new PAnswers();
                for (int a = 0; a < 86; a++)
                {
                    paa.Add(0, "", "", a, "");
                }
                XmlSerializer mySerializerpr = new XmlSerializer(typeof(PAnswers));
                StringWriter  myWriterpr     = new StringWriter();
                mySerializerpr.Serialize(myWriterpr, paa);
                _human = _fe.humans.First(h => h.idh == _humanid);
                PTestReport par = new PTestReport(_human, testresult.Createtestresult(0, _humanid, DateTime.Now, (int)EnumPTests.Prognoz, myWriterpr.ToString(), "manual"), _ge, _fe, true);
                for (int i = 0; i < par.ListScales.Count(); i++)
                {
                    ScaleControl sc = new ScaleControl();
                    this.flp_parent.Controls.Add(sc);
                    sc.ControlScale = par.ListScales[i];
                }
                break;

            case (int)EnumPTests.Addictive:
                AAnswers aaa = new AAnswers();
                for (int a = 0; a < 30; a++)
                {
                    aaa.Add(0, "", "", a, "");
                }
                XmlSerializer mySerializeraa = new XmlSerializer(typeof(AAnswers));
                StringWriter  myWriteraa     = new StringWriter();
                mySerializeraa.Serialize(myWriteraa, aaa);
                _human = _fe.humans.First(h => h.idh == _humanid);
                ATestReport aar = new ATestReport(_human, testresult.Createtestresult(0, _humanid, DateTime.Now, (int)EnumPTests.Addictive, myWriteraa.ToString(), "manual"), _ge, _fe, true);
                for (int i = 0; i < aar.ListScales.Count(); i++)
                {
                    ScaleControl sc = new ScaleControl();
                    this.flp_parent.Controls.Add(sc);
                    sc.ControlScale = aar.ListScales[i];
                }
                break;

            case (int)EnumPTests.NPNA:
                NPNAnswers npn = new NPNAnswers();
                for (int a = 0; a < 276; a++)
                {
                    npn.Add(0, "", "", a, "");
                }
                XmlSerializer mySerializernpn = new XmlSerializer(typeof(NPNAnswers));
                StringWriter  myWriternpn     = new StringWriter();
                mySerializernpn.Serialize(myWriternpn, npn);
                _human = _fe.humans.First(h => h.idh == _humanid);
                NPNTestReport npnr = new NPNTestReport(_human, testresult.Createtestresult(0, _humanid, DateTime.Now, (int)EnumPTests.NPNA, myWriternpn.ToString(), "manual"), _ge, _fe, true);
                for (int i = 0; i < npnr.ListScales.Count(); i++)
                {
                    ScaleControl sc = new ScaleControl();
                    this.flp_parent.Controls.Add(sc);
                    sc.ControlScale = npnr.ListScales[i];
                }
                break;

            case (int)EnumPTests.Leongard:
                LAnswers lpn = new LAnswers();
                for (int a = 0; a < 88; a++)
                {
                    lpn.Add(0, "", "", a, "");
                }
                XmlSerializer mySerializerlpn = new XmlSerializer(typeof(LAnswers));
                StringWriter  myWriterlpn     = new StringWriter();
                mySerializerlpn.Serialize(myWriterlpn, lpn);
                _human = _fe.humans.First(h => h.idh == _humanid);
                LTestReport lpnr = new LTestReport(_human, testresult.Createtestresult(0, _humanid, DateTime.Now, (int)EnumPTests.Leongard, myWriterlpn.ToString(), "manual"), _ge, _fe, true);
                for (int i = 0; i < lpnr.ListScales.Count(); i++)
                {
                    ScaleControl sc = new ScaleControl();
                    this.flp_parent.Controls.Add(sc);
                    sc.ControlScale = lpnr.ListScales[i];
                }
                break;
            }
        }
Exemplo n.º 3
0
 public KettellATestReference(ITestReport KettellAReport)
 {
     _kettellatestreport = (KettellATestReport)KettellAReport;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Создает характеристику по выбранным тестам
        /// </summary>
        /// <param name="checkedtestsid">Отмеченные тесты</param>
        /// <param name="SelectedRef">Выбранная характеристика</param>
        /// <returns></returns>
        public IReference GetReference(List <int> checkedtestsid, EnumPReferences SelectedRef)
        {
            IReference        _reference  = null;
            List <testresult> testresults = new List <testresult>();

            foreach (int testid in checkedtestsid)
            {//выбираем все отмеченные тесты
                testresults.Add(_human.testresults.FirstOrDefault(test => test.idtr == testid));
            }

            switch (SelectedRef)
            {
            case EnumPReferences.KettellC:
                if (testresults.Count(test => test.testid == (int)EnumPTests.KettellC) != 0)
                {
                    testresult  kettellctestresult = testresults.LastOrDefault(test => test.testid == (int)EnumPTests.KettellC);
                    ITestReport kettellcreport     = new KettellCTestReport(_human, kettellctestresult, _ge, _fe, true);
                    _reference = new KettellCTestReference(kettellcreport);
                }
                else
                {
                    MessageBox.Show("Для выбранной характеристики необходим тест Кеттелла С \nОтметьте его галочной в списке тестов");
                }
                break;

            case EnumPReferences.Adaptability:
                if (testresults.Count(test => test.testid == (int)EnumPTests.Adaptability) != 0)
                {
                    testresult  dtestresult = testresults.LastOrDefault(test => test.testid == (int)EnumPTests.Adaptability);
                    ITestReport dreport     = new DTestReport(_human, dtestresult, _ge, _fe, true);
                    _reference = new DTestReference(dreport);
                }
                else
                {
                    MessageBox.Show("Для выбранной характеристики необходим тест Адаптивность \nОтметьте его галочной в списке тестов");
                }
                break;

            case EnumPReferences.FPI:
                if (testresults.Count(test => test.testid == (int)EnumPTests.FPI) != 0)
                {
                    testresult  fpitestresult = testresults.LastOrDefault(test => test.testid == (int)EnumPTests.FPI);
                    ITestReport fpireport     = new FPITestReport(_human, fpitestresult, _ge, _fe, true);
                    _reference = new FPITestReference(fpireport);
                }
                else
                {
                    MessageBox.Show("Для выбранной характеристики необходим тест FPI \nОтметьте его галочной в списке тестов");
                }
                break;

            case EnumPReferences.KettellA:
                if (testresults.Count(test => test.testid == (int)EnumPTests.KettellA) != 0)
                {
                    testresult  kettellatestresult = testresults.LastOrDefault(test => test.testid == (int)EnumPTests.KettellA);
                    ITestReport kettellareport     = new KettellATestReport(_human, kettellatestresult, _ge, _fe, true);
                    _reference = new KettellATestReference(kettellareport);
                }
                else
                {
                    MessageBox.Show("Для выбранной характеристики необходим тест Кеттелла А \nОтметьте его галочной в списке тестов");
                }
                break;

            case EnumPReferences.Modul:
                if (testresults.Count(test => test.testid == (int)EnumPTests.Modul2) != 0)
                {
                    testresult  mdtestresult = testresults.LastOrDefault(test => test.testid == (int)EnumPTests.Modul2);
                    ITestReport mdreport     = new MDTestReport(_human, mdtestresult, _ge, _fe, true);
                    _reference = new MDTestReference(mdreport);
                }
                else
                {
                    MessageBox.Show("Для выбранной характеристики необходим тест Модуль \nОтметьте его галочной в списке тестов");
                }
                break;

            case EnumPReferences.Integrative:
                if (testresults.Count(test => test.testid == (int)EnumPTests.KettellC) != 0)
                {
                    testresult  kettelltestresult = testresults.LastOrDefault(test => test.testid == (int)EnumPTests.KettellC);
                    ITestReport kettellreport     = new KettellCTestReport(_human, kettelltestresult, _ge, _fe, true);
                    _reference = new IntegrativeReference(kettellreport, _fe);
                }
                else
                {
                    MessageBox.Show("Для выбранной характеристики необходим тест Кеттелла С \nОтметьте его галочной в списке тестов");
                }
                break;

            case EnumPReferences.Prognoz:
                if (testresults.Count(test => test.testid == (int)EnumPTests.Prognoz) != 0)
                {
                    testresult  prognoztestresult = testresults.LastOrDefault(test => test.testid == (int)EnumPTests.Prognoz);
                    ITestReport prognozreport     = new PTestReport(_human, prognoztestresult, _ge, _fe, true);
                    _reference = new PTestReference(prognozreport);
                }
                else
                {
                    MessageBox.Show("Для выбранной характеристики необходим тест Прогноз 2 \nОтметьте его галочной в списке тестов");
                }
                break;

            case EnumPReferences.Addictive:
                if (testresults.Count(test => test.testid == (int)EnumPTests.Addictive) != 0)
                {
                    testresult  addictivetestresult = testresults.LastOrDefault(test => test.testid == (int)EnumPTests.Addictive);
                    ITestReport addictivereport     = new ATestReport(_human, addictivetestresult, _ge, _fe, true);
                    _reference = new ATestReference(addictivereport);
                }
                else
                {
                    MessageBox.Show("Для выбранной характеристики необходим тест Аддиктивная склонность \nОтметьте его галочной в списке тестов");
                }
                break;

            case EnumPReferences.NPNA:
                if (testresults.Count(test => test.testid == (int)EnumPTests.NPNA) != 0)
                {
                    testresult  addictivetestresult = testresults.LastOrDefault(test => test.testid == (int)EnumPTests.NPNA);
                    ITestReport addictivereport     = new NPNTestReport(_human, addictivetestresult, _ge, _fe, true);
                    _reference = new NPNTestReference(addictivereport);
                }
                else
                {
                    MessageBox.Show("Для выбранной характеристики необходим тест НПН-А \nОтметьте его галочной в списке тестов");
                }
                break;

            case EnumPReferences.Leongard:
                if (testresults.Count(test => test.testid == (int)EnumPTests.Leongard) != 0)
                {
                    testresult  addictivetestresult = testresults.LastOrDefault(test => test.testid == (int)EnumPTests.Leongard);
                    ITestReport addictivereport     = new LTestReport(_human, addictivetestresult, _ge, _fe, true);
                    _reference = new LTestReference(addictivereport);
                }
                else
                {
                    MessageBox.Show("Для выбранной характеристики необходим тест Леонгарда \nОтметьте его галочной в списке тестов");
                }
                break;
            }
            return(_reference);
        }