Exemple #1
0
        private void comboBox1_TextChanged(object sender, EventArgs e)
        {
            for (int i = 0; i < checkedListBox1.Items.Count; i++)
            {
                checkedListBox1.SetItemChecked(i, false);
            }

            List <Teacher> TeacherList = TeacherDB.TeacherLoad();
            List <Classes> ClassList   = ClassesDB.ClassLoad();

            string[] teacherName = comboBox1.Text.Split(' ');
            Teacher  teacher     = TeacherDB.TeacherFind(Convert.ToInt32(teacherName[0]));

            for (int i = 0; i < checkedListBox1.Items.Count; i++)
            {
                string[] classid = checkedListBox1.Items[i].ToString().Split(' ');

                foreach (int id in teacher.ClassID)
                {
                    if (Convert.ToInt32(classid[0]) == id)
                    {
                        checkedListBox1.SetItemChecked(i, true);
                    }
                }
            }
        }
Exemple #2
0
        private void AssignClasses_Load(object sender, EventArgs e)
        {
            List <Teacher> TeacherList = TeacherDB.TeacherLoad();
            List <Classes> ClassList   = ClassesDB.ClassLoad();

            foreach (Classes classes in ClassList)
            {
                string className = classes.ClassID + " " + classes.ClassTitle + " " + classes.ClassTrack;
                checkedListBox1.Items.Add(className, false);
            }

            foreach (Teacher teacher in TeacherList)
            {
                comboBox1.Items.Add(teacher.TeacherID + " " + teacher.FirstName + " " + teacher.LastName);
            }
        }