Exemplo n.º 1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int blresult = 0;

            blresult = Convert.ToInt16(MessageBox.Show("Are you sure you want to delete this row?", "Deleting Customer", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation));
            //MessageBox.Show(blresult.ToString());
            if (blresult == 1)
            {
                if (string.IsNullOrWhiteSpace(txtCustomerID.Text) != true)
                {
                    if (bus_cus.Delete(txtCustomerID.Text))
                    {
                        MessageBox.Show("DELETING SUCCESS", "DELETE", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LoadData();
                        ResetValues();
                    }
                    else
                    {
                        MessageBox.Show("DELETING FAIL", "DELETE", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Please enter the Customer ID you want to delete in the Customer ID box!");
                    txtCustomerID.Focus();
                }
            }//Kết thúc thao tác xóa
        }