Esempio n. 1
0
        public virtual void Insert( Microblog blog, int i )
        {
            String rcontent = blog.Content;

            MicroblogBinder smbinder = new MicroblogBinder();

            MicroblogParser mp = new MicroblogParser( blog.Content, smbinder );
            mp.Process();

            blog.Content = mp.ToString();

            blog.Content = processEmotions( blog.Content );

            Result result = blog.insert();

            if( i==0 ) {

                // ����tag
                TagService.SaveDataTag( blog, mp.GetTagList() );

                // ��֪ͨ
                addNotification( smbinder.GetValidUsers(), blog );
            }

            // ת����Ҫˢ��ԭ����ת����
            if (blog.ParentId > 0) {
                Microblog parent = GetById( blog.ParentId );
                if (parent != null) {
                    parent.Reposts = Microblog.count( "ParentId=" + parent.Id );
                    parent.update( "Reposts" );
                }
            }

            if (result.IsValid) addFeedInfo( blog );
        }
Esempio n. 2
0
        public virtual void Insert( Microblog blog, int i )
        {
            String rcontent = blog.Content;

            MicroblogBinder smbinder = new MicroblogBinder();

            //�ȱ���ԭʼ��content��ͬ��΢����Ҫ
            string statusText = blog.Content;

            MicroblogParser mp = new MicroblogParser( blog.Content, smbinder );
            mp.Process();

            blog.Content = mp.ToString();

            blog.Content = processEmotions( blog.Content );

            Result result = blog.insert();

            if( i==0 ) {

                // ����tag
                TagService.SaveDataTag( blog, mp.GetTagList() );

                // ��֪ͨ
                addNotification( smbinder.GetValidUsers(), blog );
            }

            // ת����Ҫˢ��ԭ����ת����
            if (blog.ParentId > 0) {
                Microblog parent = GetById( blog.ParentId );
                if (parent != null) {
                    parent.Reposts = Microblog.count( "ParentId=" + parent.Id );
                    parent.update( "Reposts" );
                }
            }

            if (result.IsValid) {
                addFeedInfo(blog);
                //�������ת����΢���Ǿ�ͬ��
                if (blog.ParentId == 0)
                {
                    string picUrl = string.IsNullOrEmpty(blog.PicOriginal) ? null : PathHelper.Map(blog.PicOriginal);
                    if (string.IsNullOrEmpty(picUrl))
                        MicroblogSyncManager.Instance.Sync(blog.User, statusText);
                    else
                        MicroblogSyncManager.Instance.SyncWithPic(blog.User, statusText, picUrl);
                }
            }
        }