Пример #1
0
        public void MarkCommentRepliesDone()
        {
            //ExStart
            //ExFor:Comment.Done
            //ExFor:CommentCollection
            //ExSummary:Shows how to mark comment as Done.
            Document doc = new Document(MyDir + "Comments.docx");

            NodeCollection comments = doc.GetChildNodes(NodeType.Comment, true);

            Comment           comment           = (Comment)comments[0];
            CommentCollection repliesCollection = comment.Replies;

            foreach (Comment childComment in repliesCollection)
            {
                if (!childComment.Done)
                {
                    // Update comment reply Done mark
                    childComment.Done = true;
                }
            }
            //ExEnd

            doc               = DocumentHelper.SaveOpen(doc);
            comment           = (Comment)doc.GetChildNodes(NodeType.Comment, true)[0];
            repliesCollection = comment.Replies;

            foreach (Comment childComment in repliesCollection)
            {
                Assert.True(childComment.Done);
            }
        }
Пример #2
0
        protected override void OnLoadComplete(EventArgs e)
        {
            int?uid        = _Request.Get <int>("uid");
            int pageNumber = _Request.Get <int>("page", 1);

            m_CommentListPageSize = 20;

            if (uid != null)
            {
                if (_Request.IsClick("addcomment"))
                {
                    AddComment(null, null, "boardform");
                }
            }

            if (uid != null && BoardCanDisplay)
            {
                m_VisitorIsAdmin = CommentBO.Instance.ManagePermission.Can(My, BackendPermissions.ActionWithTarget.Manage_Comment, uid.Value);


                m_CommentList = CommentBO.Instance.GetComments(uid.Value, CommentType.Board, pageNumber, m_CommentListPageSize, true, out m_TotalCommentCount);

                WaitForFillSimpleUsers <Comment>(m_CommentList);

                SetPager("list", null, pageNumber, CommentListPageSize, TotalCommentCount);
            }
            else
            {
                m_CommentList = new CommentCollection();
            }

            base.OnLoadComplete(e);
        }
        public async Task <ActionResult <CommentCollection> > PostCommentCollection(CommentCollection commentCollection)
        {
            _context.CommentCollections.Add(commentCollection);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCommentCollection", new { id = commentCollection.Id }, commentCollection));
        }
        private CommentCollection GetReplies(Node comment, int level = 0)
        {
            var replies = new CommentCollection();

            if (comment.ChildrenAsList.Any(x => x.NodeTypeAlias == "CommentItem" && x.GetProperty <bool>("isSpam") == false))
            {
                var counter = 0;
                replies.Comments = new Models.Comment[comment.ChildrenAsList.Count(x => x.NodeTypeAlias == "CommentItem" && x.GetProperty <bool>("isSpam") == false)];
                foreach (var item in comment.ChildrenAsList.Where(x => x.NodeTypeAlias == "CommentItem" && x.GetProperty <bool>("isSpam") == false))
                {
                    replies.Comments[counter] = new Models.Comment
                    {
                        Content    = item.GetProperty("message").Value,
                        Email      = item.GetProperty("email").Value,
                        Website    = item.HasProperty("website") ? item.GetProperty("website").Value : "",
                        Name       = item.GetProperty("name").Value,
                        ParentId   = item.Parent.Id,
                        Id         = item.Id,
                        CreateDate = item.CreateDate,
                        IsAdmin    = item.GetProperty <bool>("isBackOffice"),
                        IsShow     = item.GetProperty <bool>("showComment"),
                        IsSpam     = item.GetProperty <bool>("isSpam"),
                        ParentName = item.Parent.HasProperty("title") ? item.Parent.GetProperty("title").Value : item.Parent.Name,
                        ParentUrl  = item.Parent.GetFullNiceUrl(),
                        Replies    = GetReplies((Node)item, level++)
                    };
                    counter++;
                }
                return(replies);
            }
            else
            {
                return(null);
            }
        }
Пример #5
0
        public void Initialize([NotNull] PostObject post)
        {
            headerImage.sprite   = post.character.profilePicture;
            headerName.text      = post.character.GetNameString();
            headerTimestamp.text = post.GetTimestampString();

            if (post.image != null)
            {
                image.sprite = post.image;
            }
            else
            {
                Destroy(image.gameObject);
            }

            text.text = Localization.Localization.Get(post.text);

            _commentCollection = GetComponentInChildren <CommentCollection>();
            if (post.comments.Length == 0)
            {
                Destroy(_commentCollection.gameObject);
            }
            else
            {
                _commentCollection.Initialize(post.comments);
            }
        }
Пример #6
0
        public static IEnumerable <CommentDetails> GetCommentsOfCollection(int id)
        {
            string collectionFileName = GetCollectionFilename(id) + ".json";
            string resourceName       = Root_NameSpace + collectionFileName;

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
            {
                using (var reader = new StreamReader(stream))
                {
                    string  objText    = reader.ReadToEnd();
                    JObject joResponse = JObject.Parse(objText);

                    CommentCollection            commentCollection = JsonConvert.DeserializeObject <CommentCollection>(objText);
                    IEnumerable <CommentDetails> commentCategories = commentCollection.Comments.Where(x => x.Parent == null);
                    IEnumerable <CommentDetails> commentChildren   = commentCollection.Comments.Where(x => x.Parent != null);
                    Dictionary <int?, List <CommentDetails> > commentsPerCategory = commentChildren.GroupBy(grp => grp.Parent).ToDictionary(g => g.Key, g => g.ToList());

                    List <CommentDetails> finalList = new List <CommentDetails>();

                    foreach (CommentDetails commentDetailParent in commentCategories)
                    {
                        finalList.Add(commentDetailParent);
                        List <CommentDetails> children;
                        commentsPerCategory.TryGetValue(commentDetailParent.ID, out children);
                        if (children != null)
                        {
                            finalList.AddRange(children);
                        }
                    }
                    return(finalList);
                }
            }
        }
