protected void btnregistrar_Click(object sender, EventArgs e) { try { EntitiesCaisa ec = new EntitiesCaisa(); ec.email = txtemail.Text; ec.usuario = Seguridad.Encriptar(txtusuario.Text); ec.contrasena = Seguridad.Encriptar(txtpass.Text); ec.confirmarcontrasena = txtconfpass.Text; ec.nombre = Seguridad.Encriptar(txtnombre.Text); ec.paterno = Seguridad.Encriptar(txtpaterno.Text); ec.materno = Seguridad.Encriptar(txtmaterno.Text); ec.nacimiento = Convert.ToDateTime(txtnacimiento.Text); ec.edad = Convert.ToInt32(txtedad.Text); ec.direccion = txtdireccion.Text; ec.telefono = txttelefono.Text; bu.registrar(ec); ScriptManager.RegisterStartupScript(btnregistrar, this.GetType(), "alert", "alert('El registro se genero correctamente');", true); Response.Redirect("Login.aspx"); } catch (Exception ex) { throw ex; } }
protected void txtnacimiento_TextChanged(object sender, EventArgs e) { try { EntitiesCaisa ed = new EntitiesCaisa(); ed.nacimiento = Convert.ToDateTime(txtnacimiento.Text); ed.edad = DateTime.Today.Year - ed.nacimiento.Year; txtedad.Text = ed.edad.ToString(); } catch (Exception ex) { throw ex; } }
protected void gvdatospersonales_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { EntitiesCaisa ec = new EntitiesCaisa(); TextBox ema = (TextBox)gvdatospersonales.Rows[e.RowIndex].FindControl("txtemail"); TextBox nom = (TextBox)gvdatospersonales.Rows[e.RowIndex].FindControl("txtnombre"); TextBox pat = (TextBox)gvdatospersonales.Rows[e.RowIndex].FindControl("txtpaterno"); TextBox mat = (TextBox)gvdatospersonales.Rows[e.RowIndex].FindControl("txtmaterno"); TextBox fechaa = (TextBox)gvdatospersonales.Rows[e.RowIndex].FindControl("txtnacimiento"); TextBox edad = (TextBox)gvdatospersonales.Rows[e.RowIndex].FindControl("txtedad"); TextBox dir = (TextBox)gvdatospersonales.Rows[e.RowIndex].FindControl("txtdireccion"); TextBox tel = (TextBox)gvdatospersonales.Rows[e.RowIndex].FindControl("txttelefono"); ec.email = ema.Text; ec.nombre = nom.Text; ec.paterno = pat.Text; ec.materno = mat.Text; ec.nacimiento = Convert.ToDateTime(fechaa.Text); ec.edad = Convert.ToInt32(edad.Text); ec.direccion = dir.Text; ec.telefono = tel.Text; bu.actualizadatos(ec); gvdatospersonales.EditIndex = -1; mostrardatospersonales(); } catch (Exception ex) { throw ex; } }