コード例 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            int i = 0;

            if (tbTeachCourseNo.Text.Trim().Equals(""))
            {
                MessageBox.Show("开课号不能为空", "提示");
                tbTeachCourseNo.Focus();
                return;
            }
            if (tbAmount.Text.Trim().Equals(""))
            {
                MessageBox.Show("学分不能为空", "提示");
                tbAmount.Focus();
                return;
            }
            if (tbTeacher.Text.Trim().Equals(""))
            {
                MessageBox.Show("学分不能为空", "提示");
                tbTeacher.Focus();
                return;
            }
            OpenCourse         oc  = new OpenCourse(tbTeachCourseNo.Text, cbCourseName.Text, tbTeacher.Text, int.Parse(tbAmount.Text), int.Parse(cbStartWeek.Text), int.Parse(cbEndWeek.Text));
            CourseManageAction cma = new CourseManageAction();

            cma.setOpenCourse(oc);
            if (isUpdate == false)
            {
                i = cma.addOpenCourse();
                if (i > 0)
                {
                    MessageBox.Show(string.Format("增加了{0}条记录", i));
                    foreach (Control ctrl in groupBox2.Controls)
                    {
                        if (!(ctrl is Label))
                        {
                            ctrl.Text = "";
                        }
                    }
                }
                else
                {
                    MessageBox.Show("添加不成功");
                }
            }
            else
            {
                i = cma.updateOpenCourse();
                if (i > 0)
                {
                    MessageBox.Show(string.Format("更新了{0}条记录", i));
                    this.Close();
                }
                else
                {
                    MessageBox.Show("更新不成功");
                }
            }
            this.Close();
        }
コード例 #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Course          c   = CourseManageAction.QueryCourseInfo(tbCourseNo.Text);
            InputCourseForm acf = new InputCourseForm(c);

            acf.MdiParent = this.MdiParent;
            acf.Show();
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)//btRearch
        {
            string cNo   = tbCourseNo.Text;
            string cName = tbCourseName.Text;

            lvCourse.Items.Clear();
            CourseManageAction.loadAllCourse(lvCourse, cNo, cName);
        }
コード例 #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            Course c = CourseManageAction.QueryCourseInfo(tbCourseNo.Text);

            CourseManager.OpenCourseForm ocf = new OpenCourseForm(c);
            ocf.MdiParent = this.MdiParent;
            ocf.Show();
        }
コード例 #5
0
 public OpenCourseForm(Course c)
 {
     InitializeComponent();
     this.Text = "开设课程";
     tbTeachCourseNo.Enabled = true;
     isUpdate          = false;
     btnAdd.Text       = "开课";
     cbCourseName.Text = c.courseName;
     tbCourseNo.Text   = CourseManageAction.QuerycourseNo(c.courseName);
 }
コード例 #6
0
 private void tbWorkerNo_Leave(object sender, EventArgs e)
 {
     tbTeacher.Text = CourseManageAction.QueryWorkerName(tbWorkerNo.Text);
     if (tbTeacher.Text == "")
     {
         MessageBox.Show("不存在该教师");
         tbWorkerNo.Text = "";
         return;
     }
 }
コード例 #7
0
        private void btoRevise_Click(object sender, EventArgs e)
        {
            if (lvLessons.SelectedItems.Count == 0)
            {
                return;
            }
            OpenCourse oc = CourseManageAction.QueryOpenCourseInfo(lvLessons.SelectedItems[0].SubItems[0].Text);

            CourseManager.OpenCourseForm ocf = new OpenCourseForm(oc);
            ocf.MdiParent = this.MdiParent;
            ocf.Show();
        }
コード例 #8
0
        //课程列表行改变时的事件响应函数
        private void lvCourse_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvCourse.SelectedItems.Count == 0)
            {
                return;                                   //未选中任何一行
            }
            string cNo = lvCourse.SelectedItems[0].Text;  //取选中行中的第一行的第一列文本

            tbCourseNo.Text   = cNo;
            tbCourseName.Text = lvCourse.SelectedItems[0].SubItems[1].Text;
            CourseManageAction.loadOpenCourse(lvLessons, cNo);
        }
コード例 #9
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (lvLessons.SelectedItems.Count == 0)
            {
                return;
            }
            OpenCourse     oc  = CourseManageAction.QueryOpenCourseInfo(lvLessons.SelectedItems[0].SubItems[0].Text);
            studentInClass SIC = new studentInClass(oc);

            SIC.MdiParent = this.MdiParent;
            SIC.Show();
        }
