Ejemplo n.º 1
0
        public static string CheckRateState(string postidlist, int userid)
        {
            if (!Utils.IsNumericList(postidlist))
            {
                return("");
            }
            string text = "";

            string[] array = Utils.SplitString(postidlist, ",");
            for (int i = 0; i < array.Length; i++)
            {
                string pid = array[i];
                //string text2 = BBX.Data.TopicAdmins.CheckRateState(userid, pid);
                var rate  = RateLog.FindByPidAndUid(pid.ToInt(), userid);
                var text2 = rate != null ? rate.Pid + "" : "";
                if (!text2.IsNullOrEmpty())
                {
                    if (!text.IsNullOrEmpty())
                    {
                        text += ",";
                    }
                    text += text2;
                }
            }
            return(text);
        }
Ejemplo n.º 2
0
        private int GetRecordCount()
        {
            //if (this.ViewState["condition"] == null)
            //{
            //	//return AdminRateLogs.RecordCount();
            //	return RateLog.FindCount();
            //}
            //return AdminRateLogs.RecordCount(this.ViewState["condition"].ToString());

            return(RateLog.SearchCount(Username.Text, postdatetimeStart.SelectedDate, postdatetimeEnd.SelectedDate, others.Text));
        }
Ejemplo n.º 3
0
        public static DataTable GroupParticipateScore(int uid, int gid)
        {
            var dataTable = GroupParticipateScore(gid);

            int[] array         = new int[9];
            var   stringBuilder = new StringBuilder();

            if (dataTable != null)
            {
                int[] array2 = RateLog.GroupParticipateScore(uid);
                for (int i = dataTable.Rows.Count - 1; i >= 0; i--)
                {
                    DataRow dataRow = dataTable.Rows[i];
                    int     num     = dataRow["Max"].ToInt();
                    int     num2    = dataRow["Min"].ToInt();
                    int     num3    = dataRow["MaxInDay"].ToInt();
                    num3 -= array2[dataRow["ScoreCode"].ToInt()];
                    dataRow["MaxInDay"] = num3;
                    int num4 = (num > num3) ? num3 : num;
                    if (!Convert.ToBoolean(dataRow["available"]) || num3 <= 0)
                    {
                        dataRow.Delete();
                    }
                    else
                    {
                        int num5 = (Int32)Math.Abs(Math.Ceiling((double)(num4 - num2) / 10.0));
                        num5 = ((num5 <= 0) ? 1 : num5);
                        stringBuilder.Remove(0, stringBuilder.Length);
                        int num6 = num4;
                        while (num6 >= dataRow["Min"].ToDouble())
                        {
                            if (num6 != 0 && Math.Abs(num6) <= num3)
                            {
                                stringBuilder.AppendFormat("\n<li>{0}{1}</li>", (num6 > 0) ? "+" : "", num6);
                            }
                            num6 -= num5;
                        }
                        dataRow["Options"] = stringBuilder.ToString();
                    }
                }
                dataTable.AcceptChanges();
            }
            if (dataTable == null)
            {
                dataTable = new DataTable();
            }

            return(dataTable);
        }
Ejemplo n.º 4
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);
     }
 }
