Exemple #1
0
        protected void grdInstitucion_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            institucion = new InstitucionAD();
            GridViewRow row = grdInstitucion.Rows[e.RowIndex];
            Label       id  = (row.FindControl("lblID") as Label);

            if (institucion.DeleteInstitucion(Convert.ToInt32(id.Text)))
            {
                Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri);
            }
            else
            {
                Response.Write("<script>window.alert('No Se Pudo Eliminar " + id + "')</script>");
            }
        }
Exemple #2
0
        protected void btnAgregar_Click(object sender, EventArgs e)
        {
            institucion = new InstitucionAD();

            string nombre    = txtNombre.Text;
            string ubicacion = txtUbicacion.Text;

            if (institucion.InsertInstitucion(nombre, ubicacion))
            {
                //Response.Write("<script>window.alert('Institucion Creada')</script>");
                Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri);
            }
            else
            {
                Response.Write("<script>window.alert('Ingreso Fallido')</script>");
            }
        }
Exemple #3
0
        protected void grdInstitucion_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            institucion = new InstitucionAD();

            GridViewRow row       = grdInstitucion.Rows[e.RowIndex];
            Label       id        = (row.FindControl("lblID") as Label);
            TextBox     nombre    = (row.FindControl("txtEditNombre") as TextBox);
            TextBox     ubicacion = (row.FindControl("txtEditUbicacion") as TextBox);

            if (institucion.UpdateInstitucion(Convert.ToInt32(id.Text), nombre.Text, ubicacion.Text))
            {
                grdInstitucion.EditIndex = -1;
                GridLoad();
            }
            else
            {
                grdInstitucion.EditIndex = -1;
                GridLoad();
                Response.Write("<script>window.alert('Actualización Fallida')</script>");
            }
        }
Exemple #4
0
 public void GridLoad()
 {
     institucion = new InstitucionAD();
     grdInstitucion.DataSource = institucion.SelectInstitucion();
     grdInstitucion.DataBind();
 }