Example #1
0
        protected override void ShowPage()
        {
            string linkurl = "";

            pagetitle = "用户控制面板";

            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }

            user   = Discuz.Forum.Users.GetUserInfo(userid);
            pageid = DNTRequest.GetInt("page", 1);
            typeid = DNTRequest.GetInt("typeid", 0);

            typelist = Attachments.AttachTypeList();

            if (typeid > 0)
            {
                attachmentcount = Attachments.GetUserAttachmentCount(this.userid, typeid);
                linkurl         = string.Format("myattachment.aspx?typeid={0}", typeid.ToString());
            }
            else
            {
                attachmentcount = Attachments.GetUserAttachmentCount(this.userid);
                linkurl         = "myattachment.aspx";
            }
            pagecount = attachmentcount % pagesize == 0 ? attachmentcount / pagesize : attachmentcount / pagesize + 1;
            if (pagecount == 0)
            {
                pagecount = 1;
            }
            //修正请求页数中可能的错误
            if (pageid < 1)
            {
                pageid = 1;
            }
            if (pageid > pagecount)
            {
                pageid = pagecount;
            }
            myattachmentlist = Attachments.GetAttachmentByUid(this.userid, typeid, pageid, pagesize);

            pagenumbers = Utils.GetPageNumbers(pageid, pagecount, linkurl, 10);
        }