Пример #7
0
        public override CommentCollection GetCommentsByFilter(AdminCommentFilter filter, int operatorUserID, IEnumerable <Guid> excludeRoleIDs, int pageNumber, out int totalCount)
        {
            totalCount = 0;

            using (SqlQuery query = new SqlQuery())
            {
                query.Pager.TableName = "bx_Comments";
                query.Pager.SortField = filter.Order.ToString();
                if (filter.Order != AdminCommentFilter.OrderBy.CommentID)
                {
                    query.Pager.PrimaryKey = "CommentID";
                }
                query.Pager.IsDesc      = filter.IsDesc;
                query.Pager.PageNumber  = pageNumber;
                query.Pager.PageSize    = filter.PageSize;
                query.Pager.SelectCount = true;
                query.Pager.Condition   = BuildConditionsByFilter(query, filter, false, operatorUserID, excludeRoleIDs);


                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    CommentCollection comments = new CommentCollection(reader);
                    if (reader.NextResult())
                    {
                        while (reader.Read())
                        {
                            totalCount = reader.Get <int>(0);
                        }
                    }
                    return(comments);
                }
            }
        }
Пример #8
0
        public override CommentCollection GetCommentsBySearch(int operatorID, Guid[] excludeRoleIDs, AdminCommentFilter filter, int pageNumber)
        {
            using (SqlQuery query = new SqlQuery())
            {
                string conditions = BuildConditionsByFilter(query, filter, false, operatorID, excludeRoleIDs);

                query.Pager.TableName   = "[bx_Comments]";
                query.Pager.SortField   = filter.Order.ToString();
                query.Pager.IsDesc      = filter.IsDesc;
                query.Pager.PageNumber  = pageNumber;
                query.Pager.PageSize    = filter.PageSize;
                query.Pager.SelectCount = true;

                query.Pager.Condition = conditions.ToString();

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    CommentCollection comments = new CommentCollection(reader);

                    if (reader.NextResult())
                    {
                        if (reader.Read())
                        {
                            comments.TotalRecords = reader.Get <int>(0);
                        }
                    }

                    return(comments);
                }
            }
        }
Пример #9
0
        /// <summary>
        /// Updates the comments.
        /// </summary>
        private void UpdateComments()
        {
            if (InvokeRequired)
            {
                Invoke(new ThreadStart(UpdateComments));
                return;
            }

            ClearCommentsPanel();
            if (ImageViewer == null || ImageViewer.Image == null)
            {
                return;
            }
            CommentCollection comments = _commentController.GetComments(ImageViewer.Image);

            if (comments != _comments)
            {
                if (_comments != null)
                {
                    _comments.Changed -= Comments_Changed;
                }
                _comments = comments;
                if (comments != null)
                {
                    comments.Changed += Comments_Changed;
                    foreach (Comment comment in comments)
                    {
                        AddCommentControl(comment);
                    }
                }
            }
        }
Пример #10
0
		protected override void OnLoadComplete(EventArgs e)
		{
			int? uid = _Request.Get<int>("uid");
			int pageNumber = _Request.Get<int>("page", 1);

			m_CommentListPageSize = 20;

            if (uid != null)
            {
                if (_Request.IsClick("addcomment"))
                    AddComment(null, null, "boardform");
            }

			if (uid != null && BoardCanDisplay)
			{
				m_VisitorIsAdmin = CommentBO.Instance.ManagePermission.Can(My, BackendPermissions.ActionWithTarget.Manage_Comment, uid.Value);


				m_CommentList = CommentBO.Instance.GetComments(uid.Value, CommentType.Board, pageNumber, m_CommentListPageSize, true, out m_TotalCommentCount);

                WaitForFillSimpleUsers<Comment>(m_CommentList);

                SetPager("list", null, pageNumber, CommentListPageSize, TotalCommentCount);
			}
			else
			{
				m_CommentList = new CommentCollection();
			}

			base.OnLoadComplete(e);

        }
Пример #11
0
        private CommentCollection ReorderComments(CommentCollection _comments)
        {
            CommentCollection tempCol = new CommentCollection(_comments);

            tempCol.Sort(new CommentSorter());
            return(tempCol);
        }
Пример #12
0
        protected override async void SetById(long id)
        {
            var task1 = this._netWorkServices.GetAsync <Music>("Music", "GetMusicDetailById", new { id });
            var task2 = this._netWorkServices.GetAsync <List <Music> >("Music", "GetSimiMusic", new { id });
            var task3 = this._netWorkServices.GetAsync <CommentCollection>("Common", "GetCommentById", new { commentThreadId = $"R_SO_4_{id}" });
            var task4 = this._netWorkServices.GetAsync <List <Lyric> >("Music", "GetLyricByMusicId", new { id });
            var task5 = this._netWorkServices.GetAsync <PlayList[]>("Music", "GetSimiPlayList", new { id });
            await Task.WhenAll(task1, task2, task3, task4, task5);

            if (task1.Result.Successed &&
                task2.Result.Successed &&
                task3.Result.Successed &&
                task4.Result.Successed &&
                task5.Result.Successed)
            {
                this._innerMusic   = task1.Result.Data;
                this._innerComment = task3.Result.Data;
                await Task.WhenAll(
                    Artists.AddRangeAsync(this._innerMusic.Artists),
                    SimiMusics.AddRangeAsync(task2.Result.Data),
                    NewComments.AddRangeAsync(this._innerComment.Comments),
                    HotComments.AddRangeAsync(this._innerComment.HotComments),
                    Lryics.AddRangeAsync(task4.Result.Data),
                    ContainsThisTrackList.AddRangeAsync(task5.Result.Data));

                this._currentPage = 1;
                RaiseAllPropertyChanged();
            }
            else
            {
                //todo 提示信息
            }
        }
Пример #13
0
        public RssRoot GetEntryCommentsRss(string guid)
        {
            CommentCollection _com = dataService.GetPublicCommentsFor(guid);

            _com = ReorderComments(_com);
            return(GetCommentsRssCore(_com, guid));
        }
        public static void Run()
        {
            // ExStart:1
            //Source directory
            string sourceDir = RunExamples.Get_SourceDirectory();
            string outDir    = RunExamples.Get_OutputDirectory();

            Workbook workbook = new Workbook(sourceDir + "ThreadedCommentsSample.xlsx");

            //Access first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            CommentCollection comments = worksheet.Comments;

            // Get Author of first comment in A1
            ThreadedCommentAuthor author = worksheet.Comments.GetThreadedComments("A1")[0].Author;

            // Remove Comments in A1
            comments.RemoveAt("A1");

            ThreadedCommentAuthorCollection authors = workbook.Worksheets.ThreadedCommentAuthors;

            // Remove Author of first comment in A1
            authors.RemoveAt(authors.IndexOf(author));

            workbook.Save(outDir + "ThreadedCommentsSample_Out.xlsx");
            // ExEnd:1

            Console.WriteLine("RemoveThreadedComments executed successfully.");
        }
