Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_Request.IsClick("btn_delete"))
            {
                string[] denouncingIDs = _Request.Get("denouncingIDs", Method.Post, string.Empty).Split(',');

                if (denouncingIDs[0] != string.Empty)
                {
                    int[] ids = ParseIntArray(denouncingIDs);

                    DenouncingBO.Instance.DeleteDenouncings(MyUserID, ids);
                }
                string filter = _Request.Get("filter");

                if (filter != null)
                {
                    BbsRouter.JumpToCurrentUrl(true, "filter=" + HttpUtility.UrlEncode(filter));
                }
                //BbsRouter.JumpToUrl(BbsRouter.GetCurrentUrlScheme().ToString(false, false), "filter=" + HttpUtility.UrlEncode(filter));
                else
                {
                    BbsRouter.JumpToCurrentUrl(true);
                }
                //BbsRouter.JumpToUrl(BbsRouter.GetCurrentUrlScheme().ToString(false, false), "");
            }
            else if (_Request.IsClick("btn_ignore"))
            {
                string[] denouncingIDs = _Request.Get("denouncingIDs", Method.Post, string.Empty).Split(',');

                if (denouncingIDs[0] != string.Empty)
                {
                    int[] ids = ParseIntArray(denouncingIDs);

                    DenouncingBO.Instance.DeleteDenouncings(MyUserID, ids);
                    //DenouncingBO.Instance.IgnoreDenouncings(MyUserID, ids);
                }
                string filter = _Request.Get("filter");

                if (filter != null)
                {
                    BbsRouter.JumpToCurrentUrl(true, "filter=" + HttpUtility.UrlEncode(filter));
                }
                //BbsRouter.JumpToUrl(BbsRouter.GetCurrentUrlScheme().ToString(false, false), "filter=" + HttpUtility.UrlEncode(filter));
                else
                {
                    BbsRouter.JumpToCurrentUrl(true);
                }
                //BbsRouter.JumpToUrl(BbsRouter.GetCurrentUrlScheme().ToString(false, false), "");
            }
            else if (_Request.IsClick("btn_deleteboth"))
            {
                string[] denouncingIDs = _Request.Get("denouncingIDs", Method.Post, string.Empty).Split(',');

                if (denouncingIDs[0] != string.Empty)
                {
                    int[] ids = ParseIntArray(denouncingIDs);

                    for (int i = 0; i < denouncingIDs.Length; i++)
                    {
                        DenouncingBO.Instance.DeleteDenouncingWithData(MyUserID, ids[i]);
                    }
                }
                string filter = _Request.Get("filter");

                if (filter != null)
                {
                    BbsRouter.JumpToCurrentUrl(true, "filter=" + HttpUtility.UrlEncode(filter));
                }
                else
                {
                    BbsRouter.JumpToCurrentUrl(true);
                }
            }
            else if (_Request.IsClick("searchreport"))
            {
                DenouncingFilter filter = DenouncingFilter.GetFromForm();
                filter.Apply("filter", "page");
            }
            else if (_Request.Get("delete") != null)
            {
                int?denouncingID = _Request.Get <int>("delete");

                if (denouncingID != null)
                {
                    DenouncingBO.Instance.DeleteDenouncingWithData(MyUserID, denouncingID.Value);

                    string filter = _Request.Get("filter");

                    if (filter != null)
                    {
                        BbsRouter.JumpToCurrentUrl(true, "filter=" + HttpUtility.UrlEncode(filter));
                    }
                    else
                    {
                        BbsRouter.JumpToCurrentUrl(true);
                    }
                }
            }
            else if (_Request.Get("delete2") != null)
            {
                int?denouncingID = _Request.Get <int>("delete2");

                if (denouncingID != null)
                {
                    DenouncingBO.Instance.DeleteDenouncings(MyUserID, new int[] { denouncingID.Value });

                    string filter = _Request.Get("filter");

                    if (filter != null)
                    {
                        BbsRouter.JumpToCurrentUrl(true, "filter=" + HttpUtility.UrlEncode(filter));
                    }
                    else
                    {
                        BbsRouter.JumpToCurrentUrl(true);
                    }
                }
            }
            else if (_Request.Get("ignore") != null)
            {
                int?denouncingID = _Request.Get <int>("ignore");

                if (denouncingID != null)
                {
                    DenouncingBO.Instance.DeleteDenouncings(MyUserID, new int[] { denouncingID.Value });

                    //DenouncingBO.Instance.IgnoreDenouncing(MyUserID, denouncingID.Value);

                    string filter = _Request.Get("filter");

                    if (filter != null)
                    {
                        BbsRouter.JumpToCurrentUrl(true, "filter=" + HttpUtility.UrlEncode(filter));
                    }
                    else
                    {
                        BbsRouter.JumpToCurrentUrl(true);
                    }
                }
            }

            m_Filter = DenouncingFilter.GetFromFilter("filter");

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

            string view = _Request.Get("view");


            if (m_Filter.IsNull && view != null)
            {
                switch (view)
                {
                case "blog":
                    m_DenouncingList = DenouncingBO.Instance.GetDenouncingWithArticle(m_Filter, page);

                    break;

                case "photo":
                    m_DenouncingList = DenouncingBO.Instance.GetDenouncingWithPhoto(m_Filter, page);
                    break;

                case "share":
                    m_DenouncingList = DenouncingBO.Instance.GetDenouncingWithShare(m_Filter, page);
                    break;

                case "user":
                    m_DenouncingList = DenouncingBO.Instance.GetDenouncingWithUser(m_Filter, page);
                    break;

                case "topic":
                    m_DenouncingList = DenouncingBO.Instance.GetDenouncingWithTopic(m_Filter, page);
                    break;

                case "reply":
                    m_DenouncingList = DenouncingBO.Instance.GetDenouncingWithReply(m_Filter, page);
                    break;
                }
                //ShowError("缺少必要的页面参数");
                //return;
            }
            else
            {
                m_DenouncingList = DenouncingBO.Instance.GetDenouncingBySearch(m_Filter, page);
            }



            if (m_DenouncingList != null)
            {
                m_DenouncingTotalCount = m_DenouncingList.TotalRecords;

                foreach (Denouncing denouncing in m_DenouncingList)
                {
                    if (denouncing.Type == DenouncingType.Topic)
                    {
                        denouncing.TargetTopic = Threads.GetValue(denouncing.TargetID);
                    }
                    else if (denouncing.Type == DenouncingType.Reply)
                    {
                        denouncing.TargetReply = Posts.GetValue(denouncing.TargetID);
                    }
                    UserBO.Instance.WaitForFillSimpleUsers <DenouncingContent>(denouncing.ContentList);
                }

                UserBO.Instance.WaitForFillSimpleUsers <Denouncing>(m_DenouncingList);
            }
        }