コード例 #1
0
 private void DeleteRequest_Button_Click(object sender, EventArgs e)
 {
     if (Requests_DataGridView.CurrentRow == null)
     {
         Alert.DisplayError("No item selected!");
         return;
     }
     try
     {
         Request request = new Request();
         request.id_request = (int)Requests_DataGridView.CurrentRow.Cells[0].Value;
         request            = ManagerService.GetRequests(request).SingleOrDefault();
         ManagerService.DeleteRequest(request);
         int             index           = Requests_DataGridView.CurrentRow.Index;
         CurrencyManager currencyManager = (CurrencyManager)BindingContext[Requests_DataGridView.DataSource];
         currencyManager.SuspendBinding();
         Requests_DataGridView.Rows[index].Visible = false;
         currencyManager.ResumeBinding();
     }
     catch (ServiceException exc)
     {
         Alert.DisplayError(exc.Message);
     }
 }