jordanmcgowan / guqu

Guqu project for CS506 [Spring '16]
4 stars 1 forks source link

Delete button in 'Manage Account' #24

Open jordanmcgowan opened 8 years ago

jordanmcgowan commented 8 years ago

When clicking delete, the account is removed from the table, but not actually removed. They repopulate upon opening the window again

jordanmcgowan commented 8 years ago

should use @jordanmcgowan code sent to @bbtrapp

jordanmcgowan commented 8 years ago
    //Delete statement
    public void DeleteUserCloud(User user, String cloudType)

    {
        int cloudId = -1;
        if (cloudType == "Google Drive")
        {
            cloudId = 2;
        }
        else if (cloudType == "One Drive")
        {
            cloudId = 1;
        }
        else
        {
            Console.WriteLine("No valid Cloud Type");
        }
        string query = "DELETE FROM user_clouds WHERE user_id='" + user.User_id + "' and cloud_id='" + cloudId + "';";

        if (this.OpenConnection() == true)
        {
            MySqlCommand cmd = new MySqlCommand(query, connection);
            cmd.ExecuteNonQuery();
            this.CloseConnection();
        }
    }