Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            utility = new Utility();
            utility.loadClient();
            user = getUser();

            //call the web service to retrieve media data
            media = utility.getMedia(itemID);
            comment_list = media.Comments;
            media_url = utility.getMediaUrl(media.MediaId);

            if (user != null)
            {

                isRented = utility.isRented(media.MediaId, user);
            }

            //preload media for viewing if rented
            if (isRented)
            {
                utility.loadFileService();
                Tuple<string, RentItServices.Media, RentItServices.User> tuple =
                    new Tuple<string, RentItServices.Media, RentItServices.User>(user.SharedKey, media, user);

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //load webservice client
            utility = new Utility();
            utility.loadClient();
            currentUser = getUser();
            if (currentUser == null)
            {
                Response.Redirect("~/index.aspx?msg=You have no permission to carry out the action!");
                return;
            }

            //determine which action to execute
            String deleteBookmark = Request.QueryString["deleteBookmark"];
            if (deleteBookmark != null)
            {
                doDeleteBookmark(Convert.ToInt32(deleteBookmark));
                return;
            }

            //determine if suspend action
            String suspendUser = Request.QueryString["suspend"];
            if (suspendUser != null)
            {
                doSuspend(suspendUser);
                return;
            }

            //determine if unsuspend action
            String unsuspendUser = Request.QueryString["unsuspend"];
            if (unsuspendUser != null)
            {
                doUnSuspend(unsuspendUser);
                return;
            }

            //determine if make admin action
            String makeAdmin = Request.QueryString["make_admin"];
            if (makeAdmin != null)
            {
                doMakeAdmin(makeAdmin);
                return;
            }

            //determine if revoke admin action
            String revokeAdmin = Request.QueryString["revoke_admin"];
            if (revokeAdmin != null)
            {
                doRevokeAdmin(revokeAdmin);
                return;
            }
        }
Example #3
0
        protected void register_click(object sender, EventArgs e)
        {
            currentUser = new RentItServices.User();
            currentUser.Email = this.Request.Form.Get("signup_email");
            String password1 = this.Request.Form.Get("signup_password1");
            String password2 = this.Request.Form.Get("signup_password2");

            if (this.Request.Form.Get("signup_gender").Equals("Male"))
            {
                currentUser.Gender = RentItServices.Gender.Male;
            }
            else
            {
                currentUser.Gender = RentItServices.Gender.Female;
            }

            currentUser.Age = int.Parse(this.Request.Form.Get("signup_age"));
            int country_position = int.Parse(this.Request.Form.Get("signup_country"));
            currentUser.Country = country_list[country_position];

                if (password1.Equals("") || password2.Equals(""))
                {
                    redirect_error(REG_FAIL, PWD_AGAIN);
                }
                else
                {
                    if (password1.Equals(password2))
                    {
                        currentUser.Password = password1;
                    }
                    else
                    {
                        redirect_error(REG_FAIL, PWD_AGAIN);
                    }
                }

                if (utility.createUser(currentUser.Email, currentUser.Password, currentUser.Gender, currentUser.Country, currentUser.Age))
                {

                    doLogin(currentUser.Email, currentUser.Password);
                }
                else
                {
                    redirect_error(REG_FAIL, REG_AGAIN);
                }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //load webservice client
            utility = new Utility();
            utility.loadClient();

            //call the web service to load data
            country_list = utility.getCountries();
            music_category_list = utility.getMusicCategories();
            movie_category_list = utility.getMovieCategories();

            currentUser = getUser();
            if (currentUser != null)
            {
                //if user is not null, load his history
                bookmark_list = utility.getUserBookmarks(currentUser);
                rental_list = utility.getRentalHistory(currentUser);
            }
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //GET params that determine what UI to show
            String actionType = Request.QueryString["type"];
            String param = Request.QueryString["param"];
            String item = Request.QueryString["item"];

            //GET params that determine if a msg need to be displayed
            String msgTitle = Request.QueryString["msgTitle"];
            String msg = Request.QueryString["msg"];

            //load webservice client
            utility = new Utility();
            utility.loadClient();

            //PREPARE THE NAV BAR WITH INFO
            header thisHeader = (header)LoadControl("~/header.ascx");

            currentUser = getUser();

            if (currentUser != null)
            {

                //login = true;
                //login = utility.isLoggedIn(currentUser);
                login = true;
                thisHeader.login = login;

                thisHeader.userid = currentUser.UserId;
                thisHeader.username = currentUser.Username;
                thisHeader.email = currentUser.Email;
                thisHeader.dp_url = currentUser.FbImageUrl;
                thisHeader.edollar = currentUser.Credits;

            }

            headerBar.Controls.Add(thisHeader);

            //PREPARE MSG BAR
            if (msg != null)
            {
                showMsg(msgTitle, msg);
            }
            //OLD LOGIN

            /*
            //login = true;
            //PREPARE MAIN BODY UI
            if (login)
            {
                if (actionType == null)
                {
                    //if user is loggedin, default to most popular UI

                    if (item != null)
                    { //handle ITEM VIEW

                        //if a param is provided, proceed to do ITEM VIEW
                        showItemUI(Convert.ToInt32(item));

                    }
                    else
                    {
                        showListUI(0);
                    }

                }

                else
                {
                    actionType = actionType.ToLower();
                    //determine which UI to show base on action type
                    if (actionType == "popular")
                    {
                        showListUI(0);
                    }
                    if (actionType == "music")
                    {
                        showListUI(2,null, Convert.ToInt32(param));
                    }
                    if (actionType == "movie")
                    {
                        showListUI(3, null, Convert.ToInt32(param));
                    }
                    if (actionType == "search")
                    { //handle search action
                        if (param != null)
                        {
                            //if a keyword is provided, trigger show search UI
                            showListUI(1, param,0);
                        }
                        else
                        {
                            //no keyword provided, default the most popular UI
                            showListUI(0);
                        }
                    }

                }
            }
            else
            {
                //SINCE NOT LOGIN, add the splash
                splash_carousel splasher = (splash_carousel)LoadControl("~/splash_carousel.ascx");
                mainBody.Controls.Add(splasher);
            }
             * */

            if (actionType == null)
            {
                //if user is loggedin, default to most popular UI

                if (item != null)
                { //handle ITEM VIEW

                    //if a param is provided, proceed to do ITEM VIEW
                    showItemUI(Convert.ToInt32(item));

                }
                else
                {
                    if (currentUser==null)
                    {
                        //SINCE NOT LOGIN, add the splash
                        splash_carousel splasher = (splash_carousel)LoadControl("~/splash_carousel.ascx");
                        mainBody.Controls.Add(splasher);
                    }
                    else
                    {
                        showListUI(0);
                    }
                }

            }

            else
            {
                actionType = actionType.ToLower();
                //determine which UI to show base on action type
                if (actionType == "popular")
                {
                    showListUI(0);
                }
                if (actionType == "book")
                {
                    showListUI(4, null, 0);
                }
                if (actionType == "music")
                {
                    showListUI(2, null, Convert.ToInt32(param));
                }
                if (actionType == "movie")
                {
                    showListUI(3, null, Convert.ToInt32(param));
                }
                if (actionType == "search")
                { //handle search action
                    if (param != null)
                    {
                        //if a keyword is provided, trigger show search UI
                        showListUI(1, param, 0);
                    }
                    else
                    {
                        //no keyword provided, default the most popular UI
                        showListUI(0);
                    }
                }

            }
        }
Example #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     utility = new Utility();
     utility.loadClient();
     currentUser = getUser();
 }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //GET params that determine what UI to show
            String actionType = Request.QueryString["type"];
            String param = Request.QueryString["param"];
            String item = Request.QueryString["item"];

            //GET params that determine if a msg need to be displayed
            String msgTitle = Request.QueryString["msgTitle"];
            String msg = Request.QueryString["msg"];

            //load webservice client
            utility = new Utility();
            utility.loadClient();

            //PREPARE THE NAV BAR WITH INFO
            admin_header thisHeader = (admin_header)LoadControl("~/admin_header.ascx");
            currentUser = getUser();

            if ((currentUser != null)&&(currentUser.IsAdmin))
            {

                //login = true;
                //login = utility.isLoggedIn(currentUser);
                login = true;
                thisHeader.login = login;

                thisHeader.userid = currentUser.UserId;
                thisHeader.username = currentUser.Username;
                thisHeader.email = currentUser.Email;

            }

            headerBar.Controls.Add(thisHeader);

            //PREPARE MSG BAR
            if (msg != null)
            {
                showMsg(msgTitle, msg);
            }

            if (login)
            {
                if (actionType == "user_analytics")
                {
                    showUserAnalytics();
                }
                if (actionType == "media_analytics")
                {
                    showMediaAnalytics();
                }
                if (actionType == "user")
                {
                    showUserUI();
                }
                if (actionType == "media")
                {
                    showListMediaUI();
                }

                if (item != null)
                { //handle ITEM VIEW

                    //if a param is provided, proceed to do ITEM VIEW
                    showMediaItemUI(Convert.ToInt32(item));
                }

            }
            else
            {

            }
        }