Пример #15
0
        public override CommentCollection GetCommentsBySearch(int operatorID, Guid[] excludeRoleIDs, AdminCommentFilter filter, int pageNumber)
        {
            using (SqlQuery query = new SqlQuery())
            {
                string conditions = BuildConditionsByFilter(query, filter, false, operatorID, excludeRoleIDs);

                query.Pager.TableName = "[bx_Comments]";
                query.Pager.SortField = filter.Order.ToString();
                query.Pager.IsDesc = filter.IsDesc;
                query.Pager.PageNumber = pageNumber;
                query.Pager.PageSize = filter.PageSize;
                query.Pager.SelectCount = true;

                query.Pager.Condition = conditions.ToString();

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    CommentCollection comments = new CommentCollection(reader);

                    if (reader.NextResult())
                    {
                        if (reader.Read())
                        {
                            comments.TotalRecords = reader.Get<int>(0);
                        }
                    }

                    return comments;
                }
            }
        }
        public string GetTotalCommentCount()
        {
            CommentCollection commentList = new CommentCollection();

            commentList.GetMulti(null);
            return(commentList.Count.ToString());
        }
Пример #17
0
 public void RemoveAnnotation(IAnnotation annotation)
 {
     removedAnnotation = annotation;
     removedIndex      = CommentCollection.IndexOf(annotation.Comments[0]);
     CommentCollection.Remove(annotation.Comments[0]);
     AnnotationCount = CommentCollection.Count.ToString();
 }
 public CustomAttribute(TypeReference?typeReference)
 {
     Arguments      = new CodeObjectCollection <CustomAttributeArgument>(this);
     CommentsBefore = new CommentCollection(this);
     CommentsAfter  = new CommentCollection(this);
     Type           = typeReference;
 }
Пример #19
0
        public CardContext(string id, TrelloAuthorization auth)
            : base(auth)
        {
            Data.Id = id;

            Actions                 = new ReadOnlyActionCollection(typeof(Card), () => Data.Id, auth);
            Actions.Refreshed      += (s, e) => OnMerged(new[] { nameof(Actions) });
            Attachments             = new AttachmentCollection(() => Data.Id, auth);
            Attachments.Refreshed  += (s, e) => OnMerged(new[] { nameof(Attachments) });
            CheckLists              = new CheckListCollection(() => Data.Id, auth);
            CheckLists.Refreshed   += (s, e) => OnMerged(new[] { nameof(CheckLists) });
            Comments                = new CommentCollection(() => Data.Id, auth);
            Comments.Refreshed     += (s, e) => OnMerged(new[] { nameof(Comments) });
            CustomFields            = new ReadOnlyCustomFieldCollection(() => Data.Id, auth);
            CustomFields.Refreshed += (s, e) => OnMerged(new[] { nameof(CustomFields) });
            Labels                   = new CardLabelCollection(this, auth);
            Labels.Refreshed        += (s, e) => OnMerged(new[] { nameof(Labels) });
            Members                  = new MemberCollection(() => Data.Id, auth);
            Members.Refreshed       += (s, e) => OnMerged(new[] { nameof(Members) });
            PowerUpData              = new ReadOnlyPowerUpDataCollection(EntityRequestType.Card_Read_PowerUpData, () => Data.Id, auth);
            PowerUpData.Refreshed   += (s, e) => OnMerged(new[] { nameof(PowerUpData) });
            Stickers                 = new CardStickerCollection(() => Data.Id, auth);
            Stickers.Refreshed      += (s, e) => OnMerged(new[] { nameof(Stickers) });
            VotingMembers            = new ReadOnlyMemberCollection(EntityRequestType.Card_Read_MembersVoted, () => Data.Id, auth);
            VotingMembers.Refreshed += (s, e) => OnMerged(new[] { nameof(VotingMembers) });

            BadgesContext = new BadgesContext(Auth);

            Data.Badges = BadgesContext.Data;
        }
 protected TypeDeclaration()
 {
     CustomAttributes = new CodeObjectCollection <CustomAttribute>(this);
     CommentsBefore   = new CommentCollection(this);
     CommentsAfter    = new CommentCollection(this);
     XmlComments      = new XmlCommentCollection(this);
 }
        public CommentCollection GetCommentList()
        {
            CommentCollection commentList = new CommentCollection();

            commentList.GetMulti(null);
            return(commentList);
        }
Пример #22
0
		public void Rebuild()
		{
			// get the lock
			fileLock.AcquireWriterLock(100);
			try
			{
				XmlSerializer x = new XmlSerializer(typeof(DayExtra));
				CommentCollection rebuiltCollection = new CommentCollection();
				DirectoryInfo di = new DirectoryInfo(this.contentBaseDirectory);
				foreach (FileInfo file in di.GetFiles("*dayfeedback.xml"))
				{
					using(FileStream fs = file.OpenRead())
					{
						DayExtra de = (DayExtra)x.Deserialize(fs);
						rebuiltCollection.AddRange(de.Comments);
					}
				}
				_commentCache = rebuiltCollection;
			} 
			catch(Exception e) 
			{
				// report error
				ErrorTrace.Trace(TraceLevel.Error,e);
			}
			finally
			{
				// release the lock
				fileLock.ReleaseWriterLock();
			}
		}
Пример #23
0
        public RssRoot GetCommentsRss()
        {
            CommentCollection _com = dataService.GetAllComments();

            _com = ReorderComments(_com);
            return(GetCommentsRssCore(_com));
        }
