예제 #1
0
 private void DeleteCustomerRadButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.CustomersRadGridView.SelectedRows.Count == 0)
         {
             RadMessageBox.Show(null, "Debe seleccionar un cliente para realizar esta operación", "JOSIAS INDUSTRIAL SRL", MessageBoxButtons.OK, RadMessageIcon.Exclamation);
             return;
         }
         else
         {
             selectedRow = (Int32)this.CustomersRadGridView.CurrentRow.Cells["CustomerID"].Value;
             DialogResult result = RadMessageBox.Show(null, "¿Usted quiere eliminar el cliente seleccionado?", "JOSIAS INDUSTRIAL SRL", MessageBoxButtons.OKCancel, RadMessageIcon.Question);
             if (result == DialogResult.OK)
             {
                 _serviceCustomer.Delete(selectedRow.Value);
                 FillCustomersRadGridView();
                 RadMessageBox.Show(null, "Cliente eliminado correctamente", "JOSIAS INDUSTRIAL SRL", MessageBoxButtons.OK, RadMessageIcon.Info);
             }
         }
     }
     catch (Exception ee)
     {
         RadMessageBox.Show(null, string.Format("Se ha producido un error: {0}", ee.Message), "JOSIAS INDUSTRIAL SRL", MessageBoxButtons.OK, RadMessageIcon.Error);
         return;
     }
 }
        public HttpResponseMessage Delete(int id)
        {
            try
            {
                return(_httpResponseMessageBuilder.GetSimpleResponse(_customerBL.Delete(id), Request));
            }

            catch (Exception ex)
            {
                ExceptionHandler exceptionHandler = new ExceptionHandler();
                exceptionHandler.WrapLogException(ex);
                return(null);
            }
        }