//----------------------------------------------------------------------------------------------------------



        //----------------------------------------------------------------------------------------------------------
        //authentitication implemented inside (ajax call)
        public string deletePlaylistSong()
        {
            //--------------------------------------------------------------------------------------------
            if (User.Identity.IsAuthenticated == false)
            {
                return("not authorized");
            }
            //--------------------------------------------------------------------------------------------



            // 1.genral declarations
            //--------------------------------------------------------------------------------------------
            hypster_tv_DAL.memberManagement   memberManager = new hypster_tv_DAL.memberManagement();
            hypster_tv_DAL.playlistManagement songManager   = new hypster_tv_DAL.playlistManagement();
            //--------------------------------------------------------------------------------------------



            //--------------------------------------------------------------------------------------------
            int SONG_ID = 0;

            if (Request.QueryString["SONG_ID"] != null && Int32.TryParse(Request.QueryString["SONG_ID"], out SONG_ID) == true)
            {
                songManager.DeleteSong(memberManager.getMemberByUserName(User.Identity.Name).id, SONG_ID);
                return("true");
            }
            //--------------------------------------------------------------------------------------------



            return("false");
        }
示例#2
0
        public string DeleteDealLink(int id)
        {
            int song_id = id;

            hypster_tv_DAL.memberManagement member_manager = new hypster_tv_DAL.memberManagement();
            hypster_tv_DAL.Member           curr_member    = new hypster_tv_DAL.Member();
            string user_name = "";

            if (Request.QueryString["user_name"] != null)
            {
                user_name   = Request.QueryString["user_name"].ToString();
                curr_member = member_manager.getMemberByUserName(user_name);
            }
            else
            {
                return("wrong/missing user_name");
            }
            hypster_tv_DAL.playlistManagement playlistManager = new hypster_tv_DAL.playlistManagement();
            playlistManager.DeleteSong(curr_member.id, song_id);
            return("ok");
        }
示例#3
0
        public ActionResult playlist()
        {
            hypster.ViewModels.createPlaylist_ViewModel model = new ViewModels.createPlaylist_ViewModel();


            // 1.general declarations
            //-----------------------------------------------------------------------------------------------------
            hypster_tv_DAL.memberManagement   memberManager   = new hypster_tv_DAL.memberManagement();
            hypster_tv_DAL.playlistManagement playlistManager = new hypster_tv_DAL.playlistManagement();
            hypster_tv_DAL.memberManagement   userManager     = new hypster_tv_DAL.memberManagement();
            hypster_tv_DAL.songsManagement    songsManager    = new hypster_tv_DAL.songsManagement();


            model.curr_user = memberManager.getMemberByUserName(User.Identity.Name);
            //-----------------------------------------------------------------------------------------------------



            // 2.proccess user actions if any
            //-----------------------------------------------------------------------------------------------------
            // process user actions
            if (Request.QueryString["ACT"] != null)
            {
                switch (Request.QueryString["ACT"].ToString())
                {
                //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                case "delete_playlist":
                    int d_playlist_id = 0;
                    if (Int32.TryParse(Request.QueryString["playlist_id"], out d_playlist_id) == false)
                    {
                        d_playlist_id = 0;
                    }

                    if (d_playlist_id != 0)
                    {
                        playlistManager.Delete_Playlist(model.curr_user.id, d_playlist_id);
                        return(RedirectPermanent("/create/playlist"));
                    }
                    break;
                //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



                //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                case "delete_song":
                    int d_song_id = 0;
                    if (Int32.TryParse(Request.QueryString["song_id"], out d_song_id) == false)
                    {
                        d_song_id = 0;
                    }


                    string pl_id = "";
                    if (Request.QueryString["playlist_id"] != null)
                    {
                        pl_id = Request.QueryString["playlist_id"].ToString();
                    }


                    if (d_song_id != 0)
                    {
                        playlistManager.DeleteSong(model.curr_user.id, d_song_id);
                        return(RedirectPermanent("/create/playlist?playlist_id=" + pl_id));
                    }
                    break;
                //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



                //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                case "delete_song_plr":
                    int d_song_id1 = 0;
                    if (Int32.TryParse(Request.QueryString["song_id"], out d_song_id1) == false)
                    {
                        d_song_id1 = 0;
                    }

                    if (d_song_id1 != 0)
                    {
                        playlistManager.DeleteSong(model.curr_user.id, d_song_id1);

                        if (Request.QueryString["ret_url"] == null)
                        {
                            return(RedirectPermanent("/create/playlist"));
                        }
                        else
                        {
                            return(RedirectPermanent("/create/playlist"));
                        }
                    }
                    break;
                //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


                default:
                    break;
                }
            }
            //-----------------------------------------------------------------------------------------------------



            // 3.prepare output model
            //-----------------------------------------------------------------------------------------------------
            //hypster.ViewModels.AccountPlaylistsViewModel model = new ViewModels.AccountPlaylistsViewModel();
            //model.curr_user = member_user;
            model.userPlaylists_list = playlistManager.GetUserPlaylists(model.curr_user.id);
            //-----------------------------------------------------------------------------------------------------



            // 4. get current requested playlist id
            // if no playlist selected display default
            //-----------------------------------------------------------------------------------------------------
            int playlist_id = 0;

            if (Request.QueryString["playlist_id"] != null)
            {
                if (Int32.TryParse(Request.QueryString["playlist_id"], out playlist_id) == false)
                {
                    playlist_id = 0;
                }
            }
            else
            {
                playlist_id = model.curr_user.active_playlist;
            }
            //-----------------------------------------------------------------------------------------------------



            // 5.get selected playlist details
            //-----------------------------------------------------------------------------------------------------
            foreach (var item in model.userPlaylists_list)
            {
                if (item.id == playlist_id)
                {
                    ViewBag.ActivePlaylistName = item.name;
                    ViewBag.ActivePlaylistID   = item.id;
                }
            }
            //-----------------------------------------------------------------------------------------------------



            // 6.get songs for selected playlist
            //-----------------------------------------------------------------------------------------------------
            if (playlist_id != 0)
            {
                model.userActivePlaylist_Songs_list = playlistManager.GetSongsForPlayList(model.curr_user.id, playlist_id);
            }
            else
            {
                model.userActivePlaylist_Songs_list = playlistManager.GetSongsForPlayList(model.curr_user.id, model.curr_user.active_playlist);
            }
            //-----------------------------------------------------------------------------------------------------



            return(View(model));
        }
