Ejemplo n.º 1
0
        private void updatelikesandviews()
        {
            var connection = DBFunctions.OpenConnection();

            if (connection == null)
            {
                return;
            }

            string sqlText = string.Format("select views,likecount,dislikecount from videos where videolink='{0}';", axShockwaveFlash1.Movie);
            var    reader  = DBFunctions.ExecuteSqlSelect(sqlText, connection);

            if (reader == null)
            {
                return;
            }

            while (reader.Read())
            {
                label8.Text = reader[0].ToString();
                label1.Text = reader[1].ToString();
                label2.Text = reader[2].ToString();
            }
            reader.Close();
            reader.Dispose();
            countlikes();
        }
Ejemplo n.º 2
0
        private void editvideo_Load(object sender, EventArgs e)
        {
            var connectionn = DBFunctions.OpenConnection();

            if (connectionn == null)
            {
                return;
            }

            string sqlText2 = string.Format("SELECT name,videolink,description FROM videos WHERE videolink = '{0}'", link);
            var    reader   = DBFunctions.ExecuteSqlSelect(sqlText2, connectionn);

            if (reader == null)
            {
                return;
            }
            while (reader.Read())
            {
                textBox1.Text = reader[0].ToString();
                textBox2.Text = reader[1].ToString();
                textBox3.Text = reader[2].ToString();
            }
            reader.Close();
            reader.Dispose();
        }
Ejemplo n.º 3
0
        private void channel_Load(object sender, EventArgs e)
        {
            label4.Width = label3.Width;


            var connectionn = DBFunctions.OpenConnection();

            if (connectionn == null)
            {
                return;
            }

            string sqltxt = string.Format("SELECT username from logins where id='{0}';", Convert.ToInt64(id));
            var    reader = DBFunctions.ExecuteSqlSelect(sqltxt, connectionn);

            if (reader == null)
            {
                return;
            }
            while (reader.Read())
            {
                label3.Text = reader[0].ToString();
            }
            reader.Close();
            reader.Dispose();

            mn.loadchannel(Convert.ToInt64(id));
        }
Ejemplo n.º 4
0
        private void watchvideo_Load_1(object sender, EventArgs e)
        {
            axShockwaveFlash1.Movie = link;

            timer1.Enabled = true;

            var connection = DBFunctions.OpenConnection();

            if (connection == null)
            {
                return;
            }

            string sqlText = string.Format("select * from videos where videolink='{0}';", axShockwaveFlash1.Movie);
            var    reader  = DBFunctions.ExecuteSqlSelect(sqlText, connection);

            if (reader == null)
            {
                return;
            }

            while (reader.Read())
            {
                label9.Text   = reader[1].ToString();
                label13.Text  = reader[2].ToString();
                label8.Text   = reader[4].ToString();
                label1.Text   = reader[5].ToString();
                label2.Text   = reader[6].ToString();
                label3.Text   = reader[8].ToString();
                textBox3.Text = reader[7].ToString();
                videoID       = (ulong)reader[0];
            }
            reader.Close();
            reader.Dispose();
            string sqltxt  = string.Format("SELECT username,subscribers from logins where id='{0}';", Convert.ToInt64(label9.Text));
            var    reader2 = DBFunctions.ExecuteSqlSelect(sqltxt, connection);

            if (reader2 == null)
            {
                return;
            }
            while (reader2.Read())
            {
                label9.Text  = reader2[0].ToString();
                label11.Text = reader2[1].ToString();
            }
            reader2.Close();
            reader2.Dispose();
            connection.Close();
            connection.Dispose();
            coutviews();
            if (active == true)
            {
                updatelikesandviews();
                loadlikeordislike();
            }
        }
Ejemplo n.º 5
0
        private void filllusername(long labelid, LinkLabel labelname)
        {
            var connectionn = DBFunctions.OpenConnection();

            if (connectionn == null)
            {
                return;
            }

            string sqltxt  = string.Format("SELECT username from logins where id='{0}';", Convert.ToInt64(labelid));
            var    reader2 = DBFunctions.ExecuteSqlSelect(sqltxt, connectionn);

            if (reader2 == null)
            {
                return;
            }
            while (reader2.Read())
            {
                labelname.Text = reader2[0].ToString();
            }
            reader2.Close();
            reader2.Dispose();
        }
