Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            int id = int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString());

            if (MyDataBaseModel.deleteCourse(id))
            {
                MessageBox.Show("删除课程成功!");
            }
            else
            {
                MessageBox.Show("删除课程失败!");
            }
            this.Form3_Load(new object(), new EventArgs());
        }
Пример #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            string xingqi = (string)dataGridView1.CurrentRow.Cells[1].Value;
            string time   = (string)dataGridView1.CurrentRow.Cells[2].Value;

            if (MyDataBaseModel.deleteLessonPlan(xingqi, time))
            {
                MessageBox.Show("删除成功!");
                Form5_Load(new object(), new EventArgs());
            }
            else
            {
                MessageBox.Show("删除失败!");
            }
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string classname = textBox1.Text;

            if (classname == "")
            {
                MessageBox.Show("请输入课程名!");
                return;
            }
            string teacher = textBox2.Text;

            if (teacher == "")
            {
                MessageBox.Show("请输入教师!");
                return;
            }
            string classroom = textBox3.Text;

            if (classroom == "")
            {
                MessageBox.Show("请输入上课教室!");
                return;
            }
            int score;

            try
            {
                score = int.Parse(textBox4.Text);
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("请输入学分!");
                return;
            }catch (FormatException) {
                MessageBox.Show("请输入正确格式的学分!");
                return;
            }
            int hour;

            try
            {
                hour = int.Parse(textBox5.Text);
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("请输入课时!");
                return;
            }
            catch (FormatException)
            {
                MessageBox.Show("请输入正确格式的课时!");
                return;
            }
            if (!checkedListBox1.GetItemChecked(0) && !checkedListBox1.GetItemChecked(1))
            {
                MessageBox.Show("请选择是否为必修课!");
                return;
            }
            bool   isBixiu   = checkedListBox1.GetItemChecked(0);
            Course newCourse = new Course(classname, teacher, classname, score, hour, isBixiu);

            if (MyDataBaseModel.addNewCourse(newCourse))
            {
                MessageBox.Show("添加成功!");
                this.Close();
            }
            else
            {
                MessageBox.Show("添加失败,请检查输入的内容和格式!");
            }
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string xingqi = "";

            if (radioButton1.Checked)
            {
                xingqi = "星期一";
            }
            else if (radioButton2.Checked)
            {
                xingqi = "星期二";
            }
            else if (radioButton3.Checked)
            {
                xingqi = "星期三";
            }
            else if (radioButton4.Checked)
            {
                xingqi = "星期四";
            }
            else if (radioButton5.Checked)
            {
                xingqi = "星期五";
            }
            else
            {
                MessageBox.Show("请选择上课星期");
                return;
            }
            string time = "";

            if (radioButton6.Checked)
            {
                time = "8:00-10:00";
            }
            else if (radioButton7.Checked)
            {
                time = "10:00-12:00";
            }
            else if (radioButton8.Checked)
            {
                time = "14:00-16:00";
            }
            else if (radioButton9.Checked)
            {
                time = "16:00-18:00";
            }
            else if (radioButton10.Checked)
            {
                time = "18:30-21:00";
            }
            else
            {
                MessageBox.Show("请选择上课时间");
                return;
            }

            string       lesson       = (string)listBox1.SelectedValue;
            MyLessonPlan mylessonplan = new MyLessonPlan(lesson, xingqi, time);

            if (MyDataBaseModel.addLessonPlan(mylessonplan))
            {
                MessageBox.Show("添加成功!!");
            }
            else
            {
                MessageBox.Show("添加失败,您在该时段已经有课啦!");
            }
        }