예제 #1
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (dgvState.RowCount != 0)
     {
         DialogResult dr;
         dr = MessageBox.Show("Are you sure?If you delete state corresponding addresses will get deleted", "Delete", MessageBoxButtons.YesNo);
         if (dr == System.Windows.Forms.DialogResult.No)
         {
             return;
         }
         int     StateId    = (int)dgvState.SelectedRows[0].Cells[0].Value;
         StateBO objStateBO = new StateBO();
         objStateBO.DeleteState(StateId);
         BindGridView();
     }
 }
예제 #2
0
 //for Deleting the data from the table
 public void Delete(object T, int d)
 {
     if (d == 1)
     {
         CountryBO.DeleteCountry((Country)T);
     }
     else if (d == 2)
     {
         StateBO.DeleteState((State)T);
     }
     else if (d == 3)
     {
         UserDB.DeleteUser((UserDetail)T);
     }
     if (d == 4)
     {
         AddressBookDB.DeleteAddress((Addressbook)T);
     }
 }