public void ManageSchedule_Add(object sender, EventArgs args)
        {
            //If there are no courses, return
            if (CourseManager.GetCourseCount() == 0)
            {
                MessageBox.Show("There are no courses.");
                return;
            }

            this.OverlayForm <MS_Add>(false, (context) =>
            {
                context.Show();
                RefreshGridView();
            });
        }
Пример #2
0
        public void RefreshCourse()
        {
            //Clear courses
            lcCourses = null;
            dgvCourses.Rows.Clear();

            //Fill courses list
            lcCourses = CourseManager.GetAllCourses();

            //Display each courses
            for (int i = 0; i < lcCourses.Count; i++)
            {
                Course curCourse = lcCourses[i];
                dgvCourses.Rows.Add(curCourse.Course_ID, curCourse.Course_Name, curCourse.GetFaculty().Faculty_Name, curCourse.Course_Code, curCourse.Course_Description);
            }

            //Refresh courses view
            dgvCourses.Refresh();
        }
Пример #3
0
        public void FillCourses()
        {
            //Clear courses
            lcCourses = null;
            cbCourse.Items.Clear();

            //Get list of courses
            lcCourses = CourseManager.GetAllCourses();
            Debug.Log("LcCourses count: " + lcCourses.Count);

            //Fill courses combo box
            for (int i = 0; i < lcCourses.Count; i++)
            {
                cbCourse.Items.Add(lcCourses[i].Course_Name);
            }

            //Select the first course
            cbCourse.SelectedIndex = 0;

            cbCourse.Refresh();
        }
Пример #4
0
        public void Add(object sender, EventArgs args)
        {
            #region Validate inputs
            if (string.IsNullOrEmpty(tbName.Text))
            {
                MessageBox.Show("Type in the course name.");
                return;
            }
            if (string.IsNullOrEmpty(tbCode.Text))
            {
                MessageBox.Show("Type in the course code.");
                return;
            }
            if (string.IsNullOrEmpty(tbDescription.Text))
            {
                MessageBox.Show("Type in the couse description");
                return;
            }
            #endregion

            //Create new course
            Course course = new Course();
            course.Course_Code        = tbCode.Text;
            course.Course_Description = tbDescription.Text;
            course.Course_Name        = tbName.Text;
            course.CreatedBy          = GlobalApplication.cMyUser.User_ID;
            course.Faculty_ID         = lcFaculties[cbFaculty.SelectedIndex].Faculty_ID;
            course.ModifiedBy         = GlobalApplication.cMyUser.User_ID;

            //Add to DB
            CourseManager.Create(course);

            MessageBox.Show("Added new course.");

            this.Close();
        }