public PaperSet PaperSet; //Include PaperSet after create /// <summary> /// Create List of PaperSet /// </summary> /// <param name="questionSet"></param> /// <param name="numOfPage"></param> public ShuffleExamModel(QuestionSet questionSet, int numOfPage) { QuestionSet = questionSet; PaperSet = new PaperSet(new List <Paper>(), QuestionSet.DBScriptList, new List <int>(), QuestionSet); //List<List<CandidateNode>> cases = GetRandomNElementsInList(numOfPage, GetAllCasesTest(), PaperSet.ListPaperMatrixId); List <List <CandidateNode> > cases = new List <List <CandidateNode> >(); List <List <CandidateNode> > tmp = GetAllCasesTest(); List <CandidateNode> first = tmp.First(); List <CandidateNode> last = tmp.Last(); cases.Add(first); cases.Add(last); PaperSet.ListPaperMatrixId.Add(tmp.IndexOf(first)); PaperSet.ListPaperMatrixId.Add(tmp.IndexOf(last)); //codeTestCount: for TestCode int codeTestCount = 0; //Adding candidate into Tests foreach (List <CandidateNode> c in cases) { List <Candidate> candidateList = new List <Candidate>(); //Adding candidate into a Test foreach (var candidateNode in c) { candidateList.Add(candidateNode.Candi); } var paper = new Paper(); paper.PaperNo = (++codeTestCount).ToString(); paper.CandidateSet = candidateList; PaperSet.Papers.Add(paper); } }
/// <summary> /// Updates the paperset. /// </summary> /// <param name="paperSetDetails">The paper set details.</param> public void UpdatePaperset(PaperSet paperSetDetails) { var paperSet = Context.PaperSets.FirstOrDefault(@this => @this.PaperSetID == paperSetDetails.PaperSetID); if (paperSet != null) { paperSet.Description = paperSetDetails.Description; } else { Context.PaperSets.Add(paperSetDetails); } }
public QuestionSet QuestionSet; //QBank from Creator /// <summary> /// Create List of PaperSet /// </summary> /// <param name="questionSet"></param> /// <param name="numOfPage"></param> public ShufflePaperModel(QuestionSet questionSet, int numOfPage) { QuestionSet = questionSet; PaperSet = new PaperSet(new List <Paper>(), QuestionSet.DBScriptList, new List <int>(), QuestionSet); var allCases = GetAllPaperCases(); var papersCandidateNode = new List <List <CandidateNode> >(); if (Constants.PaperSet != null && Constants.PaperSet.ListPaperMatrixId != null && Constants.PaperSet.ListPaperMatrixId.Count > 0 && Constants.PaperSet.ListPaperMatrixId.Count > 0) { foreach (var paperId in Constants.PaperSet.ListPaperMatrixId) { papersCandidateNode.Add(allCases.ElementAt(paperId)); } } else { papersCandidateNode = GetRandomNElementsInList(numOfPage, allCases); } //Adding Matrix Id foreach (var candidateNode in papersCandidateNode) { PaperSet.ListPaperMatrixId.Add(allCases.IndexOf(candidateNode)); } //codeTestCount: for TestCode var codeTestCount = 0; //Adding candidate into Tests foreach (var c in papersCandidateNode) { var candidateList = new List <Candidate>(); //Adding candidate into a Test foreach (var candidateNode in c) { candidateList.Add(candidateNode.Candi); } var paper = new Paper { PaperNo = (++codeTestCount).ToString(), CandidateSet = candidateList }; PaperSet.Papers.Add(paper); } }
public Scoring(PaperSet paperSet, List <Submission> Listsubmissions) { InitializeComponent(); PaperSet = paperSet; // Show Scoring Form and generate Score here ListResults = new List <Result>(); //Prepare(); SetupUI(); DBScripts = paperSet.DBScriptList; // Merge Question and submission to ListResults foreach (Submission submission in Listsubmissions) { Result result = new Result { // Add PaperNo PaperNo = submission.PaperNo, // Add StudentID StudentID = submission.StudentID }; // Add Answers foreach (string answer in submission.ListAnswer) { result.ListAnswers.Add(answer); } // Add Candidates foreach (Paper paper in paperSet.Papers) { if (paper.PaperNo.Equals(result.PaperNo)) { foreach (Candidate candidate in paper.CandidateSet) { result.ListCandidates.Add(candidate); } break; } } // Add to List to get score ListResults.Add(result); } Show(); }
/// <summary> /// Updates the paperset. /// </summary> /// <param name="paperSetDetails">The paper set details.</param> public void UpdatePaperset(PaperSet paperSetDetails) { this.repository.UpdatePaperset(paperSetDetails); }
/// <summary> /// Adds the paperset. /// </summary> /// <param name="paperSetDetails">The paper set details.</param> public void AddPaperset(PaperSet paperSetDetails) { this.repository.AddPaperset(paperSetDetails); }
/// <summary> /// Adds the paperset. /// </summary> /// <param name="paperSetDetails">The paper set details.</param> public void AddPaperset(PaperSet paperSetDetails) { Context.PaperSets.Add(paperSetDetails); }