Пример #24
0
        public override CommentCollection GetCommentsByUserID(int userID, CommentType type, int pageNumber, int pageSize, out int totalCount)
        {
            totalCount = 0;
            string sqlCondition = "Type = @Type AND UserID = @UserID AND IsApproved = 1";

            using (SqlQuery query = new SqlQuery())
            {
                query.Pager.TableName    = "bx_Comments";
                query.Pager.Condition    = sqlCondition;
                query.Pager.SortField    = "CommentID";
                query.Pager.PageNumber   = pageNumber;
                query.Pager.PageSize     = pageSize;
                query.Pager.SelectCount  = true;
                query.Pager.ResultFields = "*";

                query.CreateParameter <int>("@UserID", userID, SqlDbType.Int);
                query.CreateParameter <int>("@Type", (int)type, SqlDbType.Int);

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    CommentCollection comments = new CommentCollection(reader);
                    if (reader.NextResult())
                    {
                        while (reader.Read())
                        {
                            totalCount = reader.Get <int>(0);
                        }
                    }
                    return(comments);
                }
            }
        }
        public async Task <IActionResult> PutCommentCollection([FromRoute] int id, [FromBody] CommentCollection commentCollection)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != commentCollection.Id)
            {
                return(BadRequest());
            }

            _context.Entry(commentCollection).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CommentCollectionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #26
0
 public CommentCollection FetchAll()
 {
     CommentCollection coll = new CommentCollection();
     Query qry = new Query(Comment.Schema);
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
Пример #27
0
        public void Load()
        {
            if (comments.Count > 0)
            {
                loaded = true;
            }
            if (loaded)
            {
                return;
            }

            if (BlogXData.Resolver != null)
            {
                string fullPath = BlogXData.ResolvePath(FileName);
                if (File.Exists(fullPath))
                {
                    XmlSerializer ser = new XmlSerializer(typeof(DayExtra));
                    using (StreamReader reader = new StreamReader(fullPath))
                    {
                        DayExtra e = (DayExtra)ser.Deserialize(reader);
                        this.comments = e.comments;
                    }
                }
            }
            loaded = true;
        }
Пример #28
0
 protected override void SetupDependencies()
 {
     connection.Get <Rest.Deserialization.Issue>(Arg.Any <GetIssueRequest>()).Returns(new DeserializedIssueMock());
     fileUrlCollection = new FileUrlCollection();
     commentCollection = new CommentCollection {
         Comments = new List <Rest.Deserialization.Comment>()
     };
 }
Пример #29
0
        private static CommentCollection CreateCommentsWrapper()
        {
            CommentCollection commentCollection = new CommentCollection();

            commentCollection.Comments = new List <Rest.Deserialization.Comment>();

            return(commentCollection);
        }
Пример #30
0
        public CustomAttributeArgument(string propertyName, Expression value)
        {
            CommentsBefore = new CommentCollection(this);
            CommentsAfter  = new CommentCollection(this);

            PropertyName = propertyName;
            Value        = value;
        }
Пример #31
0
 public Comment(string text, int id, int parentId, CommentCollection collection)
 {
     Id            = id;
     this.parentId = parentId;
     collection.Add(this);
     this.collection = collection;
     this.text       = text;
 }
Пример #32
0
        public void Import()
        {
            CommentImporter.Import(UserID, ContentDirectory, null);

            CommentCollection comments = DataService.GetAllComments();

            Assert.AreEqual(15, comments.Count);
        }
 protected MemberDeclaration(string name)
 {
     CustomAttributes = new CodeObjectCollection <CustomAttribute>(this);
     Implements       = new CodeObjectCollection <MemberReferenceExpression>(this);
     CommentsBefore   = new CommentCollection(this);
     CommentsAfter    = new CommentCollection(this);
     Name             = name;
 }
Пример #34
0
        private IEnumerable <IComment> GetComments()
        {
            GetCommentsOfAnIssueRequest request = new GetCommentsOfAnIssueRequest(Id);

            CommentCollection commentCollection = Connection.Get <CommentCollection>(request);

            return(commentCollection.GetComments(Connection));
        }
Пример #35
0
 public static void UpdateCommentsHostIDs()
 {
     //This iterates through each comment, updating its HostID (host id was added in SVN revision 226
     //NOTE: GJ: This will not perform well if there are thousands of comments
     CommentCollection comments = new CommentCollection();
     comments.Load(Comment.FetchAll());
     foreach (Comment comment in comments) {
         comment.HostID = comment.Story.HostID;
         comment.Save();
     }
 }
 public CommentsWindow(IServiceApi api, Tweet t)
 {
     twitterApi = api;
     tweet = t;
     InitializeComponent();
     comments = new CommentCollection();
     //HeadImage.Source = new BitmapImage(new Uri(tweet.User.ImageUrl)); ;
     TitleBar.DataContext = tweet;
     TweetText.DataContext = tweet;
     CommentsListBox.DataContext = comments;
     UpdateComments();
 }
Пример #37
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = Request.Url.ToString().Replace("default.aspx", "");
            string domain = url.Remove(url.IndexOf("/", url.IndexOf("//") + 3));

            target_link = domain + target_link;

            usercurr = Current_user;
            int.TryParse(Request.QueryString["cpg"], out page);
            objecttype = Request["objecttype"];
            long.TryParse(Request["objectid"], out objectID);

            //target_link = Request["targetlink"];
            //target_object_name = Request["targetobjectname"];

            objecttypeID = ObjectTypeID.get(objecttype);

            CC = CommentDA.SelectByObjectID(objectID,  pagesize, page);
            CC = CommentDA.getAllComment(CC);

            receiver = Current_user;
        }
 private CommentCollection ReorderComments(CommentCollection _comments)
 {
     CommentCollection tempCol = new CommentCollection( _comments );
     tempCol.Sort( new CommentSorter() );
     return tempCol;
 }
 private void UpdateComments()
 {
     CommentCollection newComments = new CommentCollection();
     newComments = twitterApi.RetriveComments(tweet);
     for (int i = newComments.Count - 1; i >= 0; i--)
     {
         Comment co = newComments[i];
         if (comments.Contains(co)) continue;
         comments.Add(co);
     }
 }
Пример #40
0
		public void SaveComments( CommentCollection comments ){
		}
Пример #41
0
 public static CommentCollection GetUserComments(int userID, int hostID, int pageNumber, int pageSize)
 {
     CommentCollection comments = new CommentCollection();
     comments.Load(SPs.Kick_GetPagedCommentsByUserIDAndHostID(userID, hostID, pageNumber, pageSize).GetReader());
     return comments;
 }
