예제 #1
0
        protected void LoadData()
        {
            int  userId = 0;
            User user   = Utils.GetCurrentUser();

            if (user != null)
            {
                userId = user.Id;
            }

            pnlBetting.Visible    = false;
            pnlPrediction.Visible = false;
            pnlQuestion.Visible   = false;
            int totalRow = 0;

            if (GameType == 1)
            {
                pnlBetting.Visible = true;

                List <BettingUser> lstBetting = TNHelper.GetBettingUserGameInfo(userId);
                if (lstBetting != null)
                {
                    totalRow   = lstBetting.Count;
                    lstBetting = lstBetting.Skip((PageIndex - 1) * PageSize)
                                 .Take(PageSize).ToList();
                }

                if (lstBetting != null && lstBetting.Count > 0)
                {
                    rptBetting.DataSource = lstBetting;
                    rptBetting.DataBind();
                }
            }
            else if (GameType == 2)
            {
                pnlPrediction.Visible = true;

                List <PredictionGameUser> lstPrediction = TNHelper.GetPredictionUserGameInfo(userId);
                if (lstPrediction != null)
                {
                    totalRow      = lstPrediction.Count;
                    lstPrediction = lstPrediction.Skip((PageIndex - 1) * PageSize)
                                    .Take(PageSize).ToList();
                }

                if (lstPrediction != null && lstPrediction.Count > 0)
                {
                    rptPrediction.DataSource = lstPrediction;
                    rptPrediction.DataBind();
                }
            }
            else if (GameType == 3)
            {
                pnlQuestion.Visible = true;

                List <QuestionUser> lstQuestion = TNHelper.GetQuestionUserGameInfo(userId);
                if (lstQuestion != null)
                {
                    totalRow    = lstQuestion.Count;
                    lstQuestion = lstQuestion.Skip((PageIndex - 1) * PageSize)
                                  .Take(PageSize).ToList();
                }

                if (lstQuestion != null && lstQuestion.Count > 0)
                {
                    rptQuestion.DataSource = lstQuestion;
                    rptQuestion.DataBind();
                }
            }

            if (pager != null)
            {
                pager.ItemCount = totalRow;
            }
        }
예제 #2
0
        protected void LoadData()
        {
            string strId  = Page.RouteData.Values["id"] as string;
            int    userId = 0;

            int.TryParse(strId, out userId);

            User user = TNHelper.GetUserById(userId);

            if (user != null)
            {
                litUser.Text = user.DisplayName;
            }

            pnlBetting.Visible    = false;
            pnlPrediction.Visible = false;
            pnlQuestion.Visible   = false;
            int totalRow = 0;

            if (GameType == 0)
            {
                pnlBetting.Visible = true;

                List <BettingUser> lstBetting = TNHelper.GetBettingUserGameInfo(userId);
                if (lstBetting != null)
                {
                    totalRow   = lstBetting.Count;
                    lstBetting = lstBetting.Skip((PageIndex - 1) * PageSize)
                                 .Take(PageSize).ToList();
                }

                if (lstBetting != null && lstBetting.Count > 0)
                {
                    rptBetting.DataSource = lstBetting;
                    rptBetting.DataBind();
                }
                else
                {
                    Utils.ShowMessage(lblMsg, "Không tìm thấy dữ liệu trò chơi thử tài kiến thức");
                }
            }
            else if (GameType == 1)
            {
                pnlPrediction.Visible = true;

                List <PredictionGameUser> lstPrediction = TNHelper.GetPredictionUserGameInfo(userId);
                if (lstPrediction != null)
                {
                    totalRow      = lstPrediction.Count;
                    lstPrediction = lstPrediction.Skip((PageIndex - 1) * PageSize)
                                    .Take(PageSize).ToList();
                }

                if (lstPrediction != null && lstPrediction.Count > 0)
                {
                    rptPrediction.DataSource = lstPrediction;
                    rptPrediction.DataBind();
                }
                else
                {
                    Utils.ShowMessage(lblMsg, "Không tìm thấy dữ liệu trò chơi dự đoán");
                }
            }
            else if (GameType == 2)
            {
                pnlQuestion.Visible = true;

                List <QuestionUser> lstQuestion = TNHelper.GetQuestionUserGameInfo(userId);
                if (lstQuestion != null)
                {
                    totalRow    = lstQuestion.Count;
                    lstQuestion = lstQuestion.Skip((PageIndex - 1) * PageSize)
                                  .Take(PageSize).ToList();
                }

                if (lstQuestion != null && lstQuestion.Count > 0)
                {
                    rptQuestion.DataSource = lstQuestion;
                    rptQuestion.DataBind();
                }
                else
                {
                    Utils.ShowMessage(lblMsg, "Không tìm thấy dữ liệu trò chơi dự đoán");
                }
            }

            if (pager != null)
            {
                pager.ItemCount = totalRow;
            }
        }