Esempio n. 1
0
        public IActionResult Attestation(AttestationModel attestation)
        {
            switch (attestation.Action)
            {
            case AttestationAction.Choosing:
                attestation.Workers = _workerService.GetLoadedWorkers();
                break;

            case AttestationAction.CompetencesChose:     //вывести таблицу компетенций
                attestation = _attestationService.CreateCompetenceTable(attestation);
                break;

            case AttestationAction.GradeChose:     //вывести таблицу грейдов
                attestation = _attestationService.CreateGradeTable(attestation);
                break;

            case AttestationAction.AttestationByCompetences:     //вывести окно аттестации по компетенциям
                attestation = _attestationService.CreateAttestationByCompetences(attestation);
                break;

            case AttestationAction.AttestationByGrade:     //вывести окно аттестации по грейдам
                attestation = _attestationService.CreateAttestationByGrades(attestation, out var isReattistation);
                attestation.ReAttestation = isReattistation;
                ViewBag.ReAttestation     = isReattistation;
                break;

            case AttestationAction.Finished:     //сохранить результаты
                _attestationService.FinishAttestation(attestation);
                return(RedirectToAction("AttestationList"));

            case AttestationAction.NotEnoughQuestion:
                return(View(attestation));
            }
            return(View(attestation));
        }
Esempio n. 2
0
        public AttestationModel CreateGradeTable(AttestationModel attestation)
        {
            attestation.Workers = _workerService.GetLoadedWorkers();
            attestation.Grades  = _gradeService.GetLoadedGrades();

            var worker = _workerService.GetWorker((int)attestation.WorkerId);

            var workerCompetences = new List <CompetencesModel>();

            foreach (var item in worker.SpecificWorkerCompetencesModels)
            {
                workerCompetences.Add(item.Competence);
            } //заполняем его

            var workerGrades = _gradeService.GetWorkerGrades(workerCompetences, attestation.Grades, _context.Set <GradeToGradeModel>().ToList());

            if (workerGrades.Count() != 0)
            {
                var max = workerGrades.Max(x => x.GradesCompetences.Count());

                var currentGrade = workerGrades.Where(x => x.GradesCompetences.Count() == max).FirstOrDefault();

                foreach (var element in workerGrades)
                {
                    if (attestation.Grades.Contains(element))
                    {
                        attestation.Grades.Remove(element);
                    }
                }
                attestation.Grades.Add(currentGrade);
            }
            return(attestation);
        }
Esempio n. 3
0
        public Tuple <string, List <AnswerModel> > GetProblemsAndAnswers(AttestationModel model)
        {
            var problems = new StringBuilder("");
            var answers  = new List <AnswerModel>();

            for (int i = 0; i < model.Questions.Count; i++)
            {
                var answerModel = new AnswerModel();
                if (model.Commentaries[i] == null || model.Commentaries[i] == "")
                {
                    model.Commentaries[i] = "Комментарий не добавлен";
                }
                answerModel.Commentary  = model.Commentaries[i];
                answerModel.Question    = model.Questions[i];
                answerModel.IsRight     = model.RightAnswers.Contains(i);
                answerModel.IsSkipped   = model.SkipedAnswers.Contains(i);
                answerModel.NumberOfAsk = i + 1;
                answers.Add(answerModel);

                if (!answerModel.IsRight && !answerModel.IsSkipped)
                {
                    problems.Append($"вопрос №{i + 1}: {answerModel.Question} \n");
                }
            }

            if (problems.ToString() == "")
            {
                problems.Append("Всё верно!");
            }
            Tuple <string, List <AnswerModel> > tuple = new Tuple <string, List <AnswerModel> >(problems.ToString(), answers);

            return(tuple);
        }
