Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int threadID = _Request.Get <int>("threadID", Method.Get, 0);

            if (threadID < 1)
            {
                ShowError(new InvalidParamError("threadID").Message);
            }

            thread = PostBOV5.Instance.GetThread(threadID);
            if (thread == null)
            {
                ShowError("该主题不存在或者已被删除!");
            }

            ForumPermissionSetNode permission = AllSettings.Current.ForumPermissionSet.Nodes.GetPermission(thread.ForumID);

            if (thread.PostUserID != MyUserID && (!permission.Can(My, ForumPermissionSetNode.Action.AlwaysViewContents)))
            {
                if (!thread.IsBuyed(My))
                {
                    ShowError("您还没有购买此主题,不能查看购买记录!");
                }
            }

            TradePoint = ForumPointAction.Instance.GetUserPoint(thread.PostUserID, ForumPointValueType.SellThread, thread.ForumID);

            int pageNumber = _Request.Get <int>("page", Method.Get, 1);

            ExchangeList = PostBOV5.Instance.GetThreadExchanges(threadID, pageNumber, pageSize, out totalCount, out totalMoney);

            WaitForFillSimpleUsers <ThreadExchange>(ExchangeList);

            SetPager("list", null, pageNumber, pageSize, totalCount);
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int threadID = _Request.Get<int>("threadID", Method.Get, 0);

            if (threadID < 1)
                ShowError(new InvalidParamError("threadID").Message);

            thread = PostBOV5.Instance.GetThread(threadID);
            if (thread == null)
                ShowError("该主题不存在或者已被删除!");

            ForumPermissionSetNode permission = AllSettings.Current.ForumPermissionSet.Nodes.GetPermission(thread.ForumID);
            if (thread.PostUserID != MyUserID && (!permission.Can(My, ForumPermissionSetNode.Action.AlwaysViewContents)))
            {
                if (!thread.IsBuyed(My))
                {
                    ShowError("您还没有购买此主题,不能查看购买记录!");
                }
            }

            TradePoint = ForumPointAction.Instance.GetUserPoint(thread.PostUserID, ForumPointValueType.SellThread, thread.ForumID);

            int pageNumber = _Request.Get<int>("page",Method.Get,1);

            ExchangeList = PostBOV5.Instance.GetThreadExchanges(threadID, pageNumber, pageSize, out totalCount, out totalMoney);

            WaitForFillSimpleUsers<ThreadExchange>(ExchangeList);

            SetPager("list", null, pageNumber, pageSize, totalCount);
        }
Esempio n. 3
0
        private void ProcessDownload3(HttpContext context, BasicThread thread, PostV5 post, int diskFileID)
        {
            Forum forum = ForumBO.Instance.GetForum(post.ForumID);
            ForumPermissionSetNode permission = AllSettings.Current.ForumPermissionSet.Nodes.GetPermission(post.ForumID);

            if (false == permission.Can(userID, ForumPermissionSetNode.Action.ViewAttachment) && attachment.UserID != userID)
            {
                ShowErrorMessage(context, "您没有权限下载附件!", "您没有权限下载附件.gif");
                return;
            }

            if (!AlwaysViewContents(forum, post.UserID) && attachment.UserID != userID)//检查是否是出售的帖子
            {
                AuthUser user  = User.Current;
                bool     isBuy = false;
                if (user.BuyedThreads.TryGetValue(post.ThreadID, out isBuy))//缓存中获取
                {
                }
                if (!isBuy)
                {
                    if (thread.Price > 0)
                    {
                        if (post.PostType == MaxLabs.bbsMax.Enums.PostType.ThreadContent)
                        {
                            if (false == post.IsFreeDiskFileID(diskFileID) && false == post.IsFreeAttachmentID(attachment.AttachmentID))
                            {
                                if (!thread.IsOverSellDays(forum.ForumSetting) && !thread.IsBuyed(user))
                                {
                                    Context.ThrowError <CustomError>(new CustomError("error", "该附件所在的帖子需要购买,您还没有购买该帖子没有权限下载附件!"));
                                    return;
                                    //Bbs3Globals.ShowError("error", "该附件所在的帖子需要购买,您还没有购买该帖子没有权限下载附件!", 0);
                                }
                            }
                        }
                    }
                }
            }

            if (CheckPermission(forum.ForumSetting) || AlwaysViewContents(forum, attachment.UserID))
            {
                if (false == OutputFileByID(context, attachment.FileID, attachment.FileName, attachment.FileType, outputMode))
                {
                    ShowErrorMessage(context, "该附件不存在,可能被移动或被删除!", "文件不存在.gif");
                }
            }
            else
            {
                ShowErrorMessage(context, "你还没有购买此附件,不能下载!", "needpay.gif");
            }
        }
