当前位置: 首页>>代码示例>>C#>>正文


C# ContentPost.insert方法代码示例

本文整理汇总了C#中ContentPost.insert方法的典型用法代码示例。如果您正苦于以下问题:C# ContentPost.insert方法的具体用法?C# ContentPost.insert怎么用?C# ContentPost.insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContentPost的用法示例。


在下文中一共展示了ContentPost.insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Insert

        public virtual void Insert( ContentPost post, string sectionIds, string tagList )
        {
            int[] ids = cvt.ToIntArray( sectionIds );
            if (ids.Length == 0) throw new ArgumentException( "sectionIds" );

            // 保存
            post.PageSection = new ContentSection { Id = ids[0] }; // 缓存Section
            post.insert();

            // 多对多处理
            ContentPostSection ps = new ContentPostSection();
            foreach (int sectionId in ids) {
                ContentSection section = new ContentSection();
                section.Id = sectionId;
                ps.Post = post;
                ps.Section = section;
                ps.insert();
            }

            // tag
            post.Tag.Save( tagList );
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:22,代码来源:ContentPostService.cs

示例2: createPost

        protected void createPost( ContentSection s, String title, String titleHome, String content, String imgUrl, String videoUrl, int categoryId, int width, int height )
        {
            IMember o = this.owner;
            User u = this.user;

            ContentPost p = new ContentPost();

            p.OwnerId = o.Id;
            p.OwnerType = o.GetType().FullName;
            p.OwnerUrl = o.Url;

            p.Creator = u;
            p.CreatorUrl = u.Url;

            p.AppId = s.AppId;
            p.PageSection = s;

            p.Author = "作者";

            p.Title = title;
            p.Content = content;
            p.TitleHome = titleHome;

            p.ImgLink = imgUrl;
            p.SourceLink = videoUrl;

            if (strUtil.HasText( videoUrl )) {
                p.CategoryId = PostCategory.Video;
                p.TypeName = typeof( ContentVideo ).FullName;
                p.Width = 290;
                p.Height = 235;
            }
            else if (strUtil.HasText( imgUrl )) {

                if (categoryId > 0)
                    p.CategoryId = categoryId;
                else
                    p.CategoryId = PostCategory.Img;

                //if (isBigImg) {
                //    p.Width = 290;
                //    p.Height = 210;
                //}
                //else {
                //    p.Width = 120;
                //    p.Height = 90;
                //}

                p.Width = width;
                p.Height = height;
            }

            p.insert();
        }
开发者ID:robin88,项目名称:wojilu,代码行数:54,代码来源:CmsInstallerBase.cs

示例3: importDirect

        private static int importDirect( SpiderArticle art, SpiderImport item, ContentSection section, ContentApp app )
        {
            ContentPost post = new ContentPost();
            post.Title = art.Title;
            post.Content = art.Body;

            if (art.IsPic == 1) {
                post.CategoryId = PostCategory.Img;
                post.ImgLink = art.PicUrl;
            }

            post.SourceLink = art.Url;

            post.Creator = item.Creator;
            post.CreatorUrl = item.Creator.Url;
            post.PageSection = section;
            post.OwnerId = app.OwnerId;
            post.OwnerType = app.OwnerType;
            post.OwnerUrl = app.OwnerUrl;
            post.AppId = app.Id;

            post.insert();
            return post.Id;
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:24,代码来源:ImportUtil.cs

示例4: Insert

        public virtual void Insert( ContentPost post, string sectionIds, string tagList )
        {
            int[] ids = cvt.ToIntArray( sectionIds );

            post.PageSection = new ContentSection(); // ����ʹ�þɰ�һ�Զ��ϵ
            post.PageSection.Id = ids[0];
            post.insert();

            // ��Զദ��
            ContentPostSection ps = new ContentPostSection();
            foreach (int sectionId in ids) {

                ContentSection section = new ContentSection();
                section.Id = sectionId;

                ps.Post = post;
                ps.Section = section;
                ps.insert();
            }

            // �ɰ�һ�Զ���ݴ���
            foreach (int sectionId in ids) {
                updateCachePostIds( sectionId );
            }

            post.Tag.Save( tagList );
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:27,代码来源:ContentPostService.cs


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