Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            ClassInfoData data = new ClassInfoData();

            data.Classid       = txtClassid.Text;
            data.Specialtyid   = txtSpecialtyid.Text;
            data.Studentnumber = int.Parse(txtStudentnumber.Text);
            data.Remark        = txtRemark.Text;

            if (txtClassid.Text == "" || txtClassid.Text == null)
            {
                MessageBox.Show("用户名不能为空");
                txtClassid.Focus();
                return;
            }
            Classes.ClassInfoOperation op = new Classes.ClassInfoOperation();

            if (op.InsertClassInfo(data))
            {
                MessageBox.Show("插入成功");
            }
            else
            {
                MessageBox.Show("失败");
            }
        }
Esempio n. 2
0
        DataSet Bind()
        {
            ClassInfoData data = new ClassInfoData();

            data.Classid     = txtClassid.Text;
            data.Specialtyid = txtSpecialtyid.Text;

            Classes.ClassInfoOperation op = new Classes.ClassInfoOperation();
            ds = op.GetClassInfo(data);
            return(ds);
        }
Esempio n. 3
0
        //删除
        private void button3_Click(object sender, EventArgs e)
        {
            string classid = txtClassid1.Text;

            Classes.ClassInfoOperation op = new Classes.ClassInfoOperation();
            if (op.DeleteClass(classid))
            {
                MessageBox.Show("成功");
            }
            else
            {
                MessageBox.Show("失败了");
            }
            dataGridView1.DataSource = Bind().Tables[0];
        }
Esempio n. 4
0
        //修改
        private void button2_Click(object sender, EventArgs e)
        {
            ClassInfoData data = new ClassInfoData();

            data.Classid       = txtClassid1.Text;
            data.Specialtyid   = txtSpecialtyid1.Text;
            data.Studentnumber = int.Parse(txtStudentnumber1.Text);
            data.Remark        = txtRemark1.Text;

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