protected void TextBox_mask_TextChanged(object sender, EventArgs e) { GroupListBox.Items.Clear(); GroupList gl1 = new GroupList(); gl1.LoadList_NonNewDawnOnly(DateTime.Now, GroupList.GroupListOrder.GroupName); foreach (Group g in gl1._groups) { if (g._GroupCode.ToUpper().Contains(TextBox_mask.Text.ToUpper())) { ListItem l = new ListItem(g._GroupCode, g._GroupID.ToString()); GroupListBox.Items.Add(l); } } if (GroupListBox.Items.Count > 0) { //GroupListBox.Items[0].Selected = true; GroupListBox.Visible = true; Display_List.Visible = true; Display(); } }
private void Build_GroupList(string type, string year, string group1) { GroupListBox.Items.Clear(); DateTime ListDate = new DateTime(); ListDate = System.Convert.ToDateTime(TextBox_ListDate.Text); if (type == "Group") { Group g = new Group(); g.Load(group1, ListDate); ListItem l = new ListItem(g._GroupCode, g._GroupID.ToString()); GroupListBox.Items.Add(l); l.Selected = true; Label_Groups.Text = ""; Display(); return; } if (Year == "0") { //need to do mask... soo nothing... TextBox_mask.Visible = true; GroupListBox.Visible = false; Label_Groups.Text = "Type mask and return"; Display_List.Visible = false; GroupListControl1.Groups.Clear(); return; } bool add = false; string user = ""; PupilPeriodList ppl = new PupilPeriodList(); if (type == "User") { Utility u = new Utility(); //user = u.GetStaffCodefromContext(Context); user = u.GetsStaffCodefromRequest(Request); #if DEBUG user = "******"; #endif ppl.LoadList("StaffCode", user, false, ListDate); } GroupList gl1 = new GroupList(); gl1.LoadList_NonNewDawnOnly(ListDate, GroupList.GroupListOrder.GroupName); foreach (Group g in gl1._groups) { add = false; switch (type) { case "Year": if (g._GroupCode.StartsWith(year) || (year == "All")) { add = true; } break; case "User": foreach (ScheduledPeriod p in ppl.m_pupilTTlist) { if (p.m_groupcode == g._GroupCode) { add = true; break; } } ; break; default: break; } if (add) { ListItem l = new ListItem(g._GroupCode, g._GroupID.ToString()); GroupListBox.Items.Add(l); } } switch (type) { case "Year": Label_Groups.Text = "Year" + Year; break; case "User": Label_Groups.Text = "Groups for " + user; break; } }