Beispiel #1
0
 protected void Like_PL(object sender, EventArgs e)
 {
     ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
     localhost.Links item = new localhost.Links();
     item.AddLike(Request.QueryString["Username"], int.Parse(Current.Text));
     Label3.Text   = "you have liked this playlist!";
     PL_likes.Text = item.GetLikes(Request.QueryString["Username"], int.Parse(Current.Text)).ToString();
 }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Label3.Text = "";
            query       = Request.QueryString["Username"];
            if (Request.QueryString["Username"] == null)
            {
                Response.Redirect("Errorpage.aspx");
            }
            if (Request.QueryString["playlist"] == null)
            {
                ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
                localhost.Links item = new localhost.Links();
                Current.Text  = "1";
                PL_name.Text  = item.GetPlaylistName(query, int.Parse(Current.Text));
                PL_likes.Text = item.GetLikes(query, int.Parse(Current.Text)).ToString();
            }
            else if (int.Parse(Request.QueryString["playlist"].ToString()) > 0 && int.Parse(Request.QueryString["playlist"].ToString()) < 100)
            {
                Current.Text = Request.QueryString["playlist"].ToString();
                ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
                localhost.Links item = new localhost.Links();
                PL_name.Text  = item.GetPlaylistName(query, int.Parse(Current.Text));
                PL_likes.Text = item.GetLikes(query, int.Parse(Current.Text)).ToString();
            }
            else
            {
                Response.Redirect("Errorpage.aspx");
            }
            if (Session["user"] != null)
            {
                Copy_playlist.Visible = true;
                if (Session["user"].ToString() == Request.QueryString["Username"].ToString() || Session["Admin"] == "true")
                {
                    Copy_playlist.Visible   = false;
                    Like.Visible            = false;
                    Add_link.Visible        = true;
                    User_update.Visible     = true;
                    YoutubeLink.Visible     = true;
                    Link_Edit.Visible       = true;
                    Edit_Delete.Visible     = true;
                    Add_playlist.Visible    = true;
                    Delete_playlist.Visible = true;
                    Edit_PL.Visible         = true;

                    if (Session["Admin"] == "true")
                    {
                        Copy_playlist.Visible = true;
                        Like.Visible          = true;
                        Add_playlist.Visible  = false;
                        if (Session["user"].ToString() == Request.QueryString["Username"].ToString())
                        {
                            Copy_playlist.Visible = false;
                            Like.Visible          = false;
                            Add_playlist.Visible  = true;
                        }
                    }
                }
            }
            current1       = Current.Text;
            User_Name.Text = Request.QueryString["Username"];
            if (!Page.IsPostBack)
            {
                OleDbConnection con1 = new OleDbConnection();
                con1.ConnectionString = @"Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + Request.PhysicalApplicationPath + "\\Yoav_DB.accdb";
                con1.Open();
                string       sqlstring = @"SELECT FirstName, LastName FROM users_tbl WHERE Username = @usr";
                OleDbCommand conSer    = new OleDbCommand(sqlstring, con1);
                conSer.Parameters.AddWithValue("@usr", Request.QueryString["Username"]);
                OleDbDataReader Drdr = conSer.ExecuteReader();
                while (Drdr.Read())
                {
                    if (Drdr.HasRows)
                    {
                        First_Name.Text = Drdr.GetString(0);
                        Last_Name.Text  = Drdr.GetString(1);
                    }
                }
                con1.Close();

                Load_Images();
                Load_Playlists();
            }
            Load_Links();
        }