private OpRes query(ParamGameHistory param, IMongoQuery imq, GMUser user)
    {
        fillData fillFun   = null;
        string   tableName = getTableName(param, ref fillFun);

        if (tableName == "")
        {
            return(OpRes.op_res_not_found_data);
        }

        user.totalRecord = DBMgr.getInstance().getRecordCount(tableName, imq,
                                                              user.getDbServerID(), DbName.DB_PUMP);

        List <Dictionary <string, object> > dataList = DBMgr.getInstance().executeQuery(tableName,
                                                                                        user.getDbServerID(),
                                                                                        DbName.DB_PUMP,
                                                                                        imq,
                                                                                        (param.m_curPage - 1) * param.m_countEachPage,
                                                                                        param.m_countEachPage);

        if (dataList == null || dataList.Count == 0)
        {
            return(OpRes.op_res_not_found_data);
        }

        fillFun(param, user, dataList);

        return(OpRes.opres_success);
    }
    // 填充百家乐数据
    void fillBaccarat(ParamGameHistory param, GMUser user, List <Dictionary <string, object> > dataList)
    {
        for (int i = 0; i < dataList.Count; i++)
        {
            Dictionary <string, object>  data = dataList[i];
            ResultGameHistoryBaccaratIem tmp  = new ResultGameHistoryBaccaratIem();
            m_result.Add(tmp);

            tmp.m_time       = Convert.ToDateTime(data["genTime"]).ToLocalTime().ToString(ConstDef.DATE_TIME24);
            tmp.m_gameId     = (int)GameId.baccarat;
            tmp.m_totalBound = Convert.ToInt64(data["gameIndex"]);
            tmp.m_boundToday = Convert.ToInt64(data["dayIndex"]);
            string[] arr = Tool.split(Convert.ToString(data["resultStr"]), ',', StringSplitOptions.RemoveEmptyEntries);
            for (int k = 0; k < arr.Length; k++)
            {
                tmp.m_resultList.Add(Convert.ToInt32(arr[k]));
            }
            arr = Tool.split(Convert.ToString(data["playerCardStr"]), ',', StringSplitOptions.RemoveEmptyEntries);
            for (int k = 0; k < arr.Length; k++)
            {
                tmp.m_cardListXian.Add(Convert.ToInt32(arr[k]));
            }
            arr = Tool.split(Convert.ToString(data["bankerCardStr"]), ',', StringSplitOptions.RemoveEmptyEntries);
            for (int k = 0; k < arr.Length; k++)
            {
                tmp.m_cardListZhuang.Add(Convert.ToInt32(arr[k]));
            }
        }
    }
        protected void onQueryRecord(object sender, EventArgs e)
        {
            m_view = ViewGameHistoryBase.create(Convert.ToInt32(m_whichGame.SelectedValue));
            if (m_view == null)
            {
                return;
            }

            GMUser           user  = (GMUser)Session["user"];
            ParamGameHistory param = new ParamGameHistory();

            param.m_countEachPage = m_gen.rowEachPage;
            param.m_curPage       = m_gen.curPage;
            param.m_gameId        = Convert.ToInt32(m_whichGame.SelectedValue);
            param.m_time          = m_time.Text;
            param.m_bound         = m_bound.Text;

            m_page.InnerHtml = "";
            m_foot.InnerHtml = "";

            OpRes res = user.doQuery(param, QueryType.queryTypeGameHistory);

            m_view.genTable(m_result, res, user);

            param.m_gameId = m_whichGame.SelectedIndex;
            string page_html = "", foot_html = "";

            m_gen.genPage(param, @"/appaspx/stat/gamehistory/GameHistory.aspx", ref page_html, ref foot_html, user);
            m_page.InnerHtml = page_html;
            m_foot.InnerHtml = foot_html;
        }
    // 填充黑红梅方数据
    void fillShcd(ParamGameHistory param, GMUser user, List <Dictionary <string, object> > dataList)
    {
        for (int i = 0; i < dataList.Count; i++)
        {
            Dictionary <string, object> data = dataList[i];
            ResultGameHistoryShcdItem   tmp  = new ResultGameHistoryShcdItem();
            m_result.Add(tmp);

            tmp.m_time       = Convert.ToDateTime(data["genTime"]).ToLocalTime().ToString(ConstDef.DATE_TIME24);
            tmp.m_gameId     = (int)GameId.shcd;
            tmp.m_totalBound = Convert.ToInt64(data["gameIdx"]);
            tmp.m_cardType   = Convert.ToInt32(data["cardType"]);
            tmp.m_cardValue  = Convert.ToInt32(data["cardValue"]);
        }
    }
    // 填充骰宝数据
    void fillDice(ParamGameHistory param, GMUser user, List <Dictionary <string, object> > dataList)
    {
        for (int i = 0; i < dataList.Count; i++)
        {
            Dictionary <string, object> data = dataList[i];
            ResultGameHistoryDicetIem   tmp  = new ResultGameHistoryDicetIem();
            m_result.Add(tmp);

            tmp.m_time       = Convert.ToDateTime(data["genTime"]).ToLocalTime().ToString(ConstDef.DATE_TIME24);
            tmp.m_gameId     = (int)GameId.dice;
            tmp.m_totalBound = Convert.ToInt64(data["gameIndex"]);
            tmp.m_dice1      = Convert.ToInt32(data["dice1"]);
            tmp.m_dice2      = Convert.ToInt32(data["dice2"]);
            tmp.m_dice3      = Convert.ToInt32(data["dice3"]);
        }
    }
    public override OpRes doQuery(object param, GMUser user)
    {
        m_result.Clear();
        m_cond.startQuery();
        OpRes res = makeQuery(param, user, m_cond);

        if (res != OpRes.opres_success)
        {
            return(res);
        }

        IMongoQuery      imq = m_cond.getImq();
        ParamGameHistory p   = (ParamGameHistory)param;

        return(query(p, imq, user));
    }
    public override void genPage(ParamQueryBase queryParam, string url, ref string page_link, ref string foot, GMUser user)
    {
        ParamGameHistory    dparam           = (ParamGameHistory)queryParam;
        PageBrowseGenerator p                = new PageBrowseGenerator();
        long total_page                      = 0;
        Dictionary <string, object> urlParam = new Dictionary <string, object>();

        urlParam["time"]      = dparam.m_time;
        urlParam["gameIndex"] = dparam.m_gameId;
        urlParam["bound"]     = dparam.m_bound;

        page_link = p.genPageFoot(queryParam.m_curPage, m_rowEachPage, url, ref total_page, user, urlParam);
        if (total_page != 0)
        {
            foot = queryParam.m_curPage + "/" + total_page;
        }
    }
    // 填充牛牛数据
    void fillCows(ParamGameHistory param, GMUser user, List <Dictionary <string, object> > dataList)
    {
        for (int i = 0; i < dataList.Count; i++)
        {
            Dictionary <string, object> data = dataList[i];
            ResultGameHistoryCowstIem   tmp  = new ResultGameHistoryCowstIem();
            m_result.Add(tmp);

            tmp.m_time   = Convert.ToDateTime(data["genTime"]).ToLocalTime().ToString(ConstDef.DATE_TIME24);
            tmp.m_gameId = (int)GameId.cows;
            if (data.ContainsKey("gameIndex"))
            {
                tmp.m_totalBound = Convert.ToInt64(data["gameIndex"]);
            }

            GameDetail.detailInfoForCows(tmp.m_info, data);
        }
    }
    string getTableName(ParamGameHistory param, ref fillData fillFun)
    {
        string tableName = "";

        switch (param.m_gameId)
        {
        case (int)GameId.crocodile:
        {
            fillFun   = fillCrocodile;
            tableName = TableName.HISTORY_CROCODILE;
        }
        break;

        case (int)GameId.dice:
        {
            fillFun   = fillDice;
            tableName = TableName.HISTORY_DICE;
        }
        break;

        case (int)GameId.cows:
        {
            fillFun   = fillCows;
            tableName = TableName.HISTORY_COWS;
        }
        break;

        case (int)GameId.baccarat:
        {
            fillFun   = fillBaccarat;
            tableName = TableName.HISTORY_BACCARAT;
        }
        break;

        case (int)GameId.shcd:
        {
            fillFun   = fillShcd;
            tableName = TableName.HISTORY_SHCD;
        }
        break;
        }
        return(tableName);
    }
    // 填充鳄鱼大亨数据
    void fillCrocodile(ParamGameHistory param, GMUser user, List <Dictionary <string, object> > dataList)
    {
        for (int i = 0; i < dataList.Count; i++)
        {
            Dictionary <string, object>    data = dataList[i];
            ResultGameHistoryCrocodiletIem tmp  = new ResultGameHistoryCrocodiletIem();
            m_result.Add(tmp);

            tmp.m_time       = Convert.ToDateTime(data["genTime"]).ToLocalTime().ToString(ConstDef.DATE_TIME24);
            tmp.m_gameId     = (int)GameId.crocodile;
            tmp.m_totalBound = Convert.ToInt64(data["gameIndex"]);
            tmp.m_awardType  = Convert.ToInt32(data["awardType"]);
            tmp.m_handSel    = Convert.ToInt32(data["handselProb"]);
            string[] arr = Tool.split(Convert.ToString(data["resultStr"]), ',', StringSplitOptions.RemoveEmptyEntries);
            for (int k = 0; k < arr.Length; k++)
            {
                tmp.m_result.Add(Convert.ToInt32(arr[k]));
            }
        }
    }
    public override OpRes makeQuery(object param, GMUser user, QueryCondition queryCond)
    {
        ParamGameHistory p   = (ParamGameHistory)param;
        bool             res = false;

        DateTime mint = DateTime.Now, maxt = DateTime.Now;

        res = Tool.splitTimeStr(p.m_time, ref mint, ref maxt);
        if (!res)
        {
            return(OpRes.op_res_time_format_error);
        }

        IMongoQuery imq1 = Query.LT("genTime", BsonValue.Create(maxt));
        IMongoQuery imq2 = Query.GTE("genTime", BsonValue.Create(mint));

        queryCond.addImq(Query.And(imq1, imq2));

        switch (p.m_gameId)
        {
        case (int)GameId.baccarat:     // 百家乐
        {
            if (!string.IsNullOrEmpty(p.m_bound))
            {
                int x = 0;
                if (!int.TryParse(p.m_bound, out x))
                {
                    return(OpRes.op_res_pwd_not_valid);
                }

                int         minV  = (x - 1) * 66;
                int         maxV  = x * 66 + 1;
                IMongoQuery imqx1 = Query.LT("dayIndex", BsonValue.Create(maxV));
                IMongoQuery imqx2 = Query.GT("dayIndex", BsonValue.Create(minV));
                queryCond.addImq(Query.And(imqx1, imqx2));
            }
        }
        break;
        }
        return(OpRes.opres_success);
    }