Beispiel #1
0
        private void senddatatohistory()
        {
            var connectionn = DBFunctions.OpenConnection();

            if (connectionn == null)
            {
                return;
            }

            string sqlText    = string.Format("SELECT cout(id) FROM historyvideo WHERE videoid = {0};", videoID);
            var    connection = DBFunctions.OpenConnection();

            if (connection == null)
            {
                return;
            }
            if ((ulong)DBFunctions.ExecuteSqlScalar(sqlText, connection) == 0)
            {
                sqlText = string.Format("INSERT INTO historyvideo VALUES(null, {0}, {1});", user.user_ID, videoID);
                DBFunctions.ExecuteSqlNoReturn(sqlText, connection);
                connection.Close();
                connection.Dispose();
            }
            else
            {
                sqlText = string.Format("UPDATE historyvideo SET id=null WHERE videoid='{0}';", videoID);
                DBFunctions.ExecuteSqlNoReturn(sqlText, connection);
                connection.Close();
                connection.Dispose();
            }
        }
Beispiel #2
0
        private void label7_Click(object sender, EventArgs e)
        {
            if (active == false)
            {
                MessageBox.Show("You need to login first!");
                return;
            }
            if (label7.ForeColor == Color.WhiteSmoke)
            {
                string sqlText    = "SELECT DislikeCount from videos where videolink='" + axShockwaveFlash1.Movie + "';";
                var    connection = DBFunctions.OpenConnection();
                if (connection == null)
                {
                    return;
                }
                ulong dislikes = (ulong)DBFunctions.ExecuteSqlScalar(sqlText, connection);
                dislikes++;
                string sqlText2 = string.Format("UPDATE videos SET dislikecount='{0}' WHERE videolink='{1}';", dislikes, axShockwaveFlash1.Movie);

                DBFunctions.ExecuteSqlNoReturn(sqlText2, connection);
                connection.Close();
                connection.Dispose();
                label7.ForeColor = Color.Red;
                like.Enabled     = false;
                connection.Close();
                connection.Dispose();
                updatelikesandviews();
                addtodislikedvideos();
            }
            else if (label7.ForeColor == Color.Red)
            {
                string sqlText    = "select dislikecount from videos where videolink='" + axShockwaveFlash1.Movie + "';";
                var    connection = DBFunctions.OpenConnection();
                if (connection == null)
                {
                    return;
                }
                ulong dislikes = (ulong)DBFunctions.ExecuteSqlScalar(sqlText, connection);
                dislikes--;
                string sqlText2 = string.Format("UPDATE videos SET dislikecount='{0}' WHERE videolink='{1}';", dislikes, axShockwaveFlash1.Movie);

                DBFunctions.ExecuteSqlNoReturn(sqlText2, connection);
                connection.Close();
                connection.Dispose();
                label7.ForeColor = Color.WhiteSmoke;
                like.Enabled     = true;
                connection.Close();
                connection.Dispose();
                updatelikesandviews();
                deletefromdislikedvideos();
            }
        }
Beispiel #3
0
        private void sendRegInfoToDatabase(ulong channelID, string name, string videolink, ulong views, ulong likes, ulong dislikes, string discription, DateTime uploadtime)
        {
            string sqlText = string.Format("INSERT INTO videos VALUES(null,{0},'{1}','{2}',{3},{4},{5},'{6}','{7}');", channelID, name, videolink, views, likes, dislikes, discription, uploadtime.ToString());

            var connection = DBFunctions.OpenConnection(); //get connection to server

            if (connection == null)
            {
                return;
            }
            DBFunctions.ExecuteSqlNoReturn(sqlText, connection);
            connection.Close();
            connection.Dispose();
        }
Beispiel #4
0
        private void deletefromdislikedvideos()
        {
            var connection = DBFunctions.OpenConnection();

            if (connection == null)
            {
                return;
            }
            string sqlText2 = string.Format("DELETE FROM dislikes WHERE videoID = {0} AND userID = {1};", videoID, user.user_ID);

            DBFunctions.ExecuteSqlNoReturn(sqlText2, connection);
            connection.Close();
            connection.Dispose();
        }
Beispiel #5
0
        private void addtodislikedvideos()
        {
            var connection = DBFunctions.OpenConnection();

            if (connection == null)
            {
                return;
            }
            string sqlText2 = string.Format("INSERT INTO dislikes VALUES(null, {0}, {1});", videoID, user.user_ID);

            DBFunctions.ExecuteSqlNoReturn(sqlText2, connection);
            connection.Close();
            connection.Dispose();
        }
Beispiel #6
0
        private void sendRegInfoToDatabase(string username, string password, string email, string color, int subs)
        {
            string sqlText = string.Format("INSERT INTO logins VALUES(null,'{0}','{1}','{2}','{3}',{4});", username, PasswordClass.GetMD5hash(textBox3.Text), email, color, subs);

            var connection = DBFunctions.OpenConnection(); //get connection to server

            if (connection == null)
            {
                return;
            }
            DBFunctions.ExecuteSqlNoReturn(sqlText, connection);
            connection.Close();
            connection.Dispose();
        }
Beispiel #7
0
        private void coutviews()
        {
            string sqlText    = "select views from videos where videolink='" + axShockwaveFlash1.Movie + "';";
            var    connection = DBFunctions.OpenConnection();

            if (connection == null)
            {
                return;
            }
            ulong views = (ulong)DBFunctions.ExecuteSqlScalar(sqlText, connection);

            views++;
            string sqlText2 = string.Format("UPDATE videos SET views='{0}' WHERE videolink='{1}';", views, axShockwaveFlash1.Movie);

            DBFunctions.ExecuteSqlNoReturn(sqlText2, connection);
            connection.Close();
            connection.Dispose();
        }
Beispiel #8
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == textBox2.Text)
            {
                string sqlText    = string.Format("select password from logins where email='{0}';", emailas);
                var    connection = DBFunctions.OpenConnection();
                if (connection == null)
                {
                    return;
                }
                OldPassword = (string)DBFunctions.ExecuteSqlScalar(sqlText, connection);

                sqlText = string.Format("UPDATE logins SET Password='******' WHERE Password='******';", PasswordClass.GetMD5hash(textBox2.Text), OldPassword);

                DBFunctions.ExecuteSqlNoReturn(sqlText, connection);
                connection.Close();
                connection.Dispose();
            }
        }
Beispiel #9
0
        private void label10_Click(object sender, EventArgs e)
        {
            try
            {
                var connection = DBFunctions.OpenConnection();
                if (connection == null)
                {
                    return;
                }

                string sqlText = string.Format("UPDATE videos SET name='{0}',videolink = '{1}',description = '{2}' WHERE videolink='{3}';", textBox1.Text, textBox2.Text, textBox3.Text, link);

                DBFunctions.ExecuteSqlNoReturn(sqlText, connection);
                connection.Close();
                connection.Dispose();
                MessageBox.Show("Video was succsesfully updated!");
                this.Hide();
            }
            catch
            {
                MessageBox.Show("Failed while updating video!");
            }
        }