Example #1
0
        private void PlaylistSelected(object sender, RoutedEventArgs e)
        {
            PlaylistWindow win = new PlaylistWindow(user, userid);

            win.Show();
            this.Close();
        }
Example #2
0
        private void RemovePlaylist(object sender, RoutedEventArgs e)
        {
            string value = PlaylistBox.SelectedItem as string;
            int    id    = 0;

            for (int i = 0; i < playlist_list.Count; i++)
            {
                if (playlist_list[i].nome == value)
                {
                    id = playlist_list[i].id;
                    break;
                }
            }

            if (!verifySGBDConnection())
            {
                return;
            }

            SqlCommand cmd = new SqlCommand("SampleKeeper.remove_playlist", cn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@playlist_ID", id);
            cmd.Connection = cn;
            if (PlaylistBox.SelectedItem == null)
            {
                hidden.Content = "Please select a playlist!";
            }
            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to update contact in database. \n ERROR MESSAGE: \n" + ex.Message);
            }
            finally
            {
                cn.Close();
            }
            PlaylistWindow pw = new PlaylistWindow(user, userid);

            pw.Show();
            this.Close();
        }