private void BtnActualizar_Click(object sender, EventArgs e) { try { string Rpta = ""; if (txtId.Text == string.Empty || CboRol.Text == string.Empty || txtNombre.Text == string.Empty || txtEmail.Text == string.Empty) { this.MensajeError("Falta ingresa algunos datos, seran remarcados."); Erroricono.SetError(CboRol, "Seleccione un rol."); Erroricono.SetError(txtNombre, "Ingrese un nombre"); Erroricono.SetError(txtEmail, "Ingrese un email."); } else { Rpta = NUsuario.Actualizar(Convert.ToInt32(txtId.Text), Convert.ToInt32(CboRol.SelectedValue), txtNombre.Text.Trim(), CboTipoDocumento.Text, txtNumDocumento.Text.Trim(), txtDireccion.Text.Trim(), txtTelefono.Text.Trim(), this.EmailAnt, txtEmail.Text.Trim(), txtClave.Text.Trim()); if (Rpta.Equals("OK")) { this.MensajeOK("Se actulizo de forma correcta el registro"); this.Listar(); } else { this.MensajeError(Rpta); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void BtnActualizar_Click(object sender, EventArgs e) { try { string Rpta = ""; if (TxtId.Text == string.Empty || CboRol.Text == String.Empty || TxtNombre.Text == string.Empty || TxtEmail.Text == string.Empty) { this.MensajeError("Falta ingresar unos datos"); ErrorIcono.SetError(CboRol, "Tienes que elegir un rol"); ErrorIcono.SetError(TxtNombre, "Ingresa un nombre"); ErrorIcono.SetError(TxtEmail, "Ingresa un email"); ErrorIcono.SetError(CboRol, "Ingresa una clave"); } else { Rpta = NUsuario.Actualizar(Convert.ToInt32(TxtId.Text), Convert.ToInt32(CboRol.SelectedValue), TxtNombre.Text.Trim(), CboTipoDoc.Text, TxtNumDoc.Text.Trim(), TxtDireccion.Text.Trim(), TxtTelefono.Text.Trim(), this.EmailAnte, TxtEmail.Text.Trim(), TxtClave.Text.Trim()); if (Rpta.Equals("OK")) { this.MensajeOK("Se insertaron los datos de manera correcta"); this.Limpiar(); } else { this.MensajeError(Rpta); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void btnEditar_Click(object sender, EventArgs e) { try { string rpta = ""; if (txtid.Text == string.Empty || cmbrol.Text == string.Empty || txtusuario.Text == string.Empty) { this.MensajeError("Ingrese los datos faltantes"); errorIcono.SetError(cmbrol, "Seleccione un rol"); errorIcono.SetError(txtusuario, "Ingrese un nombre"); errorIcono.SetError(txtpass, "Ingrese una contraseña"); } else { rpta = NUsuario.Actualizar(Convert.ToInt32(txtid.Text), Convert.ToInt32(cmbrol.SelectedValue), this.UsuarioAnterior, txtusuario.Text.Trim(), txtpass.Text); if (rpta.Equals("OK")) { this.MensajeOk("Se actualizó correctamente"); this.Limpiar(); this.Listar(); } else { this.MensajeError(rpta); button1.Enabled = true; TabGral.SelectedIndex = 0; } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void BtnActualizar_Click(object sender, EventArgs e) { try { string Rpta = ""; if (string.IsNullOrEmpty(TxtTelefonoFijo.Text)) { TxtTelefonoFijo.Text = "0"; } if (TxtRut.Text == string.Empty || TxtNombre.Text == string.Empty || TxtApPaterno.Text == string.Empty || TxtApMaterno.Text == string.Empty || TxtDireccion.Text == string.Empty || TxtEmail.Text == string.Empty || TxtTelefonoMovil.Text == string.Empty || CboComuna.Text == string.Empty || CboRol.Text == string.Empty || CboContrato.Text == string.Empty) { this.MensajeError("Debe rellenar todos los datos obligatorios (*), seran remarcados."); ErrorIcono.SetError(TxtRut, "Ingrese un rut."); ErrorIcono.SetError(TxtNombre, "Ingrese su Nombre."); ErrorIcono.SetError(TxtApPaterno, "Ingrese un Apellido Paterno."); ErrorIcono.SetError(TxtApMaterno, "Ingrese su Apellido Materno."); ErrorIcono.SetError(TxtDireccion, "Ingrese su Direccion."); ErrorIcono.SetError(TxtEmail, "Ingrese un Email."); ErrorIcono.SetError(TxtTelefonoMovil, "Ingrese un Telefono Movil."); ErrorIcono.SetError(CboComuna, "Ingrese una Comuna."); ErrorIcono.SetError(CboRol, "Ingrese un Rol."); ErrorIcono.SetError(CboContrato, "Ingrese un Contrato."); } else { Rpta = NUsuario.Actualizar(Convert.ToInt32(txtId.Text.Trim()), this.RutAnterior, TxtRut.Text.Trim(), TxtNombre.Text.Trim(), TxtApPaterno.Text.Trim(), TxtApMaterno.Text.Trim(), TxtDireccion.Text.Trim(), this.EmailAnterior, TxtEmail.Text.Trim(), Convert.ToInt32(TxtTelefonoMovil.Text), Convert.ToInt32(TxtTelefonoFijo.Text.Trim()), Convert.ToInt32(CboComuna.SelectedValue), Convert.ToInt32(CboRol.SelectedValue), Convert.ToInt32(CboContrato.SelectedValue), TxtClave.Text.Trim()); if (Rpta.Equals("OK")) { this.MensajeOk("Se actualizó de forma correcta el registro"); this.Limpiar(); this.Listar(); } else { this.MensajeError(Rpta); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void botonActualizar_Click(object sender, EventArgs e) { try { string respuesta = ""; if (txtID.Text == string.Empty || comboRol.Text == string.Empty || textoNombre.Text == string.Empty || textoEmail.Text == string.Empty) { this.MensajeError("Falta ingresar algunos datos, seran remarcados"); errorIcono.SetError(textoNombre, "ingrese nombre"); errorIcono.SetError(comboRol, "ingrese rol"); errorIcono.SetError(textoEmail, "ingrese email"); } else { respuesta = NUsuario.Actualizar(Convert.ToInt32(txtID.Text), Convert.ToInt32(comboRol.SelectedValue), textoNombre.Text.Trim(), comboTipoDocumento.Text, textoNumeroDocumento.Text.Trim(), textoDireccion.Text.Trim(), textoTelefono.Text.Trim(), this.EmailAnterior, textoEmail.Text.Trim(), textoClave.Text.Trim()); if (respuesta.Equals("Ok")) { this.MensajeOk("se actualizo"); this.Limpiar(); this.Listar(); TabGeneral.SelectedIndex = 0; } else { this.MensajeError(respuesta); } } } catch (Exception exepcion) { MessageBox.Show(exepcion.Message + exepcion.StackTrace); } }
private void BtnActualizar_Click(object sender, EventArgs e) { try { string Rpta = ""; //Validamos que los campos necesarios esten llenos if (CboRol.Text == string.Empty || TxtNombre.Text == string.Empty || CboTipoDocumento.Text == string.Empty || TxtNumeroDocumento.Text == string.Empty || TxtTelefono.Text == string.Empty || TxtDireccion.Text == string.Empty || TxtDireccion.Text == string.Empty || TxtEmail.Text == string.Empty) { this.MensajeError("Falta Ingresar Algunos Datos, Seran marcados."); Erroricono.SetError(CboRol, "Ingrese un Rol."); Erroricono.SetError(TxtNombre, "Ingrese un nombre."); Erroricono.SetError(CboTipoDocumento, "Ingrese un tipo de documento."); Erroricono.SetError(TxtNumeroDocumento, "Ingrese un numero de documento."); Erroricono.SetError(TxtTelefono, "Ingrese un numero de telefono."); Erroricono.SetError(TxtDireccion, "Ingrese una Direecion"); Erroricono.SetError(TxtEmail, "Ingrese un Email"); } //En caso de que no Ejecutamos el metodo Insertar else { Rpta = NUsuario.Actualizar(Convert.ToInt32(TxtId.Text), Convert.ToInt32(CboRol.SelectedValue), TxtNombre.Text.Trim(), CboTipoDocumento.Text.Trim(), TxtNumeroDocumento.Text.Trim(), TxtDireccion.Text.Trim(), TxtTelefono.Text.Trim(), this.emailant, TxtEmail.Text.Trim(), TxtClave.Text.Trim()); if (Rpta.Equals("OK")) { this.MensajeOK("Usuario Actulizado Exitosamente"); this.Listar(); } else { this.MensajeError(Rpta); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }