Пример #1
0
        private void btnXoaNCC_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.Delete(id);

            if (numberOfRows > 0)
            {
                List <Supplier> list = supBUS.LoadSupplier();
                dgvSupplier.DataSource = list;
                MessageBox.Show("Xóa thành công");
                txtId.Clear();
                txtName.Clear();
                txtAddress.Clear();
            }
            else
            {
                MessageBox.Show("Xóa thất bại");
            }
        }
Пример #2
0
        private void dgvSupplier_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int col = e.ColumnIndex;

            if (dgvSupplier.Columns[col] is DataGridViewButtonColumn && dgvSupplier.Columns[col].Name == "Cotxoa")
            {
                int    row          = e.RowIndex;
                String id           = dgvSupplier.Rows[row].Cells["Cotcanlay"].Value.ToString();
                int    numberOfRows = supBUS.Delete(id);

                if (numberOfRows > 0)
                {
                    List <Supplier> list = supBUS.LoadSupplier();
                    dgvSupplier.DataSource = list;
                    MessageBox.Show("Da xoa");
                }
                else
                {
                    MessageBox.Show("Xoa that bai");
                }
            }
        }