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


C# ForumTopic类代码示例

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


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

示例1: checkCreatorPermission

 private Boolean checkCreatorPermission( ForumTopic topic ) {
     if (topic.Creator.Id != ctx.viewer.Id) {
         echoText( alang( "exRewardSelfOnly" ) );
         return false;
     }
     return true;
 }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:7,代码来源:PostSaveController.cs

示例2: isTopicFound

        private static Boolean isTopicFound( List<StickyTopic> stickyList, ForumTopic ft ) {

            foreach (StickyTopic t in stickyList) {
                if (t.Id == ft.Id) return true;
            }
            return false;
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:7,代码来源:ForumStickyTopic.cs

示例3: Buy

        public virtual Result Buy( int buyerId, int creatorId, ForumTopic topic )
        {
            if (topic == null) throw new ArgumentNullException( "ForumBuyLogService.Buy" );

            Result result = new Result();
            if (topic.Price <= 0) {
                result.Add( "topic.price <=0" );
                return result;
            }

            if (incomeService.HasEnoughKeyIncome( buyerId, topic.Price ) == false) {
                result.Add( String.Format( alang.get( typeof( ForumApp ), "exIncome" ), KeyCurrency.Instance.Name ) );
                return result;
            }

            // 购买日志
            ForumBuyLog log = new ForumBuyLog();
            log.UserId = buyerId;
            log.TopicId = topic.Id;
            log.insert();

            String msg = string.Format( "访问需要购买的帖子 <a href=\"{0}\">{1}</a>", alink.ToAppData( topic ), topic.Title );
            incomeService.AddKeyIncome( buyerId, -topic.Price, msg );

            String msg2 = string.Format( "销售帖子 <a href=\"{0}\">{1}</a>", alink.ToAppData( topic ), topic.Title );
            incomeService.AddKeyIncome( creatorId, topic.Price, msg2 );

            return result;
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:29,代码来源:ForumBuyLogService.cs

示例4: Buy

        public virtual Result Buy( int buyerId, int creatorId, ForumTopic topic )
        {
            Result result = new Result();
            if (userIncomeService.HasEnoughKeyIncome( buyerId, topic.Price ) == false) {
                result.Add( String.Format( alang.get( typeof( ForumApp ), "exIncome" ), KeyCurrency.Instance.Name ) );
                return result;
            }

            // 日志:买方减少收入
            UserIncomeLog log = new UserIncomeLog();
            log.UserId = buyerId;
            log.CurrencyId = KeyCurrency.Instance.Id;
            log.Income = -topic.Price;
            log.DataId = topic.Id;
            log.ActionId = actionId;
            db.insert( log );

            // 日志:卖方增加收入
            UserIncomeLog log2 = new UserIncomeLog();
            log2.UserId = creatorId;
            log2.CurrencyId = KeyCurrency.Instance.Id;
            log2.Income = topic.Price;
            log2.DataId = topic.Id;
            log2.ActionId = actionId;
            db.insert( log2 );

            userIncomeService.AddKeyIncome( buyerId, -topic.Price );
            userIncomeService.AddKeyIncome( creatorId, topic.Price );

            return result;
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:31,代码来源:ForumBuyLogService.cs

示例5: boardError

 private Boolean boardError( ForumTopic topic ) {
     if (ctx.GetLong( "boardId" ) != topic.ForumBoard.Id) {
         echoRedirect( lang( "exNoPermission" ) + ": borad id error" );
         return true;
     }
     return false;
 }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:7,代码来源:PostController.cs

示例6: setCategory

 private void setCategory( ForumTopic topic, ForumBoard board ) {
     List<ForumCategory> categories = categoryService.GetByBoard( board.Id );
     if (categories.Count > 0) {
         categories.Insert( 0, new ForumCategory( 0, alang( "plsSelectCategory" ) ) );
         long categoryId = topic.Category == null ? 0 : topic.Category.Id;
         set( "post.Category", Html.DropList( categories, "CategoryId", "Name", "Id", categoryId ) );
     }
     else {
         set( "post.Category", string.Empty );
     }
 }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:11,代码来源:TopicController.cs

示例7: updatePost

        private static void updatePost( ForumTopic post ) {

            if (post.OwnerType != typeof( Site ).FullName) return;

            IMember owner = Site.Instance;
            int appId = post.AppId;

            IndexViewCacher.Update( owner, appId );
            BoardViewCacher.Update( owner, appId, post.ForumBoard.Id, 1 );
            RecentViewCacher.Update( owner, appId, "Topic" );

        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:12,代码来源:ForumInterceptor.cs

示例8: CreateByTemp

        public void CreateByTemp( String ids, ForumTopic topic )
        {
            int[] arrIds = cvt.ToIntArray( ids );
            if (arrIds.Length == 0) return;

            ForumTopicService topicService = new ForumTopicService();

            ForumPost post = topicService.GetPostByTopic( topic.Id );

            int attachmentCount = 0;
            foreach (int id in arrIds) {

                AttachmentTemp _temp = AttachmentTemp.findById( id );
                if (_temp == null) continue;

                Attachment a = new Attachment();

                a.AppId = _temp.AppId;
                a.Guid = _temp.Guid;

                a.FileSize = _temp.FileSize;
                a.Type = _temp.Type;
                a.Name = _temp.Name;

                a.Description = _temp.Description;
                a.ReadPermission = _temp.ReadPermission;
                a.Price = _temp.Price;

                a.TopicId = topic.Id;
                a.PostId = post.Id;

                a.OwnerId = topic.OwnerId;
                a.OwnerType = topic.OwnerType;
                a.OwnerUrl = topic.OwnerUrl;
                a.Creator = topic.Creator;
                a.CreatorUrl = topic.CreatorUrl;

                a.insert();

                _temp.delete();

                attachmentCount++;

            }

            if (attachmentCount > 0) {
                String msg = string.Format( "上传附件 <a href=\"{0}\">{1}</a>,获得奖励", alink.ToAppData( topic ), topic.Title );
                incomeService.AddIncome( topic.Creator, UserAction.Forum_AddAttachment.Id, msg );
            }

            topicService.UpdateAttachments( topic, attachmentCount );
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:52,代码来源:AttachmentService.cs

示例9: CreateByTemp

        public void CreateByTemp( String ids, ForumTopic topic )
        {
            int[] arrIds = cvt.ToIntArray( ids );
            if (arrIds.Length == 0) return;

            ForumTopicService topicService = new ForumTopicService();

            ForumPost post = topicService.GetPostByTopic( topic.Id );

            int attachmentCount = 0;
            foreach (int id in arrIds) {

                AttachmentTemp at = AttachmentTemp.findById( id );
                if (at == null) continue;

                Attachment a = new Attachment();

                a.AppId = at.AppId;
                a.Guid = at.Guid;

                a.FileSize = at.FileSize;
                a.Type = at.Type;
                a.Name = at.Name;

                a.Description = at.Description;
                a.ReadPermission = at.ReadPermission;
                a.Price = at.Price;

                a.TopicId = topic.Id;
                a.PostId = post.Id;

                a.OwnerId = topic.OwnerId;
                a.OwnerType = topic.OwnerType;
                a.OwnerUrl = topic.OwnerUrl;
                a.Creator = topic.Creator;
                a.CreatorUrl = topic.CreatorUrl;

                a.insert();

                at.delete();

                attachmentCount++;

            }

            topicService.UpdateAttachments( topic, attachmentCount );
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:47,代码来源:AttachmentService.cs

示例10: addPost

    //adds a new post to db
    public bool addPost(string postTitle, string firstComment, string username)
    {
        ForumDAO dataLayer = new ForumDAO();
        ForumTopic topic = new ForumTopic();
        topic.createdBy = username;
        topic.createdOnDate = DateTime.Now;
        topic.title = postTitle;
        int topicID = dataLayer.createNewTopic(topic);

        Comment comment = new Comment();
        comment.comment = firstComment;
        comment.username = username;
        comment.createdOnDate = DateTime.Now;
        comment.forumTopic = topicID;
        bool success = dataLayer.addComment(comment);

        return success;
    }
开发者ID:craig-smith,项目名称:CISSeniorProjectTest,代码行数:19,代码来源:Forums.cs

示例11: getAllTopics

    /**
     * this mehtod load all fourm topics
     * */
    public List<ForumTopic> getAllTopics()
    {
        List<ForumTopic> topics = new List<ForumTopic>();
        String database = System.Configuration.ConfigurationManager.ConnectionStrings["programaholics_anonymous_databaseConnectionString"].ConnectionString;
        using (OleDbConnection sqlConn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + database))
        {
            try
            {

                String query = "SELECT * FROM [forum_topic] ORDER BY [createdOnDate]";
                OleDbDataAdapter adapter = new OleDbDataAdapter(query, sqlConn);
                ForumTopicDataSet ds = new ForumTopicDataSet();
                adapter.Fill(ds, "forum_topic");
                DataTable table = ds.Tables["forum_topic"];

                for (int i = 0; i < table.Rows.Count; i++)
                {
                    ForumTopic topic = new ForumTopic();
                    DataRow currentRow = table.Rows[i];
                    topic.ID = Convert.ToInt32(currentRow["ID"]);
                    topic.title = currentRow["title"].ToString();
                    topic.createdBy = currentRow["createdBy"].ToString();
                    topic.createdOnDate = DateTime.Parse(currentRow["createdOnDate"].ToString());

                    topics.Add(topic);
                }

            }
            catch (OleDbException ex)
            {

            }
            finally
            {
                sqlConn.Close();

            }
            return topics;
        }
    }
开发者ID:craig-smith,项目名称:CISSeniorProjectTest,代码行数:43,代码来源:ForumDAO.cs

示例12: bindTopicOne

        private void bindTopicOne( IBlock block, ForumTopic topic ) {

            String typeImg = string.Empty;
            if (strUtil.HasText( topic.TypeName )) {
                typeImg = string.Format( "<img src='{0}apps/forum/{1}.gif'>", sys.Path.Skin, topic.TypeName );
            }

            block.Set( "p.Id", topic.Id );
            block.Set( "p.TypeImg", typeImg );
            block.Set( "p.TitleStyle", topic.TitleStyle );
            block.Set( "p.Titile", topic.Title );
            block.Set( "p.Author", topic.Creator.Name );

            block.Set( "p.Url", Link.To( topic.OwnerType, topic.OwnerUrl, new TopicController().Show, topic.Id, topic.AppId ) );

            block.Set( "p.Created", topic.Created );
            block.Set( "p.ReplyCount", topic.Replies );
            block.Set( "p.Hits", topic.Hits.ToString() );

            String attachments = topic.Attachments > 0 ? "<img src='" + sys.Path.Img + "attachment.gif'/>" : "";
            block.Set( "p.Attachments", attachments );

            block.Next();
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:24,代码来源:SearchController.cs

示例13: bindFormNew

        private void bindFormNew( ForumTopic topic, ForumPost lastPost, IBlock formBlock )
        {
            User user = ctx.viewer.obj as User;
            if (strUtil.HasText( user.Pic )) {
                formBlock.Set( "currentUser", "<img src=\"" + user.PicMedium + "\"/>" );
            }
            else {
                formBlock.Set( "currentUser", user.Name );
            }

            formBlock.Set( "post.ReplyActionUrl", Link.To( new Users.PostController().Create ) + "?boardId=" + topic.ForumBoard.Id );
            formBlock.Set( "post.ReplyTitle", "re:" + topic.Title );
            formBlock.Set( "post.TopicId", topic.Id );
            formBlock.Set( "post.ParentId", lastPost.Id );
            formBlock.Set( "forumBoard.Id", topic.ForumBoard.Id );

            Editor ed = Editor.NewOne( "Content", "", "150px", sys.Path.Editor, MvcConfig.Instance.JsVersion, Editor.ToolbarType.Basic );
            ed.AddUploadUrl( ctx );

            formBlock.Set( "Editor", ed );
            formBlock.Next();
        }
开发者ID:robin88,项目名称:wojilu,代码行数:22,代码来源:TopicController.cs

示例14: checkIsLockPrivate

 private Boolean checkIsLockPrivate( ForumTopic topic ) {
     if (topic.IsLocked == 1) {
         echoRedirect( alang( "exLockTip" ) );
         return false;
     }
     return true;
 }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:7,代码来源:PostController.cs

示例15: bindRewardInfo

        private void bindRewardInfo( ForumTopic topic ) {

            List<ForumBoard> pathboards = getTree().GetPath( topic.ForumBoard.Id );
            set( "location", ForumLocationUtil.GetSetReward( pathboards, topic, ctx ) );

            int rewardAvailable = topic.RewardAvailable;

            set( "currency.Name", KeyCurrency.Instance.Name );
            set( "post.Reward", topic.Reward );
            set( "post.RewardSetted", topic.Reward - rewardAvailable );
            set( "post.RewardAvailable", rewardAvailable );

            String rewardInfo = string.Format( alang( "rewardInfo" ), (topic.Reward - rewardAvailable), rewardAvailable );
            set( "rewardInfo", rewardInfo );
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:15,代码来源:PostController.cs


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