Esempio n. 4
0
        public IActionResult Attestation()
        {
            AttestationModel attestation = new AttestationModel();

            attestation.Workers     = _workerService.GetLoadedWorkers();
            attestation.Grades      = _gradeService.GetLoadedGrades();
            attestation.Competences = _context.Set <CompetencesModel>().ToList();

            if (attestation.Competences.Count == 0)
            {
                attestation.Action = AttestationAction.None;
            }
            else
            {
                if (attestation.Grades.Count != 0)
                {
                    attestation.Action = AttestationAction.Choosing;
                }
                else
                {
                    attestation.Action = AttestationAction.CompetencesChose;
                }
            }

            return(View(attestation));
        }
        public HttpResponseMessage DownloadAttestation(AttestationModel json)
        {
            if (ModelState.IsValid)
            {
                AttestationService att = new AttestationService();
                att.SaveWord(json, "C:\\Users\\Ivan\\Desktop\\AttestationFile.docx");

                return(Post("C:\\Users\\Ivan\\Desktop\\AttestationFile.docx", "application/docx"));
            }

            return(null);
        }
Esempio n. 6
0
        public AttestationModel CreateCompetenceTable(AttestationModel attestation)
        {
            attestation.Workers     = _workerService.GetLoadedWorkers();
            attestation.Competences = _context.Set <CompetencesModel>().ToList();

            var worker = attestation.Workers.Where(x => x.Id == attestation.WorkerId).FirstOrDefault();

            foreach (var workerCompetence in worker.SpecificWorkerCompetencesModels)
            {
                attestation.Competences.Remove(workerCompetence.Competence);
            }
            return(attestation);
        }
Esempio n. 7
0
        public void AddAnswers(List <AnswerModel> answers, AttestationModel model)
        {
            foreach (var answer in answers)
            {
                var attestationAnswerModel = new AttestationAnswerModel();

                attestationAnswerModel.Answer      = answer;
                attestationAnswerModel.Attestation = model;

                model.AttestationAnswer.Add(attestationAnswerModel);
                answer.AttestationAnswer.Add(attestationAnswerModel);
                _context.Add(answer);
            }
        }
Esempio n. 8
0
        public AttestationModel CreateAttestationByCompetences(AttestationModel attestation)
        {
            bool isValid           = true;
            var  worker            = _workerService.GetWorker((int)attestation.WorkerId);
            var  workerCompetences = new List <CompetencesModel>();

            foreach (var item in worker.SpecificWorkerCompetencesModels)
            {
                workerCompetences.Add(item.Competence);
            }

            var questions = new List <string>();

            var testedCompetences = new List <CompetencesModel>();

            foreach (var competenceId in attestation.IdsTestedCompetences)
            {
                var competence = _context.Set <CompetencesModel>().Find(competenceId);
                if (!workerCompetences.Contains(competence))
                {
                    testedCompetences.Add(competence);
                }
            }

            questions = _questionService
                        .GetCompetencesAttestationQuestions(testedCompetences, out isValid)
                        .Select(x => x.Question)
                        .ToList();

            if (isValid)
            {
                questions = questions.Distinct().ToList();
                if (_context.Set <AttestationModel>().Any(x => x.WorkerId == attestation.WorkerId))
                {
                    questions.AddRange(_questionService.GetFiftyPercentOfWrongQuestionsFromlastAttestation(attestation));
                }

                attestation.Questions         = questions;
                attestation.TestedCompetences = testedCompetences;
            }
            else
            {
                attestation.Action = AttestationAction.NotEnoughQuestion;
                return(attestation);
            }
            return(attestation);
        }
        public List <GroupResults> Calculation(AttestationModel att)
        {
            List <GroupResults> listGroups = new List <GroupResults>();
            int cnt = att.attestationRecords.Count;

            foreach (var record in att.attestationRecords)
            {
                GroupResults res = new GroupResults();
                res.course         = record.course;
                res.group          = record.group;
                res.date           = record.date;
                res.contingent     = record.contingentOfStudents;
                res.countOfStudens = record.marks.Count;
                int sum = 0;
                foreach (var mark in record.marks)
                {
                    switch (mark.mark)
                    {
                    case 5: res.countA++; sum = sum + 5;
                        break;

                    case 4: res.countB++; sum = sum + 4;
                        break;

                    case 3: res.countC++; sum = sum + 3;
                        break;

                    case 2: res.countD++; sum = sum + 2;
                        break;

                    default: res.countNA++;
                        break;
                    }
                }

                res.percentNA         = (float)(res.countNA) / res.countOfStudens * 100;
                res.percentOfStudents = 100 - res.percentNA;
                res.percentA          = (float)(res.countA) / res.countOfStudens * 100;
                res.percentB          = (float)(res.countB) / res.countOfStudens * 100;
                res.percentC          = (float)(res.countC) / res.countOfStudens * 100;
                res.percentD          = (float)(res.countD) / res.countOfStudens * 100;
                res.avg = (float)(sum) / (res.countOfStudens - res.countNA);
                listGroups.Add(res);
            }
            return(listGroups);
        }
