Beispiel #1
0
        public bool SubmitExamEncryptedZipped(string anExamSubmission, RequiredDetails details, int numberofQuestions, int numberOfStudents)
        {
            var ret = Firewalls[numberOfStudents].IsValidSubmission(details, GetIP());

            if (ret != FilterationResult.Accepted)
            {
                //    aLogger.LogMessage($"Invalid Student Is Trying To Submit from [IP:] {this.CurrentClient.RemoteEndPoint} [ClientID:] {CurrentClient.ClientId} | CONNECTION WILL BE DROPPED. ", LogMsgType.Verbose);
                // this.CurrentClient.Disconnect();
                return(false);
            }



            //var s = ExamSubmissionZippedStringList.
            //    Where(x => x.Details.StudentID
            //     == details.StudentID).FirstOrDefault();
            //if (s == null)
            // {
            //    ExamSubmissionZippedStringList.Add(s = new ExamStatusUpdate(details));
            // }
            // s.UpdateSubmitInfo(anExamSubmission, $"[{DateTime.Now}]a copy of the exam sent to [IP:] {this.CurrentClient.RemoteEndPoint} [StudentName:] {details.StudentName}, [ID:] {details.StudentID}");


            //   try
            //   {
            //       submittedFiles.Add(details.StudentID, anExamSubmission);
            //  aLogger.LogMessage($"Exam Was Submitted By [StudentName:] {details.StudentName}, [ID:] {details.StudentID}", LogMsgType.Verbose);
            //     }
            //    catch (Exception ex)
            //     {
            //  aLogger.LogMessage($"STUDENT TRYING TO SUBMIT TWICE (EXAM DROPPED) [StudentName:] {details.StudentName}, [ID:] {details.StudentID}", LogMsgType.Error);
            //    }
            //UpdateMethod(ExamSubmissionZippedStringList);
            return(true);
        }
Beispiel #2
0
        public string GetExamCopyEncryptedZipped(RequiredDetails details, int numberOfQuestions, int numberOfStds)
        {
            try
            {
                var ret = Firewalls[numberOfStds].GenerateExamCopyForSendingToStudent(OriginalExamWithNoStdDetails[numberOfQuestions], details, GetIP());

                if (ret.Decision != FilterationResult.Accepted)
                {
                    //  aLogger.LogMessage($"Invalid Student Is Asking for Copy from [IP:] {this.CurrentClient.RemoteEndPoint} [ClientID:] {CurrentClient.ClientId} | CONNECTION WILL BE DROPPED. [Reason:] {ret.Decision.ToString()} ", LogMsgType.Verbose);
                    //   this.CurrentClient.Disconnect();

                    return(null);
                }
                else
                {
                    return(ret.ExamToSendForStudent); // this should include now V updated details
                }
            }
            catch (Exception ex)
            {
                throw ex;
                return(null);
                //  aLogger.LogMessage(ex.Message + $"Used Details Are: StdID=[{details.StudentID}], SrcIP=[{CurrentClient.RemoteEndPoint}], ExamKey=[{details.ExamKey}], SharedKey=[{details.SharedKeyIS}]", LogMsgType.Warning);
            }
        }
Beispiel #3
0
        public string GetExamCopyEncryptedZipped(RequiredDetails details)
        {
            try
            {
                var ret = Firewall.GenerateExamCopyForSendingToStudent(OriginalExamWithNoStdDetails, details, GetIP());

                if (ret.Decision != FilterationResult.Accepted)
                {
                    aLogger.LogMessage($"Invalid Student Is Asking for Copy from [IP:] {this.CurrentClient.RemoteEndPoint} [ClientID:] {CurrentClient.ClientId} | CONNECTION WILL BE DROPPED. [Reason:] {ret.Decision.ToString()} ", LogMsgType.Verbose);
                    this.CurrentClient.Disconnect();

                    return(null);
                }
                else
                {
                    var s = ExamSubmissionZippedStringList.
                            Where(x => x.Details.StudentID == details.StudentID).FirstOrDefault();
                    if (s == null)
                    {
                        lock (ExamSubmissionZippedStringList)
                        {
                            ExamSubmissionZippedStringList.Add(s = new ExamStatusUpdate(details));
                        }
                    }
                    lock (s)
                    {
                        s.UpdateSendInfo($"[{DateTime.Now}]a copy of the exam sent to [IP:] {this.CurrentClient.RemoteEndPoint} [StudentName:] {details.StudentName}, [ID:] {details.StudentID}");
                    }
                    aLogger.LogMessage($"a copy of the exam sent to [IP:] {this.CurrentClient.RemoteEndPoint} [StudentName:] {details.StudentName}, [ID:] {details.StudentID}", LogMsgType.Verbose);

                    UpdateMethod(ExamSubmissionZippedStringList);


                    return(ret.ExamToSendForStudent); // this should include now V updated details
                }
            }
            catch (Exception ex)
            {
                aLogger.LogMessage(ex.Message + $"Used Details Are: StdID=[{details.StudentID}], SrcIP=[{CurrentClient.RemoteEndPoint}], ExamKey=[{details.ExamKey}], SharedKey=[{details.SharedKeyIS}]", LogMsgType.Warning);
                return(null);
            }
        }
Beispiel #4
0
 public ExamStatusUpdate(RequiredDetails details)
 {
     Details   = details;
     sent      = false;
     submitted = false;
 }