Пример #1
0
        public System.Text.StringBuilder GetOrderDetails(string format, string orderitemfomat, OrderInfo order)
        {
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            string text = string.Empty;

            if (order != null)
            {
                System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                long num = 0L;
                System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = order.LineItems;
                foreach (LineItemInfo current in lineItems.Values)
                {
                    stringBuilder2.AppendFormat(orderitemfomat, new object[]
                    {
                        "0",
                        order.OrderId,
                        current.ProductId.ToString(),
                        current.ItemDescription,
                        current.SKU,
                        current.SkuId,
                        Globals.HtmlEncode(current.SKUContent),
                        current.Quantity.ToString(),
                        current.ItemListPrice.ToString("F2"),
                        current.ItemAdjustedPrice.ToString("F2"),
                        current.ThumbnailsUrl
                    });
                    num += (long)current.Quantity;
                }
                if (this.fomat == "json" && stringBuilder2.Length > 0)
                {
                    stringBuilder2 = stringBuilder2.Remove(stringBuilder2.ToString().LastIndexOf(','), 1);
                }
                System.Collections.Generic.Dictionary <string, string> shippingRegion = MessageInfo.GetShippingRegion(order.ShippingRegion);
                string text2 = order.ModeName;
                if (!string.IsNullOrEmpty(order.RealModeName))
                {
                    text2 = order.RealModeName;
                }
                if (string.IsNullOrEmpty(text))
                {
                    text = order.ModeName;
                }
                string text3 = "";
                string text4 = "";
                string text5 = "";
                if (order.PayDate.Year != 1)
                {
                    text3 = order.PayDate.ToString("yyyy-MM-dd");
                }
                if (order.ShippingDate.Year != 1)
                {
                    text4 = order.ShippingDate.ToString("yyyy-MM-dd");
                }
                if (order.OrderDate.Year != 1)
                {
                    text5 = order.OrderDate.ToString("yyyy-MM-dd");
                }
                stringBuilder.AppendFormat(format, new object[]
                {
                    order.OrderId,
                    "0",
                    order.Username,
                    order.EmailAddress,
                    order.ShipTo,
                    shippingRegion["Province"],
                    shippingRegion["City"].ToString(),
                    shippingRegion["District"],
                    order.Address,
                    order.ZipCode,
                    order.CellPhone,
                    order.TelPhone,
                    Globals.HtmlEncode(order.Remark),
                    order.ManagerMark,
                    order.ManagerRemark,
                    num.ToString(),
                    order.GetTotal().ToString("F2"),
                    order.GetTotal().ToString("F2"),
                    order.Gateway,
                    order.PaymentTypeId.ToString(),
                    order.PaymentType,
                    order.AdjustedFreight.ToString("F2"),
                    order.ReducedPromotionAmount.ToString("F2"),
                    order.AdjustedDiscount.ToString("F2"),
                    text3,
                    text4,
                    ((int)order.RefundStatus).ToString(),
                    order.RefundAmount.ToString("F2"),
                    order.RefundRemark,
                    ((int)order.OrderStatus).ToString(),
                    text2,
                    text5,
                    stringBuilder2
                });
                if (!string.IsNullOrEmpty(order.ShippingRegion))
                {
                    text = order.ShippingRegion;
                }
                if (!string.IsNullOrEmpty(order.Address))
                {
                    text += order.Address;
                }
                if (!string.IsNullOrEmpty(order.ShipTo))
                {
                    text = text + "   " + order.ShipTo;
                }
                if (!string.IsNullOrEmpty(order.ZipCode))
                {
                    text = text + "   " + order.ZipCode;
                }
                if (!string.IsNullOrEmpty(order.TelPhone))
                {
                    text = text + "   " + order.TelPhone;
                }
                if (!string.IsNullOrEmpty(order.CellPhone))
                {
                    text = text + "   " + order.CellPhone;
                }
                string text6 = "<ShipAddress>{0}</ShipAddress><ShipOrderNumber>{1}</ShipOrderNumber><ExpressCompanyName>{2}</ExpressCompanyName>";
                if (this.fomat == "json")
                {
                    text6 = "\"ShipAddress\":\"{0}\",\"ShipOrderNumber\":\"{1}\",\"ExpressCompanyName\":\"{2}\"";
                }
                text6 = string.Format(text6, text, order.ShipOrderNumber, order.ExpressCompanyName);
                if (this.fomat == "json")
                {
                    stringBuilder = stringBuilder.Replace(",\"ModeName", "," + text6 + ",\"ModeName");
                    stringBuilder = stringBuilder.Remove(stringBuilder.ToString().LastIndexOf(','), 1);
                }
                else
                {
                    stringBuilder = stringBuilder.Replace("</Status>", "</Status>" + text6);
                }
            }
            return(stringBuilder);
        }
