Exemple #1
0
        public ActionResult EntradasBlog(int pageIndex, int pageSize, int contentId, string view)
        {
            int total         = 0;
            int?currentUserId = null;

            if (User.Identity.IsAuthenticated)
            {
                currentUserId = ((CustomPrincipal)User).UserId;
            }

            BlogEntryRepository blog    = new BlogEntryRepository(SessionCustom);
            CommentRepository   comment = new CommentRepository(SessionCustom);

            blog.Entity.ContentId = contentId;

            List <BlogEntriesPaging> blogContentEntries = blog.BlogContentEntriesPaging(pageIndex, pageSize, out total);

            foreach (BlogEntriesPaging content in blogContentEntries)
            {
                content.CollComment = comment.CommentsPagingContent(1, 3, out total, contentId);
            }

            if (string.IsNullOrEmpty(view))
            {
                view = "_ContentBlogEntriesList";
            }

            return(this.View(view, blogContentEntries));
        }
Exemple #2
0
        /// <summary>
        /// Bind the context and the session with the content
        /// </summary>
        /// <param name="context">Context page</param>
        /// <param name="session">Session object</param>
        /// <param name="id">Content ID</param>
        /// <param name="userId">current user ID</param>
        public void Bind(HttpContextBase context, ISession session, int?id, int?userId, int?LanguageId)
        {
            int total = 0;
            BlogEntryRepository  blogEntryRepository = new BlogEntryRepository(session);
            FileattachRepository fileRepository      = new FileattachRepository(session);
            CommentRepository    comment             = new CommentRepository(session);

            this.CollBlogEntries = blogEntryRepository.BlogEntriesPaging(1, 6, out total, true, LanguageId);
            this.TotalCount      = total;
            int totalCount = 0;

            foreach (BlogEntriesPaging blogEntry in this.CollBlogEntries)
            {
                blogEntry.CollComment = comment.CommentsPagingContent(1, 3, out totalCount, blogEntry.ContentId.Value);
                if (blogEntry.CollComment.Count > 0)
                {
                    blogEntry.CollComment[0].CommentContentOwnerId = blogEntry.UserId.Value;
                }

                fileRepository.Entity.ContentId = blogEntry.ContentId;
                Fileattach file = fileRepository.GetAll().FirstOrDefault(t => t.Type == Domain.Entities.Fileattach.TypeFile.Video);
                if (file != null)
                {
                    blogEntry.Video = file.Filename;
                }

                this.CommentsCount = totalCount;
            }
        }
Exemple #3
0
        /// <summary>
        /// obtains the challenge detail
        /// </summary>
        /// <param name="mod">identifier of module</param>
        /// <param name="id">identifier of section</param>
        /// <param name="sectionId">seccion del molulo</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int mod, int id, int?sectionId)
        {
            ContentManagement      objcontentman   = new ContentManagement(SessionCustom, HttpContext);
            ContentRepository      objcontent      = new ContentRepository(SessionCustom);
            SuccessStoryRepository objSuccessStory = new SuccessStoryRepository(SessionCustom);
            FileattachRepository   objfiles        = new FileattachRepository(SessionCustom);
            TagRepository          objtag          = new TagRepository(SessionCustom);
            SectionRepository      objsection      = new SectionRepository(SessionCustom);
            TemplateRepository     objtemplate     = new TemplateRepository(SessionCustom);
            CommentRepository      objcomment      = new CommentRepository(SessionCustom);
            TagFacade tagFacade = new TagFacade();

            objtemplate.Entity.Type = 0;

            objSuccessStory.Entity.ContentId        =
                objfiles.Entity.ContentId           =
                    objcomment.Entity.ContentId     =
                        objcontent.Entity.ContentId = id;

            objSuccessStory.LoadByKey();
            objcontent.LoadByKey();

            int totalComments = 0;
            List <CommentsPaging> comments = objcomment.CommentsPagingContent(0, 50, out totalComments, id);

            ViewBag.TotalComments = totalComments;

            IEnumerable <Tag> SelectedTags = objtag.GetTagbycontent(id);

            this.ViewBag.SelectedTags = string.Join("|", SelectedTags.Select(t => t.TagId));
            this.ViewBag.NewsTags     = string.Empty;

            return(this.View(
                       "Index",
                       new SuccessStoryModel()
            {
                UserPrincipal = this.CustomUser,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Module = this.Module,
                ListFiles = objfiles.GetAllReadOnly(),
                SuccessStory = objSuccessStory.Entity,
                IContent = objcontent.Entity,
                Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                ListContent = objcontent.GetContentRelation(CurrentLanguage.LanguageId.Value),
                ListTags = SelectedTags,
                DeepFollower = Business.Utils.GetDeepFollower(objsection.GetAll(), objcontent.Entity.SectionId.Value),
                CurrentLanguage = this.CurrentLanguage,
                ListComments = comments,
                Tags = tagFacade.GetAll().Select(t => new SelectListItem {
                    Text = t.Name, Value = t.TagId.ToString()
                })
            }));
        }