Esempio n. 4
0
        private void ProcessDownload3(HttpContext context, BasicThread thread, PostV5 post,int diskFileID)
        {
            Forum forum = ForumBO.Instance.GetForum(post.ForumID);
            ForumPermissionSetNode permission = AllSettings.Current.ForumPermissionSet.Nodes.GetPermission(post.ForumID);

            if (false == permission.Can(userID,ForumPermissionSetNode.Action.ViewAttachment) && attachment.UserID != userID)
            {
                ShowErrorMessage(context, "您没有权限下载附件!", "您没有权限下载附件.gif");
                return;
            }

            if (!AlwaysViewContents(forum, post.UserID) && attachment.UserID != userID)//检查是否是出售的帖子
            {
                AuthUser user = User.Current;
                bool isBuy = false;
                if (user.BuyedThreads.TryGetValue(post.ThreadID, out isBuy))//缓存中获取
                {
                }
                if (!isBuy)
                {
                    if (thread.Price > 0)
                    {
                        if (post.PostType == MaxLabs.bbsMax.Enums.PostType.ThreadContent)
                        {
                            if (false == post.IsFreeDiskFileID(diskFileID) && false == post.IsFreeAttachmentID(attachment.AttachmentID))
                            {
                                if (!thread.IsOverSellDays(forum.ForumSetting) && !thread.IsBuyed(user))
                                {
                                    Context.ThrowError<CustomError>(new CustomError("error", "该附件所在的帖子需要购买,您还没有购买该帖子没有权限下载附件!"));
                                    return;
                                    //Bbs3Globals.ShowError("error", "该附件所在的帖子需要购买,您还没有购买该帖子没有权限下载附件!", 0);
                                }
                            }
                        }
                    }
                }

            }

            if (CheckPermission(forum.ForumSetting) || AlwaysViewContents(forum, attachment.UserID))
            {
                if (false == OutputFileByID(context, attachment.FileID, attachment.FileName, attachment.FileType, outputMode))
                {
                    ShowErrorMessage(context, "该附件不存在,可能被移动或被删除!", "文件不存在.gif");
                }

            }
            else
            {
                ShowErrorMessage(context, "你还没有购买此附件,不能下载!", "needpay.gif");
            }
        }
Esempio n. 5
0
 private static string ProcessFreeTag(string content, BasicThread thread, Forum forum)
 {
     AuthUser user = User.Current;
     if (user.UserID == thread.PostUserID || thread.IsOverSellDays(forum.ForumSetting) || thread.IsBuyed(user) || (AllSettings.Current.ForumPermissionSet.Nodes.GetPermission(forum.ForumID).Can(user, ForumPermissionSetNode.Action.AlwaysViewContents)))
         content = regex_free.Replace(content, string.Format(freeStyle, "$1"));
     else
     {
         content = ProcessFreeTag(content,thread.IsBuyed(user));
     }
     return content;
 }
