• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Microblog类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microblog的典型用法代码示例。如果您正苦于以下问题:C# Microblog类的具体用法?C# Microblog怎么用?C# Microblog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Microblog类属于命名空间,在下文中一共展示了Microblog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: bindUserInfo

        private static void bindUserInfo( IBlock block, MvcContext ctx, Microblog blog, Boolean showUserFace )
        {
            IBlock ufBlock = block.GetBlock( "userFace" );
            if (showUserFace) {

                ufBlock.Set( "blog.UserName", blog.User.Name );
                ufBlock.Set( "blog.UserFace", blog.User.PicSmall );

                if (ctx.GetItemString( "_showType" ) == "microblog") {
                    ufBlock.Set( "blog.UserLink", alink.ToUserMicroblog( blog.User ) );
                    ufBlock.Set( "userNameInfo", string.Format( "<a href=\"{0}\">{1}</a>", alink.ToUserMicroblog( blog.User ), blog.User.Name ) );
                }
                else {
                    ufBlock.Set( "blog.UserLink", Link.ToMember( blog.User ) );
                    ufBlock.Set( "userNameInfo", string.Format( "<a href=\"{0}\">{1}</a>", Link.ToMember( blog.User ), blog.User.Name ) );
                }

                String deleteCmd = getDeleteCmd( ctx, blog );
                ufBlock.Set( "blog.DeleteCmd", deleteCmd );

                ufBlock.Next();

                if (ctx.GetItemString( "_showType" ) == "microblog") {
                    block.Set( "userNameInfo", string.Format( "<a href=\"{0}\">{1}</a>", alink.ToUserMicroblog( blog.User ), blog.User.Name ) );
                }
                else {
                    block.Set( "userNameInfo", string.Format( "<a href=\"{0}\">{1}</a>", Link.ToMember( blog.User ), blog.User.Name ) );
                }

            }
            else {
                block.Set( "userNameInfo", "" );
            }
        }
开发者ID:KDF5000,项目名称:wojilu,代码行数:34,代码来源:MicroblogController.cs


示例2: DeleteSys

        //------------------------------------------------------------------------------------------
        public virtual void DeleteSys( Microblog blog )
        {
            if (blog == null) throw new ArgumentNullException( "blog" );

            blog.SaveStatus = SaveStatus.SysDelete;
            blog.delete();
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:8,代码来源:SysMicroblogService.cs


示例3: CancelFavorite

        public void CancelFavorite( int userId, Microblog blog )
        {
            MicroblogFavorite f = MicroblogFavorite.find( "UserId=" + userId + " and MicroblogId=" + blog.Id ).first();
            if (f == null) return;

            f.delete();
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:7,代码来源:MicroblogFavoriteService.cs


示例4: hasFavorite

 private bool hasFavorite( Microblog blog, List<MicroblogFavorite> mfs )
 {
     foreach (MicroblogFavorite mf in mfs) {
         if (mf.Microblog.Id == blog.Id) return true;
     }
     return false;
 }
开发者ID:Boshin,项目名称:wojilu,代码行数:7,代码来源:MicroblogFavoriteService.cs


示例5: SaveFavorite

        public void SaveFavorite( int userId, Microblog blog )
        {
            MicroblogFavorite f = MicroblogFavorite.find( "UserId=" + userId + " and MicroblogId=" + blog.Id ).first();
            if (f != null) return;

            MicroblogFavorite mf = new MicroblogFavorite();
            mf.UserId = userId;
            mf.Microblog = blog;
            mf.insert();
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:10,代码来源:MicroblogFavoriteService.cs


示例6: bindPicInfo

 private static void bindPicInfo( IBlock block, Microblog blog )
 {
     IBlock picBlock = block.GetBlock( "pic" );
     if (strUtil.HasText( blog.Pic )) {
         picBlock.Set( "blog.PicSmall", blog.PicSmall );
         picBlock.Set( "blog.PicMedium", blog.PicMedium );
         picBlock.Set( "blog.PicOriginal", blog.PicOriginal );
         picBlock.Next();
     }
 }
开发者ID:robin88,项目名称:wojilu,代码行数:10,代码来源:MicroblogController.cs


示例7: Add

        public virtual void Add( User creator, String msg, String dataType, int dataId, String ip )
        {
            Microblog x = new Microblog();
            x.User = creator;
            x.Content = msg;
            x.Ip = ip;

            x.DataType = dataType;
            x.DataId = dataId;

            this.Insert( x, 0 );
        }
开发者ID:NOTHEN,项目名称:wojilu,代码行数:12,代码来源:MicroblogService.cs


示例8: AddSimple

        /// <summary>
        /// 纯粹插入数据库,不检查表情、at用户、不处理tag;不处理转发
        /// </summary>
        /// <param name="creator"></param>
        /// <param name="msg"></param>
        /// <param name="dataType"></param>
        /// <param name="dataId"></param>
        /// <param name="ip"></param>
        public virtual void AddSimple(User creator, string msg, string dataType, long dataId, string ip)
        {
            Microblog x = new Microblog();
            x.User = creator;
            x.Content = msg;
            x.Ip = ip;

            x.DataType = dataType;
            x.DataId = dataId;

            x.insert();
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:20,代码来源:MicroblogService.cs


示例9: bindVideoInfo

        private static void bindVideoInfo( IBlock block, Microblog blog )
        {
            IBlock vBlock = block.GetBlock( "video" );
            if (strUtil.HasText( blog.FlashUrl )) {

                String vpic = strUtil.HasText( blog.PicUrl ) ? blog.PicUrl : strUtil.Join( sys.Path.Img, "/big/novideopic.png" );

                vBlock.Set( "blog.FlashPic", vpic );
                vBlock.Set( "blog.Flash", wojilu.Web.Utils.WebHelper.GetFlash( blog.FlashUrl, 450, 340 ) );
                vBlock.Set( "blog.FlashPageUrl", blog.PageUrl );
                vBlock.Next();
            }
        }
开发者ID:robin88,项目名称:wojilu,代码行数:13,代码来源:MicroblogController.cs


示例10: getBlog

        private Microblog getBlog( User creator, String content, int i )
        {
            Microblog x = new Microblog();

            x.Creator = creator;
            x.Content = content;
            logger.Info( x.Content );

            if (i % 2 == 1 && i > 0) {
                // 发布一篇图片微博
                x.Pic = Img.CopyToUploadPath( "/__installer/pic/pic" + i + ".jpg" );
            }

            return x;
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:15,代码来源:MicroblogInstaller.cs


示例11: bindUserInfo

        private static void bindUserInfo( IBlock block, Microblog blog, Boolean showUserFace )
        {
            IBlock ufBlock = block.GetBlock( "userFace" );
            if (showUserFace) {

                ufBlock.Set( "blog.UserName", blog.User.Name );
                ufBlock.Set( "blog.UserFace", blog.User.PicSmall );
                ufBlock.Set( "blog.UserLink", alink.ToUserMicroblog( blog.User ) );

                ufBlock.Next();

                block.Set( "userNameInfo", string.Format( "<a href=\"{0}\">{1}</a>: ", alink.ToUserMicroblog( blog.User ), blog.User.Name ) );
            }
            else {
                block.Set( "userNameInfo", "" );
            }
        }
开发者ID:robin88,项目名称:wojilu,代码行数:17,代码来源:MicroblogController.cs


示例12: Create

        public void Create()
        {
            if (Component.IsClose( typeof( MicroblogApp ) )) {
                content( "对不起,微博功能暂停运行" );
                return;
            }

            String blogContent = ctx.Post( "Content" );
            if (strUtil.IsNullOrEmpty( blogContent )) {
                content( lang( "exContent" ) );
                return;
            }

            String picUrl = ctx.Post( "PicUrl" );

            User user = ctx.viewer.obj as User;

            Microblog blog = new Microblog();
            blog.Content = blogContent;
            blog.Ip = ctx.Ip;
            blog.User = user;
            blog.Pic = picUrl;

            setVideoInfo( blog );

            microblogService.Insert( blog );

            String srcType = ctx.Post( "srcType" );

            if ("shareBox".Equals( srcType )) {
                returnCloseBox();
            }
            else if ("mbHome".Equals( srcType )) {
                returnOneBlogHtml( blog );
            }
            else {
                echoRedirect( "ok", to( new My.MicroblogController().Home ) );
            }
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:39,代码来源:MicroblogSaveController.cs


示例13: saveComment

        private void saveComment( Microblog tblog, String content )
        {
            MicroblogComment c = new MicroblogComment();
            c.Root = tblog;
            c.Content = content;
            c.User = ctx.viewer.obj as User;
            c.Ip = ctx.Ip;

            commentService.InsertComment( c, to( new MicroblogController().Show, tblog.Id ) );
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:10,代码来源:MicroblogController.cs


示例14: addFeedInfo

        private void addFeedInfo( Microblog log )
        {
            Feed feed = new Feed();
            feed.Creator = log.User;
            feed.DataType = typeof( Microblog ).FullName;
            feed.DataId = log.Id;

            // ת��΢����Ϣ
            String pbody = "";
            if (log.ParentId > 0) {
                Microblog parent = GetById( log.ParentId );
                if (parent == null) {
                    pbody = " [��ת΢���ѱ�ԭ����ɾ��]";
                }
                else {
                    pbody = ": [ת]" + parent.Content;
                }
            }

            feed.TitleTemplate = "{*actor*} :" + strUtil.SubString( log.Content + pbody, 230 );

            if (strUtil.HasText( log.Pic )) {

                Dictionary<String, String> data = new Dictionary<string, string>();
                data.Add( "pic", "<img src=\"" + log.PicSmall + "\" />" );

                feed.BodyTemplate = "{*pic*}";
                feed.BodyData = JsonString.ConvertDictionary( data );
            }

            feedService.publishUserAction( feed );
        }
开发者ID:robin88,项目名称:wojilu,代码行数:32,代码来源:MicroblogService.cs


示例15: addNotification

        private void addNotification( List<User> users, Microblog blog )
        {
            // ��@�û���֪ͨ
            foreach (User u in users) {

                //String msg = string.Format( "��΢���ᵽ����:<a href=\"{0}\">{1}</a>", lnk, strUtil.ParseHtml( blog.Content, 30 ) );
                //nfService.send( u.Id, msg );

                MicroblogAt mat = new MicroblogAt();
                mat.Microblog = blog;
                mat.User = u;
                mat.insert();

                u.MicroblogAt++;
                u.update( "MicroblogAt" );

                u.MicroblogAtUnread++;
                u.update( "MicroblogAtUnread" );

            }
        }
开发者ID:robin88,项目名称:wojilu,代码行数:21,代码来源:MicroblogService.cs


示例16: Insert

        //--------------------------------------
        //public virtual void InsertBig( Microblog blog ) {
        //    List<String> arrContent = strUtil.SplitByNum( blog.Content, config.Instance.Site.MicroblogContentMax );
        //    for (int i = 0; i < arrContent.Count; i++) {
        //        saveMicroblogOther( blog, arrContent, i );
        //    }
        //}
        //private void saveMicroblogOther( Microblog ob, List<String> arrContent, int i ) {
        //    Microblog blog = new Microblog();
        //    if (arrContent.Count > 1) {
        //        blog.Content = "(" + (i + 1) + ")" + arrContent[i];
        //    }
        //    else {
        //        blog.Content = arrContent[i];
        //    }
        //    if (i == 0) {
        //        blog.Pic = ob.Pic;
        //        blog.FlashUrl = ob.FlashUrl;
        //        blog.PageUrl = ob.PageUrl;
        //        blog.PicUrl = ob.PicUrl;
        //    }
        //    blog.Ip = ob.Ip;
        //    blog.User = ob.User;
        //    Insert( blog, i );
        //}
        public virtual void Insert( Microblog blog )
        {
            blog.Content = strUtil.SubString( blog.Content, config.Instance.Site.MicroblogContentMax );

            Insert( blog, 0 );
        }
开发者ID:robin88,项目名称:wojilu,代码行数:31,代码来源:MicroblogService.cs


示例17: getParentId

 private int getParentId( Microblog tblog )
 {
     if (tblog.ParentId <= 0) return tblog.Id;
     return tblog.ParentId;
 }
开发者ID:Boshin,项目名称:wojilu,代码行数:5,代码来源:MicroblogController.cs


示例18: bindVideoInfo

        private void bindVideoInfo( IBlock block, Microblog blog )
        {
            IBlock vBlock = block.GetBlock( "video" );
            if (strUtil.HasText( blog.FlashUrl )) {

                String vpic = strUtil.HasText( blog.PicUrl ) ? blog.PicUrl : strUtil.Join( sys.Path.Img, "/big/novideopic.png" );

                vBlock.Set( "blog.FlashPic", vpic );
                vBlock.Set( "blog.ShowLink", MbLink.ToShowFeed( blog.User, blog.Id ) );

                vBlock.Next();
            }
        }
开发者ID:happyYao,项目名称:wojilu,代码行数:13,代码来源:MainController.cs


示例19: DeleteTrue

 public virtual void DeleteTrue( Microblog blog )
 {
     blog.delete();
 }
开发者ID:Boshin,项目名称:wojilu,代码行数:4,代码来源:SysMicroblogService.cs


示例20: bindOne

        //--------------------------------------------------------------------------------------------------
        private void bindOne( IBlock block, Microblog blog, Boolean isFavorite, Boolean showUserFace )
        {
            block.Set( "blog.Id", blog.Id );
            block.Set( "blog.Created", blog.Created );

            if (ctx.GetItemString( "_showType" ) == "microblog") {
                block.Set( "blog.ShowLink", MbLink.ToShowMicroblog( blog.User, blog.Id ) );
            }
            else {
                block.Set( "blog.ShowLink", MbLink.ToShowFeed( blog.User, blog.Id ) );
            }

            block.Set( "blog.Content", getBlogContent( blog ) );

            bindUserInfo( block, ctx, blog, showUserFace ); // 用户信息
            bindRepost( block, blog ); // 转发信息
            bindPicInfo( block, blog ); // 图片信息
            bindVideoInfo( block, blog ); // 视频信息

            // 评论数
            block.Set( "blog.StrReplies", blog.Replies == 0 ? "" : string.Format( "<span class=\"feed-replies\">(<span class=\"feed-replies-num\" id=\"renum{1}\">{0}</span>)</span>", blog.Replies, blog.Id ) );

            block.Set( "blog.StrLikes", blog.Likes == 0 ? "" : string.Format( "<span class=\"feed-likes\">(<span class=\"feed-likes-num\">{0}</span>)</span>", blog.Likes ) );
            block.Set( "blog.SaveLikeLink", to( SaveLike, blog.Id ) );

            // 转发数
            String reposts = blog.Reposts > 0 ? "(" + blog.Reposts + ")" : "";
            block.Set( "blog.Reposts", reposts );

            block.Set( "blog.CommentsLink", getCommentUrl( blog ) );
            block.Set( "blog.ForwardUrl", to( Forward, blog.Id ) );
            block.Set( "blog.FavoriteCmd", getFavoriteCmd( blog, isFavorite ) ); // 收藏命令

            // 删除命令
            String deleteCmd = getDeleteCmd( ctx, blog );
            block.Set( "blog.DeleteCmd", deleteCmd );
        }
开发者ID:NOTHEN,项目名称:wojilu,代码行数:38,代码来源:MicroblogController.cs



注:本文中的Microblog类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Microservice_Endpoint_Protocol_Enum类代码示例发布时间:2022-05-24
下一篇:
C# Miaow类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap