Beispiel #1
0
        //获取奖励的配置信息
        private void GetGlobalInfo()
        {
            DataSet ds = aideTreasureFacade.GetDataSetByWhere("SELECT * FROM GlobalCheckIn(NOLOCK)");

            if (ds.Tables[0].Rows.Count != 7)
            {
                globalInfo.Add(1, 1000);
                globalInfo.Add(2, 2000);
                globalInfo.Add(3, 3000);
                globalInfo.Add(4, 4000);
                globalInfo.Add(5, 5000);
                globalInfo.Add(6, 6000);
                globalInfo.Add(7, 8000);
            }
            else
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    globalInfo.Add(Convert.ToInt32(dr["ID"]), Convert.ToInt32(dr["PresentGold"]));
                }
            }

            //加载图片信息
            int score = 0;

            for (int i = 1; i < globalInfo.Count + 1; i++)
            {
                globalInfo.TryGetValue(i, out score);
                ((Literal)Page.FindControl("litDay" + i)).Text = score.ToString();
                if (i == globalInfo.Count)
                {
                    ((Literal)Page.FindControl("litDay" + i + i)).Text = score.ToString();
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        protected void BindRankData( )
        {
            string tag = "MatchRank";
            object ob  = SessionState.Get(tag);

            if (SessionState.Get("MatchRank") == null)
            {
                TreasureFacade treasureFacade = new TreasureFacade(kindID);
                string         sqlQuery       = "Select Top 100 * from GameScoreInfo(nolock) order by Score desc";
                DataSet        ds             = treasureFacade.GetDataSetByWhere(sqlQuery);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    rptRank.DataSource = ds;
                    rptRank.DataBind( );
                }
                SessionState.Set(tag, ob, 10);
            }
            else
            {
                DataSet ds = ( DataSet )ob;
                if (ds.Tables[0].Rows.Count > 0)
                {
                    rptRank.DataSource = ds;
                    rptRank.DataBind( );
                }
            }
        }
Beispiel #3
0
        //获取金币排行榜,前50
        protected void GetScoreRank(HttpContext context)
        {
            StringBuilder msg       = new StringBuilder( );
            int           pageIndex = GameRequest.GetInt("pageindex", 1);
            int           pageSize  = GameRequest.GetInt("pagesize", 10);
            int           userID    = GameRequest.GetInt("UserID", 0);

            if (pageIndex <= 0)
            {
                pageIndex = 1;
            }
            if (pageSize <= 0)
            {
                pageSize = 10;
            }
            if (pageSize > 50)
            {
                pageSize = 50;
            }

            //获取用户排行
            string  sqlQuery = string.Format("SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY Score DESC) as ChartID,UserID,Score FROM GameScoreInfo) a WHERE UserID={0}", userID);
            DataSet dsUser   = treasureFacade.GetDataSetByWhere(sqlQuery);
            int     uChart   = 0;
            Int64   uScore   = 0;

            if (dsUser.Tables[0].Rows.Count != 0)
            {
                uChart = Convert.ToInt32(dsUser.Tables[0].Rows[0]["ChartID"]);
                uScore = Convert.ToInt64(dsUser.Tables[0].Rows[0]["Score"]);
            }

            //获取总排行
            DataSet ds = treasureFacade.GetList("GameScoreInfo", pageIndex, pageSize, " ORDER BY Score DESC", " ", "UserID,Score").PageSet;

            if (ds.Tables[0].Rows.Count > 0)
            {
                msg.Append("[");

                //添加用户排行
                msg.Append("{\"NickName\":\"" + Fetch.GetNickNameByUserID(userID) + "\",\"Score\":" + uScore + ",\"Rank\":" + uChart + "},");
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    msg.Append("{\"NickName\":\"" + Fetch.GetNickNameByUserID(Convert.ToInt32(dr["UserID"])) + "\",\"Score\":" + dr["Score"] + "},");
                }
                msg.Remove(msg.Length - 1, 1);
                msg.Append("]");
            }
            else
            {
                msg.Append("{}");
            }
            context.Response.Write(msg.ToString( ));
        }
Beispiel #4
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        protected void BindRankData( )
        {
            TreasureFacade treasureFacade = new TreasureFacade(kindID);
            string         sqlQuery       = "Select Top 100 * from GameScoreInfo(nolock) order by Score desc";
            DataSet        ds             = treasureFacade.GetDataSetByWhere(sqlQuery);

            if (ds.Tables[0].Rows.Count > 0)
            {
                rptRank.DataSource = ds;
                rptRank.DataBind( );
            }
        }