private void Build_NameList(string year) { NameList.Items.Clear(); if ((year == "14") || (year == "")) { Label_Year.Text = ((year == "14") ? "Past(Leaving year)" : "Current (Entry year)"); //special case .. need leavers who are not therefore in a year group PastStudentList stlist = new PastStudentList(((year == "") ?"Expr13 = 1" :"Expr13 = 0")); //not on role foreach (SimplePupil sp in stlist._studentlist) { ListItem Item = new ListItem(sp.m_GivenName + " " + sp.m_Surname + " (" + ((year == "14") ? sp.m_dol.Year.ToString() : sp.m_doa.Year.ToString()) + ")", sp.m_StudentId.ToString()); NameList.Items.Add(Item); } } else { DateTime d = new DateTime(); d = DateTime.Now; Label_Year.Text = "Year " + year; StudentYearList yl1 = new StudentYearList(NameList, year + "Year", d); if (NameList.Items.Count == 0) { Label_Year.Text = "Year " + year + " (Next Year)"; yl1.StudentYearList_Load(NameList, year + "Year", d); } } if (NameList.Items.Count > 0) { NameList.Items[0].Selected = true; } }
public void SetUpYearList(string year) { //SimpleStudentList sl1 = new SimpleStudentList("GroupCode LIKE '"+year+"%'"); StudentYearList yl1 = new StudentYearList(ListBox_Names, year + "Year", DateTime.Now); //ListBox_Names.Items.Clear(); //foreach (SimplePupil p in sl1._studentlist) //{ // ListItem l = new ListItem(p.m_GivenName + " " + p.m_Surname, p.m_StudentId.ToString()); // ListBox_Names.Items.Add(l); // } }
protected void UpdateMessageList(string t) { Cerval_Globals cg1 = new Cerval_Globals(); ListBox_staff.Items.Clear(); string s1 = DropDownList_Year.SelectedValue; DateTime date1 = new DateTime(); date1 = DateTime.Now.AddMonths(0); if (t == "Group") { GroupList gl1; gl1 = new GroupList("", date1); //put the form groups first foreach (Group g in gl1._groups) { if (g._GroupCode.StartsWith(s1)) { if (g._CourseID == Cerval_Globals.RegistrationCse)//registration../ { //only for year groups... ListItem l1 = new ListItem(g._GroupCode, g._GroupID.ToString()); ListBox_staff.Items.Add(l1); } } } foreach (Group g in gl1._groups) { if (g._GroupCode.StartsWith(s1)) { if ((g._CourseID != Cerval_Globals.RegistrationCse) && (!Cerval_Globals.NewStructureCourses.Contains(g._CourseID))) { ListItem l1 = new ListItem(g._GroupCode, g._GroupID.ToString()); ListBox_staff.Items.Add(l1); } } } } if (t == "Student") { //StudentYearList yl1 = new StudentYearList(ListBox_staff, s1 + "Year", "{ fn NOW() }"); StudentYearList yl1 = new StudentYearList(ListBox_staff, s1 + "Year", DateTime.Now); ListBox_staff.SelectionMode = ListSelectionMode.Multiple; TextBox_textTo.Visible = true; } }
private void Build_NameList(string year) { DateTime d = new DateTime(); d = DateTime.Now; Label_Year.Text = "Year " + year; StudentYearList yl1 = new StudentYearList(NameList, year + "Year", d); if (NameList.Items.Count == 0) { Label_Year.Text = "Year " + year + " (Next Year)"; yl1.StudentYearList_Load(NameList, year + "Year", d); } if (NameList.Items.Count > 0) { NameList.Items[0].Selected = true; } }
protected void UpdateMessageList(string t) { Cerval_Globals cg1 = new Cerval_Globals(); ListBox_staff.Items.Clear(); string s1 = DropDownList_Year.SelectedValue; DateTime date1 = new DateTime(); date1 = DateTime.Now.AddMonths(0); if (t == "Group") { GroupList gl1; if (s1 == "My Groups") { gl1 = new GroupList(); Utility u = new Utility(); string staff_code = u.GetsStaffCodefromRequest(Request); gl1.LoadList_StaffPrivateGroups(staff_code.Trim(), GroupList.GroupListOrder.GroupName); foreach (Group g in gl1._groups) { ListItem l1 = new ListItem(g._GroupName, g._GroupID.ToString()); ListBox_staff.Items.Add(l1); } return; } else { gl1 = new GroupList("", date1); } //put the form groups first foreach (Group g in gl1._groups) { if (g._GroupCode.StartsWith(s1)) { if (g._CourseID == Cerval_Globals.RegistrationCse)//registration../ { //only for year groups... ListItem l1 = new ListItem(g._GroupCode, g._GroupID.ToString()); ListBox_staff.Items.Add(l1); } } } foreach (Group g in gl1._groups) { if (g._GroupCode.StartsWith(s1)) { if ((g._CourseID != Cerval_Globals.RegistrationCse) && (!Cerval_Globals.NewStructureCourses.Contains(g._CourseID))) { ListItem l1 = new ListItem(g._GroupCode, g._GroupID.ToString()); ListBox_staff.Items.Add(l1); } } if (s1.ToUpper() == "14") { if (g._GroupCode.StartsWith("1") || g._GroupCode.StartsWith("7") || g._GroupCode.StartsWith("8") || g._GroupCode.StartsWith("9")) { } else { ListItem l1 = new ListItem(g._GroupCode, g._GroupID.ToString()); ListBox_staff.Items.Add(l1); } } } } if (t == "Student") { //StudentYearList yl1 = new StudentYearList(ListBox_staff, s1 + "Year", "{ fn NOW() }"); StudentYearList yl1 = new StudentYearList(ListBox_staff, s1 + "Year", DateTime.Now); ListBox_staff.SelectionMode = System.Web.UI.WebControls.ListSelectionMode.Multiple; TextBox_textTo.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GetMasterValues(); DropDownList1.Visible = false; GridView2.Visible = false; GridView1.Visible = false; ListBox1.Visible = false; TextBox1.Visible = false; Label_Select3.Text = ""; if (Request.QueryString.Count >= 1) { DisplayType = Request.QueryString["Type"]; } switch (DisplayType) { case "Student": Label_Select1.Text = "Select Year:"; Label_Select3.Text = "OR type Admission Number:"; DropDownList1.Visible = true; DropDownList1.Items.Add("14"); DropDownList1.Items.Add("13"); DropDownList1.Items.Add("12"); DropDownList1.Items.Add("11"); DropDownList1.Items.Add("10"); DropDownList1.SelectedIndex = 1; DropDownList1.Visible = true; ListBox1.Visible = true; TextBox1.Visible = true; GridView2.Visible = true; StudentYearList styl1 = new StudentYearList(ListBox1, DropDownList1.SelectedValue + "Year", DateTime.Now); break; case "Option": Label_Select1.Text = "Select Option:"; DropDownList1.Visible = true; GridView1.Visible = true; DropDownList1.Items.Clear(); ExamOption_List exol1 = new ExamOption_List(); exol1.Load(YearCode.ToString(), SeasonCode.ToString()); foreach (ExamOption exo in exol1.m_list) { DropDownList1.Items.Add(new ListItem(exo.m_OptionCode, exo.m_OptionID.ToString())); } DropDownList1.SelectedIndex = -1; break; case "Subject": Label_Select1.Text = "Select Subject:"; DropDownList1.Visible = true; GridView1.Visible = true; ListItem l1 = new ListItem("All", "0"); DropDownList1.Items.Add(l1); CourseList cl1 = new CourseList(0); foreach (Course c in cl1._courses) { if (c.KeyStage == 5) { ListItem l = new ListItem(c.CourseName + "( A-level)", c._CourseID.ToString()); DropDownList1.Items.Add(l); } if (c.KeyStage == 4) { ListItem l = new ListItem(c.CourseName + "( GCSE)", c._CourseID.ToString()); DropDownList1.Items.Add(l); } } DropDownList1.SelectedIndex = -1; break; case "Status": Label_Select1.Text = "Select Status:"; DropDownList1.Visible = true; GridView1.Visible = true; Exam_Entry_Status_List el1 = new Exam_Entry_Status_List(); foreach (Exam_Entry_Status e1 in el1.m_list) { ListItem l2 = new ListItem(e1.m_EntryStatusDescription, e1.m_EntryStatusCode); DropDownList1.Items.Add(l2); } //going to add extra line for Student resits... ListItem l3 = new ListItem("Resit Request waiting to be processed", "RESITS"); DropDownList1.Items.Add(l3); DropDownList1.SelectedIndex = -1; break; default: break; } } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Encode en = new Encode(); switch (DisplayType) { case "Student": StudentYearList styl1 = new StudentYearList(ListBox1, DropDownList1.SelectedValue + "Year", DateTime.Now); if (DropDownList1.SelectedValue == "14") { styl1.Load_NotOnRole_ExamEntries(ListBox1, Year.ToString(), SeasonCode.ToString()); } ListBox1.SelectedIndex = -1; break; case "Option": SqlDataSource1.SelectCommand = GetQueryString(); SqlDataSource1.ConnectionString = en.GetDbConnection(); SqlDataSource1.DataBind(); string s = "SELECT COUNT (ExamEntryID) FROM dbo.qry_Cerval_Exams_Entries " + GetWhereString(); Label_Grid.Text = "Entries for " + DropDownList1.SelectedItem.Text + " Total Number =" + en.Execute_one_SQL(s); break; case "Subject": CourseId = DropDownList1.SelectedValue; SqlDataSource1.SelectCommand = GetQueryString(); SqlDataSource1.ConnectionString = en.GetDbConnection(); SqlDataSource1.DataBind(); Label_Grid.Text = ""; if (SqlDataSource1.SelectCommand.Contains("ZZZZZZ")) { Label_Grid.Text = "None found"; } //the other option for none is that there are options found for this seasonby no entries... have to run the querry... int n = 0; using (SqlConnection cn = new SqlConnection(en.GetDbConnection())) { cn.Open(); using (SqlCommand cm = new SqlCommand(SqlDataSource1.SelectCommand, cn)) { using (SqlDataReader dr = cm.ExecuteReader()) { while (dr.Read()) { n++; } dr.Close(); } } cn.Close(); } if (n == 0) { Label_Grid.Text = "None found"; } break; case "Status": SqlDataSource1.SelectCommand = GetQueryString(); SqlDataSource1.ConnectionString = en.GetDbConnection(); SqlDataSource1.DataBind(); if (DropDownList1.SelectedValue == "RESITS") { string s1 = "SELECT COUNT (OptionCode) FROM qry_Cerval_Exams_ResitEntries "; Label_Grid.Text = "Entries for Status = " + DropDownList1.SelectedItem.Text + " Total Number =" + en.Execute_one_SQL(s1); } else { string s1 = "SELECT COUNT (ExamEntryID) FROM dbo.qry_Cerval_Exams_Entries " + GetWhereString(); Label_Grid.Text = "Entries for Status = " + DropDownList1.SelectedItem.Text + " Total Number =" + en.Execute_one_SQL(s1); } break; } }