protected void Button_Upload_Click(object sender, EventArgs e) { string id = DropDownList_ExamBoards.SelectedValue; Exam_Board eb1 = new Exam_Board(new Guid(id)); string s1 = DropDownList_data.SelectedValue; ExamOption exo1 = new ExamOption(); ExamFiles ef1 = new ExamFiles(); exo1.Load(s1, SeasonCode.ToString(), YearCode.ToString(), eb1.m_LegacyExamBdId); if (!exo1.m_valid) { ExamOption exo2 = ef1.Find_Option(s1, eb1, SeasonCode.ToString(), YearCode.ToString()); if (exo2 != null) { //Label_Result.Text = "Successfully uploaded " + exo.m_OptionCode + " : " + exo.m_OptionTitle + " to Cerval"; //DropDownList1.SelectedIndex = -1; //ListItem l = DropDownList1.SelectedItem; //DropDownList1.Items.Remove(l); } else { //Label_Result.Text = "Failed to upload " + exo.m_OptionCode + " : " + exo.m_OptionTitle + " to Cerval"; } } }
private void SetUpForReatkes() { List <ExamOption> list1 = new List <ExamOption>(); int no_new = 0; int no_found = 0; string Errors = "The following Options seem not to be offered this summer: "; ExamOption_List exoL1 = new ExamOption_List(); ExamFiles ef1 = new ExamFiles(); ExamOption exo1 = new ExamOption(); //load results for last JUNE sitting now. exoL1.Load((YearCode - 1).ToString(), SeasonCode.ToString()); foreach (ExamOption exo in exoL1.m_list) { Exam_Board eb1 = new Exam_Board(exo.m_ExamBoardID); exo1.Load(exo.m_OptionCode, SeasonCode.ToString(), YearCode.ToString(), eb1.m_LegacyExamBdId); if (exo1.m_valid) { no_found++; } else { if (!exo.NeedsTeacherMarks()) { ExamOption exo2 = ef1.Find_Option(exo.m_OptionCode, eb1, SeasonCode.ToString(), YearCode.ToString()); if (exo2 != null) { no_new++; } else { Errors += exo.m_OptionCode + ", "; } } else { list1.Add(exo); //list has those needing teacher marks } } } Label_Result.Text = "We made " + no_new.ToString() + " new options and found already " + no_found.ToString(); Label_Error.Text = Errors; //now need to offer those with coursework... if (list1.Count > 0) { DropDownList1.Visible = true; Button_Upload.Visible = true; foreach (ExamOption e in list1) { ListItem l = new ListItem(e.m_OptionCode + e.m_OptionTitle, e.m_OptionID.ToString()); DropDownList1.Items.Add(l); } LabelDropDown.Text = "The list below are options that require Teacher marks... select and add any you want students to see."; } }
protected void Button_Opt_Find_Click(object sender, EventArgs e) { //find code... string s = TextBox_FindOption.Text.ToUpper().Trim(); bool found = false; foreach (ListItem item in ListBox_Options.Items) { if (item.Text.Substring(0, 6).ToUpper().Trim() == s) { item.Selected = true; found = true; TextBox_FindOption.Text = ""; } } if (found) { return; } found = false; ExamOption eo1 = new ExamOption(); ExamBoardList ebl1 = new ExamBoardList(); ExamFiles ef1 = new ExamFiles(); foreach (Exam_Board eb in ebl1._ExamBoardList) { eo1 = ef1.Find_Option(s, eb, SeasonCode.ToString(), YearCode.ToString()); if (eo1 != null) { found = true; break; } } if (!found) { TextBox1.Text = "NOT FOUND!!!!"; TextBox1.Visible = true; return; } ListItem i1 = new ListItem(eo1.m_OptionCode + ":" + eo1.m_OptionTitle, eo1.m_OptionID.ToString()); ListBox_Options.Items.Add(i1); foreach (ListItem item in ListBox_Options.Items) { if (item.Text.Substring(0, 6).ToUpper().Trim() == s) { item.Selected = true; found = true; TextBox_FindOption.Text = ""; } } }