private void btnAdd_Click(object sender, EventArgs e) { if (txtProNum.Text == "") { MessageBox.Show("专业号不能为空!\n 请重新输入!"); } else { ProfessionBLL objProfessionBLL = new ProfessionBLL(); ProfessionModel objProfessionModel = new ProfessionModel(); objProfessionModel.ProNum = txtProNum.Text; objProfessionModel.ProName = txtProName.Text; objProfessionModel.DepartNum = txtDepartNum.Text; objProfessionModel.DepartName = txtDepartName.Text; if(objProfessionBLL.InsertProfession(objProfessionModel)==true) { MessageBox.Show("录入成功!"); } else MessageBox.Show("录入失败!"); } ShowTable(); }
private void btnDel_Click(object sender, EventArgs e) { if (txtProNum.Text == "") { MessageBox.Show("学号不能为空!\n 请重新输入!"); } else { ProfessionBLL objSelCourseBLLClass = new ProfessionBLL(); ProfessionModel objProfessionModel = new ProfessionModel(); objProfessionModel.ProNum = txtProNum.Text; if (objSelCourseBLLClass.DelProfession(objProfessionModel) == true) { MessageBox.Show("删除成功!!"); } else { MessageBox.Show("删除失败!"); } } ShowTable(); }
private void btnModify_Click_1(object sender, EventArgs e) { if (txtProNum.Text==""|| txtProName.Text == "") { MessageBox.Show("专业号,专业名称不能为空!\n 请重新输入!"); } else { ProfessionBLL objProfessionBLL = new ProfessionBLL(); ProfessionModel objProfessionModel = new ProfessionModel(); objProfessionModel.ProNum = txtProNum.Text; objProfessionModel.ProName = txtProName.Text; objProfessionModel.DepartNum = txtDepartNum.Text; objProfessionModel.DepartName = txtDepartName.Text; if(objProfessionBLL.UpdatejProfession(objProfessionModel)==true) { MessageBox.Show("修改成功!"); } else MessageBox.Show("修改失败!"); } ShowTable(); }
private void ShowTable() { ProfessionBLL objProfessionBLL = new ProfessionBLL(); dataGridView1.DataSource = objProfessionBLL.ShowProfession(); }