Exemple #4
0
        public ActionResult Index(int id, bool layer)
        {
            BlogEntryRepository blog = new BlogEntryRepository(SessionCustom);

            blog.Entity.ContentId = id;
            blog.LoadByKey();

            ContentRepository content = new ContentRepository(SessionCustom);

            content.Entity.ContentId = blog.Entity.ContentId;
            content.LoadByKey();

            if (User.Identity.IsAuthenticated)
            {
                ViewBag.CurrentUserId = ((CustomPrincipal)User).UserId;
            }

            if (content.Entity.UserId.HasValue)
            {
                // blog owner
                ViewBag.IdeaOwner = content.Entity.UserId.Value == ViewBag.CurrentUserId;
            }

            int total = 0;
            CommentRepository comment = new CommentRepository(SessionCustom);
            List <Domain.Entities.FrontEnd.CommentsPaging> comments = comment.CommentsPagingContent(1, 6, out total, id);

            FileattachRepository fileRepository = new FileattachRepository(SessionCustom);

            fileRepository.Entity.ContentId = content.Entity.ContentId;
            Fileattach file = fileRepository.GetAll().FirstOrDefault(t => t.Type == Domain.Entities.Fileattach.TypeFile.Video);

            if (file != null)
            {
                content.Entity.Video = file.Filename;
            }

            return(this.View(new Models.FEBlogEntry()
            {
                Entity = blog.Entity,
                CollComments = comments,
                ObjContent = content.Entity,
                CurrentLanguage = CurrentLanguage,
                CommentCount = total
            }));
        }
Exemple #5
0
        /// <summary>
        /// Bind the context and the session with the content
        /// </summary>
        /// <param name="context">Context page</param>
        /// <param name="session">Session object</param>
        /// <param name="id">Content ID</param>
        /// <param name="userId">current user ID</param>
        public void Bind(HttpContextBase context, ISession session, int?id, int?userId, int?LanguageId)
        {
            ContentRepository contentrepository = new ContentRepository(session);

            if (contentrepository.Entity != null)
            {
                BlogEntryRepository  blogentryrepository = new BlogEntryRepository(session);
                FileattachRepository file    = new FileattachRepository(session);
                CommentRepository    comment = new CommentRepository(session);

                contentrepository.Entity.ContentId = id;
                contentrepository.LoadByKey();

                if (contentrepository.Entity.Frienlyname != null)
                {
                    file.Entity.ContentId =
                        blogentryrepository.Entity.ContentId =
                            contentrepository.Entity.ContentId;

                    blogentryrepository.LoadByKey();

                    this.ObjContent   = contentrepository.Entity;
                    this.ObjBlogEntry = blogentryrepository.Entity;
                    this.CollFiles    = file.GetAll();
                }

                contentrepository.Entity           = new Content();
                contentrepository.Entity.ContentId = this.ObjContent.ContentId;
                contentrepository.Entity.SectionId = this.ObjContent.SectionId;

                if (id.HasValue)
                {
                    CommentRepository commentRepository = new CommentRepository(session);
                    int totalCount;
                    this.CollComments = commentRepository.CommentsPagingContent(1, 3, out totalCount, id.Value);
                }
            }

            this.CollContent = contentrepository.GetNewsRelationFrontEnd();
        }
Exemple #6
0
        public ActionResult ComentariosContenido(int pageIndex, int pageSize, int contentId, string view)
        {
            if (string.IsNullOrEmpty(view))
            {
                view = "_BlogEntryCommentsList";
            }

            int total = 0;
            CommentRepository     comment  = new CommentRepository(SessionCustom);
            List <CommentsPaging> comments = comment.CommentsPagingContent(pageIndex, pageSize, out total, contentId);

            ContentRepository content = new ContentRepository(SessionCustom);

            content.Entity.ContentId = contentId;
            content.LoadByKey();

            if (User.Identity.IsAuthenticated)
            {
                ViewBag.CurrentUserId = ((CustomPrincipal)User).UserId;
            }

            if (content.Entity.UserId.HasValue)
            {
                // blog owner
                ViewBag.IdeaOwner = content.Entity.UserId.Value == ViewBag.CurrentUserId;
            }

            if (content.Entity.UserId.HasValue)
            {
                if (comments.Count > 0)
                {
                    comments[0].CommentContentOwnerId = content.Entity.UserId.Value;
                }
            }

            return(this.View(view, comments));
        }
