예제 #1
0
        protected void btngrabar_Click(object sender, EventArgs e)
        {
            Epersona p = new Epersona();

            p.idpersona = (this.txtid.Text != "") ? Convert.ToInt32(this.txtid.Text) : 0;
            p.accion    = (editar) ? "U" : "I";
            p.nombre    = this.txtnombre.Text;
            p.estado    = "A";
            p.cedula    = this.txtcedula.Text;
            p.clave     = this.txtclave.Text;
            p.rol       = (this.cmbrol.SelectedValue == "1") ? "1" : "2";
            p.idcarrera = Convert.ToInt32(this.cmbcarrera.SelectedValue);
            p.usuario   = this.txtusuario.Text;

            try
            {
                int id = Npersonas.Sentencia(p);
                if (!editar)
                {
                    this.txtid.Text = id.ToString();
                }
                buscar();
                Habilitar(false);
                ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "$.notify('Datos grabados!','success');", true);
            }
            catch (Exception)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "$.notify('Error no se pudo grabar.','warm');", true);
            }
        }
예제 #2
0
 private static Boolean editar = false; //variable encargada para modificar el registro
 private void buscar()
 {
     this.Grid.DataSource = Npersonas.Buscar(this.txtbuscar.Text);
     this.DataBind();
 }