Пример #1
0
        private static Merger GetMerger( FeedView feed, FeedView target ) {

            if ( strUtil.Equals( feed.TitleTemplate, target.TitleTemplate )
                && strUtil.Equals( feed.TitleData, target.TitleData )
                && strUtil.Equals( feed.BodyTemplate, target.BodyTemplate )
                && strUtil.Equals( feed.BodyData, target.BodyData )
                && strUtil.Equals( feed.BodyGeneral, target.BodyGeneral )) {
                return new CreatorMerger( feed, target );
            }

            if (feed.Creator == null || target.Creator == null) return new NoMerger();
            if (feed.Creator.Id != target.Creator.Id) return new NoMerger();
            if (feed.TitleTemplate.Equals( target.TitleTemplate ) == false) return new NoMerger();
            if (feed.BodyTemplate.Equals( target.BodyTemplate ) == false) return new NoMerger();

            if (feed.DataType.Equals( typeof( Share ).FullName )) return new NoMerger();
                 

            if (strUtil.Equals( feed.TitleData, target.TitleData ) == false && strUtil.Equals( feed.BodyData, target.BodyData ) == false) return new NoMerger();

            // 依次合并
            if (strUtil.Equals( feed.TitleData, target.TitleData ) && strUtil.Equals( feed.BodyData, target.BodyData )) return new CommentMerger( feed, target );
            if (strUtil.Equals( feed.TitleData, target.TitleData ) == false) return new TitleMerger( feed, target );
            if (strUtil.Equals( feed.BodyData, target.BodyData ) == false) return new BodyMerger( feed, target );


            return new NoMerger();

        }
Пример #2
0
        private static Merger GetMerger(FeedView feed, FeedView target)
        {
            if (strUtil.Equals(feed.TitleTemplate, target.TitleTemplate) &&
                strUtil.Equals(feed.TitleData, target.TitleData) &&
                strUtil.Equals(feed.BodyTemplate, target.BodyTemplate) &&
                strUtil.Equals(feed.BodyData, target.BodyData) &&
                strUtil.Equals(feed.BodyGeneral, target.BodyGeneral))
            {
                return(new CreatorMerger(feed, target));
            }

            if (feed.Creator == null || target.Creator == null)
            {
                return(new NoMerger());
            }
            if (feed.Creator.Id != target.Creator.Id)
            {
                return(new NoMerger());
            }
            if (feed.TitleTemplate.Equals(target.TitleTemplate) == false)
            {
                return(new NoMerger());
            }
            if (feed.BodyTemplate.Equals(target.BodyTemplate) == false)
            {
                return(new NoMerger());
            }

            if (feed.DataType.Equals(typeof(Share).FullName))
            {
                return(new NoMerger());
            }


            if (strUtil.Equals(feed.TitleData, target.TitleData) == false && strUtil.Equals(feed.BodyData, target.BodyData) == false)
            {
                return(new NoMerger());
            }

            // 依次合并
            if (strUtil.Equals(feed.TitleData, target.TitleData) && strUtil.Equals(feed.BodyData, target.BodyData))
            {
                return(new CommentMerger(feed, target));
            }
            if (strUtil.Equals(feed.TitleData, target.TitleData) == false)
            {
                return(new TitleMerger(feed, target));
            }
            if (strUtil.Equals(feed.BodyData, target.BodyData) == false)
            {
                return(new BodyMerger(feed, target));
            }


            return(new NoMerger());
        }
Пример #3
0
        private static Boolean mergeFeedOne( FeedView feed, List<FeedView> results )
        {
            foreach (FeedView target in results) {

                Boolean isMerged = Merger.Merge( feed, target );
                if (isMerged) return true;
            }

            return false;
        }
