Ejemplo n.º 1
0
    protected void GrillaSerieUsuario_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int IdSerieU = Convert.ToInt32(GrillaSerieUsuario.DataKeys[e.RowIndex].Values[0]);

        cdc = new ConexionLQDataContext();
        Serie_Usuario au = (from a in cdc.Serie_Usuario where a.id_SerieUsuario == IdSerieU select a).FirstOrDefault();

        cdc.Serie_Usuario.DeleteOnSubmit(au);
        cdc.SubmitChanges();
        Mensaje("Bye bye!", "Se ha eliminado la serie de tu lista", "success");
        GrillaSerieUsuario.Visible = false;
        APersonalS.Visible         = false;
    }
Ejemplo n.º 2
0
 protected void GrillaSeriesNA_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         String      Nick     = Convert.ToString(Session["Admin"]);
         int         rowIndex = Convert.ToInt32(e.CommandArgument);
         GridViewRow row      = GrillaSeriesNA.Rows[rowIndex];
         string      ID       = (row.FindControl("lbl_id") as Label).Text;
         IdGrilla = Convert.ToInt32(ID);
         if (e.CommandName == "Select")
         {
             Response.Redirect("Detalles_Serie.aspx?Id=" + ID);
         }
         else if (e.CommandName == "Add")
         {
             SqlDataReader AnimeUser = sql.consulta("EXEC vDetalleSerie '" + Nick + "'," + ID);
             if (AnimeUser.Read())
             {
                 Mensaje("Sin duplicados", "Esta serie ya está en tu lista", "info");
             }
             else
             {
                 cdc = new ConexionLQDataContext();
                 Serie_Usuario su = new Serie_Usuario();
                 su.id_Serie       = Convert.ToInt32(ID);
                 su.id_Usuario     = (from u in cdc.Usuario where u.Nick == Nick select u.id_Usuario).FirstOrDefault();
                 su.id_AvanceSerie = 3;
                 su.Nota           = "Sin notas adjuntas";
                 cdc.Serie_Usuario.InsertOnSubmit(su);
                 cdc.SubmitChanges();
                 Mensaje("¡Felicidades!", "Agregado a tu lista exitosamente", "success");
                 this.llenado();
             }
         }
     }
     catch
     {
         Mensaje("Surgió un problema", "No se ha podido agregar la serie a tu lista", "error");
     }
 }
Ejemplo n.º 3
0
    protected void GrillaSerieUsuario_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            GridViewRow row            = GrillaSerieUsuario.Rows[e.RowIndex];
            int         idSerieUsuario = Convert.ToInt32(GrillaSerieUsuario.DataKeys[e.RowIndex].Values[0]);
            int         Avance         = (row.FindControl("dd_ASerie") as DropDownList).SelectedIndex;
            String      Nota           = (row.FindControl("txt_nota") as TextBox).Text.Trim();

            cdc = new ConexionLQDataContext();
            Serie_Usuario au = (from a in cdc.Serie_Usuario where a.id_SerieUsuario == idSerieUsuario select a).FirstOrDefault();
            au.id_AvanceSerie = Avance + 1;
            au.Nota           = Nota;
            cdc.SubmitChanges();
            GrillaSerieUsuario.EditIndex = -1;
            Mensaje("Completado con exito", "Se han actualizado los datos", "success");
            this.llenarGrilla();
            this.LlenaDetalles();
        }
        catch
        {
            Mensaje("Sin jugueteos", "Debes ingresar datos validos", "error");
        }
    }