Exemple #1
0
        public ActionResult Comments(int pageIndex, int pageSize, int ideaId)
        {
            int total = 0;
            CommentRepository comment = new CommentRepository(SessionCustom);

            return(this.View("CommentsList", comment.CommentsPaging(pageIndex, pageSize, out total, ideaId)));
        }
Exemple #2
0
        /// <summary>
        /// obtains the idea detail
        /// </summary>
        /// <param name="mod">identifier of module</param>
        /// <param name="id">identifier of section</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int mod, int id)
        {
            QuestionRepository   objquestion   = new QuestionRepository(SessionCustom);
            ContentManagement    objcontentman = new ContentManagement(SessionCustom, HttpContext);
            ContentRepository    objcontent    = new ContentRepository(SessionCustom);
            IdeaRepository       objidea       = new IdeaRepository(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;

            objidea.Entity.IdeaId        =
                objcomment.Entity.IdeaId = id;
            objidea.LoadByKey();

            objquestion.Entity.ContentId    =
                objcontent.Entity.ContentId = objidea.Entity.ContentId;
            objcontent.LoadByKey();
            objquestion.LoadByKey();

            if (objquestion.Entity != null && objquestion.Entity.Type.Equals(Domain.Entities.Question.TypeQuestion.Ubicacion))
            {
                ViewBag.Location = true;
            }
            else
            {
                ViewBag.Location = false;
            }

            int totalComments = 0;
            List <CommentsPaging> comments = objcomment.CommentsPaging(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(
                       "Detail",
                       new IdeaModel()
            {
                UserPrincipal = this.CustomUser,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Module = this.Module,
                ListFiles = objfiles.GetAllReadOnly(),
                Idea = objidea.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
            }));
        }
Exemple #3
0
        public ActionResult Comentarios(int pageIndex, int pageSize, int ideaId, string view)
        {
            int?currentUserId = null;

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

            ViewBag.CurrentUserId = currentUserId;

            IdeaRepository idea = new IdeaRepository(SessionCustom);

            idea.Entity.IdeaId = ideaId;
            idea.LoadByKey();
            ViewBag.Idea = idea.Entity;
            if (idea.Entity.UserId == currentUserId)
            {
                ViewBag.IdeaOwner = true;
            }
            else
            {
                ViewBag.IdeaOwner = false;
            }

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

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

            if (comments.Count > 0)
            {
                comments[0].CommentCount = total;
            }

            return(this.View(view, comments));
        }
Exemple #4
0
        public ActionResult Idea(int ideaId)
        {
            int total         = 0;
            int?currentUserId = null;

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

            IdeaRepository     idea     = new IdeaRepository(SessionCustom);
            CommentRepository  comment  = new CommentRepository(SessionCustom);
            QuestionRepository question = new QuestionRepository(SessionCustom);
            List <IdeasPaging> ideas    = new List <IdeasPaging>();

            IdeasPaging singleIdea = idea.IdeaPagingById(ideaId, currentUserId);

            ideas.Add(singleIdea);
            foreach (IdeasPaging item in ideas)
            {
                item.CollComment = comment.CommentsPaging(1, 1, out total, item.IdeaId.Value);
                if (item.CollComment.Count > 0)
                {
                    item.CollComment[0].CommentCount = total;
                }
            }

            if (ideas.Count > 0)
            {
                question.Entity.ContentId = singleIdea.ContentId;
                question.LoadByKey();
                if (question.Entity.EndDate.HasValue)
                {
                    ideas[0].QuestionType = question.Entity.Type;
                }
            }

            ViewBag.CurrentUserId = currentUserId;

            return(this.View("_CardIdeasList", ideas));
        }
Exemple #5
0
        public ActionResult Ideas(int pageIndex, int pageSize, int contentId, int filter, string view, int[] ideasId)
        {
            int total         = 0;
            int?currentUserId = null;

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

            IdeaRepository     idea     = new IdeaRepository(SessionCustom);
            CommentRepository  comment  = new CommentRepository(SessionCustom);
            QuestionRepository question = new QuestionRepository(SessionCustom);
            List <IdeasPaging> ideas    = new List <IdeasPaging>();

            switch (filter)
            {
            case 1:
                ideas = idea.IdeasPagingRandom(pageSize, out total, contentId, currentUserId, ideasId);
                break;

            case 2:
                ideas = idea.IdeasPaging(pageIndex, pageSize, out total, contentId, currentUserId);
                break;

            case 3:
                ideas = idea.IdeasPagingTop(pageIndex, pageSize, out total, contentId, currentUserId);
                break;

            case 4:
                ideas = idea.IdeasPagingRecommended(pageIndex, pageSize, out total, contentId, currentUserId);
                break;
            }

            foreach (IdeasPaging item in ideas)
            {
                item.CollComment = comment.CommentsPaging(1, 1, out total, item.IdeaId.Value);
                if (item.CollComment.Count > 0)
                {
                    item.CollComment[0].CommentCount = total;
                }
            }

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

            if (ideas.Count > 0)
            {
                question.Entity.ContentId = contentId;
                question.LoadByKey();
                if (question.Entity.EndDate.HasValue)
                {
                    ideas[0].QuestionType = question.Entity.Type;
                }
            }

            ViewBag.CurrentUserId = currentUserId;

            return(this.View(view, ideas));
        }
Exemple #6
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();
        }