public int EliminarMedicamento(int iidMedicamento) { int rpta = 0; try { MedicamentosClient oMedicamentoClient = new MedicamentosClient(); oMedicamentoClient.ClientCredentials.UserName.UserName = "******"; oMedicamentoClient.ClientCredentials.UserName.Password = "******"; rpta = oMedicamentoClient.EliminarMedicamento(iidMedicamento); } catch (Exception) { rpta = 0; } return(rpta); }
private void toolStripEliminar_Click(object sender, EventArgs e) { if (MessageBox.Show("Eliminar?", "", MessageBoxButtons.YesNo).Equals(DialogResult.Yes)) { int idMedicamento = (int)dgvMedicamento.CurrentRow.Cells[0].Value; MedicamentosClient oMedicamentosClient = new MedicamentosClient(); oMedicamentosClient.ClientCredentials.UserName.UserName = "******"; oMedicamentosClient.ClientCredentials.UserName.Password = "******"; int rpta = oMedicamentosClient.EliminarMedicamento(idMedicamento); if (rpta == 1) { Listar(); MessageBox.Show("Eliminado"); } else { MessageBox.Show("Error"); } } }