コード例 #1
0
        private void DoQuery()
        {
            List <SqlParameter> paramValues = new List <SqlParameter>();
            string    condition             = "Where 1=1";
            JsonTable jsonTable             = new JsonTable();

            if (GetParam("NickName").Length > 0)
            {
                condition += " and NickName like @NickName";
                paramValues.Add(SqlParamHelper.MakeInParam("@NickName", SqlDbType.VarChar, 0, "%" + GetParam("NickName") + "%"));
            }
            if (GetParam("Pid").Length > 0)
            {
                condition += " and Pid=@Pid";
                paramValues.Add(SqlParamHelper.MakeInParam("@Pid", SqlDbType.VarChar, 0, GetParam("Pid")));
            }
            if (GetParam("UserStatus").Length > 0)
            {
                condition += " and UserStatus=@UserStatus";
                paramValues.Add(SqlParamHelper.MakeInParam("@UserStatus", SqlDbType.VarChar, 0, GetParam("UserStatus")));
            }
            if (GetParam("MsgState").Length > 0)
            {
                condition += " and MsgState=@MsgState";
                paramValues.Add(SqlParamHelper.MakeInParam("@MsgState", SqlDbType.VarChar, 0, GetParam("MsgState")));
            }
            if (GetParam("fromDate").Length > 0)
            {
                condition += " and CreateDate>=@fromDate";
                paramValues.Add(SqlParamHelper.MakeInParam("@fromDate", SqlDbType.VarChar, 0, GetParam("fromDate")));
            }
            if (GetParam("toDate").Length > 0)
            {
                condition += " and CreateDate<=@toDate";
                paramValues.Add(SqlParamHelper.MakeInParam("@toDate", SqlDbType.VarChar, 0, GetParam("toDate")));
            }
            if (IsChannel)
            {
                condition += " and RetailID=@ChannelID";
                paramValues.Add(SqlParamHelper.MakeInParam("@ChannelID", SqlDbType.VarChar, 0, EmpRetailId));
            }

            var service = new DdzDataService(GameID, ServerID);

            AppendPageParam(paramValues, PageIndex, PageSize);
            var getter = service.Get <UserGetter>(condition, PageIndex, PageSize, paramValues);

            jsonTable.rows  = getter.GetData();
            jsonTable.total = getter.RecordCount;

            _context.Response.Write(jsonTable.ToJson());
        }
コード例 #2
0
ファイル: PrizeRemote.cs プロジェクト: dongliang/Scut
        private void DoQuery()
        {
            List <SqlParameter> paramValues = new List <SqlParameter>();
            string    condition             = "Where 1=1";
            JsonTable jsonTable             = new JsonTable();

            if (GetParam("GameUserID").Length > 0)
            {
                condition += " and UserID=@UserID";
                paramValues.Add(SqlParamHelper.MakeInParam("@UserID", SqlDbType.VarChar, 0, GetParam("GameUserID")));
            }
            if (GetParam("IsTasked").Length > 0)
            {
                condition += " and IsTasked=@IsTasked";
                paramValues.Add(SqlParamHelper.MakeInParam("@IsTasked", SqlDbType.Bit, 0, GetParamAsInt("IsTasked")));
            }
            if (GetParam("FromDate").Length > 0)
            {
                condition += " and CreateDate>=@fromDate";
                paramValues.Add(SqlParamHelper.MakeInParam("@fromDate", SqlDbType.VarChar, 0, GetParam("FromDate")));
            }
            if (GetParam("ToDate").Length > 0)
            {
                condition += " and CreateDate<=@toDate";
                paramValues.Add(SqlParamHelper.MakeInParam("@toDate", SqlDbType.VarChar, 0, GetParam("ToDate")));
            }

            var service = new DdzDataService(GameID, ServerID);

            AppendPageParam(paramValues, PageIndex, PageSize);
            var getter = service.Get <PrizeGetter>(condition, PageIndex, PageSize, paramValues);

            jsonTable.rows  = getter.GetData();
            jsonTable.total = getter.RecordCount;

            _context.Response.Write(jsonTable.ToJson());
        }