コード例 #1
0
        private bool isAvail(string IDTeacher, int hour, string date)
        {
            DataTable dt = ClassMethods.GetAllClassesForTeacher(IDTeacher);

            foreach (DataRow row in dt.Rows)
            {
                int time = int.Parse(row["ClassHour"].ToString());
                if (time == hour && row["ClassDate"].ToString() == date)
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (isAvail(((twoitem)comboBox1.SelectedItem).Number.ToString(), hour, Date))
            {
                ClassMethods.AddClass(((twoitem)comboBox1.SelectedItem).Number.ToString(), ((twoitem)comboBox2.SelectedItem).Number.ToString(), (Date).ToString(), hour);
                monthCalendar1.SetDate(monthCalendar1.TodayDate);
                comboBox1.Text = "";
                comboBox2.Text = "";
                comboBox3.Text = "";
                label6.Text    = "";
                label5.Text    = "";
                MessageBox.Show("Class Added!");
            }

            else
            {
                MessageBox.Show("There is already a class in this hour.");
            }
        }
コード例 #3
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     dataGridView1.DataSource = ClassMethods.GetAllClasses();
 }