Esempio n. 6
0
        private void ProcessBuyThread()
        {
            BasicThread thread = PostBOV5.Instance.GetThread(threadID);

            bool success;

            if (IsLogin == false)
            {
                ShowError("您还没有登陆,不能购买!");
            }
            else if (thread.Price < 1)
            {
                ShowError("该主题不需要购买");
            }
            else if (thread.PostUserID == MyUserID)
            {
                ShowError("自己的主题不需要购买");
            }
            else if (thread.IsBuyed(My))
            {
                ShowError("您已经购买过该主题");
            }
            else
            {
                UserPoint tradePoint = ForumPointAction.Instance.GetUserPoint(thread.PostUserID, ForumPointValueType.SellThread, thread.ForumID);
                if (tradePoint == null)
                {
                    ShowError("系统没有设置交易积分!");
                }

                using (ErrorScope es = new ErrorScope())
                {
                    success = UserBO.Instance.TradePoint(MyUserID, thread.PostUserID, thread.Price, tradePoint.Type, false, true, null);
                    if (success == false)
                    {
                        es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                        {
                            if (error is UserPointOverMinValueError)
                            {
                                UserPointOverMinValueError tempError            = (UserPointOverMinValueError)error;
                                NotEnoughPointBuyThread notEnoughPointBuyThread = new NotEnoughPointBuyThread("", tempError.UserPoint, thread.Price, My.ExtendedPoints[(int)tempError.UserPoint.Type]);
                                ShowError(notEnoughPointBuyThread);
                            }
                            else
                            {
                                ShowError(error.Message);
                            }
                        });
                    }
                    else
                    {
                        try
                        {
                            success = PostBOV5.Instance.CreateThreadExchange(thread.ThreadID, MyUserID, thread.Price);
                            if (success)
                            {
                                PostBOV5.Instance.SetThreadBuyedInCache(My, threadID, true);
                            }
                            else
                            {
                                ShowError("创建交易记录失败!");
                            }
                        }
                        catch (Exception ex)
                        {
                            ShowError(ex.Message);
                        }
                    }

                    if (success)
                    {
                        ShowSuccess("购买成功!", true);
                    }
                }
            }
        }
Esempio n. 7
0
        private void ProcessDownload(HttpContext context, string fileID)
        {
            PostV5 post  = PostBOV5.Instance.GetPost(attachment.PostID, false);
            Forum  forum = ForumBO.Instance.GetForum(post.ForumID);

            ForumPermissionSetNode permission = AllSettings.Current.ForumPermissionSet.Nodes.GetPermission(post.ForumID);

            //if (!forum.Permission.ViewAttachment && attachment.UserID != userID)
            if (false == permission.Can(userID, ForumPermissionSetNode.Action.ViewAttachment) && attachment.UserID != userID)
            {
                ShowErrorMessage(context, "您没有权限下载附件!", "您没有权限下载附件.gif");
                return;
            }

            if (!AlwaysViewContents(forum, post.UserID) && attachment.UserID != userID)//检查是否是出售的帖子
            {
                AuthUser user  = User.Current;
                bool     isBuy = false;
                if (user.BuyedThreads.TryGetValue(post.ThreadID, out isBuy))//缓存中获取
                {
                }
                if (!isBuy)
                {
                    BasicThread thread = PostBOV5.Instance.GetThread(post.ThreadID);
                    if (thread.Price > 0)
                    {
                        //Post firstPost = PostManager.GetThreadFirstPost(thread.ThreadID);
                        //if (firstPost != null && firstPost.PostID == post.PostID)//附件所在的帖子是主题的内容
                        if (post.PostType == MaxLabs.bbsMax.Enums.PostType.ThreadContent)
                        {
                            //if (!firstPost.FreeAttachmentIDs.Contains(attachment.AttachmentID))//attachment.DiskFileID))//不在[free]标签中
                            if (false == post.IsFreeAttachmentID(attachment.AttachmentID))
                            {
                                if (!thread.IsOverSellDays(forum.ForumSetting) && !thread.IsBuyed(user))
                                {
                                    Context.ThrowError <CustomError>(new CustomError("error", "该附件所在的帖子需要购买,您还没有购买该帖子,没有权限下载附件!"));
                                    //Bbs3Globals.ShowError("error", "该附件所在的帖子需要购买,您还没有购买该帖子没有权限下载附件!", 0);
                                    return;
                                }
                            }
                        }
                    }
                }
            }

            if (CheckPermission(forum.ForumSetting) || AlwaysViewContents(forum, attachment.UserID))
            {
                //if (!IOUtil.DownloadFile(context.Response, context.Request, filePath, attachment.FileName, true, false))
                if (false == OutputFileByID(context, fileID, attachment.FileName, attachment.FileType, outputMode))
                {
                    ShowErrorMessage(context, "该附件不存在,可能被移动或被删除!", "文件不存在.gif");
                    return;
                }
            }
            else
            {
                ShowErrorMessage(context, "你还没有购买此附件,不能下载!", "needpay.gif");
                return;
            }

            context.Response.End();
        }