private async void Delete() { if (_selectedProvedor != null) { if (MessageBox.Show("Desea Eliminar Este Proveedor?", "Confirmacion", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { btnDelete.Enabled = false; var result = await _proveedorPagoService.Delete(_selectedProvedor.Id); MessageBox.Show(result ? "Proveedor Eliminado con Exito" : "Fallo al Eliminar Proveedor", String.Empty, MessageBoxButtons.OK, result ? MessageBoxIcon.None: MessageBoxIcon.Error); if (result) { LoadList(); CleanForm(); } btnDelete.Enabled = true; } } else { MessageBox.Show("Seleccione Concepto a Eliminar"); } }
private void ClienteGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0)//ELIMNAR { Proovedor c = (Proovedor)ProvGrid.CurrentRow.DataBoundItem; _proveedorService.Delete(c.id); proveedores = _proveedorService.searchProovedores(); ProvGrid.DataSource = new BindingSource(proveedores, null); } else if (e.ColumnIndex == 1)//EDITAR { Proovedor c = (Proovedor)ProvGrid.CurrentRow.DataBoundItem; AltaProovedorForm formAlta = new AltaProovedorForm(c, ServiceDependencies.GetCiudadService(), ServiceDependencies.getRubroService(), ServiceDependencies.getDireccionService(), ServiceDependencies.getProveedorService()); this.Hide(); formAlta.Show(); } }