Пример #42
0
 public static DateTime GetLatestModifedCommentDateTime(IBlogDataService dataService, CommentCollection comments)
 {
     return SiteUtilities.GetLatestModifedCommentDateTime(dataService,comments);
 }
Пример #43
0
        /// <summary>
        /// Gets the post trackbacks from the specified postId
        /// </summary>
        /// <param name="PostId"></param>
        /// <returns></returns>
        public CommentCollection PostTrackbacks(int PostId)
        {
            CommentCollection cc = ZCache.Get<CommentCollection>("Trackbacks-" + PostId);
            if (cc == null)
            {
                cc = new CommentCollection();
                Query q = Comment.CreateQuery();
                q.AndWhere(Comment.Columns.PostId, PostId);
                q.AndWhere(Comment.Columns.IsPublished, true);
                q.AndWhere(Comment.Columns.IsDeleted, false);
                q.AndWhere(Comment.Columns.IsTrackback, true);
                q.OrderByAsc(Comment.Columns.Published);
                cc.LoadAndCloseReader(q.ExecuteReader());
                ZCache.InsertCache("Trackbacks-" + PostId, cc, 60);
            }

            return cc;
        }
Пример #44
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="targetID"></param>
        /// <param name="type"></param>
        /// <param name="getCount">取最新的前N条 和 最旧的一条</param>
        /// <param name="isGetAll"></param>
        /// <returns></returns>
        public override CommentCollection GetComments(int targetID, CommentType type, int getCount, bool isGetAll)
        {
            using (SqlQuery query = new SqlQuery())
            {
                if (isGetAll)
                {
                    query.CommandText = "SELECT * FROM [bx_Comments] WHERE Type = @Type AND TargetID = @TargetID AND IsApproved = 1 ORDER BY CommentID ASC;";
                }
                else
                {
                    query.CommandText = @"
SELECT TOP(@TopCount) * FROM [bx_Comments] WHERE Type = @Type AND TargetID = @TargetID AND IsApproved = 1 ORDER BY CommentID DESC;
SELECT TOP 1 * FROM [bx_Comments] WHERE Type = @Type AND TargetID = @TargetID ORDER BY CommentID ASC;
                ";
                    query.CreateTopParameter("@TopCount", getCount);
                }

                query.CreateParameter<int>("@TargetID", targetID, SqlDbType.Int);
                query.CreateParameter<int>("@Type", (int)type, SqlDbType.TinyInt);

                CommentCollection comments = new CommentCollection();

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    if (isGetAll)
                    {
                        while (reader.Read())
                        {
                            comments.Add(new Comment(reader));
                        }
                    }
                    else
                    {
                        while (reader.Read())
                        {
                            comments.Insert(0, new Comment(reader));
                        }
                        if (reader.NextResult())
                        {
                            while (reader.Read())
                            {
                                comments.Insert(0, new Comment(reader));
                            }
                        }
                    }
                    return comments;
                }
            }
        }
Пример #45
0
        internal void LoadDayExtra(string fullPath)
        {
            FileStream fileStream = FileUtils.OpenForRead(fullPath);
            if (fileStream != null)
            {
                try
                {
                    XmlSerializer ser = new XmlSerializer(typeof (DayExtra), Data.NamespaceURI);
                    using (StreamReader reader = new StreamReader(fileStream))
                    {
                        //XmlNamespaceUpgradeReader upg = new XmlNamespaceUpgradeReader(reader, "", Data.NamespaceURI);
                        DayExtra e = (DayExtra)ser.Deserialize(reader);
                        this._comments = e.Comments;
                        this._trackings = e.Trackings;
                    }
                }
                catch (Exception e)
                {
                    ErrorTrace.Trace(TraceLevel.Error, e);
                }
                finally
                {
                    fileStream.Close();
                }

                //RepairComments();
            }
        }
