Ejemplo n.º 1
0
        public IEnumerable <IComment> SelectComments(int startRowIndex, int maximumRows = -1)
        {
            var comments = new List <Comment>();

            if (!FeatureCheckHelper.IsFeatureEnabled(FeatureNames.Feedback) || maximumRows == 0)
            {
                return(comments);
            }
            var includeUnapprovedComments = TryAssertCommentModerationPermission(Dependencies);
            var query =
                OrganizationServiceContextExtensions.SelectCommentsByPage(
                    OrganizationServiceContextExtensions.GetPageInfo(startRowIndex, maximumRows), WebPageReference.Id,
                    includeUnapprovedComments);
            var commentsEntitiesResult = Dependencies.GetServiceContext().RetrieveMultiple(query);

            comments.AddRange(
                commentsEntitiesResult.Entities.Select(
                    commentEntity =>
                    new Comment(
                        commentEntity,
                        new Lazy <ApplicationPath>(() => Dependencies.GetEditPath(commentEntity.ToEntityReference()), LazyThreadSafetyMode.None),
                        new Lazy <ApplicationPath>(() => Dependencies.GetDeletePath(commentEntity.ToEntityReference()), LazyThreadSafetyMode.None),
                        new Lazy <bool>(() => includeUnapprovedComments, LazyThreadSafetyMode.None), (new RatingDataAdapter(commentEntity)).GetRatingInfo(), RatingsEnabled)));
            return(comments);
        }
Ejemplo n.º 2
0
        protected void SearchButton_Click(object sender, EventArgs e)
        {
            var serviceContext = _portal.Value.ServiceContext;

            var searchPage = OrganizationServiceContextExtensions.GetPageBySiteMarkerName(serviceContext, _portal.Value.Website, "Blog Search");

            if (searchPage == null)
            {
                return;
            }

            var url = OrganizationServiceContextExtensions.GetUrl(serviceContext, searchPage);

            if (url == null)
            {
                return;
            }

            var urlBuilder = new UrlBuilder(url);

            urlBuilder.QueryString.Set(_searchQueryStringField, QueryText.Text);

            Guid blogId;

            if (BlogSearchFilters.Visible && BlogSearchFilterOptions.SelectedValue == "blog" && TryGetBlogScope(out blogId))
            {
                urlBuilder.QueryString.Set(_blogQueryStringField, blogId.ToString());
            }

            Response.Redirect(urlBuilder.PathWithQueryString);
        }
Ejemplo n.º 3
0
        private ActionResult RedirectToPageNotFound()
        {
            var context = PortalCrmConfigurationManager.CreatePortalContext();

            var page = context.ServiceContext.GetPageBySiteMarkerName(context.Website, PageNotFoundSiteMarker);

            if (page == null)
            {
                throw new Exception("Please contact your System Administrator. Required Site Marker '{0}' is missing.".FormatWith(PageNotFoundSiteMarker));
            }

            var path = OrganizationServiceContextExtensions.GetUrl(context.ServiceContext, page);

            if (path == null)
            {
                throw new Exception("Please contact your System Administrator. Unable to build URL for Site Marker '{0}'.".FormatWith(PageNotFoundSiteMarker));
            }

            return(Redirect(path));
        }
        private ActionResult RedirectToAccessDeniedPage()
        {
            var serviceContext = PortalCrmConfigurationManager.CreatePortalContext();

            var page = serviceContext.ServiceContext.GetPageBySiteMarkerName(serviceContext.Website, AccessDeniedSiteMarker);

            if (page == null)
            {
                throw new Exception(
                          ResourceManager.GetString("Contact_System_Administrator_Required_Site_Marker_Missing_Exception")
                          .FormatWith(PageNotFoundSiteMarker));
            }

            var path = OrganizationServiceContextExtensions.GetUrl(serviceContext.ServiceContext, page);

            if (path == null)
            {
                throw new Exception("Please contact your System Administrator. Unable to build URL for Site Marker {0}.".FormatWith(PageNotFoundSiteMarker));
            }

            return(Redirect(path));
        }