Example #1
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     StudentBLL objstudentBLLClass = new StudentBLL();
     string StuNum = dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString();
     if (objstudentBLLClass.DeleteStudent(StuNum) == true)
     { MessageBox.Show("数据删除成功"); }
     else
     { MessageBox.Show("数据删除失败"); }
     dataGridView1.DataSource = objstudentBLLClass.ShowStuInfo();
 }
Example #2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     StudentBLL objstudentBBLClass = new StudentBLL();
     StudentModel objStudentModel = new StudentModel();
     objStudentModel.StuNum = txtStuNum.Text;
     objStudentModel.StuName = txtStuName.Text;
     objStudentModel.StuSex = cbxStuSex.Text;
     objStudentModel.Address = txtAddress.Text;
     objStudentModel.ClaNum = txtClaNum.Text;
     if (objstudentBBLClass.Insertstudent(objStudentModel) == true)
         MessageBox.Show("数据添加成功");
     else
         MessageBox.Show("数据添加失败");
     dataGridView1.DataSource = objstudentBBLClass.ShowStuInfo();
 }
Example #3
0
 private void btnModify_Click_1(object sender, EventArgs e)
 {
     StudentBLL objstudentBBLClass = new StudentBLL();
     StudentModel objStudentModel = new StudentModel();
     objStudentModel.StuNum = dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString();
     objStudentModel.StuName = txtStuName.Text;
     objStudentModel.StuSex = cbxStuSex.Text;
     objStudentModel.Address = txtAddress.Text;
     if (objstudentBBLClass.UpdateStudent(objStudentModel) == true)
     { MessageBox.Show("数据修改成功"); }
     else
     { MessageBox.Show("数据修改失败"); }
     dataGridView1.DataSource = objstudentBBLClass.ShowStuInfo();
 }
Example #4
0
 private void Form1_Load(object sender, EventArgs e)
 {
     StudentBLL objStudentBLL = new StudentBLL();
     dataGridView1.DataSource = objStudentBLL.ShowStuInfo();
 }