Esempio n. 10
0
        public List <string> GetFiftyPercentOfWrongQuestionsFromlastAttestation(AttestationModel attestation)
        {
            var questions = new List <string>();

            var lastDate = _context.Set <AttestationModel>()
                           .Where(x => x.WorkerId == attestation.WorkerId)
                           .Max(x => x.Date);

            var lastAttestation = _context.Set <AttestationModel>()
                                  .Where(x => x.WorkerId == attestation.WorkerId && x.Date == lastDate)
                                  .FirstOrDefault();

            if (lastAttestation != null)
            {
                questions.AddRange(GetPreviousAttestationQuestions(lastAttestation).Select(x => x.Question));
            }
            return(questions);
        }
Esempio n. 11
0
        public List <SpecificWorkerCompetencesModel> GetNewCompetences(AttestationModel model)
        {
            var specificWorkerModel          = _context.Set <SpecificWorkerCompetencesModel>().Where(x => x.WorkerId == model.WorkerId).ToList();
            var newSpecificWorkerCompetences = new List <SpecificWorkerCompetencesModel>();

            if (model.GotCompetences == null)
            {
                model.GotCompetences = new List <long>();
            }

            foreach (var competence in model.GotCompetences)
            {
                newSpecificWorkerCompetences.Add(new SpecificWorkerCompetencesModel {
                    CompetenceId = competence, WorkerId = (int)model.WorkerId
                });
            }

            newSpecificWorkerCompetences = newSpecificWorkerCompetences.Union(specificWorkerModel).Distinct(new SpecificWorkerCompetencesComparer()).ToList();

            var newCompetences = newSpecificWorkerCompetences.Except(specificWorkerModel, new SpecificWorkerCompetencesComparer()).ToList();

            return(newCompetences);
        }
Esempio n. 12
0
        public List <QuestionModel> GetPreviousAttestationQuestions(AttestationModel attestation)
        {
            var questions           = _context.Set <QuestionModel>().ToList();
            var attestationToAnswer = _context.Set <AttestationAnswerModel>().ToList();
            var answers             = _context.Set <AnswerModel>().ToList();

            var answerIds = attestationToAnswer
                            .Where(x => x.AttestationId == attestation.Id)
                            .Select(x => x.AnswerId)
                            .ToList();

            var neededQuestions = new List <QuestionModel>();

            foreach (var id in answerIds)
            {
                var answer = answers.Where(x => !x.IsRight).FirstOrDefault(a => a.AnswerId == id);

                if (answer == default)
                {
                    continue;
                }
                var question = questions.FirstOrDefault(q => q.Question == answer.Question);
                if (question != default)
                {
                    neededQuestions.Add(question);
                }
            }

            var rnd    = new Random();
            var result = neededQuestions
                         .OrderBy(x => rnd.Next())
                         .Take(neededQuestions.Count / 2)
                         .ToList();

            return(result);
        }
