Пример #1
0
        private void ProcessGetMemberAmountDetails(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            MemberInfo member   = MemberHelper.GetMember(Globals.RequestFormNum("userid"));
            string     s        = "{\"success\":\"false\"}";
            int        num2     = Globals.RequestFormNum("type");
            int        page     = Globals.RequestFormNum("page");
            int        pagesize = Globals.RequestFormNum("pagesize");
            string     str2     = context.Request["startTime"].ToString();
            string     str3     = context.Request["endTime"].ToString();

            if (pagesize < 5)
            {
                pagesize = 5;
            }
            if (page < 1)
            {
                page = 1;
            }
            switch (num2)
            {
            case 0:
            {
                MemberDetailOrderQuery query = new MemberDetailOrderQuery {
                    UserId = new int?(member.UserId)
                };
                query.Status = new OrderStatus[] { OrderStatus.Finished, OrderStatus.BuyerAlreadyPaid, OrderStatus.SellerAlreadySent };
                if (!string.IsNullOrEmpty(str2))
                {
                    query.StartFinishDate = new DateTime?(Convert.ToDateTime(str2));
                }
                if (!string.IsNullOrEmpty(str3))
                {
                    query.EndFinishDate = new DateTime?(Convert.ToDateTime(str3));
                }
                query.PageIndex = page;
                query.PageSize  = pagesize;
                query.SortBy    = "OrderDate";
                query.SortOrder = SortAction.Desc;
                DbQueryResult memberDetailOrders = OrderHelper.GetMemberDetailOrders(query);
                object        data = memberDetailOrders.Data;
                if (data != null)
                {
                    DataTable     table   = (DataTable)data;
                    StringBuilder builder = new StringBuilder();
                    int           count   = table.Rows.Count;
                    string        str4    = "-";
                    string        str5    = "-";
                    if (count > 0)
                    {
                        int num6 = 0;
                        str4 = !table.Rows[num6].IsNull(table.Columns["GatewayOrderId"]) ? table.Rows[num6]["GatewayOrderId"].ToString() : "-";
                        str5 = (table.Rows[num6]["FinishDate"] != DBNull.Value) ? DateTime.Parse(table.Rows[num6]["FinishDate"].ToString()).ToString("yyyy-MM-dd") : "-";
                        builder.Append("{\"GatewayOrderId\":\"" + str4 + "\",\"OrderTotal\":\"" + Globals.String2Json(Math.Round((decimal)table.Rows[num6]["OrderTotal"], 2).ToString()) + "\",\"OrderDate\":\"" + str5 + "\",\"PaymentType\":\"" + table.Rows[num6]["PaymentType"].ToString() + "\",\"OrderId\":\"" + table.Rows[num6]["OrderId"].ToString() + "\",\"ShipTo\":\"" + table.Rows[num6]["ShipTo"].ToString() + "\",\"Remark\":\"" + table.Rows[num6]["Remark"].ToString() + "\"}");
                        for (num6 = 1; num6 < count; num6++)
                        {
                            str4 = !table.Rows[num6].IsNull(table.Columns["GatewayOrderId"]) ? table.Rows[num6]["GatewayOrderId"].ToString() : "-";
                            str5 = (table.Rows[num6]["FinishDate"] != DBNull.Value) ? DateTime.Parse(table.Rows[num6]["FinishDate"].ToString()).ToString("yyyy-MM-dd") : "-";
                            builder.Append(",{\"GatewayOrderId\":\"" + str4 + "\",\"OrderTotal\":\"" + Globals.String2Json(Math.Round((decimal)table.Rows[num6]["OrderTotal"], 2).ToString()) + "\",\"OrderDate\":\"" + str5 + "\",\"PaymentType\":\"" + table.Rows[num6]["PaymentType"].ToString() + "\",\"OrderId\":\"" + table.Rows[num6]["OrderId"].ToString() + "\",\"ShipTo\":\"" + table.Rows[num6]["ShipTo"].ToString() + "\",\"Remark\":\"" + table.Rows[num6]["Remark"].ToString() + "\"}");
                        }
                    }
                    s = string.Concat(new object[] { "{\"success\":\"true\",\"rowtotal\":\"", table.Rows.Count, "\",\"total\":\"", memberDetailOrders.TotalRecords, "\",\"lihtml\":[", builder.ToString(), "]}" });
                }
                break;
            }

            case 1:
            {
                DbQueryResult result2 = MemberAmountProcessor.GetAmountListRequestByTime(0, page, pagesize, member.UserId, str2, str3);
                object        obj3    = result2.Data;
                if (obj3 != null)
                {
                    DataTable     table2   = (DataTable)obj3;
                    StringBuilder builder2 = new StringBuilder();
                    int           num7     = table2.Rows.Count;
                    string        str6     = string.Empty;
                    if (num7 > 0)
                    {
                        int num9 = 0;
                        str6 = Math.Round(decimal.Parse(table2.Rows[num9]["TradeAmount"].ToString()), 2).ToString();
                        builder2.Append("{\"id\":" + table2.Rows[num9]["ID"].ToString() + ",\"AvailableAmount\":\"" + Globals.String2Json(Math.Round((decimal)table2.Rows[num9]["AvailableAmount"], 2).ToString()) + "\",\"TradeTime\":\"" + DateTime.Parse(table2.Rows[num9]["TradeTime"].ToString()).ToString("yyyy-MM-dd") + "\",\"TradeAmount\":\"" + str6 + "\",\"TradeType\":\"" + MemberHelper.StringToTradeType(table2.Rows[num9]["TradeType"].ToString()) + "\",\"PayId\":\"" + table2.Rows[num9]["PayId"].ToString() + "\",\"TradeWays\":\"" + MemberHelper.StringToTradeWays(table2.Rows[num9]["TradeWays"].ToString()) + "\",\"Remark\":\"" + table2.Rows[num9]["Remark"].ToString() + "\"}");
                        for (num9 = 1; num9 < num7; num9++)
                        {
                            str6 = Math.Round(decimal.Parse(table2.Rows[num9]["TradeAmount"].ToString()), 2).ToString();
                            builder2.Append(",{\"id\":" + table2.Rows[num9]["ID"].ToString() + ",\"AvailableAmount\":\"" + Globals.String2Json(Math.Round((decimal)table2.Rows[num9]["AvailableAmount"], 2).ToString()) + "\",\"TradeTime\":\"" + DateTime.Parse(table2.Rows[num9]["TradeTime"].ToString()).ToString("yyyy-MM-dd") + "\",\"TradeAmount\":\"" + str6 + "\",\"TradeType\":\"" + MemberHelper.StringToTradeType(table2.Rows[num9]["TradeType"].ToString()) + "\",\"PayId\":\"" + table2.Rows[num9]["PayId"].ToString() + "\",\"TradeWays\":\"" + MemberHelper.StringToTradeWays(table2.Rows[num9]["TradeWays"].ToString()) + "\",\"Remark\":\"" + table2.Rows[num9]["Remark"].ToString() + "\"}");
                        }
                    }
                    s = string.Concat(new object[] { "{\"success\":\"true\",\"rowtotal\":\"", table2.Rows.Count, "\",\"total\":\"", result2.TotalRecords, "\",\"lihtml\":[", builder2.ToString(), "]}" });
                }
                break;
            }
            }
            context.Response.Write(s);
            context.Response.End();
        }
Пример #2
0
        private void ProcessGetMemberAmountDetails(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int        userId = Globals.RequestFormNum("userid");
            MemberInfo member = MemberHelper.GetMember(userId);
            string     s      = "{\"success\":\"false\"}";
            int        num    = Globals.RequestFormNum("type");
            int        num2   = Globals.RequestFormNum("page");
            int        num3   = Globals.RequestFormNum("pagesize");
            string     text   = context.Request["startTime"].ToString();
            string     text2  = context.Request["endTime"].ToString();

            if (num3 < 5)
            {
                num3 = 5;
            }
            if (num2 < 1)
            {
                num2 = 1;
            }
            if (num == 0)
            {
                MemberDetailOrderQuery memberDetailOrderQuery = new MemberDetailOrderQuery();
                memberDetailOrderQuery.UserId = new int?(member.UserId);
                OrderStatus[] status = new OrderStatus[]
                {
                    OrderStatus.Finished,
                    OrderStatus.BuyerAlreadyPaid,
                    OrderStatus.SellerAlreadySent
                };
                memberDetailOrderQuery.Status = status;
                if (!string.IsNullOrEmpty(text))
                {
                    memberDetailOrderQuery.StartFinishDate = new System.DateTime?(System.Convert.ToDateTime(text));
                }
                if (!string.IsNullOrEmpty(text2))
                {
                    memberDetailOrderQuery.EndFinishDate = new System.DateTime?(System.Convert.ToDateTime(text2));
                }
                memberDetailOrderQuery.PageIndex = num2;
                memberDetailOrderQuery.PageSize  = num3;
                memberDetailOrderQuery.SortBy    = "OrderDate";
                memberDetailOrderQuery.SortOrder = SortAction.Desc;
                DbQueryResult memberDetailOrders = OrderHelper.GetMemberDetailOrders(memberDetailOrderQuery);
                object        data = memberDetailOrders.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;
                    if (count > 0)
                    {
                        int    i     = 0;
                        string text3 = (!dataTable.Rows[i].IsNull(dataTable.Columns["GatewayOrderId"])) ? dataTable.Rows[i]["GatewayOrderId"].ToString() : "-";
                        string text4 = (dataTable.Rows[i]["FinishDate"] != System.DBNull.Value) ? System.DateTime.Parse(dataTable.Rows[i]["FinishDate"].ToString()).ToString("yyyy-MM-dd") : "-";
                        stringBuilder.Append(string.Concat(new string[]
                        {
                            "{\"GatewayOrderId\":\"",
                            text3,
                            "\",\"OrderTotal\":\"",
                            Globals.String2Json(System.Math.Round((decimal)dataTable.Rows[i]["OrderTotal"], 2).ToString()),
                            "\",\"OrderDate\":\"",
                            text4,
                            "\",\"PaymentType\":\"",
                            dataTable.Rows[i]["PaymentType"].ToString(),
                            "\",\"OrderId\":\"",
                            dataTable.Rows[i]["OrderId"].ToString(),
                            "\",\"ShipTo\":\"",
                            dataTable.Rows[i]["ShipTo"].ToString(),
                            "\",\"Remark\":\"",
                            dataTable.Rows[i]["Remark"].ToString(),
                            "\"}"
                        }));
                        for (i = 1; i < count; i++)
                        {
                            text3 = ((!dataTable.Rows[i].IsNull(dataTable.Columns["GatewayOrderId"])) ? dataTable.Rows[i]["GatewayOrderId"].ToString() : "-");
                            text4 = ((dataTable.Rows[i]["FinishDate"] != System.DBNull.Value) ? System.DateTime.Parse(dataTable.Rows[i]["FinishDate"].ToString()).ToString("yyyy-MM-dd") : "-");
                            stringBuilder.Append(string.Concat(new string[]
                            {
                                ",{\"GatewayOrderId\":\"",
                                text3,
                                "\",\"OrderTotal\":\"",
                                Globals.String2Json(System.Math.Round((decimal)dataTable.Rows[i]["OrderTotal"], 2).ToString()),
                                "\",\"OrderDate\":\"",
                                text4,
                                "\",\"PaymentType\":\"",
                                dataTable.Rows[i]["PaymentType"].ToString(),
                                "\",\"OrderId\":\"",
                                dataTable.Rows[i]["OrderId"].ToString(),
                                "\",\"ShipTo\":\"",
                                dataTable.Rows[i]["ShipTo"].ToString(),
                                "\",\"Remark\":\"",
                                dataTable.Rows[i]["Remark"].ToString(),
                                "\"}"
                            }));
                        }
                    }
                    s = string.Concat(new object[]
                    {
                        "{\"success\":\"true\",\"rowtotal\":\"",
                        dataTable.Rows.Count,
                        "\",\"total\":\"",
                        memberDetailOrders.TotalRecords,
                        "\",\"lihtml\":[",
                        stringBuilder.ToString(),
                        "]}"
                    });
                }
            }
            if (num == 1)
            {
                DbQueryResult amountListRequestByTime = MemberAmountProcessor.GetAmountListRequestByTime(0, num2, num3, member.UserId, text, text2);
                object        data2 = amountListRequestByTime.Data;
                if (data2 != null)
                {
                    System.Data.DataTable     dataTable2     = (System.Data.DataTable)data2;
                    System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                    int    count2 = dataTable2.Rows.Count;
                    string text5  = string.Empty;
                    if (count2 > 0)
                    {
                        int     j = 0;
                        decimal d = decimal.Parse(dataTable2.Rows[j]["TradeAmount"].ToString());
                        text5 = System.Math.Round(d, 2).ToString();
                        stringBuilder2.Append(string.Concat(new string[]
                        {
                            "{\"id\":",
                            dataTable2.Rows[j]["ID"].ToString(),
                            ",\"AvailableAmount\":\"",
                            Globals.String2Json(System.Math.Round((decimal)dataTable2.Rows[j]["AvailableAmount"], 2).ToString()),
                            "\",\"TradeTime\":\"",
                            System.DateTime.Parse(dataTable2.Rows[j]["TradeTime"].ToString()).ToString("yyyy-MM-dd"),
                            "\",\"TradeAmount\":\"",
                            text5,
                            "\",\"TradeType\":\"",
                            MemberHelper.StringToTradeType(dataTable2.Rows[j]["TradeType"].ToString()),
                            "\",\"PayId\":\"",
                            dataTable2.Rows[j]["PayId"].ToString(),
                            "\",\"TradeWays\":\"",
                            MemberHelper.StringToTradeWays(dataTable2.Rows[j]["TradeWays"].ToString()),
                            "\",\"Remark\":\"",
                            dataTable2.Rows[j]["Remark"].ToString(),
                            "\"}"
                        }));
                        for (j = 1; j < count2; j++)
                        {
                            d     = decimal.Parse(dataTable2.Rows[j]["TradeAmount"].ToString());
                            text5 = System.Math.Round(d, 2).ToString();
                            stringBuilder2.Append(string.Concat(new string[]
                            {
                                ",{\"id\":",
                                dataTable2.Rows[j]["ID"].ToString(),
                                ",\"AvailableAmount\":\"",
                                Globals.String2Json(System.Math.Round((decimal)dataTable2.Rows[j]["AvailableAmount"], 2).ToString()),
                                "\",\"TradeTime\":\"",
                                System.DateTime.Parse(dataTable2.Rows[j]["TradeTime"].ToString()).ToString("yyyy-MM-dd"),
                                "\",\"TradeAmount\":\"",
                                text5,
                                "\",\"TradeType\":\"",
                                MemberHelper.StringToTradeType(dataTable2.Rows[j]["TradeType"].ToString()),
                                "\",\"PayId\":\"",
                                dataTable2.Rows[j]["PayId"].ToString(),
                                "\",\"TradeWays\":\"",
                                MemberHelper.StringToTradeWays(dataTable2.Rows[j]["TradeWays"].ToString()),
                                "\",\"Remark\":\"",
                                dataTable2.Rows[j]["Remark"].ToString(),
                                "\"}"
                            }));
                        }
                    }
                    s = string.Concat(new object[]
                    {
                        "{\"success\":\"true\",\"rowtotal\":\"",
                        dataTable2.Rows.Count,
                        "\",\"total\":\"",
                        amountListRequestByTime.TotalRecords,
                        "\",\"lihtml\":[",
                        stringBuilder2.ToString(),
                        "]}"
                    });
                }
            }
            context.Response.Write(s);
            context.Response.End();
        }