private void reportBtn_Click(object sender, EventArgs e) { GradingExamHelper.GradeExamsAndGenerateReportFromEncrypted(ref rtb, eventLogChkBox.Checked, studentPassTxtBox.Text, instructorPassTxtBox.Text , aService.submittedFiles, FirewallRules, checkBox1.Checked); //rtb.Clear(); //bool includeLogs = addLogs; //var studnetPassword = studentPassTxtBox.Text; //var instructorPassword = instructorPassTxtBox.Text; //var list = aService.ExamSubmissionZippedStringList; //for (int i = 0; i < aService.ExamSubmissionZippedStringList.Count; i++) //{ // var id = Crypto.AESGCM.SimpleDecryptWithPassword(list[i].Details.StudentID, studentPassTxtBox.Text); // var name = Crypto.AESGCM.SimpleDecryptWithPassword(list[i].Details.StudentName, studentPassTxtBox.Text); // var examFile = ExamHelper.GetExamFromByteArray(aService.submittedFiles[id], studentPassTxtBox.Text); // rtb.AppendText($"{anExam.ExamDescription}\n", new System.Drawing.Font("Courier New", 16, System.Drawing.FontStyle.Bold)); // rtb.AppendText($"Student Name: {name}\n", new System.Drawing.Font("Courier New", 16, System.Drawing.FontStyle.Bold)); // rtb.AppendText($"Student ID: {id}\n", new System.Drawing.Font("Courier New", 16, System.Drawing.FontStyle.Bold)); // rtb.AppendText($"Grade: {examFile.GetExamGrade(instructorPassword)}\n", new System.Drawing.Font("Courier New", 18, System.Drawing.FontStyle.Underline)); // rtb.AppendText($"Exam Sent to Student Date and Comment:{list[i].weSentHimExamDateAndDetails}", new System.Drawing.Font("Courier New", 12, System.Drawing.FontStyle.Italic)); // rtb.AppendText($"Student Exam Submission Date And Comment:{list[i].weSentHimExamDateAndDetails}", new System.Drawing.Font("Courier New", 12, System.Drawing.FontStyle.Italic)); // foreach (var q in examFile.QuestionsList) // { // QuizHelper.AddGradedQuestionToRtb(ref rtb, q.QuestionNumber, q, instructorPassword, true, true); // } // if (includeLogs) // { // rtb.AppendText(System.Environment.NewLine); // rtb.AppendText($"***** Student Exam Logs *****\n", new System.Drawing.Font("Courier New", 18, System.Drawing.FontStyle.Italic)); // foreach (var s in examFile?.ExamLog) // { // rtb.AppendText($"{s}\n", new System.Drawing.Font("Courier New", 8, System.Drawing.FontStyle.Regular)); // } // } // rtb.AppendText($"***** END OF STUDENT {name} EXAM *****\n", new System.Drawing.Font("Courier New", 18, System.Drawing.FontStyle.Italic)); // rtb.AddNewPage(); //} //var tst = rtb.Rtf.Replace("[NEW_PAGE_AUTOMATIC_HERE]", "\\par \\page"); //SaveFileDialog sdlg = new SaveFileDialog(); //sdlg.FileName = $"StudentExamGradesAnswers"; //sdlg.Filter = "RTF File (*.rtf)|*.rtf"; //sdlg.DefaultExt = "rtf"; //sdlg.ShowDialog(); //File.WriteAllText(sdlg.FileName, tst); }
private void reportBtn_Click(object sender, EventArgs e) { if (ExamsToGrade?.Count == 0) { MessageBox.Show("There are no exams loaded to grade."); return; } GradingExamHelper.GradeExamsAndGenerateReport(ref richTextBox1, eventLogChkBox.Checked, studentPassTxtBox.Text, instructorPassTxtBox.Text , ExamsToGrade); }