示例#1
0
        private Dictionary <string, List <RealExamQuestion> > GetCompromisedQuestions(RealExamQuestion[] existingQuestions)
        {
            StudentExamQuestionController studentExamQuestionController = new StudentExamQuestionController();
            List <RealExamQuestion>       compromisedQuestions          = new List <RealExamQuestion>();
            List <RealExamQuestion>       unCompromisedQuestions        = new List <RealExamQuestion>();
            List <RealExamQuestion>       compromisedEditedQuestions    = new List <RealExamQuestion>();

            foreach (RealExamQuestion existingQuestion in existingQuestions)
            {
                if (studentExamQuestionController.QuestionInAnyExam(existingQuestion.questionId) ||
                    questionAssignController.IsQuestionAssigned(existingQuestion.questionId))
                {
                    if (existingQuestion.edited == true)
                    {
                        compromisedEditedQuestions.Add(existingQuestion);
                    }
                    else
                    {
                        compromisedQuestions.Add(existingQuestion);
                    }
                }
                else
                {
                    unCompromisedQuestions.Add(existingQuestion);
                }
            }
            return(new Dictionary <string, List <RealExamQuestion> >
            {
                { "compromised", compromisedQuestions },
                { "unCompromised", unCompromisedQuestions },
                { "editedCompromised", compromisedEditedQuestions },
            });
        }
        public void DeleteStudent(int userId)
        {
            List <SubArea> userSubAreas = subAreaController.GetUserSubAreas(userId);

            ResetSubAreasProxy(userSubAreas);
            List <string> assignmentsToDelete = SubAreaUtils.GetSubAreasStrings(userSubAreas).ToList();

            SubAreaAssignUtils.UnAssignSubAreasToUser(userId, subAreaController, assignmentsToDelete.ToArray());
            StudentExamController         studentExamController         = new StudentExamController();
            StudentExamQuestionController studentExamQuestionController = new StudentExamQuestionController();
            List <StudentExam>            allStudentExamIds             = studentExamController.GetAllStudentExams(userId);

            foreach (StudentExam studentExam in allStudentExamIds)
            {
                studentExamQuestionController.DeleteAllStudentExamQuestions(studentExam.Id);
                studentExamController.DeleteStudentExam(studentExam.Id);
            }
            userController.DeleteStudent(userId);
        }