Пример #46
0
        public override CommentCollection GetComments(string discussionLink, int pageNumber)
        {
            if (!Config.Discussions.Current.Enabled || discussionLink == null || discussionLink.Trim() == "")
            {
                throw new DiscussionUnavailableException("Discussion unavailable.");
            }

            string pendingKey = discussionLink + "-p" + pageNumber.ToString();

            bool isPending = false;

            lock (pendingRequests)
            {
                if (pendingRequests.ContainsKey(pendingKey))
                {
                    isPending = true;
                }
                else
                {
                    pendingRequests.Add(pendingKey, DateTime.Now);
                }
            }

            if (isPending) throw new DiscussionUnavailableException("Discussion request pending");

            string directLink = discussionLink;
            if (pageNumber == 0)
            {
                pageNumber = 1;
            }
            CommentCollection comments = new CommentCollection();
            System.Xml.XmlDocument xml = new XmlDocument();
            discussionLink = discussionLink.Replace("&amp;", "&");
            discussionLink += "&xsl=xml&p=" + pageNumber;
            discussionLink += string.Format("&LOGIN_USERNAME={0}&LOGIN_PASSWORD={1}", this.SettingsCollection["LOGIN_USERNAME"], this.SettingsCollection["LOGIN_PASSWORD"]);
            discussionLink = Regex.Replace(discussionLink, "&r=\\d+", "");
            CommentCollection container = new CommentCollection();
            container.PageNumber = pageNumber;
            try
            {
                HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(discussionLink);
                req.Timeout = 5000;

                HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
                using (StreamReader stream = new StreamReader(resp.GetResponseStream()))
                {
                    xml.LoadXml(stream.ReadToEnd());
                }
                XmlNode pages = xml.SelectSingleNode("/page/pages");
                if (pages != null && pages.Attributes["total"] != null)
                {
                    container.Pages = int.Parse(pages.Attributes.GetNamedItem("total").Value);
                    container.PageNumber = int.Parse(pages.Attributes.GetNamedItem("current").Value);
                }
                else
                {
                    container.Pages = 1;
                }
                int loopcount = 0;
                XmlNode profileLinkNode = xml.SelectSingleNode("/page/info/community/profile");
                if (profileLinkNode == null)
                {
                    throw new DiscussionUnavailableException(string.Format("<a href=\"{0}\">Discussion in the Open Forum</a>", directLink));
                }
                string profileLink = xml.SelectSingleNode("/page/info/community/profile").Attributes.GetNamedItem("url").Value;
                profileLink += "?x_myspace_page=profile&u={0}";
                foreach (XmlNode comment in xml.SelectNodes("/page/content/topic/message"))
                {
                    if (loopcount++ == 0 && pageNumber == 1)
                    {
                        continue;
                    }
                    Comment c = new Comment();
                    c.PostDate = DateTime.ParseExact(comment.Attributes.GetNamedItem("date-ietf").Value, "ddd, dd MMM yyyy HH:mm:ss G\\MTzz00", CultureInfo.InvariantCulture);
                    c.Body = comment.SelectSingleNode("content/message-body").InnerText;
                    if (comment.SelectSingleNode("author/user") != null)
                    {
                        c.UserName = comment.SelectSingleNode("author/user").Attributes.GetNamedItem("name").Value;
                        c.UserLink = string.Format(profileLink, comment.SelectSingleNode("author/user").Attributes.GetNamedItem("oid").Value);
                    }
                    else if (comment.SelectSingleNode("author/guest") != null)
                    {
                        c.UserName = string.Format("&lt;{0}&gt;", comment.SelectSingleNode("author/guest").Attributes.GetNamedItem("name").Value);
                        c.UserLink = null;
                    }
                    container.Add(c);
                }
                if (container.Pages == 1)
                {
                    container.TotalCount = loopcount;
                }
                else
                {
                    int pageToGet = (container.PageNumber == container.Pages) ? 1 : container.Pages;
                    discussionLink = Regex.Replace(discussionLink, "&p=\\d+", "");
                    discussionLink += "&p=" + pageToGet;

                    req = (HttpWebRequest)HttpWebRequest.Create(discussionLink);
                    req.Timeout = 5000;

                    resp = (HttpWebResponse)req.GetResponse();
                    using (StreamReader stream = new StreamReader(resp.GetResponseStream()))
                    {
                        xml.LoadXml(stream.ReadToEnd());
                    }

                    XmlNodeList commentList = xml.SelectNodes("/page/content/topic/message");
                    if (commentList != null)
                    {
                        if (pageToGet == container.Pages)
                        {
                            container.TotalCount = loopcount * (container.Pages - 1) + commentList.Count;
                        }
                        else
                        {
                            container.TotalCount = commentList.Count * (container.Pages - 1) + loopcount;
                        }
                    }
                }
                container.TotalCount--;
                //container.PostFormLink = this.GetPostFormLink(discussionLink);

                pendingRequests.Remove(pendingKey);
            }
            catch (WebException wex)
            {
                pendingRequests.Remove(pendingKey);
                throw new DiscussionUnavailableException(string.Format("<a href=\"{0}\">Discussion in the Open Forum</a>", directLink), wex);
            }
            catch (XmlException xmlex)
            {
                pendingRequests.Remove(pendingKey);
                throw new DiscussionUnavailableException(string.Format("<a href=\"{0}\">Discussion in the Open Forum</a>", directLink), xmlex);
            }
            finally { pendingRequests.Remove(pendingKey); }
            return container;
        }
Пример #47
0
        public override CommentCollection GetComments(IEnumerable<int> commentIds)
        {
            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = "SELECT * FROM [bx_Comments] WHERE CommentID IN (@CommentIds);";

                query.CreateInParameter<int>("@CommentIds", commentIds);

                CommentCollection comments = new CommentCollection();

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        comments.Add(new Comment(reader));
                    }
                    return comments;
                }
            }
        }
Пример #48
0
        public override CommentCollection GetCommentsByFilter(AdminCommentFilter filter, int operatorUserID, IEnumerable<Guid> excludeRoleIDs, int pageNumber, out int totalCount)
        {
            totalCount = 0;

            using (SqlQuery query = new SqlQuery())
            {

                query.Pager.TableName = "bx_Comments";
                query.Pager.SortField = filter.Order.ToString();
                if (filter.Order != AdminCommentFilter.OrderBy.CommentID)
                    query.Pager.PrimaryKey = "CommentID";
                query.Pager.IsDesc = filter.IsDesc;
                query.Pager.PageNumber = pageNumber;
                query.Pager.PageSize = filter.PageSize;
                query.Pager.SelectCount = true;
                query.Pager.Condition = BuildConditionsByFilter(query, filter, false, operatorUserID, excludeRoleIDs);


                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    CommentCollection comments = new CommentCollection(reader);
                    if (reader.NextResult())
                    {
                        while (reader.Read())
                            totalCount = reader.Get<int>(0);
                    }
                    return comments;
                }
            }
        }
Пример #49
0
        public override CommentCollection GetCommentsByUserID(int userID, CommentType type, int pageNumber, int pageSize, out int totalCount)
        {
            totalCount = 0;
            string sqlCondition = "Type = @Type AND UserID = @UserID AND IsApproved = 1";

            using (SqlQuery query = new SqlQuery())
            {
                query.Pager.TableName = "bx_Comments";
                query.Pager.Condition = sqlCondition;
                query.Pager.SortField = "CommentID";
                query.Pager.PageNumber = pageNumber;
                query.Pager.PageSize = pageSize;
                query.Pager.SelectCount = true;
                query.Pager.ResultFields = "*";

                query.CreateParameter<int>("@UserID", userID, SqlDbType.Int);
                query.CreateParameter<int>("@Type", (int)type, SqlDbType.Int);

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    CommentCollection comments = new CommentCollection(reader);
                    if (reader.NextResult())
                    {
                        while (reader.Read())
                            totalCount = reader.Get<int>(0);
                    }
                    return comments;
                }
            }
        }