Esempio n. 13
0
        public void FinishAttestation(AttestationModel attestation)
        {
            attestation.Grades = _gradeService.GetLoadedGrades();

            var tuple = GetProblemsAndAnswers(attestation);

            attestation.Problems = tuple.Item1;
            var answers = tuple.Item2;

            attestation.Date = DateTime.Today;

            if (attestation.GradeId != null)
            {
                if (attestation.IsGotGrade != null)
                {
                    attestation.GotCompetences = attestation.IdsTestedCompetences;
                }
                else
                {
                    attestation.GotCompetences = new List <long>();
                }
            }

            var gotCompetencesIds = new List <long>();

            var newCompetences = GetNewCompetences(attestation);

            if (attestation.ReAttestation)
            {
                var lostedCompetencesIds = attestation.IdsTestedCompetences.Except(attestation.GotCompetences);
                var lostedCompetences    = _context.Set <SpecificWorkerCompetencesModel>()
                                           .Where(x => lostedCompetencesIds.Contains(x.CompetenceId) && x.WorkerId == attestation.WorkerId);
                _context.Set <SpecificWorkerCompetencesModel>().RemoveRange(lostedCompetences);
            }
            else
            {
                foreach (var newCompetence in newCompetences)
                {
                    _context.Set <SpecificWorkerCompetencesModel>().Add(newCompetence);
                    gotCompetencesIds.Add(newCompetence.CompetenceId);
                }
            }



            var workerCompetences = new List <CompetencesModel>();

            var worker = _workerService.GetWorker((int)attestation.WorkerId);

            foreach (var item in worker.SpecificWorkerCompetencesModels.Union(newCompetences))
            {
                workerCompetences.Add(item.Competence);
            }

            var workerGrades = _gradeService.GetWorkerGrades(workerCompetences, attestation.Grades, _context.Set <GradeToGradeModel>().ToList());

            foreach (var element in workerGrades)
            {
                if (attestation.Grades.Contains(element))
                {
                    attestation.Grades.Remove(element);
                }
            }

            attestation.NextMoves = _gradeService.GetNextGrades(attestation.Grades);

            attestation.GotCompetences = gotCompetencesIds;

            _answerService.AddAnswers(answers, attestation);

            _context.Add(attestation);
            _context.SaveChanges();
        }
