Beispiel #1
0
        /// <summary>
        /// obtains the challenge detail
        /// </summary>
        /// <param name="id">identifier of section</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int id)
        {
            Business.Services.CustomPrincipal currentUserInfo = (Business.Services.CustomPrincipal)User;
            if (Utils.IsBlogAdmin(currentUserInfo.UserId))
            {
                ContentManagement    objcontentman = new ContentManagement(SessionCustom, HttpContext);
                ContentRepository    objcontent    = new ContentRepository(SessionCustom);
                BlogEntryRepository  objblogentry  = new BlogEntryRepository(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);

                objtemplate.Entity.Type = 0;

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

                objblogentry.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 BlogEntryModel()
                {
                    UserPrincipal = this.CustomUser,
                    ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                    Module = this.Module,
                    ListFiles = objfiles.GetAllReadOnly(),
                    BlogEntry = objblogentry.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
                }));
            }

            return(null);
        }
Beispiel #2
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
            }));
        }
Beispiel #3
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();
        }
Beispiel #4
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()
            }));
        }