// Used in the marking of quizzes to get the information from the QuizAttempts table public static (int, string, string, string[], string[], bool[], bool) GetQuizInformation(string username, int quizID) { QuizInstance quizInstance = new QuizInstance(); var serverConnection = new ServerConnection(); string serverResponse = serverConnection.ServerRequest("QUIZMARKINGVIEW", new string[2] { username, quizID.ToString() }); serverResponse = serverResponse.Replace("\0", string.Empty); quizInstance = DeserialiseQuizAttempt(serverResponse, quizInstance); if (serverResponse != "FALSE") { return(quizInstance.quizID, quizInstance.username, quizInstance.quizType, quizInstance.questions, quizInstance.answers, quizInstance.correct, true); } else { return(quizInstance.quizID, quizInstance.username, quizInstance.quizType, quizInstance.questions, quizInstance.answers, quizInstance.correct, false); } }
//Deserialises the quiz attempt JSON into a QuizInstance object static QuizInstance DeserialiseQuizAttempt(string JSON, QuizInstance quizInstance) { quizInstance = JsonConvert.DeserializeObject <QuizInstance>(JSON); return(quizInstance); }