Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Retrieve login's user ID value
            if (Session["ID"] == null)
                Response.Redirect(@"~/Default.aspx");
            string readId = Session["ID"].ToString();
            int memberId = Convert.ToInt32(readId);

            //Redirect unwelcome guests
            if (memberId < 0)
                Response.Redirect(@"~/Default.aspx");

            //Create member class for user's info
            currentUser = new DaownaMp3Library.Member(memberId);
            string memberName = currentUser.UserName;
            string email = currentUser.Email;
            DateTime dateRegistered = currentUser.Date;

            //Should probably be done else where (jukebox)
            List<int> playlistIds = currentUser.MyPlaylistIds;
            string playlistString = string.Join(", ", playlistIds);
            List<int> trackIds = currentUser.MyTrackIds;
            string trackString = string.Join(", ", trackIds);

            //Display user's info
            txtGreet.Text = "Welcome " + memberName + ", to your playlist library!";
            txtEmail.Text = "Your registered e-mail address is:      " + email;
            txtDate.Text = "You started using this app on      " + dateRegistered;
            txtPlaylists.Text = "Your playlist Ids:      " + playlistString;
            txtTracks.Text = "Your track Ids:      " + trackString;

            //Fill user's playlist selection
            if (ddlPlaylistSelection.Items.Count == 0 || ddlPlaylistSelection.Items.Count <= currentUser.MyPlaylistIds.Count)
                ReloadLocalDropDownLists();
            if (lbxMyTracks.Items.Count != currentUser.MyTrackIds.Count)
                ReloadLocalListBoxTracks();

            //Fill in public playlists and shared tracks
            hero = new Jukebox(currentUser.ID);
            if (ddlPublicPlayList.Items.Count == 0 || ddlPublicPlayList.Items.Count <= (hero.PublicPlayListIds.Count + hero.MyPublicPlayListIds.Count + 1))
                ReloadPublicDropDownLists();
            if (lbxSharedTracks.Items.Count != hero.SharedTrackIds.Count)
                ReloadSharedListBoxTracks();

            //Session data retrieval for Jukebox
            if (Session["TrackId"] != null)
                hero.SelectedTrack = new Track(Convert.ToInt32(Session["TrackId"].ToString()));
            else
                hero.SelectedTrack = null;

            if (Session["SharedTrackId"] != null)
                hero.SelectedSharedTrack = new Track(Convert.ToInt32(Session["SharedTrackId"].ToString()));
            else
                hero.SelectedSharedTrack = null;

            if (Session["PlaylistId"] != null)
                hero.MySelectedPlayList = new PlayList(Convert.ToInt32(Session["PlaylistId"].ToString()));
            else
                hero.MySelectedPlayList = null;
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Retrieve login's user ID value
            if (Session["ID"] == null)
            {
                Response.Redirect(@"~/Default.aspx");
            }
            string readId   = Session["ID"].ToString();
            int    memberId = Convert.ToInt32(readId);


            //Redirect unwelcome guests
            if (memberId < 0)
            {
                Response.Redirect(@"~/Default.aspx");
            }

            //Create member class for user's info
            currentUser = new DaownaMp3Library.Member(memberId);
            string   memberName     = currentUser.UserName;
            string   email          = currentUser.Email;
            DateTime dateRegistered = currentUser.Date;

            //Should probably be done else where (jukebox)
            List <int> playlistIds    = currentUser.MyPlaylistIds;
            string     playlistString = string.Join(", ", playlistIds);
            List <int> trackIds       = currentUser.MyTrackIds;
            string     trackString    = string.Join(", ", trackIds);

            //Display user's info
            txtGreet.Text     = "Welcome " + memberName + ", to your playlist library!";
            txtEmail.Text     = "Your registered e-mail address is:      " + email;
            txtDate.Text      = "You started using this app on      " + dateRegistered;
            txtPlaylists.Text = "Your playlist Ids:      " + playlistString;
            txtTracks.Text    = "Your track Ids:      " + trackString;

            //Fill user's playlist selection
            if (ddlPlaylistSelection.Items.Count == 0 || ddlPlaylistSelection.Items.Count <= currentUser.MyPlaylistIds.Count)
            {
                ReloadLocalDropDownLists();
            }
            if (lbxMyTracks.Items.Count != currentUser.MyTrackIds.Count)
            {
                ReloadLocalListBoxTracks();
            }

            //Fill in public playlists and shared tracks
            hero = new Jukebox(currentUser.ID);
            if (ddlPublicPlayList.Items.Count == 0 || ddlPublicPlayList.Items.Count <= (hero.PublicPlayListIds.Count + hero.MyPublicPlayListIds.Count + 1))
            {
                ReloadPublicDropDownLists();
            }
            if (lbxSharedTracks.Items.Count != hero.SharedTrackIds.Count)
            {
                ReloadSharedListBoxTracks();
            }

            //Session data retrieval for Jukebox
            if (Session["TrackId"] != null)
            {
                hero.SelectedTrack = new Track(Convert.ToInt32(Session["TrackId"].ToString()));
            }
            else
            {
                hero.SelectedTrack = null;
            }

            if (Session["SharedTrackId"] != null)
            {
                hero.SelectedSharedTrack = new Track(Convert.ToInt32(Session["SharedTrackId"].ToString()));
            }
            else
            {
                hero.SelectedSharedTrack = null;
            }

            if (Session["PlaylistId"] != null)
            {
                hero.MySelectedPlayList = new PlayList(Convert.ToInt32(Session["PlaylistId"].ToString()));
            }
            else
            {
                hero.MySelectedPlayList = null;
            }
        }
Exemplo n.º 3
0
 protected void LogOut_Click(object sender, EventArgs e)
 {
     currentUser = new DaownaMp3Library.Member(-1);
     Session["ID"] = null;
     Response.Redirect(@"~/Default.aspx");
 }
Exemplo n.º 4
0
 protected void LogOut_Click(object sender, EventArgs e)
 {
     currentUser   = new DaownaMp3Library.Member(-1);
     Session["ID"] = null;
     Response.Redirect(@"~/Default.aspx");
 }