예제 #1
0
 protected void btnModificar_Click(object sender, EventArgs e)
 {
     lblError.Visible = lblSucess.Visible = false;
     lblError.Text    = lblSucess.Text = String.Empty;
     try
     {
         if (validarVacios())
         {
             if (validarEntero())
             {
                 if (!Page.IsValid)
                 {
                     return;
                 }
                 AccesoLogica negocio   = new AccesoLogica();
                 int          rut       = Convert.ToInt32(txtRut.Text);
                 string       nombre    = txtNombre.Text;
                 string       apellido  = txtApellido.Text;
                 string       calle     = txtCalle.Text;
                 string       comuna    = txtComuna.Text;
                 int          numero    = Convert.ToInt32(txtNumero.Text);
                 int          resultado = negocio.ModifcarPersona(rut, nombre, apellido, calle, numero, comuna);
                 if (resultado == 1)
                 {
                     btnCancelar.Text   = "LIMPIAR";
                     btnGuardar.Enabled = false;
                     lblSucess.Visible  = true;
                     lblError.Visible   = false;
                     lblSucess.Text     = "Nuevo Registro Agregado Satisfactoriamente.";
                 }
                 negocio = null;
             }
         }
     }
     catch (Exception exception)
     {
         lblError.Visible = true;
         lblError.Text    = "Ha ocurrido un error al intentar actualizar los registros.";
     }
 }