Ejemplo n.º 5
0
        public static void CancelRatePosts(string ratelogidlist, int tid, string pid, int userid, string username, int groupid, string grouptitle, int forumid, string forumname, string reason)
        {
            if (!Utils.IsNumeric(pid))
            {
                return;
            }

            //var postid = pid.ToInt();

            //int posterid = Posts.GetPostInfo(tid, postid).Posterid;
            //if (posterid <= 0) return;
            var post = Post.FindByID(pid.ToInt());

            if (post == null)
            {
                return;
            }

            //string postTableId = TableList.GetPostTableId(tid);
            //DataTable dataTable = AdminRateLogs.LogList(ratelogidlist.Split(',').Length, 1, "id IN(" + ratelogidlist + ")");
            //foreach (DataRow dataRow in dataTable.Rows)
            //{
            //	TopicAdmins.SetPostRate(postTableId, pid.ToInt(), TypeConverter.ObjectToInt(dataRow["extcredits"]), (float)TypeConverter.ObjectToInt(dataRow["score"]), false);
            //	User.UpdateUserExtCredits(posterid, TypeConverter.ObjectToInt(dataRow["extcredits"]), -1f * TypeConverter.ObjectToFloat(dataRow["score"]));
            //}
            //AdminRateLogs.DeleteLog("[id] IN(" + ratelogidlist + ")");
            var list = RateLog.FindAllByIDs(ratelogidlist);

            foreach (var item in list)
            {
                SetPostRate(post.ID, item.ExtCredits, (float)item.Score, false);
                User.UpdateUserExtCredits(post.PosterID, item.ExtCredits, -1f * item.Score);
            }
            list.Delete();
            //if (AdminRateLogs.LogList(1, 1, "pid = " + pid).Rows.Count == 0)
            if (RateLog.SearchByPid(post.ID, 0, 1) == null)
            {
                //BBX.Data.Posts.CancelPostRate(pid, postTableId);
                post.Rate      = 0;
                post.RateTimes = 0;
                post.Update();
            }
            var topicInfo = Topic.FindByID(tid);

            ModeratorManageLog.Add(userid, username, groupid, grouptitle, forumid, forumname, tid, (topicInfo == null) ? "暂无标题" : topicInfo.Title, "撤消评分", reason);
        }
Ejemplo n.º 6
0
        public static int RatePosts(int tid, string postidlist, string score, string extcredits, int userid, string username, string reason)
        {
            if (!Utils.IsNumericList(postidlist))
            {
                return(0);
            }

            float[]  array        = new float[8];
            float[]  array2       = array;
            string[] scores       = Utils.SplitString(score, ",");
            string[] extcreditses = Utils.SplitString(extcredits, ",");
            //string postTableId = TableList.GetPostTableId(tid);
            for (int i = 0; i < extcreditses.Length; i++)
            {
                int extid = extcreditses[i].ToInt(-1);
                if (extid > 0 && extid < array2.Length)
                {
                    array2[extid - 1] = (float)scores[i].ToInt();
                    //string[] array5 = Utils.SplitString(postidlist, ",");
                    //for (int j = 0; j < array5.Length; j++)
                    //{
                    //	string text = array5[j];
                    //	if (text.Trim() != string.Empty)
                    //	{
                    //		TopicAdmins.SetPostRate(postTableId, text.ToInt(), extcreditses[i].ToInt(), TypeConverter.StrToFloat(scores[i]), true);
                    //	}
                    //}
                    //AdminRateLogs.InsertLog(postidlist, userid, username, extid, TypeConverter.StrToFloat(scores[i]), reason);
                    var arr = postidlist.SplitAsInt();
                    for (int k = 0; k < arr.Length; k++)
                    {
                        SetPostRate(arr[i], extcreditses[i].ToInt(), scores[i].ToDouble(), true);
                        var log = RateLog.Create(arr[i], userid, username, extid, scores[i].ToInt(), reason);
                    }
                }
            }
            //return CreditsFacade.UpdateUserExtCredits(TopicAdmins.GetUserListWithPostlist(tid, postidlist), array2);
            var ps   = Post.FindAllByIDs(postidlist);
            var uids = ps.Join(Post._.PosterID, ",");

            return(CreditsFacade.UpdateUserExtCredits(uids, array2));
        }
Ejemplo n.º 7
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();
        }
Ejemplo n.º 8
0
        public static int UpdatePostRateTimes(int tid, string postidlist)
        {
            if (!Utils.IsNumericList(postidlist)) return 0;

            return RateLog.UpdatePostRateTimes(postidlist);
        }
Ejemplo n.º 9
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();
            }
        }