Пример #1
0
        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());
        }
Пример #2
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());
        }
Пример #3
0
    private IEnumerator SendScores(bool _Multiplayer, string _Mode, CScoreEntry[] _Entries)
    {
        // Generate json table
        JsonTable info = new JsonTable();

        info.Add("multiplayer", _Multiplayer);
        info.Add("mode", _Mode);
        info.Add("count", _Entries.Length);

        JsonTable entry;

        for (int i = 0; i < _Entries.Length; i++)
        {
            entry = new JsonTable();
            entry.Add("name", _Entries[i].Name.Replace(" ", ""));
            entry.Add("score", _Entries[i].Score);
            entry.Add("time", Mathf.Round(_Entries[i].TotalTime * 100.0f) / 100.0f);
            info.Add("entry" + i, entry);
        }

        //Debug.Log("Json: " + info.ToJson());

        // Get complete url
        string json = UploadScoresURL + "?json=" + info.ToJson();

        Debug.Log("URL: " + json);

        // Send string to server
        WWW post = new WWW(json);

        //Debug.Log("URL: " + post.url);

        // Await response
        yield return(post);

        if (post.error != null)
        {
            Debug.LogError("CScoreCommunicator::SendScores - Error uploading scores to '" + UploadScoresURL + "' with data '" + info.ToJson() + "'. Error: " + post.error);
        }
        else
        {
            Debug.Log("CScoreCommunicator::SendScores - Uploaded scores with result: " + post.text);
        }
    }
Пример #4
0
        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());
        }
        private static string GetIsaBreakdownJson(string isaCsv)
        {
            if (isaCsv == null)
            {
                return(null);
            }

            var tableRows = new List <JsonTableRow>();

            using (var reader = new StringReader(isaCsv))
                using (var csv = new CsvReader(reader, new CsvHelper.Configuration.Configuration {
                    HasHeaderRecord = false
                }))
                {
                    while (csv.Read())
                    {
                        var field0 = csv.GetField(0);

                        string field1, field2, field3, field4;
                        if (field0.Contains("label"))
                        {
                            field1 = field2 = field3 = field4 = "";
                        }
                        else
                        {
                            field1 = csv.GetField(1);
                            field2 = csv.GetField(2);
                            field3 = csv.GetField(3);
                            field4 = csv.GetField(4);
                        }

                        tableRows.Add(new JsonTableRow
                        {
                            Data = new[]
                            {
                                field0,
                                field1,
                                field2,
                                field3,
                                field4
                                //csv.GetField(5),
                            }
                        });
                    }
                }

            var table = new JsonTable
            {
                Header = new JsonTableRow
                {
                    Data = new[]
                    {
                        "Offset",
                        "OpCode",
                        "Parameters",
                        "Category",
                        "Cycles",
                        //"Binary"
                    }
                },

                Rows = tableRows
            };

            return(table.ToJson());
        }
Пример #6
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());
        }
Пример #7
0
    private IEnumerator RequestScores(bool _Multiplayer, string _Mode, int _Amount, ScoreDownloadHandler _Callback)
    {
        // Create JsonTable with necessary data
        JsonTable info = new JsonTable();

        info.Add("multiplayer", _Multiplayer);
        info.Add("mode", _Mode);
        info.Add("amount", _Amount);

        //Debug.Log("Json: " + info.ToJson());

        // Attach info to url
        string json = GetScoresURL + "?json=" + info.ToJson();

        //Debug.Log("URL: " + json);

        // Load url
        WWW get = new WWW(json);

        // Await response
        yield return(get);

        if (get.error != null)
        {
            Debug.LogError("CScoreCommunicator::RequestScores - Error getting scores from '" + GetScoresURL + "' with data '" + info.ToJson() + "'. Error: " + get.error);
            if (_Callback != null)
            {
                _Callback(null);
            }
            yield break;
        }

        json = get.text;
        //Debug.Log("CScoreCommunicator::RequestScores - Recieved scores: " + text);

        List <CScoreEntry> result = new List <CScoreEntry>(_Amount);

        if (json.Length > 2)
        {
            JsonObject obj = Json.Decode(json);
            info = obj.ToTable();
            JsonTable entry;
            for (int i = 0; i < _Amount; i++)
            {
                entry = info.GetSubtable("entry" + i);
                if (entry != null)
                {
                    result.Add(new CScoreEntry(entry.ToString("name"),
                                               (float)entry.ToDouble("score"),
                                               (float)entry.ToDouble("time"),
                                               _Multiplayer,
                                               _Mode,
                                               i));
                    //Debug.Log("Entry " + i + ": " + entry["name"] + ", " + entry["score"] + ", " + entry["time"]);
                }
                else
                {
                    result.Add(new CScoreEntry(_Multiplayer, _Mode[0].ToString().ToUpper(), i, false));
                    //Debug.Log("Entry " + i + ": No entry available.");
                }
            }
        }
        else
        {
            for (int i = 0; i < _Amount; i++)
            {
                result.Add(new CScoreEntry(_Multiplayer, _Mode[0].ToString().ToUpper(), i, false));
                //Debug.Log("Entry " + i + ": No entry available.");
            }
        }


        if (_Callback != null)
        {
            _Callback(result.ToArray());
        }
    }