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

C# ForumTopic类代码示例

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

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



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


示例16: getRewardInfo

 private String getRewardInfo( ForumTopic topic, String rewardInfo ) {
     if (topic.RewardAvailable == 0) {
         rewardInfo = "(" + alang( "resolved" ) + ")";
     }
     else {
         rewardInfo = string.Format( "({0}{1})", topic.Reward, KeyCurrency.Instance.Unit );
     }
     if (DateTime.Now.Subtract( topic.Created ).Days >= ForumConfig.Instance.QuestionExpiryDay) {
     }
     return rewardInfo;
 }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:11,代码来源:RecentController.cs


示例17: bindTopicOne

        private void bindTopicOne( IBlock block, ForumTopic topic ) {

            if (topic.ForumBoard == null) return;
            if (topic.Creator == null) return;

            String rewardInfo = string.Empty;
            if (topic.Reward > 0) rewardInfo = getRewardInfo( topic, rewardInfo );

            String lblCategory = string.Empty;
            if (topic.Category != null && topic.Category.Id > 0) {
                String lnkCategory = to( new BoardController().Category, topic.ForumBoard.Id ) + "?categoryId=" + topic.Category.Id;
                lblCategory = string.Format( "<a href='{0}'>[<span style=\"color:{2}\">{1}]</span></a>&nbsp;", lnkCategory, topic.Category.Name, topic.Category.NameColor );
            }

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

            String priceInfo = string.Empty;
            if (topic.Price > 0) {
                priceInfo = alang( "price" ) + " :" + topic.Price + " ";
            }

            String permissionInfo = string.Empty;
            if (topic.ReadPermission > 0) {
                permissionInfo = alang( "readPermission" ) + ":" + topic.ReadPermission + "";
            }

            block.Set( "p.Id", topic.Id );
            block.Set( "p.Category", lblCategory );
            block.Set( "p.TypeImg", typeImg );
            block.Set( "p.Reward", rewardInfo );
            block.Set( "p.Price", priceInfo );
            block.Set( "p.ReadPermission", permissionInfo );
            block.Set( "p.TitleStyle", topic.TitleStyle );
            block.Set( "p.Titile", strUtil.CutString( topic.Title, 30 ) );
            block.Set( "p.Url", to( new TopicController().Show, topic.Id ) );

            block.Set( "p.BoardName", topic.ForumBoard.Name );
            block.Set( "p.BoardLink", alink.ToAppData(topic.ForumBoard) );


            block.Set( "p.MemberName", topic.Creator.Name );
            block.Set( "p.MemberUrl", toUser( topic.Creator ) );
            block.Set( "p.CreateTime", topic.Created );
            block.Set( "p.ReplyCount", topic.Replies );
            block.Set( "p.Hits", topic.Hits.ToString() );
            block.Set( "p.LastUpdate", topic.Replied.GetDateTimeFormats( 'g' )[0] );
            block.Set( "p.LastReplyUrl", toUser( topic.RepliedUserFriendUrl ) );
            block.Set( "p.LastReplyName", topic.RepliedUserName );

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

            String statusImg;

            if (topic.IsLocked == 1)
                statusImg = sys.Path.Skin + "apps/forum/lock.gif";
            else if (topic.IsPicked == 1)
                statusImg = sys.Path.Skin + "apps/forum/pick.gif";
            else
                statusImg = sys.Path.Skin + "apps/forum/topic.gif";

            block.Set( "postStatusImage", statusImg );
            block.Next();
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:67,代码来源:RecentController.cs


示例18: SaveTopic

    private int SaveTopic( ForumTopic item )
    {
        int rowsAffected = 0;
        try
        {
            Session["CurrentObject"] = item.Save();
            rowsAffected = 1;
        }
        catch ( Csla.Validation.ValidationException ex )
        {
            System.Text.StringBuilder message = new System.Text.StringBuilder();
            message.AppendFormat( "{0}<br/>", ex.Message );
            if ( item.BrokenRulesCollection.Count == 1 )
                message.AppendFormat( "* {0}: {1}", item.BrokenRulesCollection[0].Property, item.BrokenRulesCollection[0].Description );
            else
                foreach ( Csla.Validation.BrokenRule rule in item.BrokenRulesCollection )
                    message.AppendFormat( "* {0}: {1}<br/>", rule.Property, rule.Description );

            PostError.Visible = true;
            PostError.Text = message.ToString();
            rowsAffected = 0;
        }
        catch ( Csla.DataPortalException ex )
        {
            PostError.Visible = true;
            PostError.Text = ex.BusinessException.Message;
            rowsAffected = 0;
        }
        catch ( Exception ex )
        {
            PostError.Visible = true;
            PostError.Text = ex.Message;
            rowsAffected = 0;
        }
        return rowsAffected;
    }
开发者ID:TertiumQuid,项目名称:Aphelion-Trigger,代码行数:36,代码来源:ForumTopic.aspx.cs


示例19: haveReadPermission

 private Boolean haveReadPermission( ForumTopic topic )
 {
     if (ctx.viewer.IsLogin == false) return false;
     if (ctx.viewer.Id == topic.Creator.Id) return true;
     int permission = incomeService.GetUserIncome( ctx.viewer.Id, Currency.ReadPermission().Id ).Income;
     return permission >= topic.ReadPermission;
 }
开发者ID:robin88,项目名称:wojilu,代码行数:7,代码来源:TopicController.cs


示例20: forwardToPre

 private void forwardToPre( ForumTopic topic )
 {
     ForumTopic next = topicService.GetNext( topic );
     if (next == null) {
         echoRedirect( alang( "exLastTopic" ) );
     }
     else {
         redirect( Show, next.Id );
     }
 }
开发者ID:robin88,项目名称:wojilu,代码行数:10,代码来源:TopicController.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Foundation类代码示例发布时间:2022-05-24
下一篇:
C# ForumPost类代码示例发布时间: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