示例#1
0
        public void Actualizar()
        {
            try
            {
                using (WsSistemaBancario.ComponenteServiceClient componente = new WsSistemaBancario.ComponenteServiceClient())
                {
                    _componente.Nombre        = txtNombe.Text;
                    _componente.Descripcion   = txtDescripcion.Text;
                    _componente.Id_aplicacion = 1;
                    _componente.Estado        = (checkEstado.Checked) ? true : false;
                    if (checkPadre.Checked)
                    {
                        _componente.IdPadre = null;
                    }
                    else
                    {
                        _componente.IdPadre = (int)cmbPadre.SelectedIndex;
                    }

                    if (!(componente.Componente_Editar(_componente, 8)))
                    {
                        MessageBox.Show("Error al actualizar Dato");
                    }
                }
            }
            catch (Exception)
            {
            }
        }
 private void btnActualizar_Click(object sender, EventArgs e)
 {
     if (validarCampos())
     {
         try
         {
             using (WsSistemaBancario.ComponenteServiceClient componente = new WsSistemaBancario.ComponenteServiceClient())
             {
                 Error = null;
                 if (componente.Componente_Editar(componenteSelect, ref Error))
                 {
                     this.DialogResult = DialogResult.OK;
                     this.Close();
                 }
                 else
                 {
                     MetroFramework.MetroMessageBox.Show(this, Error, "Componentes.", MessageBoxButtons.OK, MessageBoxIcon.Error, 170);
                 }
             }
         }
         catch (Exception)
         {
             MetroFramework.MetroMessageBox.Show(this, "Error al conectar con el servidor, vuelva a intentarlo", "Componentes.", MessageBoxButtons.OK, MessageBoxIcon.Error, 170);
         }
     }
 }