Exemplo n.º 1
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.º 2
0
        private void TimeLineForm_Load(object sender, EventArgs e)
        {
            List <double> tm          = new List <double>();
            List <string> aq          = new List <string>();
            string        _axisXLabel = "X";
            string        _axisYLabel = "Y";

            //TODO:похоронить в фабрике
            switch (_testresult.testid)
            {
            case (int)EnumPTests.KettellC:    //kettell c
                KettellAnswers kc = GetKettellFromBase();
                tm.Add(0);
                aq.Add("");
                _axisXLabel = "Номер вопроса";
                _axisYLabel = "Секунды";
                for (int i = 1; i < kc.Count; i++)
                {
                    tm.Add(Convert.ToDouble(kc[i].Time.Ticks - kc[i - 1].Time.Ticks) / 100000000);
                    aq.Add(kc[i].AnswerDescription + " // " + kc[i].SelectedCellButtonDescription);
                }
                break;

            case (int)EnumPTests.PNN:    //pnn
                PNNAnswers pa = GetPNNFromBase();
                _axisXLabel = "Нажатия";
                _axisYLabel = "Милисекунды";
                for (int i = 0; i < pa.Count; i++)
                {
                    tm.Add(pa[i].Exposition);
                    aq.Add(pa[i].Signal.ToString() + " // " + pa[i].Answer.ToString());
                }
                break;

            case (int)EnumPTests.Adaptability:    //adaptability
                DAnswers da = GetDFromBase();
                tm.Add(0);
                aq.Add("");
                _axisXLabel = "Номер вопроса";
                _axisYLabel = "Секунды";
                for (int i = 1; i < da.Count; i++)
                {
                    tm.Add(Convert.ToDouble(da[i].Time.Ticks - da[i - 1].Time.Ticks) / 100000000);
                    aq.Add(da[i].AnswerDescription + " // " + da[i].SelectedCellButtonDescription);
                }
                break;

            case (int)EnumPTests.FPI:    //fpi
                FPIAnswers fa = GetFPIFromBase();
                tm.Add(0);
                aq.Add("");
                _axisXLabel = "Номер вопроса";
                _axisYLabel = "Секунды";
                for (int i = 1; i < fa.Count; i++)
                {
                    tm.Add(Convert.ToDouble(fa[i].Time.Ticks - fa[i - 1].Time.Ticks) / 100000000);
                    aq.Add(fa[i].AnswerDescription + " // " + fa[i].SelectedCellButtonDescription);
                }
                break;

            case (int)EnumPTests.KettellA:    //kettell a
                KettellAnswers ka = GetKettellFromBase();
                tm.Add(0);
                aq.Add("");
                _axisXLabel = "Номер вопроса";
                _axisYLabel = "Секунды";
                for (int i = 1; i < ka.Count; i++)
                {
                    tm.Add(Convert.ToDouble(ka[i].Time.Ticks - ka[i - 1].Time.Ticks) / 100000000);
                    aq.Add(ka[i].AnswerDescription + " // " + ka[i].SelectedCellButtonDescription);
                }
                break;

            case (int)EnumPTests.Modul2:    //modul
                MDAnswers mda = GetMDFromBase();
                tm.Add(0);
                aq.Add("");
                _axisXLabel = "Номер вопроса";
                _axisYLabel = "Секунды";
                for (int i = 1; i < mda.Count; i++)
                {
                    tm.Add(Convert.ToDouble(mda[i].Time.Ticks - mda[i - 1].Time.Ticks) / 100000000);
                    aq.Add(mda[i].AnswerDescription + " // " + mda[i].SelectedCellButtonDescription);
                }
                break;

            case (int)EnumPTests.Contrasts:    //контрасты
                ContrastsAnswers ca = GetContrastsFromBase();
                _axisXLabel = "Номер изображения";
                _axisYLabel = "Секунды";
                tm.Add(Convert.ToDouble(0));
                aq.Add("1");
                for (int i = 1; i < ca.Count; i++)
                {
                    tm.Add(Convert.ToDouble(ca[i].Time.Ticks - ca[i - 1].Time.Ticks) / 100000000);
                    aq.Add(ca[i].PictureId.ToString());
                }
                break;

            case (int)EnumPTests.Prognoz:
                PAnswers pda = GetPFromBase();
                tm.Add(0);
                aq.Add("");
                _axisXLabel = "Номер вопроса";
                _axisYLabel = "Секунды";
                for (int i = 1; i < pda.Count; i++)
                {
                    tm.Add(Convert.ToDouble(pda[i].Time.Ticks - pda[i - 1].Time.Ticks) / 100000000);
                    aq.Add(pda[i].AnswerDescription + " // " + pda[i].SelectedCellButtonDescription);
                }
                break;

            case (int)EnumPTests.NPNA:
                NPNAnswers nda = GetNPNFromBase();
                tm.Add(0);
                aq.Add("");
                _axisXLabel = "Номер вопроса";
                _axisYLabel = "Секунды";
                for (int i = 1; i < nda.Count; i++)
                {
                    tm.Add(Convert.ToDouble(nda[i].Time.Ticks - nda[i - 1].Time.Ticks) / 100000000);
                    aq.Add(nda[i].AnswerDescription + " // " + nda[i].SelectedCellButtonDescription);
                }
                break;

            case (int)EnumPTests.Leongard:
                LAnswers lda = GetLFromBase();
                tm.Add(0);
                aq.Add("");
                _axisXLabel = "Номер вопроса";
                _axisYLabel = "Секунды";
                for (int i = 1; i < lda.Count; i++)
                {
                    tm.Add(Convert.ToDouble(lda[i].Time.Ticks - lda[i - 1].Time.Ticks) / 100000000);
                    aq.Add(lda[i].AnswerDescription + " // " + lda[i].SelectedCellButtonDescription);
                }
                break;

            case (int)EnumPTests.Addictive:
                AAnswers ada = GetAFromBase();
                tm.Add(0);
                aq.Add("");
                _axisXLabel = "Номер вопроса";
                _axisYLabel = "Секунды";
                for (int i = 1; i < ada.Count; i++)
                {
                    tm.Add(Convert.ToDouble(ada[i].Time.Ticks - ada[i - 1].Time.Ticks) / 100000000);
                    aq.Add(ada[i].AnswerDescription + " // " + ada[i].SelectedCellButtonDescription);
                }
                break;
            }
            Series s = new Series("timeline", tm.Count - 1);

            s.MarkerStyle = MarkerStyle.Cross;
            s.MarkerSize  = 12;
            s.ChartType   = SeriesChartType.Line;
            s.YValueType  = ChartValueType.Double;
            chart_timeline.Legends.Remove(chart_timeline.Legends[0]);
            chart_timeline.ChartAreas[0].AxisX.Minimum = 1;

            for (int i = 0; i < tm.Count; i++)
            {
                s.Points.AddXY(i + 1, tm[i]);

                s.Points[i].ToolTip = aq[i];
            }
            chart_timeline.ChartAreas[0].AxisY.Title = _axisYLabel;
            chart_timeline.ChartAreas[0].AxisX.Title = _axisXLabel;
            chart_timeline.Series.Add(s);
        }