private void buttonThem_Click(object sender, EventArgs e) { //co hieu bool cohieu = true; string ma = textBoxMaBP.Text; string ten = textBoxTenBP.Text; //xu ly if (ma != "") { for (int i = 0; i < bp.Count; i++) { if (ma == bp[i].MaBP) { labelThongBao.Text = "Mã nhập không được trùng với mã khác! "; cohieu = false; break; } } } if (ma != "" && ten != "" && cohieu == true) { bool Them = XL_BoPhan.ThemBoPhan(ma, ten); if (Them) { MessageBox.Show("Thêm thành công!"); this.Close(); } else { MessageBox.Show("Thêm thất bại!"); this.Close(); } } }
public int ThemBoPhan(BoPhan bp) { return(xl_bp.ThemBoPhan(bp)); }