private async void cbStudents_SelectionChanged(object sender, SelectionChangedEventArgs 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 = await 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");
        }
        private async void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            Tafe_DataTier dt = new Tafe_DataTier();

            if (this.validateData())
            {
                try
                {
                    int rowsInserted = await dt.insertCourse(txtID.Text, txtName.Text, Decimal.Parse(txtCost.Text));

                    if (rowsInserted > 0)
                    {
                        await new MessageDialog("Add Course", "New Course Information Saved").ShowAsync();
                    }
                    else
                    {
                        await new MessageDialog("Add Course", "New Course Information NOT Saved").ShowAsync();
                    }
                }
                catch (Exception ex)
                {
                    await new MessageDialog("ERROR", ex.Message).ShowAsync();
                }
            }
        }
        private async void ContentDialog_Loaded(object sender, RoutedEventArgs e)
        {
            Tafe_DataTier dt = new Tafe_DataTier();

            studList = await dt.viewStudents();

            foreach (Student s in studList)
            {
                lbStudents.Items.Add(s.StudentID.ToString() + "-->" + s.StduentName.ToString());;
            }
        }
        private async void ContentDialog_Loaded(object sender, RoutedEventArgs e)
        {
            Tafe_DataTier dt = new Tafe_DataTier();

            courseList = await dt.viewCourses();


            foreach (Course c in courseList)
            {
                lbCourses.Items.Add(c.CourseID.ToString() + "-->" + c.CourseName.ToString());;
            }
        }
Ejemplo n.º 5
0
        private async void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            Tafe_DataTier dt           = new Tafe_DataTier();
            int           rowsInserted = await dt.insertStudent(txtID.Text, txtName.Text, dtpEnrollment.Date.DateTime);

            if (rowsInserted > 0)
            {
                await new MessageDialog("Add Student", "New Student Information Saved").ShowAsync();
            }
            else
            {
                await new MessageDialog("Add Student", "New Student Information NOT Saved").ShowAsync();
            }
        }
Ejemplo n.º 6
0
        private async void btnEnroll_Click(object sender, RoutedEventArgs e)
        {
            dt = new Tafe_DataTier();
            int rowsInserted = await dt.enroll(cbCourses.SelectedItem.ToString(), cbStudents.SelectedItem.ToString());

            if (rowsInserted > 0)
            {
                await new MessageDialog("Enrollment", "New Enrollment Information Saved").ShowAsync();
            }
            else
            {
                await new MessageDialog("Enrollment", "New Enrollment Information NOT Saved").ShowAsync();
            }
        }
        private async void cbStudents_SelectionChanged(object sender, SelectionChangedEventArgs 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 = await dt.getEnrollmentsForStudent(id);

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

            this.txtName.Text = (courseList.Where(c => c.CourseID == id).FirstOrDefault()).CourseName;
            this.txtCost.Text = (courseList.Where(c => c.CourseID == id).FirstOrDefault()).Cost.ToString("C");

            Tafe_DataTier dt       = new Tafe_DataTier();
            var           studList = await dt.getStudentsEnrolledInCourse(id);

            if (studList.Count() <= 0)
            {
                lbStudents.Items.Add("--------- NO ENROLLMENTS ----------");
            }
            else
            {
                foreach (var s in studList)
                {
                    this.lbStudents.Items.Add(s.StudentID + "-->" + s.StduentName);
                }
            }
        }
Ejemplo n.º 9
0
 public frmEnroll()
 {
     this.InitializeComponent();
     dt = new Tafe_DataTier();
 }
Ejemplo n.º 10
0
 public frmBilling()
 {
     this.InitializeComponent();
     dt = new Tafe_DataTier();
 }