Beispiel #1
0
        private void ProcessGetAmountList(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
            string     s             = "{\"success\":\"false\"}";
            int        type          = Globals.RequestFormNum("type");
            int        page          = Globals.RequestFormNum("page");
            int        pagesize      = Globals.RequestFormNum("pagesize");

            if (pagesize < 5)
            {
                pagesize = 10;
            }
            if (page < 1)
            {
                page = 1;
            }
            DbQueryResult result = MemberAmountProcessor.GetAmountListRequest(type, page, pagesize, currentMember.UserId);
            object        data   = result.Data;

            if (data != null)
            {
                DataTable     table   = (DataTable)data;
                StringBuilder builder = new StringBuilder();
                int           count   = table.Rows.Count;
                string        str2    = string.Empty;
                if (count > 0)
                {
                    str2 = Math.Round(decimal.Parse(table.Rows[0]["TradeAmount"].ToString()), 2).ToString();
                    int num6 = 0;
                    builder.Append("{\"id\":" + table.Rows[num6]["ID"].ToString() + ",\"AvailableAmount\":\"" + Globals.String2Json(Math.Round((decimal)table.Rows[num6]["AvailableAmount"], 2).ToString()) + "\",\"TradeTime\":\"" + DateTime.Parse(table.Rows[num6]["TradeTime"].ToString()).ToString("yyyy-MM-dd") + "\",\"TradeAmount\":\"" + str2 + "\",\"TradeType\":\"" + MemberHelper.StringToTradeType(table.Rows[num6]["TradeType"].ToString()) + "\"}");
                    for (num6 = 1; num6 < count; num6++)
                    {
                        str2 = Math.Round(decimal.Parse(table.Rows[num6]["TradeAmount"].ToString()), 2).ToString();
                        builder.Append(",{\"id\":" + table.Rows[num6]["ID"].ToString() + ",\"AvailableAmount\":\"" + Globals.String2Json(Math.Round((decimal)table.Rows[num6]["AvailableAmount"], 2).ToString()) + "\",\"TradeTime\":\"" + DateTime.Parse(table.Rows[num6]["TradeTime"].ToString()).ToString("yyyy-MM-dd") + "\",\"TradeAmount\":\"" + str2 + "\",\"TradeType\":\"" + MemberHelper.StringToTradeType(table.Rows[num6]["TradeType"].ToString()) + "\"}");
                    }
                }
                s = string.Concat(new object[] { "{\"success\":\"true\",\"rowtotal\":\"", table.Rows.Count, "\",\"total\":\"", result.TotalRecords, "\",\"lihtml\":[", builder.ToString(), "]}" });
            }
            context.Response.Write(s);
            context.Response.End();
        }
Beispiel #2
0
        private void ProcessGetAmountList(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
            string     s             = "{\"success\":\"false\"}";
            int        type          = Globals.RequestFormNum("type");
            int        num           = Globals.RequestFormNum("page");
            int        num2          = Globals.RequestFormNum("pagesize");

            if (num2 < 5)
            {
                num2 = 10;
            }
            if (num < 1)
            {
                num = 1;
            }
            DbQueryResult amountListRequest = MemberAmountProcessor.GetAmountListRequest(type, num, num2, currentMember.UserId);
            object        data = amountListRequest.Data;

            if (data != null)
            {
                System.Data.DataTable     dataTable     = (System.Data.DataTable)data;
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                int    count = dataTable.Rows.Count;
                string text  = string.Empty;
                if (count > 0)
                {
                    decimal d = decimal.Parse(dataTable.Rows[0]["TradeAmount"].ToString());
                    text = System.Math.Round(d, 2).ToString();
                    int i = 0;
                    stringBuilder.Append(string.Concat(new string[]
                    {
                        "{\"id\":",
                        dataTable.Rows[i]["ID"].ToString(),
                        ",\"AvailableAmount\":\"",
                        Globals.String2Json(System.Math.Round((decimal)dataTable.Rows[i]["AvailableAmount"], 2).ToString()),
                        "\",\"TradeTime\":\"",
                        System.DateTime.Parse(dataTable.Rows[i]["TradeTime"].ToString()).ToString("yyyy-MM-dd"),
                        "\",\"TradeAmount\":\"",
                        text,
                        "\",\"TradeType\":\"",
                        MemberHelper.StringToTradeType(dataTable.Rows[i]["TradeType"].ToString()),
                        "\"}"
                    }));
                    for (i = 1; i < count; i++)
                    {
                        d    = decimal.Parse(dataTable.Rows[i]["TradeAmount"].ToString());
                        text = System.Math.Round(d, 2).ToString();
                        stringBuilder.Append(string.Concat(new string[]
                        {
                            ",{\"id\":",
                            dataTable.Rows[i]["ID"].ToString(),
                            ",\"AvailableAmount\":\"",
                            Globals.String2Json(System.Math.Round((decimal)dataTable.Rows[i]["AvailableAmount"], 2).ToString()),
                            "\",\"TradeTime\":\"",
                            System.DateTime.Parse(dataTable.Rows[i]["TradeTime"].ToString()).ToString("yyyy-MM-dd"),
                            "\",\"TradeAmount\":\"",
                            text,
                            "\",\"TradeType\":\"",
                            MemberHelper.StringToTradeType(dataTable.Rows[i]["TradeType"].ToString()),
                            "\"}"
                        }));
                    }
                }
                s = string.Concat(new object[]
                {
                    "{\"success\":\"true\",\"rowtotal\":\"",
                    dataTable.Rows.Count,
                    "\",\"total\":\"",
                    amountListRequest.TotalRecords,
                    "\",\"lihtml\":[",
                    stringBuilder.ToString(),
                    "]}"
                });
            }
            context.Response.Write(s);
            context.Response.End();
        }