private void btnAddSup_Click(object sender, EventArgs e) { string Id = txtSplID.Text; string Name = cmbSplName.Text; string Address = cmbSplAddr.Text; Supplier s = new Supplier(Id, Name, Address); int rsl = sBUS.Add(s); if (txtSplID.Text != null || txtSplID.Text != "" || txtSplID.ToString() != null || txtSplID.ToString() != "") { if (cmbSplName.Text != null || cmbSplName.Text != "") { if (rsl > 0) { List <Supplier> list = sBUS.LoadSupplier(); dgvSupplier.DataSource = list; MessageBox.Show("Thêm nhà cung cấp mới thành công!"); } else { MessageBox.Show("Đã xảy ra lỗi, vui lòng thử lại..."); } } else { MessageBox.Show("Đã xảy ra lỗi, vui lòng thử lại..."); } } else { MessageBox.Show("Đã xảy ra lỗi, vui lòng thử lại..."); } }
private void btnAdd_Click(object sender, EventArgs e) { string id, name, address; id = txtId.Text; name = txtName.Text; address = txtAddress.Text; Supplier s = new Supplier(id, name, address); int numberOfRows = supBUS.Add(s); //if (numberOfRows > 0) // MessageBox.Show("Them thanh cong!"); //else // MessageBox.Show("Them that bai!"); if (numberOfRows > 0) { List <Supplier> list = supBUS.LoadSupplier(); dgvSupplier.DataSource = list; MessageBox.Show("Them thanh cong"); } else { MessageBox.Show("Them that bai"); } }