Пример #1
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (selecteRecordId != 0)
     {
         try
         {
             Cursor = Cursors.WaitCursor;
             LoginBAL _objBAL = new LoginBAL();
             _objBAL.DeleteUser(selecteRecordId);
             MessageBox.Show("Record has been deleted successfully!");
             FillGrid();
             Cursor = Cursors.Default;
             MakeEmpty();
         }
         catch (System.Data.SqlClient.SqlException sqlEx)
         {
             if (sqlEx.Number == 547)
             {
                 MessageBox.Show("You cannot delete this record. Its refference exists in other documents.");
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }