예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            TeacherInfoData data = new TeacherInfoData();

            data.Teaid       = txtTeaid.Text;
            data.Teaname     = txtTeaname.Text;
            data.Teasex      = txtTeasex.Text;
            data.Teloffice   = txtTeloffice.Text;
            data.Address     = txtAddress.Text;
            data.Teabirthday = txtTeabirthday.Text;
            if (txtTeaid.Text == "" || txtTeaid.Text == null)
            {
                MessageBox.Show("用户名不能为空");
                txtTeaid.Focus();
                return;
            }
            Classes.TeacherInfoOperation op = new Classes.TeacherInfoOperation();

            if (op.InsertTeacherInfo(data))
            {
                MessageBox.Show("插入成功");
            }
            else
            {
                MessageBox.Show("失败");
            }
        }
예제 #2
0
        DataSet Bind()
        {
            TeacherInfoData data = new TeacherInfoData();

            data.Teaid       = txtTeaid.Text;
            data.Teaname     = txtTeaname.Text;
            data.Teasex      = txtTeasex.Text;
            data.Teabirthday = txtTeabirthday.Text;

            Classes.TeacherInfoOperation op = new Classes.TeacherInfoOperation();
            ds = op.GetTeacherInfo(data);
            return(ds);
        }
예제 #3
0
        //删除
        private void button3_Click(object sender, EventArgs e)
        {
            string sno = txtTeaid1.Text;

            Classes.TeacherInfoOperation op = new Classes.TeacherInfoOperation();
            if (op.DeleteTeacher(sno))
            {
                MessageBox.Show("成功");
            }
            else
            {
                MessageBox.Show("失败了");
            }
            dataGridView1.DataSource = Bind().Tables[0];
        }
예제 #4
0
        //修改
        private void button2_Click(object sender, EventArgs e)
        {
            TeacherInfoData data = new TeacherInfoData();

            data.Teaid       = txtTeaid1.Text;
            data.Teaname     = txtTeaname1.Text;
            data.Teasex      = txtTeasex1.Text;
            data.Teloffice   = txtTeloffice1.Text;
            data.Address     = txtAddress1.Text;
            data.Teabirthday = txtTeabirthday1.Text;

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