/// <summary> /// The Constructor that displays result details /// </summary> /// <param name="candidateName">The name of the candidate</param> /// <param name="time">the total allocatable time</param> /// <param name="elapsedTime">the time used</param> /// <param name="examCode">the exam code, gotten from the exam file</param> /// <param name="score">the candidates score</param> /// <param name="requiredScore">the score required to pass</param> /// <param name="sectionQuestionNumbers">the number of questions per section</param> /// <param name="rightSectionQuestionNumbers">the number of correct questions per section</param> public Score_Sheet(string candidateName, int time, int elapsedTime, string examCode, int score, int requiredScore, Dictionary<string, int> sectionQuestionNumbers, Dictionary<string, int> rightSectionQuestionNumbers) { InitializeComponent(); lbl_date.Text = DateTime.Now.Date.ToShortDateString(); if (score >= requiredScore) { lbl_status.Text = "Passed"; lbl_status.Font = new Font("Microsoft Sans Serif", 8.25F); lbl_status.ForeColor = Color.Green; } else { lbl_status.Text = "Failed"; lbl_status.Font = new Font("Microsoft Sans Serif", 8.25F); lbl_status.ForeColor = Color.Red; } lbl_candidate_name.Text = candidateName; lbl_elapsed_time.Text = elapsedTime.ToString(); lbl_exam_number.Text = examCode; lbl_time.Text = time.ToString(); dgv_show_breakdown.Rows.Clear(); // for (int i = 0; i < sectionQuestionNumbers.Count; i++) { dgv_show_breakdown.Rows.Add(sectionQuestionNumbers.ElementAt(i).Key, sectionQuestionNumbers.ElementAt(i).Value, rightSectionQuestionNumbers.ElementAt(i).Value); } // chr_display_score.Series["Required Score"].Points.AddXY(1, requiredScore); chr_display_score.Series["Score"].Points.AddXY(0, score); // required = requiredScore; got = score; }
/// <summary> /// Returns the index of the given key in the dictionary /// </summary> /// <param name="key">The string key for the dictionary</param> /// <param name="dictionary">The dictionary to check</param> /// <returns></returns> public int GetIndex(Dictionary<string, int> dictionary, string key) { int index = 0; for (int i = 0; i < dictionary.Count; i++) { if (dictionary.ElementAt(i).Key == key) { index = 1; } } return index; }