Esempio n. 14
0
        public AttestationModel CreateAttestationByGrades(AttestationModel attestation, out bool IsReattestation)
        {
            bool isValid = true;
            var  grades  = _gradeService.GetLoadedGrades();

            IsReattestation = false;

            var worker = _workerService.GetWorker((int)attestation.WorkerId);

            var gradeToGrades          = _context.Set <GradeToGradeModel>().ToList();
            var questionsForGrade      = new List <string>();
            var gradeId                = attestation.GradeId.Value;
            var testedGradeCompetences = _context.Set <GradeCompetencesModel>()
                                         .Where(x => x.GradeId == gradeId)
                                         .ToList();

            var testedCompetences = new List <CompetencesModel>();

            var workerCompetences = new List <CompetencesModel>();

            foreach (var item in worker.SpecificWorkerCompetencesModels)
            {
                workerCompetences.Add(item.Competence);
            }

            foreach (var testedGradeCompetence in testedGradeCompetences)
            {
                var competence = _context.Set <CompetencesModel>().Find(testedGradeCompetence.CompetenceId);
                if (!workerCompetences.Contains(competence))
                {
                    testedCompetences.Add(competence);
                }
            }

            var workerGrades = _gradeService.GetWorkerGrades(workerCompetences, grades, _context.Set <GradeToGradeModel>().ToList());

            if (workerGrades.Count() != 0)
            {
                var max          = workerGrades.Max(x => x.GradesCompetences.Count());
                var currentGrade = workerGrades.Where(x => x.GradesCompetences.Count() == max).FirstOrDefault();

                if (currentGrade.Id == attestation.GradeId.Value)
                {
                    IsReattestation = true;
                }
            }

            if (IsReattestation)
            {
                if (!gradeToGrades.Where(x => x.NextGradeId == gradeId).Any())
                {
                    var grade = grades.Where(x => x.Id == gradeId).FirstOrDefault();
                    testedCompetences.AddRange(grade.GradesCompetences.Select(x => x.Competence));
                }
                else
                {
                    var previousGradesIds = gradeToGrades
                                            .Where(x => x.NextGradeId == gradeId)
                                            .Select(x => x.GradeId)
                                            .ToList();

                    var previousGrades = grades
                                         .Where(x => previousGradesIds.Contains(x.Id))
                                         .ToList();

                    var previousCompetences = previousGrades
                                              .SelectMany(x => x.GradesCompetences)
                                              .Select(x => x.Competence)
                                              .Distinct()
                                              .ToList();

                    List <CompetencesModel> needToReattestateCompetences = new List <CompetencesModel>();

                    if (previousGrades.Count == 1)
                    {
                        needToReattestateCompetences = workerCompetences
                                                       .Where(x => !previousCompetences
                                                              .Any(y => x.Id == y.Id))
                                                       .ToList();
                    }
                    else
                    {
                        Dictionary <CompetencesModel, int> dict = new Dictionary <CompetencesModel, int>();

                        foreach (var previousCompetence in previousCompetences)
                        {
                            dict[previousCompetence] = 0;
                        }

                        foreach (var previousGrade in previousGrades)
                        {
                            var competences = previousGrade.GradesCompetences.Select(x => x.Competence).ToList();
                            foreach (var competence in competences)
                            {
                                dict[competence]++;
                            }
                        }

                        foreach (var element in dict)
                        {
                            if (element.Value != previousGrades.Count())
                            {
                                needToReattestateCompetences.Add(element.Key);
                            }
                        }
                    }
                    testedCompetences.AddRange(needToReattestateCompetences);
                }
            }

            questionsForGrade = _questionService
                                .GetCompetencesAttestationQuestions(testedCompetences, out isValid)
                                .Select(x => x.Question)
                                .ToList();

            if (!isValid)
            {
                attestation.Action = AttestationAction.NotEnoughQuestion;
                return(attestation);
            }

            if (_context.Set <AttestationModel>().Any(x => x.WorkerId == attestation.WorkerId))
            {
                questionsForGrade.AddRange(_questionService.GetFiftyPercentOfWrongQuestionsFromlastAttestation(attestation));
            }

            questionsForGrade = questionsForGrade.Distinct().ToList();

            attestation.TestedCompetences = testedCompetences;
            attestation.Questions         = questionsForGrade;
            return(attestation);
        }
        public void SaveWord(AttestationModel att, string filename)
        {
            List <GroupResults> listResults = Calculation(att);
            Total total = TotalResult(listResults);

            Microsoft.Office.Interop.Word._Application word = new Microsoft.Office.Interop.Word.Application();
            var document    = word.Documents.Add();
            var fitBehavior = Type.Missing;

            document.PageSetup.Orientation  = WdOrientation.wdOrientLandscape;
            document.PageSetup.LeftMargin   = 28;
            document.PageSetup.TopMargin    = 28;
            document.PageSetup.BottomMargin = 28;
            document.PageSetup.RightMargin  = 28;
            word.ActiveDocument.Sections[1].Headers[Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = "Б ВГУ 170.750 – 2015";
            word.ActiveDocument.Sections[1].Headers[Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphRight;
            word.ActiveDocument.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Font.Name = "Arial";
            word.ActiveDocument.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Font.Size = 10;
            word.ActiveDocument.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Bold      = 1;

            document.Paragraphs.Add();
            document.Paragraphs[1].Range.Text = "УТВЕРЖДАЮ";
            document.Paragraphs[1].Range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphRight;
            document.Paragraphs[1].Range.Font.Name = "Arial";
            document.Paragraphs[1].Range.Font.Size = 12;
            document.Paragraphs.Space1();
            document.Paragraphs.Add();
            document.Paragraphs[document.Paragraphs.Count].Range.Text = "заведующий кафедрой";
            document.Paragraphs.Add();
            document.Paragraphs[document.Paragraphs.Count].Range.Text = "_____________________";
            document.Paragraphs.Add();
            document.Paragraphs[document.Paragraphs.Count].Range.Text = "__.__.20__\r\n";

            document.Paragraphs.Add();
            document.Paragraphs[document.Paragraphs.Count].Range.Bold = 1;
            document.Paragraphs[document.Paragraphs.Count].Range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;
            document.Paragraphs[document.Paragraphs.Count].Range.Text = "Итоговые данные результатов промежуточной аттестации";

            document.Paragraphs.Add();
            document.Paragraphs[document.Paragraphs.Count].Range.Bold = 0;
            document.Paragraphs[document.Paragraphs.Count].Range.Text = "Специальность";

            document.Paragraphs.Add();
            document.Paragraphs[document.Paragraphs.Count].Range.Underline = WdUnderline.wdUnderlineSingle;
            document.Paragraphs[document.Paragraphs.Count].Range.Text      = "Кафедра " + att.speciality;

            document.Paragraphs.Add();
            document.Paragraphs[document.Paragraphs.Count].Range.Underline = WdUnderline.wdUnderlineNone;
            document.Paragraphs[document.Paragraphs.Count].Range.Text      = "Учебный год " + att.year.ToString() + "/" + (att.year + 1).ToString() + "\r\n";


            document.Paragraphs.Add();
            document.Paragraphs[document.Paragraphs.Count].Range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;
            var colCount  = 15;
            var rowsCount = 4 + listResults.Count;

            document.Tables.Add(document.Paragraphs[document.Paragraphs.Count].Range, rowsCount, colCount, ref fitBehavior,
                                ref fitBehavior);
            var borders = new Border[6];
            var table   = document.Tables[1];

            borders[0] = table.Borders[WdBorderType.wdBorderLeft];
            borders[1] = table.Borders[WdBorderType.wdBorderRight];
            borders[2] = table.Borders[WdBorderType.wdBorderTop];
            borders[3] = table.Borders[WdBorderType.wdBorderBottom];
            borders[4] = table.Borders[WdBorderType.wdBorderHorizontal];
            borders[5] = table.Borders[WdBorderType.wdBorderVertical];
            foreach (var border in borders)
            {
                border.LineStyle = WdLineStyle.wdLineStyleSingle;
                border.Color     = WdColor.wdColorBlack;
            }
            table.AutoFitBehavior(WdAutoFitBehavior.wdAutoFitContent);
            table.Rows.HeightRule = WdRowHeightRule.wdRowHeightAuto;

            //объединение ячеек
            table.Cell(1, 5).Merge(table.Cell(1, colCount));
            table.Cell(2, 5).Merge(table.Cell(2, 6));
            table.Cell(2, 6).Merge(table.Cell(2, 7));
            table.Cell(2, 7).Merge(table.Cell(2, 8));
            table.Cell(2, 8).Merge(table.Cell(2, 9));
            table.Cell(2, 9).Merge(table.Cell(2, 10));
            table.Cell(1, 1).Merge(table.Cell(3, 1));
            table.Cell(1, 2).Merge(table.Cell(3, 2));
            table.Cell(1, 3).Merge(table.Cell(3, 3));
            table.Cell(1, 4).Merge(table.Cell(3, 4));
            table.Cell(rowsCount, 1).Merge(table.Cell(rowsCount, 3));

            table.Cell(1, 1).Range.Text         = "Наименование дисциплины";
            table.Cell(1, 2).Range.Text         = "Дата проведения аттестации";
            table.Cell(1, 2).Range.Orientation  = WdTextOrientation.wdTextOrientationUpward;
            table.Cell(1, 3).Range.Text         = "Группа, курс";
            table.Cell(1, 3).Range.Orientation  = WdTextOrientation.wdTextOrientationUpward;
            table.Cell(1, 4).Range.Text         = "Контингент студентов";
            table.Cell(1, 4).Range.Orientation  = WdTextOrientation.wdTextOrientationUpward;
            table.Cell(1, 5).Range.Text         = "Результаты текущей аттестации";
            table.Cell(2, 5).Range.Text         = "Количество опрошенных";
            table.Cell(2, 6).Range.Text         = "«Отл.»";
            table.Cell(2, 7).Range.Text         = "«Хор.»";
            table.Cell(2, 8).Range.Text         = "«Удовл.»";
            table.Cell(2, 9).Range.Text         = "«Неуд.»";
            table.Cell(2, 10).Range.Text        = "Средний балл";
            table.Cell(rowsCount, 1).Range.Text = "Итого по дисциплине";
            for (int i = 5; i < colCount; i++)
            {
                table.Cell(3, i).Range.Text = "абс.";
                i++;
            }
            for (int i = 6; i < colCount; i++)
            {
                table.Cell(3, i).Range.Text = "%";
                i++;
            }
            for (int i = 4; i < rowsCount; i++)
            {
                table.Cell(i, 1).Range.Text = att.subject;
            }
            var j = 4;

            foreach (var result in listResults)
            {
                table.Cell(j, 2).Range.Text  = result.date;
                table.Cell(j, 3).Range.Text  = result.group.ToString() + " г., " + result.course.ToString() + " курс";
                table.Cell(j, 4).Range.Text  = result.contingent;
                table.Cell(j, 5).Range.Text  = (result.countOfStudens - result.countNA).ToString();
                table.Cell(j, 6).Range.Text  = (result.percentOfStudents).ToString();
                table.Cell(j, 7).Range.Text  = (result.countA).ToString();
                table.Cell(j, 8).Range.Text  = (result.percentA).ToString();
                table.Cell(j, 9).Range.Text  = (result.countB).ToString();
                table.Cell(j, 10).Range.Text = (result.percentB).ToString();
                table.Cell(j, 11).Range.Text = (result.countC).ToString();
                table.Cell(j, 12).Range.Text = (result.percentC).ToString();
                table.Cell(j, 13).Range.Text = (result.countD).ToString();
                table.Cell(j, 14).Range.Text = (result.percentD).ToString();
                table.Cell(j, 15).Range.Text = (result.avg).ToString();
                j++;
            }

            table.Cell(rowsCount, 3).Range.Text  = (total.totalCount - total.totalCountNA).ToString();
            table.Cell(rowsCount, 4).Range.Text  = total.totalPercent.ToString();
            table.Cell(rowsCount, 5).Range.Text  = total.totalCountA.ToString();
            table.Cell(rowsCount, 6).Range.Text  = total.totalPercentA.ToString();
            table.Cell(rowsCount, 7).Range.Text  = total.totalCountB.ToString();
            table.Cell(rowsCount, 8).Range.Text  = total.totalPercentB.ToString();
            table.Cell(rowsCount, 9).Range.Text  = total.totalCountC.ToString();
            table.Cell(rowsCount, 10).Range.Text = total.totalPercentC.ToString();
            table.Cell(rowsCount, 11).Range.Text = total.totalCountD.ToString();
            table.Cell(rowsCount, 12).Range.Text = total.totalPercentD.ToString();
            table.Cell(rowsCount, 13).Range.Text = total.totalAVG.ToString();

            document.Paragraphs.Add();
            document.Paragraphs[document.Paragraphs.Count].Range.Text = "Фамилии студентов, не явившихся на промежуточную аттестацию по неуважительной причине:";

            document.Paragraphs.Add();
            document.Paragraphs[document.Paragraphs.Count].Range.Text = "Ответственный исполнитель ____________________________________________";

            document.SaveAs(filename);
            document.Close();
            word.Quit();
        }