Ejemplo n.º 6
0
        private void label10_Click(object sender, EventArgs e)
        {
            string sqlText    = "select count(id) from logins where UserName='******';";
            var    connection = DBFunctions.OpenConnection();

            if (connection == null)
            {
                return;
            }
            if ((long)DBFunctions.ExecuteSqlScalar(sqlText, connection) == 0)
            {
                MessageBox.Show("User does not exist");
                return;
            }

            sqlText = string.Format("select id,username,password,email,ChannelColour,subscribers from logins where Username='******' and Password='******';", textBox1.Text, PasswordClass.GetMD5hash(textBox2.Text));
            var reader = DBFunctions.ExecuteSqlSelect(sqlText, connection);

            if (reader == null)
            {
                return;
            }
            if (!reader.HasRows)
            {
                MessageBox.Show("Wrong password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            userData user = new userData();

            while (reader.Read())
            {
                user.user_ID          = (ulong)reader[0];
                user.user_username    = reader[1].ToString();
                user.user_password    = reader[2].ToString();
                user.user_email       = reader[3].ToString();
                user.user_colour      = reader[4].ToString();
                user.user_subscribers = reader[5].ToString();
            }
            reader.Close();
            reader.Dispose();
            connection.Close();
            connection.Dispose();
            //open main form
            prnt.loaduser(user);

            prnt.label2.Visible = false;

            prnt.panel2.Visible = true;

            prnt.label12.Text = user.user_username;
            Color red = Color.FromName(user.user_colour);

            prnt.label6.BackColor = red;
            prnt.active           = true;

            if (prnt.Controls.ContainsKey("hmw"))
            {
                prnt.Controls.RemoveByKey("hmw");
                prnt.loadtrends();
            }
            if (prnt.Controls.ContainsKey("wthvid"))
            {
                prnt.loadtrends();
            }

            this.Close();
        }
Ejemplo n.º 7
0
        public void loaduploads()
        {
            if (this.Controls.ContainsKey("hmw"))
            {
                this.Controls.RemoveByKey("hmw");
            }
            if (this.Controls.ContainsKey("wthvid"))
            {
                this.Controls.RemoveByKey("wthvid");
            }
            if (this.Controls.ContainsKey("channel"))
            {
                this.Controls.RemoveByKey("channel");
            }

            homeview hmv = new homeview(this);

            hmv.Name             = "hmw";
            hmv.label4.BackColor = Color.Red;

            var connectionn = DBFunctions.OpenConnection();

            if (connectionn == null)
            {
                return;
            }


            int x     = 10;
            int y     = 10;
            int arjau = 0;

            string sqlText1 = string.Format("SELECT videos.name,videos.views,videos.ChannelID,videos.videolink,videos.uploaddate,logins.username FROM videos JOIN logins ON videos.channelid = logins.ID ORDER BY uploaddate DESC limit 16;");
            var    readerr  = DBFunctions.ExecuteSqlSelect(sqlText1, connectionn);

            if (readerr == null)
            {
                return;
            }

            while (readerr.Read())
            {
                //string sqlText3 = string.Format("SELECT username from logins where ID = {0};", readerr[2] );
                //  string name = (string)DBFunctions.ExecuteSqlScalar(sqlText3, connectionn);

                vid vidd = new vid();
                vidd.label1.Text     = readerr[1].ToString();
                vidd.linkLabel1.Text = readerr[0].ToString() + " views";
                vidd.linkLabel2.Text = readerr[5].ToString();
                vidd.linkLabel1.Name = readerr[3].ToString();
                vidd.linkLabel2.Name = readerr[2].ToString();
                if (active == true && Convert.ToUInt64(readerr[2]) == user.user_ID)
                {
                    vidd.button1.Visible = true;
                    vidd.button1.Name    = readerr[2].ToString();
                }
                else
                {
                    vidd.button1.Visible = false;
                }

                vidd.button1.Click    += Button1_Click;
                vidd.linkLabel2.Click += LinkLabel2_Click;
                vidd.linkLabel1.Click += LinkLabel1_Click;

                string a = getYouTubeThumbnail(readerr[3].ToString());

                var request = WebRequest.Create(a);

                using (var response = request.GetResponse())
                    using (var stream = response.GetResponseStream())
                    {
                        vidd.pictureBox1.Image = Bitmap.FromStream(stream);
                    }

                vidd.Location = new Point(x, y);
                hmv.panel1.Controls.Add(vidd);
                arjau++;
                x += 220;

                if (arjau == 4)
                {
                    x     = 10;
                    y    += 200;
                    arjau = 0;
                }
            }
            hmv.Location = new Point(259, 124);
            this.Controls.Add(hmv);
            readerr.Close();
            readerr.Dispose();
            connectionn.Close();
            connectionn.Dispose();
        }
Ejemplo n.º 8
0
        public void loadchannel(long id)
        {
            var connectionn = DBFunctions.OpenConnection();

            if (connectionn == null)
            {
                return;
            }
            channel chl    = new channel();
            int     x      = 10;
            int     y      = 10;
            int     arjau  = 0;
            string  sqlTxt = string.Format("SELECT username from logins where id = {0}", id);
            var     read   = DBFunctions.ExecuteSqlSelect(sqlTxt, connectionn);

            if (read == null)
            {
                return;
            }
            while (read.Read())
            {
                username = read[0].ToString();
            }
            read.Close();
            read.Dispose();

            string sqlText1 = string.Format("SELECT videos.name,videos.views,videos.ChannelID,videos.videolink,videos.uploaddate FROM videos WHERE channelID = {0};", id);
            var    readerr  = DBFunctions.ExecuteSqlSelect(sqlText1, connectionn);

            if (readerr == null)
            {
                return;
            }

            while (readerr.Read())
            {
                //string sqlText3 = string.Format("SELECT username from logins where ID = {0};", readerr[2] );
                //  string name = (string)DBFunctions.ExecuteSqlScalar(sqlText3, connectionn);

                vid vidd = new vid();
                vidd.label1.Text     = readerr[1].ToString();
                vidd.linkLabel1.Text = readerr[0].ToString() + " views";
                vidd.linkLabel2.Text = username;
                vidd.linkLabel1.Name = readerr[3].ToString();
                vidd.linkLabel2.Name = readerr[2].ToString();
                if (active == true && Convert.ToUInt64(readerr[2]) == user.user_ID)
                {
                    vidd.button1.Visible = true;
                    vidd.button1.Name    = readerr[3].ToString();
                }
                else
                {
                    vidd.button1.Visible = false;
                }
                vidd.linkLabel1.Name   = readerr[3].ToString();
                vidd.linkLabel1.Click += LinkLabel1_Click;

                string a = getYouTubeThumbnail(readerr[3].ToString());

                var request = WebRequest.Create(a);

                using (var response = request.GetResponse())
                    using (var stream = response.GetResponseStream())
                    {
                        vidd.pictureBox1.Image = Bitmap.FromStream(stream);
                    }

                vidd.Location = new Point(x, y);

                chl.panel1.Controls.Add(vidd);
                arjau++;
                x += 220;

                if (arjau == 4)
                {
                    x     = 10;
                    y    += 200;
                    arjau = 0;
                }
            }

            readerr.Close();
            readerr.Dispose();
            connectionn.Close();
            connectionn.Dispose();
        }
Ejemplo n.º 9
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            if (this.Controls.ContainsKey("hmw"))
            {
                this.Controls.RemoveByKey("hmw");
            }
            if (this.Controls.ContainsKey("wthvid"))
            {
                this.Controls.RemoveByKey("wthvid");
            }
            if (this.Controls.ContainsKey("channel"))
            {
                this.Controls.RemoveByKey("channel");
            }

            Subscriptions sbs = new Subscriptions();

            sbs.Name = "hmw";

            var connectionn = DBFunctions.OpenConnection();

            if (connectionn == null)
            {
                return;
            }

            int y = 10;

            string sqlText = string.Format("SELECT videos.name,videos.views,videos.ChannelID,videos.videolink,videos.uploaddate,logins.username, videos.description FROM videos JOIN logins ON videos.channelid = logins.ID WHERE videos.name LIKE '%{0}%' ORDER BY uploaddate DESC limit 12 ;", textBox1.Text);
            var    readerr = DBFunctions.ExecuteSqlSelect(sqlText, connectionn);

            if (readerr == null)
            {
                return;
            }

            while (readerr.Read())
            {
                //string sqlText3 = string.Format("SELECT username from logins where ID = {0};", readerr[2] );
                //  string name = (string)DBFunctions.ExecuteSqlScalar(sqlText3, connectionn);

                vid_his_sub vidsub = new vid_his_sub();

                vidsub.label1.Text     = readerr[1].ToString() + " views";
                vidsub.linkLabel1.Text = readerr[0].ToString();
                vidsub.linkLabel3.Hide();
                vidsub.linkLabel2.Text = readerr[5].ToString();
                vidsub.linkLabel1.Name = readerr[3].ToString();
                vidsub.textBox3.Text   = readerr[6].ToString();

                vidsub.linkLabel2.Name   = readerr[2].ToString();
                vidsub.linkLabel1.Click += LinkLabel1_Click;
                vidsub.linkLabel2.Click += LinkLabel2_Click;

                string a = getYouTubeThumbnail(readerr[3].ToString());

                var request = WebRequest.Create(a);

                using (var response = request.GetResponse())
                    using (var stream = response.GetResponseStream())
                    {
                        vidsub.pictureBox1.Image = Bitmap.FromStream(stream);
                    }

                vidsub.Location   = new Point(0, y);
                sbs.panel1.Height = this.Height - groupBox1.Height - 80;
                sbs.panel1.Controls.Add(vidsub);

                y += 200;
            }
            sbs.Location = new Point(259, 124);
            this.Controls.Add(sbs);
            readerr.Close();
            readerr.Dispose();
        }
Ejemplo n.º 10
0
        private void historyBtn_Click(object sender, EventArgs e)
        {
            MessageBox.Show("COMING SOON!!!!");
            return;

            if (this.Controls.ContainsKey("hmw"))
            {
                this.Controls.RemoveByKey("hmw");
            }
            if (this.Controls.ContainsKey("wthvid"))
            {
                this.Controls.RemoveByKey("wthvid");
            }
            if (this.Controls.ContainsKey("channel"))
            {
                this.Controls.RemoveByKey("channel");
            }

            Subscriptions sbs = new Subscriptions();

            sbs.Name = "hmw";

            var connectionn = DBFunctions.OpenConnection();

            if (connectionn == null)
            {
                return;
            }

            int y = 10;

            string sqlText1 = string.Format("SELECT videos.name,videos.views,videos.ChannelID,videos.videolink,videos.uploaddate,historyvideo.videoid FROM video JOIN historyvideo ON historyvideo.userid = {0};", user.user_ID);
            var    readerr  = DBFunctions.ExecuteSqlSelect(sqlText1, connectionn);

            if (readerr == null)
            {
                return;
            }

            while (readerr.Read())
            {
                //string sqlText3 = string.Format("SELECT username from logins where ID = {0};", readerr[2] );
                //  string name = (string)DBFunctions.ExecuteSqlScalar(sqlText3, connectionn);

                vid_his_sub vidsub = new vid_his_sub();

                vidsub.label1.Text     = readerr[1].ToString();
                vidsub.linkLabel1.Text = readerr[0].ToString();
                vidsub.linkLabel3.Text = readerr[5].ToString();
                vidsub.linkLabel2.Text = readerr[5].ToString();
                vidsub.linkLabel1.Name = readerr[3].ToString();
                vidsub.textBox3.Text   = readerr[6].ToString();

                //vidsub.linkLabel1.Click += LinkLabel1_Click;
                vidsub.linkLabel1.Click += LinkLabel1_Click;

                string a = getYouTubeThumbnail(readerr[3].ToString());

                var request = WebRequest.Create(a);

                using (var response = request.GetResponse())
                    using (var stream = response.GetResponseStream())
                    {
                        vidsub.pictureBox1.Image = Bitmap.FromStream(stream);
                    }

                vidsub.Location = new Point(0, y);
                sbs.panel1.Controls.Add(vidsub);

                y += 200;
            }
            sbs.Location = new Point(259, 124);
            this.Controls.Add(sbs);
            readerr.Close();
            readerr.Dispose();
        }