示例#4
0
        public ActionResult delelePlaylistSong()
        {
            hypster_admin.Areas.Editors.ViewModels.PlaylistViewModel model = new hypster_admin.Areas.Editors.ViewModels.PlaylistViewModel();
            hypster_tv_DAL.memberManagement   memberManager   = new hypster_tv_DAL.memberManagement();
            hypster_tv_DAL.playlistManagement playlistManager = new hypster_tv_DAL.playlistManagement();
            hypster_tv_DAL.memberManagement   userManager     = new hypster_tv_DAL.memberManagement();
            hypster_tv_DAL.songsManagement    songsManager    = new hypster_tv_DAL.songsManagement();
            model.member = memberManager.getMemberByUserName(User.Identity.Name);

            if (Request.QueryString["ACT"] != null)
            {
                switch (Request.QueryString["ACT"].ToString())
                {
                case "delete_playlist":
                    int d_playlist_id = 0;
                    if (Int32.TryParse(Request.QueryString["playlist_id"], out d_playlist_id) == false)
                    {
                        d_playlist_id = 0;
                    }
                    if (d_playlist_id != 0)
                    {
                        playlistManager.Delete_Playlist(model.member.id, d_playlist_id);
                        //check if this playlist is default
                        if (model.member.active_playlist == d_playlist_id)
                        {
                            memberManager.SetUserDefaultPlaylist(User.Identity.Name, model.member.id, 0);
                        }
                        return(RedirectPermanent("/Editors/managePlaylist/"));
                    }
                    break;

                case "delete_song":
                    int d_song_id = 0;
                    if (Int32.TryParse(Request.QueryString["song_id"], out d_song_id) == false)
                    {
                        d_song_id = 0;
                    }
                    string pl_id = "";
                    if (Request.QueryString["playlist_id"] != null)
                    {
                        pl_id = Request.QueryString["playlist_id"].ToString();
                    }
                    if (d_song_id != 0)
                    {
                        playlistManager.DeleteSong(model.member.id, d_song_id);
                        return(RedirectPermanent("/Editors/managePlaylist/?playlist_id=" + pl_id));
                    }
                    break;

                case "delete_song_plr":
                    int d_song_id1 = 0;
                    if (Int32.TryParse(Request.QueryString["song_id"], out d_song_id1) == false)
                    {
                        d_song_id1 = 0;
                    }

                    if (d_song_id1 != 0)
                    {
                        playlistManager.DeleteSong(model.member.id, d_song_id1);
                        return(RedirectPermanent("/Editors/managePlaylist/"));
                    }
                    break;

                default:
                    break;
                }
            }

            model.playlist = playlistManager.GetUserPlaylists(model.member.id);

            int playlist_id = 0;

            if (Request.QueryString["playlist_id"] != null)
            {
                if (Int32.TryParse(Request.QueryString["playlist_id"], out playlist_id) == false)
                {
                    playlist_id = 0;
                }
            }
            else
            {
                playlist_id = model.member.active_playlist;
            }

            foreach (var item in model.playlist)
            {
                if (item.id == playlist_id)
                {
                    ViewBag.ActivePlaylistName = item.name;
                    ViewBag.ActivePlaylistID   = item.id;
                }
            }

            if (playlist_id != 0)
            {
                model.playlistData_Song = playlistManager.GetSongsForPlayList(model.member.id, playlist_id);
            }
            else
            {
                model.playlistData_Song = playlistManager.GetSongsForPlayList(model.member.id, model.member.active_playlist);
            }

            hypster_tv_DAL.TagManagement tagManager = new hypster_tv_DAL.TagManagement();
            if (playlist_id != 0)
            {
                model.tags_list = tagManager.GetPlaylistTags(playlist_id);
            }
            else
            {
                model.tags_list = tagManager.GetPlaylistTags(model.member.active_playlist);
            }

            return(View(model));
        }