Beispiel #1
0
        //Xóa Phòng
        public static void XoaRoom(string host_id)
        {
            MySqlConnection conn = DBUtils.GetDBConnection();
            MySqlCommand    MyCommand;

            MyCommand = conn.CreateCommand();
            conn.Open();
            try
            {
                MyCommand.CommandText = "DELETE FROM room WHERE host_id = @host_id;";
                MyCommand.Parameters.AddWithValue("@host_id", host_id);
                MyCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }
        }
Beispiel #2
0
        public static void ChangeStatusFriendList(string user_id)
        {
            MySqlConnection conn = DBUtils.GetDBConnection();
            MySqlCommand    MyCommand;

            MyCommand = conn.CreateCommand();
            conn.Open();
            try
            {
                MyCommand.CommandText = $"UPDATE friendlist SET status = @status WHERE name = '" + user_id + "';";
                MyCommand.Parameters.AddWithValue("@status", SqlDbType.Int).Value = 0;
                MyCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }
        }
Beispiel #3
0
        //Update join_id
        public static void UpdateRoom(string host_id, string join_id, string room_no)
        {
            MySqlConnection conn = DBUtils.GetDBConnection();
            MySqlCommand    MyCommand;

            MyCommand = conn.CreateCommand();
            conn.Open();
            try
            {
                MyCommand.CommandText = "UPDATE room SET host_id = @host_id, join_id = @join_id WHERE room_no = '" + room_no + "';";
                MyCommand.Parameters.AddWithValue("@host_id", host_id);
                MyCommand.Parameters.AddWithValue("@join_id", join_id);
                MyCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }
        }
Beispiel #4
0
        // Xoa Ban
        public static void XoaBan(string username, string name)
        {
            MySqlConnection conn = DBUtils.GetDBConnection();
            MySqlCommand    MyCommand;

            MyCommand = conn.CreateCommand();
            conn.Open();
            try
            {
                MyCommand.CommandText = "DELETE FROM friendlist WHERE name = @name and username = @username;";
                MyCommand.Parameters.AddWithValue("@name", name);
                MyCommand.Parameters.AddWithValue("@username", username);
                MyCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }
        }
Beispiel #5
0
        public static void ResetFriendList()
        {
            int             status = 0;
            MySqlConnection conn   = DBUtils.GetDBConnection();
            MySqlCommand    MyCommand;

            MyCommand = conn.CreateCommand();
            conn.Open();
            try
            {
                MyCommand.CommandText = "UPDATE friendlist SET status = @status;";
                MyCommand.Parameters.AddWithValue("@status", status);
                MyCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                conn.Dispose();
                conn.Close();
            }
        }