Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            CourseInfoData data = new CourseInfoData();

            data.Kcid            = txtKcid.Text;
            data.Kcname          = txtKcname.Text;
            data.Periodexpriment = int.Parse(txtPeriodexpriment.Text);
            data.Periodteaching  = int.Parse(txtPeriodteaching.Text);
            data.Credit          = float.Parse(txtCredit.Text);
            data.Coursetype      = txtCoursetype.Text;

            if (txtKcid.Text == "" || txtKcid.Text == null)
            {
                MessageBox.Show("课程编号不能为空");
                txtKcid.Focus();
                return;
            }
            Classes.CourseInfoOperation op = new Classes.CourseInfoOperation();

            if (op.InsertCourseInfo(data))
            {
                MessageBox.Show("插入成功");
            }
            else
            {
                MessageBox.Show("失败");
            }
        }
Beispiel #2
0
        DataSet Bind()
        {
            CourseInfoData data = new CourseInfoData();

            data.Kcid   = txtKcid.Text;
            data.Kcname = txtKcname.Text;

            Classes.CourseInfoOperation op = new Classes.CourseInfoOperation();
            ds = op.GetCourseInfo(data);
            return(ds);
        }
Beispiel #3
0
        //修改
        private void button2_Click(object sender, EventArgs e)
        {
            CourseInfoData data = new CourseInfoData();

            data.Kcid            = txtKcid1.Text;
            data.Kcname          = txtKcname1.Text;
            data.Periodexpriment = int.Parse(txtPeriodexpriment1.Text);
            data.Periodteaching  = int.Parse(txtPeriodteaching1.Text);
            data.Credit          = float.Parse(txtCredit1.Text);
            data.Coursetype      = txtCoursetype1.Text;

            Classes.CourseInfoOperation op = new Classes.CourseInfoOperation();
            if (op.UpdateCourse(data))
            {
                MessageBox.Show("成功");
            }
            else
            {
                MessageBox.Show("失败了");
            }
            dataGridView1.DataSource = Bind().Tables[0];
        }