示例#1
0
 protected override void ShowPage()
 {
     if (this.postid > 0)
     {
         this.pagetitle = "帖子ID为" + this.postid + "的评分列表";
         //this.ratecount = Posts.GetPostRateLogCount(this.postid);
         //this.rateloglist = Posts.GetPostRateLogList(this.postid, this.pageid, this.pagesize);
         this.ratecount   = RateLog.SearchCount(0, postid);
         this.rateloglist = RateLog.Search(0, postid, (pageid - 1) * pagesize, pagesize);
         this.pagecount   = ((this.ratecount % this.pagesize == 0) ? (this.ratecount / this.pagesize) : (this.ratecount / this.pagesize + 1));
         this.pagecount   = ((this.pagecount == 0) ? 1 : this.pagecount);
         this.pageid      = ((this.pageid < 1) ? 1 : this.pageid);
         this.pageid      = ((this.pageid > this.pagecount) ? this.pagecount : this.pageid);
         this.pagenumbers = Utils.GetPageNumbers(this.pageid, this.pagecount, "showratelist.aspx?pid=" + this.postid, 8);
     }
 }
示例#2
0
        public void BindData()
        {
            this.DataGrid1.AllowCustomPaging = true;
            this.DataGrid1.VirtualItemCount  = this.GetRecordCount();
            var index = this.DataGrid1.CurrentPageIndex + 1;
            var size  = this.DataGrid1.PageSize;

            //var where = this.ViewState["condition"] + "";
            ////if (this.ViewState["condition"] == null)
            ////if (!where.IsNullOrWhiteSpace())
            //{
            //	//this.DataGrid1.DataSource = AdminRateLogs.GetRateLogList(this.DataGrid1.PageSize, this.DataGrid1.CurrentPageIndex + 1);
            //	this.DataGrid1.DataSource = RateLog.FindAll(where, null, null, (index - 1) * size, size);
            //}
            ////else
            ////{
            ////	this.DataGrid1.DataSource = AdminRateLogs.LogList(this.DataGrid1.PageSize, this.DataGrid1.CurrentPageIndex + 1, this.ViewState["condition"].ToString());
            ////}
            this.DataGrid1.DataSource = RateLog.Search(Username.Text, postdatetimeStart.SelectedDate, postdatetimeEnd.SelectedDate, others.Text, null, (index - 1) * size, size);
            this.DataGrid1.DataBind();
        }
示例#3
0
        public void GetRateLogList()
        {
            var sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");

            if (!DNTRequest.IsPost() || ForumUtils.IsCrossSitePost())
            {
                sb.Append("<error>您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。</error>");
                this.ResponseXML(sb);
                return;
            }
            try
            {
                //List<RateLogInfo> postRateLogList = Posts.GetPostRateLogList(DNTRequest.GetFormInt("pid", 0));
                var postRateLogList = RateLog.Search(0, WebHelper.RequestInt("pid"));
                if (postRateLogList == null || postRateLogList.Count == 0)
                {
                    sb.Append("<error>该帖没有评分记录</error>");
                    this.ResponseXML(sb);
                }
                else
                {
                    sb.Append("<data>\r\n");
                    var list = new List <RateLog>();
                    foreach (var info in postRateLogList)
                    {
                        //Predicate<RateLogInfo> match = (RateLogInfo rateLog) => rateLog.Uid == info.Uid && rateLog.ExtCredits == info.ExtCredits;
                        //RateLogInfo rateLogInfo = list.Find(match);
                        var rateLogInfo = list.Find(e => e.Uid == info.Uid && e.ExtCredits == info.ExtCredits);
                        if (rateLogInfo == null)
                        {
                            list.Add(info);
                        }
                        else
                        {
                            rateLogInfo.Score += info.Score;
                            rateLogInfo.Reason = (string.IsNullOrEmpty(rateLogInfo.Reason) ? info.Reason : rateLogInfo.Reason);
                            if (rateLogInfo.Reason.IsNullOrWhiteSpace())
                            {
                                rateLogInfo.Reason = info.Reason;
                            }
                        }
                    }
                    string[] validScoreName = Scoresets.GetValidScoreName();
                    string[] validScoreUnit = Scoresets.GetValidScoreUnit();
                    int      num            = 0;
                    int      num2           = 0;
                    foreach (var item in list)
                    {
                        if (num2 != item.Uid)
                        {
                            num++;
                        }

                        sb.Append("<ratelog>");
                        sb.AppendFormat("\r\n\t<rateid>{0}</rateid>", item.ID);
                        sb.AppendFormat("\r\n\t<uid>{0}</uid>", item.Uid);
                        sb.AppendFormat("\r\n\t<username>{0}</username>", item.UserName.Trim());
                        sb.AppendFormat("\r\n\t<extcredits>{0}</extcredits>", item.ExtCredits);
                        sb.AppendFormat("\r\n\t<extcreditsname>{0}</extcreditsname>", validScoreName[item.ExtCredits]);
                        sb.AppendFormat("\r\n\t<extcreditsunit>{0}</extcreditsunit>", validScoreUnit[item.ExtCredits]);
                        sb.AppendFormat("\r\n\t<postdatetime>{0}</postdatetime>", ForumUtils.ConvertDateTime(item.PostDateTime));
                        sb.AppendFormat("\r\n\t<score>{0}</score>", (item.Score > 0) ? ("+" + item.Score.ToString()) : item.Score.ToString());
                        sb.AppendFormat("\r\n\t<reason>{0}</reason>", item.Reason.Trim());
                        sb.Append("\r\n</ratelog>\r\n");
                        num2 = item.Uid;
                    }
                    sb.Append("</data>");
                    this.ResponseXML(sb);
                    if (DNTRequest.GetFormInt("ratetimes", 0) != num)
                    {
                        Posts.UpdatePostRateTimes(DNTRequest.GetFormInt("tid", 0), DNTRequest.GetFormInt("pid", 0).ToString());
                    }
                }
            }
            catch
            {
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.Expires = 0;
                HttpContext.Current.Response.Cache.SetNoStore();
                HttpContext.Current.Response.End();
            }
        }