protected void Modify_Click(object sender, EventArgs e)
    {
        String myPath = path.Text;
        String val    = tipo.Text;

        if (file.FileName != "")
        {
            if (val == "2")//sonidos
            {
                System.IO.File.Delete(System.AppDomain.CurrentDomain.BaseDirectory + "Files/sounds/" + path.Text);
                myPath = "Files/sounds/" + file.FileName;
                file.SaveAs(System.AppDomain.CurrentDomain.BaseDirectory + myPath);
            }
            else if (val == "3")
            {
                System.IO.File.Delete(System.AppDomain.CurrentDomain.BaseDirectory + "Files/images/" + path.Text);
                myPath = "Files/images/" + file.FileName;
                file.SaveAs(System.AppDomain.CurrentDomain.BaseDirectory + myPath);
            }
            else if (val == "6")
            {
                System.IO.File.Delete(System.AppDomain.CurrentDomain.BaseDirectory + "Files/videos/" + path.Text);
                myPath = "Files/videos/" + file.FileName;
                file.SaveAs(System.AppDomain.CurrentDomain.BaseDirectory + myPath);
            }
            cAnclas obj = new cAnclas((int)Session["idUser"], Convert.ToInt32(id.Text), title.Text, desc.Text, myPath, Convert.ToInt32(val), 2);
            obj.GuardaAncla();
        }
        else
        {
            cAnclas obj = new cAnclas();
            obj.EditarAncla((int)Session["idUser"], Convert.ToInt32(id.Text), title.Text, desc.Text);
        }
    }
Exemple #2
0
    protected void Register_Click(object sender, EventArgs e)
    {
        String myPath = "";
        String val    = tipo.SelectedValue;

        if (file.HasFile)
        {
            if (val == "2")//sonidos
            {
                myPath = "Files/sounds/" + file.FileName;
                file.SaveAs(System.AppDomain.CurrentDomain.BaseDirectory + myPath);
            }
            else if (val == "3")
            {
                myPath = "Files/images/" + file.PostedFile.FileName;
                file.SaveAs(System.AppDomain.CurrentDomain.BaseDirectory + myPath);
            }
            else if (val == "6")
            {
                myPath = "Files/videos/" + file.FileName;
                file.SaveAs(System.AppDomain.CurrentDomain.BaseDirectory + myPath);
            }
        }
        cAnclas obj    = new cAnclas((int)Session["idUser"], 0, title.Text, desc.Text, myPath, Convert.ToInt32(tipo.SelectedValue), 0);
        string  result = obj.GuardaAncla();

        title.Text            = "";
        desc.Text             = "";
        tipo.SelectedIndex    = -1;
        file.Visible          = false;
        lblFile.Visible       = false;
        btnRegistrarF.Visible = false;
        btnRegistrar.Visible  = true;
        if (result == "Ancla Registrada Correctamente")
        {
            resultGA.Text = "msg-1";
        }
        else if (result == "Ancla Registrada Anteriormente")
        {
            resultGA.Text = "msg-2";
        }
        else if (result == "Excede el número de anclas permitidas")
        {
            resultGA.Text = "msg-3";
        }
    }
Exemple #3
0
    protected void Start_Click_Audio(object sender, EventArgs e)
    {
        estimularAnc = 1;
        MultiView1.ActiveViewIndex = 1;
        cAnclas   obj       = new cAnclas((int)Session["idUser"], 0);
        DataTable tblAnclas = obj.TraeInfoAnclas();

        if (tblAnclas.Rows.Count > 0)
        {
            int anclaId = Convert.ToInt32(tblAnclas.Rows[0]["idAncla"].ToString());
            if (anclaId == 2)
            {
            }
        }
        gvAnclas.GridLines  = GridLines.None;
        gvAnclas.DataSource = tblAnclas;
        gvAnclas.DataBind();
    }
    protected void gvAnclas_SelectedIndexChanged(object sender, EventArgs e)
    {
        int index = gvAnclas.SelectedIndex;

        try
        {
            string  idAnclaN = ((LinkButton)gvAnclas.Rows[index].Cells[0].Controls[0]).Text;
            cAnclas obj      = new cAnclas();
            obj.DeleteAncla((int)Session["idUser"], Convert.ToInt32(idAnclaN));
            Response.Redirect(Request.ApplicationPath + "AdminAnclas/Eliminar.aspx");
            //string titleN = ((LinkButton)gvAnclas.Rows[index].Cells[1].Controls[0]).Text;
            //string descN = ((LinkButton)gvAnclas.Rows[index].Cells[2].Controls[0]).Text;
            //string idTipoN = ((LinkButton)gvAnclas.Rows[index].Cells[4].Controls[0]).Text;
            //string pathN = ((LinkButton)gvAnclas.Rows[index].Cells[5].Controls[0]).Text;
            //string[] tokens = pathN.Split('/');
            //cAnclas obj = new cAnclas((int)Session["idUser"], Convert.ToInt32(idAnclaN), titleN, descN, pathN, Convert.ToInt32(idTipoN), 1);
            //obj.GuardaAncla();
        }
        catch (Exception ex)
        {
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["idUser"] == null)
     {
         Response.Redirect(Request.ApplicationPath + "Default.aspx");
     }
     else
     {
         cAnclas   obj       = new cAnclas((int)Session["idUser"], 0);
         DataTable tblAnclas = obj.TraeInfoAnclas();
         if (tblAnclas.Rows.Count > 0)
         {
             int anclaId = Convert.ToInt32(tblAnclas.Rows[0]["idAncla"].ToString());
             if (anclaId == 2)
             {
             }
         }
         gvAnclas.GridLines  = GridLines.None;
         gvAnclas.DataSource = tblAnclas;
         gvAnclas.DataBind();
     }
 }