Пример #4
0
        private static Boolean mergeFeedOne(FeedView feed, List <FeedView> results)
        {
            foreach (FeedView target in results)
            {
                Boolean isMerged = Merger.Merge(feed, target);
                if (isMerged)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #5
0
        private static FeedView getView( Feed f )
        {
            FeedView v = new FeedView();
            v.Id = f.Id;
            v.TitleData = f.TitleData;
            v.TitleTemplate = f.TitleTemplate;
            v.BodyData = f.BodyData;
            v.BodyTemplate = f.BodyTemplate;
            v.BodyGeneral = f.BodyGeneral;

            v.Creator = f.Creator;
            v.DataId = f.DataId;
            v.DataType = f.DataType;

            v.Replies = f.Replies;
            v.Created = f.Created;

            return v;
        }
Пример #6
0
        private static FeedView getView(Feed f)
        {
            FeedView v = new FeedView();

            v.Id            = f.Id;
            v.TitleData     = f.TitleData;
            v.TitleTemplate = f.TitleTemplate;
            v.BodyData      = f.BodyData;
            v.BodyTemplate  = f.BodyTemplate;
            v.BodyGeneral   = f.BodyGeneral;

            v.Creator  = f.Creator;
            v.DataId   = f.DataId;
            v.DataType = f.DataType;

            v.Replies = f.Replies;
            v.Created = f.Created;

            return(v);
        }
Пример #7
0
        private void bindOneFeed( IBlock block, FeedView feed )
        {
            block.Set( "feed.Id", feed.Id );
            block.Set( "feed.DataType", feed.DataType );
            block.Set( "feed.UserFace", feed.Creator.PicSmall );
            block.Set( "feed.UserLink", Link.ToMember( feed.Creator ) );

            String creatorInfo = getCreatorInfos( feed.CreatorList );
            String feedTitle = feedService.GetHtmlValue( feed.TitleTemplate, feed.TitleData, creatorInfo );
            block.Set( "feed.Title", feedTitle );

            String commentCmd = getCommentCmd( feed );
            block.Set( "feed.CommentCmd", commentCmd );

            String feedBody = feedService.GetHtmlValue( feed.BodyTemplate, feed.BodyData, creatorInfo );
            block.Set( "feed.Body", feedBody );
            block.Set( "feed.BodyGeneral", getComment( feed.BodyGeneral ) );

            String created = "";
            if (cvt.IsDayEqual( feed.Created, DateTime.Now )) created = cvt.ToTimeString( feed.Created );
            block.Set( "feed.Created", created );
        }
Пример #8
0
        private String getCommentCmd( FeedView feed )
        {
            return "";
            //if (!feed.CanComment) return "";

            //ControllerBase controller = ControllerFactory.FindFeedCommentsController( feed.DataType, ctx );
            //if (controller == null) return "";

            //String commentsLink = "";
            //if (feed.DataType.Equals( typeof( Share ).FullName )) {
            //    commentsLink = Link.To( ctx.owner.obj, controller.GetType(), "Show", feed.DataId );
            //}
            //else {
            //    commentsLink = Link.To( feed.Creator, controller.GetType(), "Show", feed.DataId );
            //}
            //commentsLink += "?parentPanelId=" + feed.Id;

            //String lbl = lang( "comment" );
            //String c = feed.Replies > 0 ? lbl + "(" + feed.Replies + ")" : lbl;
            //return string.Format( "<span class=\"frmUpdate link\" href=\"{0}\" loadTo=\"commentList{1}\" txtHidden=\"{2}\">{3}</span>", commentsLink, feed.Id, lang( "hideComment" ), c );
        }
Пример #9
0
 public BodyMerger(FeedView feed, FeedView target)
     : base(feed, target)
 {
 }
Пример #10
0
 public Merger(FeedView feed, FeedView target)
 {
     this.feed   = feed;
     this.target = target;
 }
Пример #11
0
 public TitleMerger( FeedView feed, FeedView target )
     : base(feed, target)
 {
 }
Пример #12
0
 public static Boolean Merge(FeedView feed, FeedView target)
 {
     return(GetMerger(feed, target).Merge(  ));
 }
Пример #13
0
 public static Boolean Merge( FeedView feed, FeedView target ) {
     return GetMerger( feed, target ).Merge(  );
 }
Пример #14
0
 public TitleMerger(FeedView feed, FeedView target)
     : base(feed, target)
 {
 }
Пример #15
0
 public BodyMerger( FeedView feed, FeedView target )
     : base(feed, target)
 {
 }
Пример #16
0
 public CommentMerger(FeedView feed, FeedView target)
     : base(feed, target)
 {
 }
Пример #17
0
 public CreatorMerger(FeedView feed, FeedView target)
     : base(feed, target)
 {
 }
Пример #18
0
 public Merger( FeedView feed, FeedView target ) {
     this.feed = feed;
     this.target = target;
 }
Пример #19
0
 public CommentMerger( FeedView feed, FeedView target )
     : base( feed, target ) {
 }
Пример #20
0
 public CreatorMerger( FeedView feed, FeedView target )
     : base(feed, target)
 {
 }