コード例 #10
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (tbCourseNo.Text == "")
            {
                return;
            }

            if (MessageBox.Show("确定要删除吗?", "", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                int i = CourseManageAction.delCourse(tbCourseNo.Text.Trim());
                MessageBox.Show(i + " row(s) affected");
            }
        }
コード例 #11
0
 public studentInClass(OpenCourse oc, string role = "教务员")
 {
     InitializeComponent();
     label5.Text = oc.teachCourseNo;
     label6.Text = oc.courseName;
     label7.Text = oc.teacher;
     label8.Text = CourseManageAction.NumberInClass(oc.teachCourseNo).ToString() + "/" + CourseManageAction.getAmount(oc.teachCourseNo).ToString();
     CourseManageAction.loadStudentInClass(lvSIC, oc.teachCourseNo);
     if (role == "教师")
     {
         button1.Visible = false;
     }
 }
コード例 #12
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            int i = 0;

            if (tbCourseNo.Text.Trim().Equals(""))
            {
                MessageBox.Show("不能为空", "提示");
                tbCourseNo.Focus();
                return;
            }
            Course             course = new Course(tbCourseNo.Text, tbCourseName.Text, float.Parse(tbPoint.Text));
            CourseManageAction cma    = new CourseManageAction();

            cma.setCourse(course);
            if (isUpdate == false)
            {
                i = cma.addCourse();
                if (i > 0)
                {
                    cma.updateDept(course, dept);
                    MessageBox.Show(string.Format("增加了{0}条记录", i));
                    foreach (Control ctrl in groupBox2.Controls)
                    {
                        if (!(ctrl is Label))
                        {
                            ctrl.Text = "";
                        }
                    }
                }
                else
                {
                    MessageBox.Show("添加不成功");
                }
            }
            else
            {
                i = cma.updateCourse();
                if (i > 0)
                {
                    MessageBox.Show(string.Format("更新了{0}条记录", i));
                    this.Close();
                }
                else
                {
                    MessageBox.Show("更新不成功");
                }
            }
            faculty.Close();
            this.Close();
        }
コード例 #13
0
        private void btoDelete_Click(object sender, EventArgs e)
        {
            if (lvLessons.SelectedItems.Count == 0)
            {
                return;
            }

            if (MessageBox.Show("确定要删除吗?", "", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                int i = CourseManageAction.delopenCourse(lvLessons.SelectedItems[0].SubItems[0].Text.Trim());
                MessageBox.Show(i + " row(s) affected");
            }
            CourseManageAction.loadAllCourse(lvCourse);
        }
コード例 #14
0
 public OpenCourseForm(OpenCourse oc)
 {
     InitializeComponent();
     this.Text = "修改开课";
     tbTeachCourseNo.Enabled = false;
     tbTeachCourseNo.Text    = oc.teachCourseNo;
     cbCourseName.Text       = oc.courseName;
     tbTeacher.Text          = oc.teacher;
     tbAmount.Text           = oc.amount.ToString();
     cbStartWeek.Text        = oc.startWeek.ToString();
     cbEndWeek.Text          = oc.endWeek.ToString();
     isUpdate        = true;
     btnAdd.Text     = "保存修改";;
     tbCourseNo.Text = CourseManageAction.QuerycourseNo(oc.courseName);
 }
コード例 #15
0
        public InputCourseForm(Course c)
        {//c非空为修改窗体;否则为增加窗体
            InitializeComponent();
            if (c == null)
            {
                tbCourseNo.Enabled = true;
                this.Text          = "增加课程";
                isUpdate           = false;
                btnAdd.Text        = "增加";
            }
            else
            {
                this.Text          = "修改课程信息";
                tbCourseNo.Enabled = false;

                tbCourseNo.Text   = c.courseNo;
                tbCourseName.Text = c.courseName;
                tbPoint.Text      = c.point.ToString("0.0");
                isUpdate          = true;
                btnAdd.Text       = "保存修改";
                dept = CourseManageAction.getDept(c);
            }
        }
コード例 #16
0
 private void btnReUpdate_Click(object sender, EventArgs e)
 {
     CourseManageAction.loadAllCourse(lvCourse);
 }
コード例 #17
0
 private void button1_Click(object sender, EventArgs e)
 {
     CourseManageAction.controllAmount(lvSIC, label5.Text);
     label8.Text = CourseManageAction.NumberInClass(label5.Text).ToString() + "/" + CourseManageAction.getAmount(label5.Text).ToString();
     CourseManageAction.loadStudentInClass(lvSIC, label5.Text);
 }
コード例 #18
0
 //刷新表lvLessons
 private void button6_Click(object sender, EventArgs e)
 {
     CourseManageAction.loadOpenCourse(lvLessons, tbCourseNo.Text);
 }