Exemple #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        cAnclas   obj       = new cAnclas();
        DataTable tblAnclas = obj.TraeTipo();

        if (tblAnclas.Rows.Count > 0)
        {
            if (tipo.Items.Count == 0)
            {
                for (int i = 0; i < tblAnclas.Rows.Count; i++)
                {
                    tipo.Items.Add(new ListItem(tblAnclas.Rows[i]["tipoAncla"].ToString(), tblAnclas.Rows[i]["idTipoAncla"].ToString()));
                }
            }
        }
        else
        {
            String script = "$.confirm({title: 'Genial!',    content: 'Tus datos han sido modificados',theme: 'material',buttons: {ok:{ btnClass: 'btn btn-info',action: function(){ }   }}}); ";
            ScriptManager.RegisterStartupScript(this, GetType(),
                                                "ServerControlScript", script, true);
        }
    }
Exemple #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["idUser"] == null)
        {
            Response.Redirect(Request.ApplicationPath + "Default.aspx");
        }
        else
        {
            cAnclas   obj       = new cAnclas((int)Session["idUser"], 0);
            DataTable tblAnclas = obj.TraeInfoAnclas();
            if (tblAnclas.Rows.Count > 0)
            {
                int anclaId = Convert.ToInt32(tblAnclas.Rows[0]["idAncla"].ToString());

                for (int i = 0; i < tblAnclas.Rows.Count; i++)
                {
                    String idTipo = tblAnclas.Rows[i]["idTipoAncla"].ToString();
                    if (idTipo == "1")
                    {
                        tblAnclas.Rows[i]["rutaFile"] = "<audio controls  src='../" + tblAnclas.Rows[i]["rutaFile"].ToString() + "' type='audio/mp3'></audio>";
                    }
                    else if (idTipo == "3")
                    {
                        tblAnclas.Rows[i]["rutaFile"] = "<img src='../" + tblAnclas.Rows[i]["rutaFile"].ToString() + "' class='img-thumbnail' style='width:300px;'>";
                        Console.Write(tblAnclas.Rows[i]["rutaFile"].ToString());
                    }
                    else if (idTipo == "2")
                    {
                        tblAnclas.Rows[i]["rutaFile"] = "<video width=300 controls><source src='../" + tblAnclas.Rows[i]["rutaFile"].ToString() + "' type='video/mp4;codecs='avc1.42E01E, mp4a.40.2''></video>";
                    }
                }
            }
            gvAnclas.GridLines  = GridLines.None;
            gvAnclas.DataSource = tblAnclas;
            gvAnclas.DataBind();
        }
    }
Exemple #8
0
    protected void Register_Click(object sender, EventArgs e)
    {
        String myPath = "";
        String val    = tipo.SelectedValue;

        if (val == "2")//sonidos
        {
            myPath = "Files/sounds/" + file.FileName;
            file.SaveAs(System.AppDomain.CurrentDomain.BaseDirectory + myPath);
        }
        else if (val == "3")
        {
            myPath = "Files/images/" + file.FileName;
            file.SaveAs(System.AppDomain.CurrentDomain.BaseDirectory + myPath);
        }
        else if (val == "6")
        {
            myPath = "Files/videos/" + file.FileName;
            file.SaveAs(System.AppDomain.CurrentDomain.BaseDirectory + myPath);
        }
        cAnclas obj = new cAnclas((int)Session["idUser"], 0, title.Text, desc.Text, myPath, Convert.ToInt32(tipo.SelectedValue), 0);

        obj.GuardaAncla();
    }