Пример #50
0
 public CommentCollection FetchByID(object Id)
 {
     CommentCollection coll = new CommentCollection().Where("ID", Id).Load();
     return coll;
 }
        private RssRoot GetCommentsRssCore(CommentCollection _com, string guid)
        {
            //Try to get out as soon as possible with as little CPU as possible
            if ( inASMX )
            {
                DateTime lastModified = SiteUtilities.GetLatestModifedCommentDateTime(dataService, _com);
                if (SiteUtilities.GetStatusNotModified(lastModified))
                    return null;
            }

            if ( inASMX )
            {
                string referrer = Context.Request.UrlReferrer!=null?Context.Request.UrlReferrer.AbsoluteUri:"";
                if (ReferralBlackList.IsBlockedReferrer(referrer) == false)
                {
                    loggingService.AddReferral(
                        new LogDataItem(
                        Context.Request.RawUrl,
                        referrer,
                        Context.Request.UserAgent,
                        Context.Request.UserHostName));
                }
            }

            // TODO: Figure out why this code is copied and pasted from above rather than using a function (shame!)
            RssRoot documentRoot = new RssRoot();
            RssChannel ch = new RssChannel();
            if (guid != null && guid != String.Empty)
            {
                //Set the title for this RSS Comments feed
                ch.Title = siteConfig.Title + " - Comments on " + dataService.GetEntry(guid).Title;
            }
            else
            {
                ch.Title = siteConfig.Title + " - Comments";
            }
            ch.Link = SiteUtilities.GetBaseUrl(siteConfig);
            ch.Copyright = siteConfig.Copyright;
            ch.ManagingEditor = siteConfig.Contact;
            ch.WebMaster = siteConfig.Contact;
            documentRoot.Channels.Add(ch);

            int i = 0;

            foreach (Comment c in _com)
            {
                ArrayList anyElements = new ArrayList();
                if (i == siteConfig.RssEntryCount) { break; }
                i++;
                string tempTitle = "";
                RssItem item = new RssItem();

                if(c.TargetTitle != null && c.TargetTitle.Length > 0 )
                {
                    tempTitle = " on \"" + c.TargetTitle + "\"";
                }

                if(c.Author == null || c.Author == "")
                {
                    item.Title = "Comment" + tempTitle;
                }
                else
                {
                    item.Title = "Comment by " + c.Author + tempTitle;
                }

                //Per the RSS Comments Spec it makes more sense for guid and link to be the same.
                // http://blogs.law.harvard.edu/tech/rss#comments
                // 11/11/05 - SDH - Now, I'm thinking not so much...
                item.Guid = new Rss20.Guid();
                item.Guid.Text = c.EntryId;
                item.Guid.IsPermaLink = false;
                item.Link = SiteUtilities.GetCommentViewUrl(siteConfig, c.TargetEntryId, c.EntryId);

                item.PubDate = c.CreatedUtc.ToString("R");

                item.Description = c.Content.Replace(Environment.NewLine, "<br />");
                if (c.AuthorHomepage == null || c.AuthorHomepage == "")
                {
                    if (c.AuthorEmail == null || c.AuthorEmail == "")
                    {
                        if(!(c.Author == null || c.Author == "") )
                        {
                            item.Description = c.Content.Replace(Environment.NewLine, "<br />") + "<br /><br />" + "Posted by: " + c.Author;
                        }
                    }
                    else
                    {
                        string content = c.Content.Replace(Environment.NewLine, "<br />");
                        if (!siteConfig.SupressEmailAddressDisplay)
                        {
                            item.Description = content + "<br /><br />" + "Posted by: " + "<a href=\"mailto:" + SiteUtilities.SpamBlocker(c.AuthorEmail) + "\">" + c.Author + "</a>";
                        }
                        else
                        {
                            item.Description = content + "<br /><br />" + "Posted by: " + c.Author;
                        }

                    }
                }
                else
                {
                    if (c.AuthorHomepage.IndexOf("http://") < 0)
                    {
                        c.AuthorHomepage = "http://" + c.AuthorHomepage;
                    }
                    item.Description += "<br /><br />" + "Posted by: " + "<a href=\"" + c.AuthorHomepage +
                        "\">" + c.Author + "</a>";
                }

                if (c.Author != null && c.Author.Length > 0 )
                {

                     	// the rss spec requires an email address in the author tag
                    // and it can not be obfuscated
                        // according to the feedvalidator
                    string email;

                    if ( !siteConfig.SupressEmailAddressDisplay )
                    {
                        email = (c.AuthorEmail != null && c.AuthorEmail.Length > 0 ? c.AuthorEmail : "*****@*****.**");
                    }
                    else
                    {
                        email = "*****@*****.**";
                    }

                    item.Author = String.Format( "{0} ({1})", email, c.Author);
                }

                item.Comments = SiteUtilities.GetCommentViewUrl(siteConfig,c.TargetEntryId,c.EntryId);

                if (ch.LastBuildDate == null || ch.LastBuildDate.Length == 0)
                {
                    ch.LastBuildDate = item.PubDate;
                }

                XmlDocument doc2 = new XmlDocument();
                try
                {
                    doc2.LoadXml(c.Content);
                    anyElements.Add( (XmlElement)doc2.SelectSingleNode("//*[local-name() = 'body'][namespace-uri()='http://www.w3.org/1999/xhtml']") );
                }
                catch
                {
                    // absorb
                }
                item.anyElements = (XmlElement[])anyElements.ToArray(typeof(XmlElement));
                ch.Items.Add(item);
            }

            return documentRoot;
        }
Пример #52
0
        CommentCollection InternalGetCommentsFor(string entryId, bool allComments)
        {

            CommentCollection commentsForEntry = new CommentCollection();
            DateTime date = GetDateForEntry(entryId);
            if (date == DateTime.MinValue)
                return commentsForEntry;

            DayExtra extra = data.GetDayExtra(date);
            foreach (Comment cm in extra.Comments)
            {

                // check if the comment is for this entry, and is public or allComments are requested
                if (String.Compare(cm.TargetEntryId, entryId, true, CultureInfo.InvariantCulture) == 0 && (cm.IsPublic || allComments))
                {
                    commentsForEntry.Add(cm);
                }
            }
            return commentsForEntry;
        }
Пример #53
0
        internal CommentCollection GetCommentsFor(string entryId, DataManager data)
        {
            Load(data);
            CommentCollection filtered = new CommentCollection();

            foreach (Comment c in Comments)
            {
                if (c.TargetEntryId.ToUpper() == entryId.ToUpper())
                {
                    filtered.Add(c);
                }
            }
            return filtered;
        }
