コード例 #1
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Select")
        {
            EPrestamo ePres = new EPrestamo();
            int       num   = Convert.ToInt32(e.CommandArgument);
            ePres.Id_elemento = Int32.Parse(((Label)GridView1.Rows[num].FindControl("Label1")).Text);
            ePres.Usuario_id  = Int32.Parse(Session["id"].ToString());
            ePres.Estado_id   = 4;
            DAPrestamo dPres = new DAPrestamo();
            String     user  = Session["nombre"].ToString();
            DataTable  tPres = dPres.PrestamoUsuario(ePres, user);

            if (tPres.Rows.Count == 2)
            {
                this.RegisterStartupScript("mensaje", ("<script type='text/javascript'>alert('Tiene el numero maximo de libros permitidos en su poder por favor devuelvalos antes del plazo indicado');</script>"));
            }
            if (tPres.Rows.Count == 3)
            {
                this.RegisterStartupScript("mensaje", ("<script type='text/javascript'>alert('Excedio el numero de libros a solicitar');</script>"));
            }
            if (tPres.Rows.Count == 1)
            {
                this.RegisterStartupScript("mensaje", ("<script type='text/javascript'>alert('No puede solicitar libros hasta que cancele todas sus deudas con la biblioteca paulo coelo');</script>"));
            }
            if (tPres.Rows.Count == 4)
            {
                this.RegisterStartupScript("mensaje", ("<script type='text/javascript'>alert('No hay mas libros de estos');</script>"));
            }
        }
    }
コード例 #2
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Select")
     {
         EPrestamo ePres = new EPrestamo();
         int       num   = Convert.ToInt32(e.CommandArgument);
         ePres.Id        = Int32.Parse(((Label)GridView1.Rows[num].FindControl("L_id")).Text);
         ePres.Admin_id  = Int32.Parse(Session["id"].ToString());
         ePres.Estado_id = 1;
         DAPrestamo dPres = new DAPrestamo();
         String     user  = Session["nombre"].ToString();
         dPres.RegistrarPrestamo(ePres, user);
         GridView1.Rows[num].Visible = false;
     }
 }
コード例 #3
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Select")
     {
         int        num    = Convert.ToInt32(e.CommandArgument);
         int        _id    = Int32.Parse(((Label)GridView1.Rows[num].FindControl("Label1")).Text);
         DAPrestamo daPres = new DAPrestamo();
         DataTable  tPres  = new DataTable();
         daPres.DevolverPrestamo(_id);
         GridView1.Rows[num].Visible = false;
         if (tPres.Rows.Count > 0)
         {
             this.RegisterStartupScript("mensaje", ("<script type='text/javascript'>alert('El usuario fue desbloqueado ya puede seguir disfrutando de nuestros libros');</script>"));
         }
     }
 }