Esempio n. 1
0
        private void cbCourses_SelectedIndexChanged(object sender, EventArgs e)
        {
            lbStudents.Items.Clear();
            string id = cbCourses.SelectedItem.ToString();

            foreach (Course c in courses)
            {
                if (c.CourseID.Trim() == id.Trim())
                {
                    this.txtName.Text = c.CourseName;
                    this.txtCost.Text = c.Cost.ToString("C");
                }
            }

            Tafe_DataTier  dt       = new Tafe_DataTier();
            List <Student> students = dt.getStudentEnrolledInCourse(id);

            if (students.Count == 0)
            {
                lbStudents.Items.Add("--------- NO ENROLLMENTS ----------");
            }
            else
            {
                foreach (Student s in students)
                {
                    this.lbStudents.Items.Add(s.StudentName + " --> " + s.StudentID);
                }
            }
        }