Esempio n. 1
0
        private void cbStudents_SelectedIndexChanged(object sender, EventArgs e)
        {
            lbCourses.Items.Clear();
            string        id      = cbStudents.SelectedItem.ToString();
            Tafe_DataTier dt      = new Tafe_DataTier();
            var           student = dt.viewStudents().Find(s => s.StudentID == id);

            txtName.Text = student.StduentName;
            DateTime date = student.DateEnrolled.Value;

            txtDateEnrolled.Text = date.ToString("d");



            if (dt.getEnrollmentsForStudent(id).Count == 0)
            {
                lbCourses.Items.Add("--------- NO ENROLLMENTS ----------");
            }
            else
            {
                var enrolls = dt.getEnrollmentsForStudent(id);
                foreach (var enroll in enrolls)
                {
                    lbCourses.Items.Add(enroll.CourseID);
                }
            }
        }
Esempio n. 2
0
        private void cbStudents_SelectedIndexChanged(object sender, EventArgs e)
        {
            lbCourses.Items.Clear();
            string id = cbStudents.SelectedItem.ToString();

            dt = new Tafe_DataTier();
            var student = dt.viewStudents().Find(s => s.StudentID == id);

            this.txtName.Text = student.StduentName;

            Decimal total = 0.0M;

            if (dt.getEnrollmentsForStudent(id).Count == 0)
            {
                lbCourses.Items.Add("--------- NO ENROLLMENTS ----------");
            }
            else
            {
                var enrolls = dt.getEnrollmentsForStudent(id);
                foreach (var enroll in enrolls)
                {
                    lbCourses.Items.Add(enroll.CourseID);
                    var cost = dt.viewCourses().Find(c => c.CourseID == enroll.CourseID).Cost;
                    total = total + Convert.ToDecimal(cost);
                }
            }
            txtCost.Text = total.ToString("C");
        }
Esempio n. 3
0
        private void cbStudents_SelectedIndexChanged(object sender, EventArgs e)
        {
            lbCourses.Items.Clear();
            string id = cbStudents.SelectedItem.ToString();

            this.txtName.Text = (studList.Where(s => s.StudentID == id)).FirstOrDefault().StduentName;

            dt = new Tafe_DataTier();
            List <Course> courseList = dt.getEnrollmentsForStudent(id);

            Decimal total = 0.0M;

            if (courseList.Count() <= 0)
            {
                lbCourses.Items.Add("--------- NO ENROLLMENTS ----------");
            }
            else
            {
                foreach (var c in courseList)
                {
                    lbCourses.Items.Add(c.CourseName);
                    total = total + c.Cost;
                }
            }
            txtCost.Text = total.ToString("C");
        }
Esempio n. 4
0
        private void cbStudents_SelectedIndexChanged(object sender, EventArgs e)
        {
            lbCourses.Items.Clear();
            string id = cbStudents.SelectedItem.ToString();

            this.txtName.Text = (studTable.FindByStudentID(id)).StduentName;

            dt = new Tafe_DataTier();
            System.Data.SqlClient.SqlDataReader dr = dt.getEnrollmentsForStudent(id);

            Decimal total = 0.0M;

            if (!dr.HasRows)
            {
                lbCourses.Items.Add("--------- NO ENROLLMENTS ----------");
            }
            else
            {
                while (dr.Read())
                {
                    lbCourses.Items.Add(dr.GetString(0));
                    total = total + dr.GetDecimal(1);
                }
            }
            txtCost.Text = total.ToString("C");
        }
Esempio n. 5
0
        private void cbStudents_SelectedIndexChanged(object sender, EventArgs e)
        {
            lbCourses.Items.Clear();
            string id = cbStudents.SelectedItem.ToString();

            txtName.Text         = (studList.Where(s => s.StudentID == id).FirstOrDefault()).StduentName;
            txtDateEnrolled.Text = (studList.Where(s => s.StudentID == id).FirstOrDefault()).DateEnrolled.ToString("d");

            Tafe_DataTier dt             = new Tafe_DataTier();
            var           enrollmentList = dt.getEnrollmentsForStudent(id);

            if (enrollmentList.Count() <= 0)
            {
                lbCourses.Items.Add("--------- NO ENROLLMENTS ----------");
            }
            else
            {
                foreach (var enroll in enrollmentList)
                {
                    lbCourses.Items.Add(enroll.CourseID);
                }
            }
        }
        private void cbStudents_SelectedIndexChanged(object sender, EventArgs e)
        {
            lbCourses.Items.Clear();
            string id = cbStudents.SelectedItem.ToString();

            txtName.Text         = (table.FindByStudentID(id)).StduentName;
            txtDateEnrolled.Text = (table.FindByStudentID(id)).DateEnrolled.ToString("d");

            Tafe_DataTier dt = new Tafe_DataTier();

            System.Data.SqlClient.SqlDataReader dr = dt.getEnrollmentsForStudent(id);

            if (!dr.HasRows)
            {
                lbCourses.Items.Add("--------- NO ENROLLMENTS ----------");
            }
            else
            {
                while (dr.Read())
                {
                    lbCourses.Items.Add(dr.GetString(0));
                }
            }
        }