Example #1
0
        private void AddScheduleForm_Load(object sender, EventArgs e)
        {
            this.datePicker.MaxDate = DateTime.Today.AddDays(7);
            this.datePicker.Value   = DateTime.Today;
            crs crs = new crs();
            Dictionary <int, string> dict = crs.CourseList();

            if (dict.Count > 0)
            {
                courseSelect.DataSource    = new BindingSource(dict, null);
                courseSelect.DisplayMember = "Value";
                courseSelect.ValueMember   = "Key";
                courseSelect.SelectedIndex = 0;
            }
            else
            {
                MessageBox.Show("No Course Available", "Course Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            dict = (new Teacher()).ListAll();
            if (dict.Count > 0)
            {
                teacherSelect.DataSource    = new BindingSource(dict, null);
                teacherSelect.DisplayMember = "Value";
                teacherSelect.ValueMember   = "Key";
                teacherSelect.SelectedIndex = 0;
            }
            else
            {
                MessageBox.Show("No Teacher Available", "Teacher Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        private void CourseAddForm_Load(object sender, EventArgs e)
        {
            crs = new crs();
            this.courseDuration.SelectedIndex = 0;
            this.courseType.SelectedIndex     = 0;
            Dictionary <int, string> dict = crs.CourseList();

            this.coursetxt.DataSource = new BindingSource(dict, null);
            coursetxt.DisplayMember   = "Value";
            coursetxt.ValueMember     = "Key";
            crs.GetDetail(cID);
        }