private void btnsil_Click(object sender, EventArgs e)
 {
     cb.Delete(Convert.ToInt32(txtid.Text));
     ListCustomers();
     MessageBox.Show("Kayıt Başarıyla Silindi", "Silme İşlemi Başarılı !", MessageBoxButtons.OK, MessageBoxIcon.Information);
     txtisim.Clear(); txtsoyisim.Clear(); txtisim.Focus();
 }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (dataGridView.SelectedRows.Count > 0)
     {
         var customer   = dataGridView.SelectedRows[0].Cells;
         var customerId = int.Parse(customer[0].Value.ToString());
         CustomerBusiness customerBusiness = new CustomerBusiness();
         customerBusiness.Delete(customerId);
         PopulateDataGridViewDefault();
         ResetSelect();
     }
 }
Example #3
0
 public override void HandleDelete()
 {
     if (string.IsNullOrEmpty(SelectedCustomerID))
     {
         MessageBox.Show("Vui lòng chọn khách hàng.");
     }
     else if (MessageBox.Show("Xóa thông tin khách hàng này?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
     {
         string result = _business.Delete(SelectedCustomerID);
         if (string.IsNullOrEmpty(result))
         {
             DataBind();
         }
         else
         {
             MessageBox.Show(result, Constants.Messages.ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult d = new DialogResult();

            d = MessageBox.Show(txtCustomerName.Text + " Adlı Müşteriyi Silmek İstediğiinizden Emin Misiniz?", " SİLME ONAY", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
            switch (d)
            {
            case DialogResult.Yes:
                cb.Delete(Convert.ToInt32(lblID.Text));
                MessageBox.Show(txtCustomerName.Text + " Adlı Müşteri Başarıyla Silindi", "ONAY", MessageBoxButtons.OK, MessageBoxIcon.Information);
                dgvCustomers.DataSource = cb.GetAll();
                break;

            case DialogResult.No:
                break;

            default:
                break;
            }
        }