Пример #54
0
 protected void Page_Load(object sender, EventArgs e)
 {
     listComment = CommentDA.SelectByObjectTypeObjID(objecttype,objectID, page, pagesize);
     listComment = CommentDA.getAllComment(listComment);
 }
 private RssRoot GetCommentsRssCore(CommentCollection _com)
 {
     return GetCommentsRssCore(_com,String.Empty);
 }
Пример #56
0
        protected CommentCollection GetComments(Share share)
        {
            if (CommentListTargetID != share.UserShareID)
                return share.CommentList;

            if (comments == null)
            {
                int count;
                comments = CommentBO.Instance.GetComments(share.UserShareID, CommentType.Share, CommentListPageNumber, CommentPageSize, false, out count);

                FillSimpleUsers<Comment>(comments);

                SetPager("commentlist", null, CommentListPageNumber, CommentPageSize, count);
            }

            return comments;
        }
Пример #57
0
        protected CommentCollection GetComments(Feed feed)
        {
            CommentCollection result;
            if (feedComments.TryGetValue(feed.ID, out result))
                return result;

            CommentType type = CommentBO.Instance.GetCommentType(feed.AppID, feed.ActionType);
            if (comments == null)
            {
                List<int> commentIDs = new List<int>();
                foreach (Feed tempFeed in FeedList)
                {
                    if (tempFeed.CommentIDs.Count == 0)
                        continue;

                    commentIDs.AddRange(tempFeed.CommentIDs);
                }

                CommentCollection temp = CommentBO.Instance.GetComments(commentIDs);

                CommentBO.Instance.ProcessKeyword(temp, ProcessKeywordMode.TryUpdateKeyword);

                WaitForFillSimpleUsers<Comment>(temp);

                comments = new Dictionary<CommentType, Dictionary<int, CommentCollection>>();

                foreach (Comment comment in temp)
                {
                    if (comment.IsApproved == false)
                        continue;

                    Dictionary<int, CommentCollection> tempComments;

                    if (comments.TryGetValue(comment.Type, out tempComments) == false)
                    {
                        tempComments = new Dictionary<int, CommentCollection>();
                        CommentCollection tempItems = new CommentCollection();
                        tempItems.Add(comment);
                        tempComments.Add(comment.TargetID, tempItems);
                        comments.Add(comment.Type, tempComments);
                    }
                    else
                    {
                        CommentCollection tempItems;
                        if (tempComments.TryGetValue(comment.TargetID, out tempItems) == false)
                        {
                            tempItems = new CommentCollection();
                            tempItems.Add(comment);
                            tempComments.Add(comment.TargetID, tempItems);
                        }
                        else
                        {
                            tempItems.Add(comment);
                        }
                    }
                }

            }

            if (feed.ID == CommentFeedID && GetCommentCount > DefaultGetCommentCount)
            {
                int count = GetCommentCount - DefaultGetCommentCount;
                result = CommentBO.Instance.GetComments(feed.CommentTargetID, type, count, feed.CommentCount <= count);
                WaitForFillSimpleUsers<Comment>(result);
                CommentBO.Instance.ProcessKeyword(result, ProcessKeywordMode.TryUpdateKeyword);
            }
            else
            {
                Dictionary<int, CommentCollection> resultDic;

                if (comments.TryGetValue(type, out resultDic))
                {
                    if (resultDic.TryGetValue(feed.CommentTargetID, out result) == false)
                        result = new CommentCollection();
                }
                else
                    result = new CommentCollection();
            }

            feedComments.Add(feed.ID, result);

            SubmitFillUsers();

            return result;
        }
Пример #58
0
        private bool IsNewTrackBack(int postId, string trackbackUrl)
        {
            CommentCollection trackbacks = new CommentCollection();
            Query q = Comment.CreateQuery();
            q.AndWhere(Comment.Columns.PostId, postId);
            q.AndWhere(Comment.Columns.IsDeleted, false);
            q.AndWhere(Comment.Columns.IsTrackback, true);
            q.OrderByAsc(Comment.Columns.Published);
            trackbacks.LoadAndCloseReader(q.ExecuteReader());

            foreach (Comment trackback in trackbacks)
            {
                if (string.Compare(trackbackUrl, trackback.WebSite, StringComparison.InvariantCultureIgnoreCase) == 0)
                {
                    return false;
                }
            }

            return true;
        }
Пример #59
0
        /// <summary>
        /// Gets the last x amount of comments from the specified category Id
        /// </summary>
        /// <param name="numberOfComments"></param>
        /// <param name="categoryId"></param>
        /// <returns></returns>
        public CommentCollection RecentComments(int numberOfComments, int categoryId)
        {
            CommentCollection cc = ZCache.Get<CommentCollection>("Comments-Recent-" + numberOfComments + "c:" + categoryId);
            if (cc == null)
            {
                cc = new CommentCollection();
                Query q = Comment.CreateQuery();
                q.AndWhere(Comment.Columns.IsDeleted, false);
                q.AndWhere(Comment.Columns.IsPublished, true);
                if (categoryId > 0)
                {
                    Category category = new CategoryController().GetCachedCategory(categoryId, true);
                    if (category != null)
                    {
                        if (category.ParentId > 0)
                            q.AndWhere(Post.Columns.CategoryId, categoryId);
                        else
                        {
                            List<int> ids = new List<int>(category.Children.Count + 1);
                            foreach (Category child in category.Children)
                                ids.Add(child.Id);

                            ids.Add(category.Id);

                            q.AndInWhere(Post.Columns.CategoryId, ids.ToArray());
                        }
                    }
                    else
                    {
                        //this should result in no data, but it will signal to
                        //the end user to edit/remove this widget
                        q.AndWhere(Post.Columns.CategoryId, categoryId);
                    }
                }
                q.Top = numberOfComments.ToString();
                q.OrderByDesc(Comment.Columns.Id);

                cc.LoadAndCloseReader(q.ExecuteReader());

                ZCache.InsertCache("Comments-Recent-" + numberOfComments + "c:" + categoryId, cc, 60);
            }

            return cc;
        }
Пример #60
0
 public CommentCollection FetchByQuery(Query qry)
 {
     CommentCollection coll = new CommentCollection();
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }