// Override of the ToString Method
 public string ToString()
 {
     // Serializing Object as CSV
     return(String.Join(",",
                        ("\"" + Url + "\""),
                        ("\"" + ReferenceDate.ToString("yyyy-MM-dd").Replace(",", "") + "\""),
                        ("\"" + Name.Replace(",", "") + "\" "),
                        ("\"" + Developer.Replace(",", "") + "\""),
                        ("\"" + IsTopDeveloper + "\""),
                        ("\"" + DeveloperURL.Replace(",", "") + "\""),
                        ("\"" + PublicationDate.ToString("yyyy-MM-dd").Replace(",", "") + "\""),
                        ("\"" + Category.Replace(",", "") + "\""),
                        ("\"" + IsFree + "\""),
                        ("\"" + Price + "\""),
                        ("\"" + Reviewers + "\""),
                        ("\"" + Score.Total + "\""),
                        ("\"" + Score.Count + "\""),
                        ("\"" + Score.FiveStars + "\""),
                        ("\"" + Score.FourStars + "\""),
                        ("\"" + Score.ThreeStars + "\""),
                        ("\"" + Score.TwoStars + "\""),
                        ("\"" + Score.OneStars + "\""),
                        ("\"" + LastUpdateDate.ToString("yyyy-MM-dd") + "\""),
                        //("\"" + AppSize                + "\""),
                        ("\"" + Instalations.Replace(",", ".") + "\""),
                        ("\"" + CurrentVersion.Replace(",", "") + "\""),
                        ("\"" + MinimumOSVersion.Replace(",", "") + "\""),
                        ("\"" + ContentRating.Replace(",", "") + "\""),
                        ("\"" + HaveInAppPurchases + "\""),
                        ("\"" + DeveloperEmail.Replace(",", "") + "\""),
                        ("\"" + DeveloperWebsite.Replace(",", "") + "\""),
                        ("\"" + DeveloperPrivacyPolicy.Replace(",", "") + "\""),
                        ("\"" + Description.Replace(",", "") + "\"")));
 }
        void grdContentRating_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string s          = e.CommandArgument.ToString();
            Guid   ratingGuid = Guid.Empty;

            if (s.Length == 36)
            {
                try
                {
                    ratingGuid = new Guid(s);
                }
                catch (FormatException) { }
            }


            switch (e.CommandName)
            {
            case "DeleteRating":

                if (ratingGuid != Guid.Empty)
                {
                    ContentRating.Delete(ratingGuid);
                }


                break;
            }

            WebUtils.SetupRedirect(this, Request.RawUrl);
        }
Beispiel #3
0
        private void BindRating()
        {
            ContentRatingStats ratingStats = ContentRating.GetStats(ContentGuid);

            UserRating.CurrentRating       = ratingStats.AverageRating;
            UserRating.JsonUrl             = jsonServiceUrl;
            UserRating.ContentId           = ContentGuid.ToString();
            UserRating.TotalVotesElementId = lblRatingVotes.ClientID;
            UserRating.CommentsEnabled     = allowFeedback;

            litRating.Text      = ratingStats.AverageRating.ToString(CultureInfo.InvariantCulture);
            lblRatingVotes.Text = string.Format(CultureInfo.InvariantCulture,
                                                Resource.RatingCountFormat,
                                                ratingStats.TotalVotes);

            if (WebUser.IsAdminOrContentAdmin)
            {
                //lnkRatingsReview.Text = lblRatingVotes.Text;
                UserRating.TotalVotesElementId = lnkResults.ClientID;
                lblRatingVotes.Visible         = false;
                //lnkRatingsReview.Visible = true;
                //lnkRatingsReview.NavigateUrl = SiteUtils.GetNavigationSiteRoot() + "/Dialog/ContentRatingsDialog.aspx?c=" + ContentGuid.ToString();
                //lnkRatingsReview.ToolTip = Resource.RatingReviewsLink;
                //lnkRatingsReview.DialogCloseText = Resource.CloseDialogButton;

                lnkResults.Text        = lblRatingVotes.Text;
                lnkResults.Visible     = true;
                lnkResults.NavigateUrl = SiteUtils.GetNavigationSiteRoot() + "/Dialog/ContentRatingsDialog.aspx?c=" + ContentGuid.ToString();
                lnkResults.ToolTip     = Resource.RatingReviewsLink;
            }
        }
Beispiel #4
0
        ///// <summary>
        ///// this is not really used since we are providing a json service url
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //void UserRating_Changed(object sender, AjaxRatingEventArgs e)
        //{
        //    if (!allowFeedback)
        //    {
        //        DoRating(Convert.ToInt32(e.Value));
        //    }
        //    else
        //    {
        //        BindRating();

        //        upRating.Update();
        //    }

        //}

        /// <summary>
        /// this is only used when comments are enabled
        /// </summary>
        /// <param name="rating"></param>
        private void DoRating(int rating)
        {
            if (ContentGuid == Guid.Empty)
            {
                return;
            }
            if (rating <= 0)
            {
                BindRating();
                upRating.Update();
                return;
            }

            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if (siteSettings == null)
            {
                return;
            }

            Guid   userGuid     = Guid.Empty;
            string emailAddress = txtEmail.Text;

            if (Request.IsAuthenticated)
            {
                SiteUser currentUser = SiteUtils.GetCurrentSiteUser();
                if (currentUser != null)
                {
                    userGuid = currentUser.UserGuid;
                    if (emailAddress.Length == 0)
                    {
                        emailAddress = currentUser.Email;
                    }
                }
            }

            ContentRating.RateContent(
                siteSettings.SiteGuid,
                ContentGuid,
                userGuid,
                rating,
                emailAddress,
                txtComments.Text,
                SiteUtils.GetIP4Address(),
                WebConfigSettings.MinutesBetweenAnonymousRatings
                );

            hdnRating.Value  = string.Empty;
            txtComments.Text = string.Empty;
            txtEmail.Text    = string.Empty;

            BindRating();

            upRating.Update();
        }
Beispiel #5
0
        public void TestTvShowSeparateExtrasContentRatings()
        {
            ResultContainer <ContentRating> contentRatings = _config.Client.GetTvShowContentRatings(BreakingBad);

            Assert.IsNotNull(contentRatings);
            Assert.AreEqual(BreakingBad, contentRatings.Id);
            ContentRating contentRating = contentRatings.Results.FirstOrDefault(r => r.Iso_3166_1.Equals("US"));

            Assert.IsNotNull(contentRating);
            Assert.AreEqual("TV-MA", contentRating.Rating);
        }
        private void PopulateControls()
        {
            List <ContentRating> ratings = ContentRating.GetPage(contentGuid, pageNumber, pageSize, out totalPages);

            string pageUrl = SiteRoot + "/Dialog/ContentRatingsDialog.aspx?c=" + contentGuid.ToString()
                             + "&amp;pagenumber={0}";;

            pgr.PageURLFormat = pageUrl;
            pgr.ShowFirstLast = true;
            pgr.CurrentIndex  = pageNumber;
            pgr.PageSize      = pageSize;
            pgr.PageCount     = totalPages;
            pgr.Visible       = (totalPages > 1);

            grdContentRating.DataSource = ratings;
            grdContentRating.DataBind();
        }
        private void DoRating(HttpContext context)
        {
            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if (siteSettings == null)
            {
                return;
            }

            Guid userGuid = Guid.Empty;

            if (context.Request.IsAuthenticated)
            {
                SiteUser currentUser = SiteUtils.GetCurrentSiteUser();
                if (currentUser != null)
                {
                    userGuid = currentUser.UserGuid;
                    if (emailAddress.Length == 0)
                    {
                        emailAddress = currentUser.Email;
                    }
                }
            }

            ContentRating.RateContent(
                siteSettings.SiteGuid,
                contentGuid,
                userGuid,
                rating,
                emailAddress,
                comments,
                SiteUtils.GetIP4Address(),
                WebConfigSettings.MinutesBetweenAnonymousRatings
                );

            ContentRatingStats ratingStats = ContentRating.GetStats(contentGuid);

            avgRating  = ratingStats.AverageRating;
            totalVotes = ratingStats.TotalVotes;
        }
Beispiel #8
0
        //private static string noClue;
        public static void ReadFile(MP4File file)
        {
            try
            {
                title = file.Tags.Title;
            }
            catch
            {
                title = "";
            }

            try
            {
                artist = file.Tags.Artist;
            }
            catch
            {
                artist = "";
            }

            try
            {
                releaseDate = file.Tags.ReleaseDate;
            }
            catch
            {
                releaseDate = "";
            }

            try
            {
                rating = (string)file.Tags.RatingInfo.Rating;
            }
            catch
            {
                rating = "";
            }

            try
            {
                genre = file.Tags.Genre;
            }
            catch
            {
                genre = "";
            }

            try
            {
                artwork = file.Tags.Artwork;
            }
            catch
            {
                artwork = null;
            }

            try
            {
                album = file.Tags.Album;
            }
            catch
            {
                album = "";
            }

            try
            {
                albumArtist = file.Tags.AlbumArtist;
            }
            catch
            {
                albumArtist = "";
            }

            try
            {
                purchaseDate = file.Tags.PurchasedDate;
            }
            catch
            {
                purchaseDate = "";
            }

            try
            {
                shortDescription = file.Tags.Description;
            }
            catch
            {
                shortDescription = "";
            }

            try
            {
                longDescription = file.Tags.LongDescription;
            }
            catch
            {
                longDescription = "";
            }

            try
            {
                videoKind = file.Tags.MediaType;
            }
            catch
            {
                videoKind = 0;
            }

            try
            {
                if (file.Tags.MovieInfo.HasCast)
                {
                    actors = String.Join(",", file.Tags.MovieInfo.Cast);
                }
                else
                {
                    actors = "";
                }
            }
            catch
            {
                actors = "";
            }

            try
            {
                if (file.Tags.MovieInfo.HasDirectors)
                {
                    director = String.Join(",", file.Tags.MovieInfo.Directors);
                }
                else
                {
                    director = "";
                }
            }
            catch
            {
                director = "";
            }

            try
            {
                if (file.Tags.MovieInfo.HasScreenwriters)
                {
                    screenwriter = String.Join(",", file.Tags.MovieInfo.Screenwriters);
                }
                else
                {
                    screenwriter = "";
                }
            }
            catch
            {
                screenwriter = "";
            }

            try
            {
                show = file.Tags.TVShow;
            }
            catch
            {
                show = "";
            }

            try
            {
                episodeId = file.Tags.EpisodeId;
            }
            catch
            {
                episodeId = "";
            }

            try
            {
                season = (int)file.Tags.SeasonNumber;
            }
            catch
            {
                season = 0;
            }

            try
            {
                episode = (int)file.Tags.EpisodeNumber;
            }
            catch
            {
                episode = 0;
            }

            try
            {
                tvNetwork = file.Tags.TVNetwork;
            }
            catch
            {
                tvNetwork = "";
            }

            try
            {
                isPodcast = (Boolean)file.Tags.IsPodcast;
            }
            catch
            {
                isPodcast = false;
            }

            feedUrl = "";
            episodeUrl = "";

            try
            {
                category = file.Tags.Category;
            }
            catch
            {
                category = "";
            }

            try
            {
                keyword = file.Tags.Keywords;
            }
            catch
            {
                keyword = "";
            }

            try
            {
                advisory = file.Tags.ContentRating;
            }
            catch
            {
                advisory = 0;
            }
        }