예제 #1
0
        void SendRank(DataSet ds, int userID, HttpContext context, DateTime start, DateTime end)
        {
            ScoreRankCode newScoreRankCode = new ScoreRankCode();

            string xx = "start:" + start.ToString() + " end:" + end.ToString() + " Count:" + ds.Tables[0].Rows.Count + " ";

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                ScoreRank newScoreRank = new ScoreRank();
                newScoreRank.RankId   = Convert.ToInt32(ds.Tables[0].Rows[i]["RankId"]);
                newScoreRank.UserID   = Convert.ToInt32(ds.Tables[0].Rows[i]["UserID"]);
                newScoreRank.UserName = ds.Tables[0].Rows[i]["UserName"].ToString();
                newScoreRank.SumScore = Convert.ToInt32(ds.Tables[0].Rows[i]["SumScore"]);
                newScoreRank.RankType = Convert.ToInt32(ds.Tables[0].Rows[i]["RankType"]);
                System.Object obj = ds.Tables[0].Rows[i]["FaceID"];
                if (obj.GetType() != typeof(DBNull))
                {
                    newScoreRank.FaceId = Convert.ToInt32(obj);
                }
                newScoreRank.RankId = i + 1;
                newScoreRankCode.ScoreRanks.Add(newScoreRank);
                if (newScoreRank.UserID == userID)
                {
                    newScoreRankCode.MyScore = newScoreRank;
                }
                xx = "RankId:" + ds.Tables[0].Rows[i]["RankId"] + "  UserID:" + ds.Tables[0].Rows[i]["UserID"] + "  UserName:"******"UserName"] + "  SumScore:" +
                     ds.Tables[0].Rows[i]["SumScore"] + "  RankType:" +
                     ds.Tables[0].Rows[i]["RankType"] + "  FaceID:" +
                     ds.Tables[0].Rows[i]["FaceID"];
            }
            newScoreRankCode.msg = xx;
            CommonTools.SendStringToClient(context, newScoreRankCode);
        }
예제 #2
0
        protected void GetWeekScoreRank(HttpContext context)
        {
            try
            {
                int      userID    = GameRequest.GetInt("UserID", 0);
                DateTime dt        = DateTime.Now;                      //当前时间
                DateTime startWeek = dt.AddDays(1 - (int)dt.DayOfWeek); //本周周一
                DateTime endWeek   = startWeek.AddDays(6);              //本周周日
                DataSet  ds        = FacadeManage.aideTreasureFacade.GetRank(startWeek, endWeek, userID);
                //
                SendRank(ds, userID, context, startWeek, endWeek);
            }
            catch (Exception exp)
            {
                ScoreRankCode newScoreRankCode = new ScoreRankCode();
                CommonTools.SendStringToClient(context, newScoreRankCode);
//                 context.Response.Write(exp.Message.ToString()+":"+exp.StackTrace.ToString());
            }
        }
예제 #3
0
        protected void GetPreDayScoreRank(HttpContext context)
        {
            try
            {
                int userID = GameRequest.GetInt("UserID", 0);

                DateTime dt        = DateTime.Now.AddDays(-1);
                DateTime startYear = new DateTime(dt.Year, dt.Month, dt.Day, 0, 0, 0); //本年年初
                DateTime endYear   = new DateTime(dt.Year, 12, 31);                    //本年年末
                DataSet  ds        = FacadeManage.aideTreasureFacade.GetRank(startYear, endYear, userID);
                SendRank(ds, userID, context, startYear, endYear);
//                 //
//                 ScoreRankCode newScoreRankCode = new ScoreRankCode();
//                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
//                 {
//                     ScoreRank newScoreRank = new ScoreRank();
//                     newScoreRank.RankId = Convert.ToInt32(ds.Tables[0].Rows[i]["RankId"]);
//                     newScoreRank.UserID = Convert.ToInt32(ds.Tables[0].Rows[i]["UserID"]);
//                     newScoreRank.UserName = ds.Tables[0].Rows[i]["UserName"].ToString();
//                     newScoreRank.SumScore = Convert.ToInt32(ds.Tables[0].Rows[i]["SumScore"]);
//                     newScoreRank.RankType = Convert.ToInt32(ds.Tables[0].Rows[i]["RankType"]);
//                     newScoreRank.FaceId = Convert.ToInt32(ds.Tables[0].Rows[i]["FaceID"]);
//
//                     newScoreRankCode.ScoreRanks.Add(newScoreRank);
//                     if (newScoreRank.UserID == userID)
//                         newScoreRankCode.MyScore = newScoreRank;
//                 }
//                 string s = Newtonsoft.Json.JsonConvert.SerializeObject(newScoreRankCode);
//                 newScoreRankCode.msg = startYear.ToString() + "--" + endYear.ToString();
//                 CommonTools.SendStringToClient(context, newScoreRankCode);
            }
            catch (Exception exp)
            {
                ScoreRankCode newScoreRankCode = new ScoreRankCode();
                CommonTools.SendStringToClient(context, newScoreRankCode);

//                 context.Response.Write(exp.Message.ToString() + ":" + exp.StackTrace.ToString());
            }
        }