Exemple #7
0
        /// <summary>
        /// Bind the context and the session with the content
        /// </summary>
        /// <param name="context">Context page</param>
        /// <param name="session">Session object</param>
        /// <param name="id">Content ID</param>
        /// <param name="userId">current user ID</param>
        public void Bind(HttpContextBase context, ISession session, int?id, int?userId, int?LanguageId)
        {
            ContentRepository contentrepository = new ContentRepository(session);

            if (contentrepository.Entity != null)
            {
                ChallengeRepository  challengepository = new ChallengeRepository(session);
                FileattachRepository file = new FileattachRepository(session);
                IdeaRepository       idea = new IdeaRepository(session);

                contentrepository.Entity.ContentId = id;
                contentrepository.LoadByKey();

                if (contentrepository.Entity.Frienlyname != null)
                {
                    file.Entity.ContentId =
                        challengepository.Entity.ContentId =
                            contentrepository.Entity.ContentId;

                    challengepository.LoadByKey();

                    this.ObjContent   = contentrepository.Entity;
                    this.ObjChallenge = challengepository.Entity;
                    this.CollFiles    = file.GetAll();
                }

                contentrepository.Entity           = new Content();
                contentrepository.Entity.ContentId = this.ObjContent.ContentId;
                contentrepository.Entity.SectionId = this.ObjContent.SectionId;

                if (userId.HasValue)
                {
                    ChaellengeFollowerRepository follower = new ChaellengeFollowerRepository(session);
                    follower.Entity.UserId      = userId;
                    follower.Entity.ChallengeId = id;
                    if (follower.GetAll().Count > 0)
                    {
                        this.JoinedChallenge = true;
                    }
                }

                if (id.HasValue)
                {
                    int totalCount = 0;
                    CommentRepository   comment = new CommentRepository(session);
                    BlogEntryRepository blog    = new BlogEntryRepository(session);
                    idea.Entity.ContentId = blog.Entity.ContentId = id.Value;

                    this.CollIdeas  = idea.IdeasPaging(1, 6, out totalCount, id.Value, userId);
                    this.IdeasCount = totalCount;
                    foreach (IdeasPaging item in this.CollIdeas)
                    {
                        item.CollComment   = comment.CommentsPaging(1, 3, out totalCount, item.IdeaId.Value);
                        this.CommentsCount = totalCount;
                    }

                    this.BlogEntries      = blog.BlogContentEntriesPaging(1, 6, out totalCount);
                    this.BlogEntriesCount = totalCount;
                    foreach (BlogEntriesPaging blogEntry in this.BlogEntries)
                    {
                        blogEntry.CollComment = comment.CommentsPagingContent(1, 3, out totalCount, blogEntry.ContentId.Value);
                        this.CommentsCount    = totalCount;
                    }

                    this.TopIdeas   = idea.TopIdeas(10);
                    this.Statistics = contentrepository.GetContentStatistics(id.Value);
                }
            }

            this.CollContent = contentrepository.GetNewsRelationFrontEnd();
        }
Exemple #8
0
        public ActionResult Index(int id)
        {
            SetLabel();
            FrontEndManagement objman = new FrontEndManagement(SessionCustom, HttpContext, FrontEndManagement.Type.Content, CurrentLanguage);
            int?currentUserId         = null;

            if (User.Identity.IsAuthenticated)
            {
                currentUserId = ((CustomPrincipal)User).UserId;
                objman.BindInfo(id, currentUserId);
                ViewBag.CurrentUserId = currentUserId;
            }
            else
            {
                objman.BindInfo(id, null);
            }

            IdeaRepository idea = new IdeaRepository(SessionCustom);

            BlogEntryRepository blog = new BlogEntryRepository(SessionCustom);

            blog.Entity.ContentId = id;
            blog.LoadByKey();

            ContentRepository content = new ContentRepository(SessionCustom);

            content.Entity.ContentId = blog.Entity.ContentId;
            content.LoadByKey();

            if (content.Entity.UserId.HasValue)
            {
                // blog owner
                ViewBag.IdeaOwner = content.Entity.UserId.Value == currentUserId;
            }

            int total = 0;
            CommentRepository comment = new CommentRepository(SessionCustom);
            List <Domain.Entities.FrontEnd.CommentsPaging> comments = comment.CommentsPagingContent(1, 6, out total, id);

            FileattachRepository fileRepository = new FileattachRepository(SessionCustom);

            fileRepository.Entity.ContentId = content.Entity.ContentId;
            Fileattach file = fileRepository.GetAll().FirstOrDefault(t => t.Type == Domain.Entities.Fileattach.TypeFile.Video);

            if (file != null)
            {
                content.Entity.Video = file.Filename;
            }

            return(this.View(
                       "IndexNivel3",
                       new Models.FEBlogEntry()
            {
                UserPrincipal = CustomUser,
                Entity = blog.Entity,
                CollComments = comments,
                ObjContent = content.Entity,
                MetaTags = objman.Metatags,
                CurrentLanguage = CurrentLanguage,
                CommentCount = total,
                IdeasCountAll = idea.IdeasCountAll()
            }));
        }