Esempio n. 1
0
        private void Create()
        {
            _exapp = new RExcel();
            _exapp.Visible = false;
            _exapp.NewDocument();

               // try
               // {
                int tstcnt = 0;
                int rowindex = 2;
                //проходим по всем тестам всех людей
                foreach (human h in _fe.humans)
                {
                    if (_worker.CancellationPending == true) { break; }
                    h.testresults.Load();
                    var tp = h.testresults.Where(t => t.testid == (int)_test & t.testdate >= _mindate.Date & t.testdate <=_maxdate.AddMinutes(1));
                    int i = tp.Count();
                    foreach (testresult t in tp)
                    {
                        if (_worker.CancellationPending == true) { break; }

                        ITestReport report = ReportFactory.CreateReport(_test, h, t, _ge, _fe, false);
                        _exapp.SetCellValue(rowindex, 1, rowindex - 1);
                        //добавление фамилии
                        _exapp.SetCellValue(rowindex, 2, h.secondname);
                        _exapp.SetCellValue(rowindex, 3, h.firstname);
                        _exapp.SetCellValue(rowindex, 4, h.lastname);
                        //добавление даты теста
                        _exapp.SetCellValue(rowindex, 5, t.testdate);
                        _exapp.SetCellValue(rowindex, 6, h.birthday);
                        _exapp.SetCellValue(rowindex, 7, ((t.testdate.Date - h.birthday.Value.Date).Days / 365));
                        _exapp.SetCellValue(rowindex, 8, _fe.educations.First(e => e.ide == h.educationid).description);
                        _exapp.SetCellValue(rowindex, 9, _fe.gensers.First(e => e.idg == h.genderid).description);
                        _exapp.SetCellValue(rowindex, 11, _fe.departments.First(e => e.idd == h.departmentid).description);

                        int colindex = 12;
                        int scalescount = report.ListScales.Count;
                        for (int scaleindex = 0; scaleindex < scalescount; scaleindex++)
                        {
                            report.ListScales[scaleindex].GetMark();
                            _exapp.SetCellValue(1, colindex + scaleindex, report.ListScales[scaleindex].Name + "(СБ)");
                            _exapp.SetCellValue(rowindex, colindex + scaleindex, report.ListScales[scaleindex].Mark);
                            _exapp.SetCellValue(1, colindex + scaleindex + scalescount, report.ListScales[scaleindex].Name + "(СТ)");
                            _exapp.SetCellValue(rowindex, colindex + scaleindex + scalescount, report.ListScales[scaleindex].Stens);

                        }

                        rowindex++;
                        tstcnt++;
                        _worker.ReportProgress(tstcnt);

                    }
                }
               // }
            //catch (Exception ex)
            //{
            //    _exapp.Visible = true;
            //    throw new Exception(ex.Message);
            //}
            _exapp.Visible = true;
        }
Esempio n. 2
0
        private void Create()
        {
            _exapp         = new RExcel();
            _exapp.Visible = false;
            _exapp.NewDocument();

            // try
            // {
            int tstcnt   = 0;
            int rowindex = 2;

            //проходим по всем тестам всех людей
            foreach (human h in _fe.humans)
            {
                if (_worker.CancellationPending == true)
                {
                    break;
                }
                h.testresults.Load();
                var tp = h.testresults.Where(t => t.testid == (int)_test & t.testdate >= _mindate.Date & t.testdate <= _maxdate.AddMinutes(1));
                int i  = tp.Count();
                foreach (testresult t in tp)
                {
                    if (_worker.CancellationPending == true)
                    {
                        break;
                    }

                    ITestReport report = ReportFactory.CreateReport(_test, h, t, _ge, _fe, false);
                    _exapp.SetCellValue(rowindex, 1, rowindex - 1);
                    //добавление фамилии
                    _exapp.SetCellValue(rowindex, 2, h.secondname);
                    _exapp.SetCellValue(rowindex, 3, h.firstname);
                    _exapp.SetCellValue(rowindex, 4, h.lastname);
                    //добавление даты теста
                    _exapp.SetCellValue(rowindex, 5, t.testdate);
                    _exapp.SetCellValue(rowindex, 6, h.birthday);
                    _exapp.SetCellValue(rowindex, 7, ((t.testdate.Date - h.birthday.Value.Date).Days / 365));
                    _exapp.SetCellValue(rowindex, 8, _fe.educations.First(e => e.ide == h.educationid).description);
                    _exapp.SetCellValue(rowindex, 9, _fe.gensers.First(e => e.idg == h.genderid).description);
                    _exapp.SetCellValue(rowindex, 11, _fe.departments.First(e => e.idd == h.departmentid).description);

                    int colindex    = 12;
                    int scalescount = report.ListScales.Count;
                    for (int scaleindex = 0; scaleindex < scalescount; scaleindex++)
                    {
                        report.ListScales[scaleindex].GetMark();
                        _exapp.SetCellValue(1, colindex + scaleindex, report.ListScales[scaleindex].Name + "(СБ)");
                        _exapp.SetCellValue(rowindex, colindex + scaleindex, report.ListScales[scaleindex].Mark);
                        _exapp.SetCellValue(1, colindex + scaleindex + scalescount, report.ListScales[scaleindex].Name + "(СТ)");
                        _exapp.SetCellValue(rowindex, colindex + scaleindex + scalescount, report.ListScales[scaleindex].Stens);
                    }

                    rowindex++;
                    tstcnt++;
                    _worker.ReportProgress(tstcnt);
                }
            }
            // }
            //catch (Exception ex)
            //{
            //    _exapp.Visible = true;
            //    throw new Exception(ex.Message);
            //}
            _exapp.Visible = true;
        }