Пример #2
0
        public System.Text.StringBuilder GetOrderList(OrderQuery query, string format, string orderitemfomat, out int totalrecords)
        {
            int num = 0;

            Globals.EntityCoding(query, true);
            System.Data.DataSet       tradeOrders   = OrderHelper.GetTradeOrders(query, out num);
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            foreach (System.Data.DataRow dataRow in tradeOrders.Tables[0].Rows)
            {
                System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                System.Data.DataRow[]     childRows      = dataRow.GetChildRows("OrderRelation");
                for (int i = 0; i < childRows.Length; i++)
                {
                    System.Data.DataRow dataRow2 = childRows[i];
                    string text  = Globals.HtmlEncode(dataRow2["SKUContent"].ToString());
                    string text2 = dataRow2["ThumbnailsUrl"].ToString();
                    stringBuilder2.AppendFormat(orderitemfomat, new object[]
                    {
                        dataRow2["Tid"].ToString(),
                        dataRow2["OrderId"].ToString(),
                        dataRow2["ProductId"].ToString(),
                        dataRow2["ItemDescription"].ToString(),
                        dataRow2["SKU"].ToString(),
                        dataRow2["SkuId"].ToString(),
                        text,
                        dataRow2["Quantity"].ToString(),
                        decimal.Parse(dataRow2["ItemListPrice"].ToString()).ToString("F2"),
                        decimal.Parse(dataRow2["ItemAdjustedPrice"].ToString()).ToString("F2"),
                        text2
                    });
                }
                if (this.fomat == "json" && stringBuilder2.ToString().Length > 0)
                {
                    stringBuilder2 = stringBuilder2.Remove(stringBuilder2.ToString().LastIndexOf(','), 1);
                }
                System.Collections.Generic.Dictionary <string, string> shippingRegion = MessageInfo.GetShippingRegion(dataRow["ShippingRegion"].ToString());
                stringBuilder.AppendFormat(this.jsonformat, new object[]
                {
                    dataRow["OrderId"].ToString(),
                    dataRow["SellerUid"].ToString(),
                    dataRow["Username"].ToString(),
                    dataRow["EmailAddress"].ToString(),
                    dataRow["ShipTo"].ToString(),
                    shippingRegion["Province"],
                    shippingRegion["City"].ToString(),
                    shippingRegion["District"],
                    dataRow["Address"].ToString(),
                    dataRow["ZipCode"].ToString(),
                    dataRow["CellPhone"].ToString(),
                    dataRow["TelPhone"].ToString(),
                    Globals.HtmlEncode(dataRow["Remark"].ToString()),
                    dataRow["ManagerMark"].ToString(),
                    dataRow["ManagerRemark"].ToString(),
                    dataRow["Nums"].ToString(),
                    decimal.Parse(dataRow["OrderTotal"].ToString()).ToString("F2"),
                    decimal.Parse(dataRow["OrderTotal"].ToString()).ToString("F2"),
                    dataRow["Gateway"].ToString(),
                    dataRow["PaymentTypeId"].ToString(),
                    dataRow["PaymentType"].ToString(),
                    decimal.Parse(dataRow["AdjustedFreight"].ToString()).ToString("F2"),
                    "0.00",
                    decimal.Parse(dataRow["AdjustedDiscount"].ToString()).ToString("F2"),
                    dataRow["PayDate"].ToString(),
                    dataRow["ShippingDate"].ToString(),
                    dataRow["ReFundStatus"].ToString(),
                    dataRow["RefundAmount"].ToString(),
                    dataRow["RefundRemark"].ToString(),
                    dataRow["OrderStatus"].ToString(),
                    dataRow["ModeName"].ToString(),
                    dataRow["OrderDate"].ToString(),
                    stringBuilder2
                });
            }
            if (this.fomat == "json" && stringBuilder.Length > 0)
            {
                stringBuilder = stringBuilder.Remove(stringBuilder.ToString().LastIndexOf(','), 1);
            }
            totalrecords = num;
            return(stringBuilder);
        }