Example #1
0
        public StringBuilder GetOrderList(PurchaseOrderQuery query, string format, string orderitemfomat, out int totalrecords)
        {
            int totalrecord = 0;

            Globals.EntityCoding(query, true);
            DataSet       aPIPurchaseOrders = SalesHelper.GetAPIPurchaseOrders(query, out totalrecord);
            StringBuilder builder           = new StringBuilder();

            foreach (DataRow row in aPIPurchaseOrders.Tables[0].Rows)
            {
                string        str      = "false";
                StringBuilder builder2 = new StringBuilder();
                foreach (DataRow row2 in row.GetChildRows("PurchaseOrderRelation"))
                {
                    string str2 = row2["SKUContent"].ToString();
                    str = "true";
                    builder2.AppendFormat(orderitemfomat, new object[] { row2["Tid"].ToString(), row2["PurchaseOrderId"].ToString(), row2["ProductId"].ToString(), row2["ItemDescription"].ToString(), row2["SKU"].ToString(), str2, row2["Quantity"].ToString(), decimal.Parse(row2["ItemListPrice"].ToString()).ToString("F2"), decimal.Parse(row2["ItemPurchasePrice"].ToString()).ToString("F2"), decimal.Parse(row2["CostPrice"].ToString()).ToString("F2") });
                }
                Dictionary <string, string> shippingRegion = MessageInfo.GetShippingRegion(row["ShippingRegion"].ToString());
                builder.AppendFormat(format, new object[] {
                    row["PurchaseOrderId"].ToString(), row["SellerUid"].ToString(), row["Username"].ToString(), row["EmailAddress"].ToString(), row["ShipTo"].ToString(), shippingRegion["Province"], shippingRegion["City"].ToString(), shippingRegion["District"], row["Address"].ToString(), row["ZipCode"].ToString(), row["CellPhone"].ToString(), row["TelPhone"].ToString(), row["Remark"].ToString(), row["ManagerMark"].ToString(), row["ManagerRemark"].ToString(), row["Nums"].ToString(),
                    decimal.Parse(row["OrderTotal"].ToString()).ToString("F2"), decimal.Parse(row["OrderTotal"].ToString()).ToString("F2"), decimal.Parse(row["AdjustedFreight"].ToString()).ToString("F2"), decimal.Parse(row["Profit"].ToString()).ToString("F2"), decimal.Parse(row["PurchaseTotal"].ToString()).ToString("F2"), row["PayDate"].ToString(), row["ShippingDate"].ToString(), row["ReFundStatus"].ToString(), decimal.Parse(row["RefundAmount"].ToString()).ToString("F2"), row["RefundRemark"].ToString(), row["OrderStatus"].ToString(), str, builder2
                });
            }
            totalrecords = totalrecord;
            return(builder);
        }
Example #2
0
        public StringBuilder GetOrderDetails(string format, string orderitemfomat, PurchaseOrderInfo order)
        {
            StringBuilder builder = new StringBuilder();
            string        str     = string.Empty;

            if (order == null)
            {
                return(builder);
            }
            string        str2     = "false";
            StringBuilder builder2 = new StringBuilder();
            long          num      = 0L;

            foreach (PurchaseOrderItemInfo info in order.PurchaseOrderItems)
            {
                str2 = "true";
                builder2.AppendFormat(orderitemfomat, new object[] { "0", order.OrderId, info.ProductId.ToString(), info.ItemDescription, info.SKU, info.SKUContent, info.Quantity.ToString(), info.ItemListPrice.ToString("F2"), info.ItemPurchasePrice.ToString("F2"), info.ItemCostPrice.ToString("F2") });
                num += info.Quantity;
            }
            Dictionary <string, string> shippingRegion = MessageInfo.GetShippingRegion(order.ShippingRegion);

            builder.AppendFormat(format, new object[] {
                order.OrderId, "0", order.Distributorname, order.DistributorEmail, order.ShipTo, shippingRegion["Province"], shippingRegion["City"].ToString(), shippingRegion["District"], order.Address, order.ZipCode, order.CellPhone, order.TelPhone, order.Remark, order.ManagerMark, order.ManagerRemark, num.ToString(),
                order.OrderTotal.ToString("F2"), order.OrderTotal.ToString("F2"), order.AdjustedFreight.ToString("F2"), order.GetPurchaseProfit().ToString("F2"), order.GetPurchaseTotal().ToString("F2"), order.PayDate.ToString(), order.ShippingDate.ToString(), ((int)order.RefundStatus).ToString(), order.RefundAmount.ToString("F2"), order.RefundRemark, ((int)order.PurchaseStatus).ToString(), str2, builder2
            });
            if (!string.IsNullOrEmpty(order.ShippingRegion))
            {
                str = order.ShippingRegion;
            }
            if (!string.IsNullOrEmpty(order.Address))
            {
                str = str + order.Address;
            }
            if (!string.IsNullOrEmpty(order.ShipTo))
            {
                str = str + "   " + order.ShipTo;
            }
            if (!string.IsNullOrEmpty(order.ZipCode))
            {
                str = str + "   " + order.ZipCode;
            }
            if (!string.IsNullOrEmpty(order.TelPhone))
            {
                str = str + "   " + order.TelPhone;
            }
            if (!string.IsNullOrEmpty(order.CellPhone))
            {
                str = str + "   " + order.CellPhone;
            }
            string str3 = "<ShipAddress>{0}</ShipAddress><ModeName>{1}</ModeName><ShipOrderNumber>{2}</ShipOrderNumber><ExpressCompanyName>{3}</ExpressCompanyName>";

            str3 = string.Format(str3, new object[] { str, order.RealModeName, order.ShipOrderNumber, order.ExpressCompanyName });
            return(builder.Replace("</Status>", "</Status>" + str3));
        }
        public System.Text.StringBuilder GetOrderDetails(string format, string orderitemfomat, PurchaseOrderInfo order)
        {
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            string text = string.Empty;

            if (order != null)
            {
                string text2 = "false";
                System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                long num = 0L;
                System.Collections.Generic.IList <PurchaseOrderItemInfo> purchaseOrderItems = order.PurchaseOrderItems;
                foreach (PurchaseOrderItemInfo current in purchaseOrderItems)
                {
                    text2 = "true";
                    stringBuilder2.AppendFormat(orderitemfomat, new object[]
                    {
                        "0",
                        order.OrderId,
                        current.ProductId.ToString(),
                        current.ItemDescription,
                        current.SKU,
                        current.SKUContent,
                        current.Quantity.ToString(),
                        current.ItemListPrice.ToString("F2"),
                        current.ItemPurchasePrice.ToString("F2"),
                        current.ItemCostPrice.ToString("F2")
                    });
                    num += (long)current.Quantity;
                }
                System.Collections.Generic.Dictionary <string, string> shippingRegion = MessageInfo.GetShippingRegion(order.ShippingRegion);
                stringBuilder.AppendFormat(format, new object[]
                {
                    order.OrderId,
                    "0",
                    order.Distributorname,
                    order.DistributorEmail,
                    order.ShipTo,
                    shippingRegion["Province"],
                    shippingRegion["City"].ToString(),
                    shippingRegion["District"],
                    order.Address,
                    order.ZipCode,
                    order.CellPhone,
                    order.TelPhone,
                    order.Remark,
                    order.ManagerMark,
                    order.ManagerRemark,
                    num.ToString(),
                    order.OrderTotal.ToString("F2"),
                    order.OrderTotal.ToString("F2"),
                    order.AdjustedFreight.ToString("F2"),
                    order.GetPurchaseProfit().ToString("F2"),
                    order.GetPurchaseTotal().ToString("F2"),
                    order.PayDate.ToString(),
                    order.ShippingDate.ToString(),
                    ((int)order.RefundStatus).ToString(),
                    order.RefundAmount.ToString("F2"),
                    order.RefundRemark,
                    ((int)order.PurchaseStatus).ToString(),
                    text2,
                    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 text3 = "<ShipAddress>{0}</ShipAddress><ModeName>{1}</ModeName><ShipOrderNumber>{2}</ShipOrderNumber><ExpressCompanyName>{3}</ExpressCompanyName>";
                text3 = string.Format(text3, new object[]
                {
                    text,
                    order.RealModeName,
                    order.ShipOrderNumber,
                    order.ExpressCompanyName
                });
                stringBuilder = stringBuilder.Replace("</Status>", "</Status>" + text3);
            }
            return(stringBuilder);
        }
        public System.Text.StringBuilder GetOrderList(PurchaseOrderQuery query, string format, string orderitemfomat, out int totalrecords)
        {
            int num = 0;

            Globals.EntityCoding(query, true);
            System.Data.DataSet       aPIPurchaseOrders = SalesHelper.GetAPIPurchaseOrders(query, out num);
            System.Text.StringBuilder stringBuilder     = new System.Text.StringBuilder();
            foreach (System.Data.DataRow dataRow in aPIPurchaseOrders.Tables[0].Rows)
            {
                string text = "false";
                System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                System.Data.DataRow[]     childRows      = dataRow.GetChildRows("PurchaseOrderRelation");
                for (int i = 0; i < childRows.Length; i++)
                {
                    System.Data.DataRow dataRow2 = childRows[i];
                    string text2 = dataRow2["SKUContent"].ToString();
                    text = "true";
                    stringBuilder2.AppendFormat(orderitemfomat, new object[]
                    {
                        dataRow2["Tid"].ToString(),
                        dataRow2["PurchaseOrderId"].ToString(),
                        dataRow2["ProductId"].ToString(),
                        dataRow2["ItemDescription"].ToString(),
                        dataRow2["SKU"].ToString(),
                        text2,
                        dataRow2["Quantity"].ToString(),
                        decimal.Parse(dataRow2["ItemListPrice"].ToString()).ToString("F2"),
                        decimal.Parse(dataRow2["ItemPurchasePrice"].ToString()).ToString("F2"),
                        decimal.Parse(dataRow2["CostPrice"].ToString()).ToString("F2")
                    });
                }
                System.Collections.Generic.Dictionary <string, string> shippingRegion = MessageInfo.GetShippingRegion(dataRow["ShippingRegion"].ToString());
                stringBuilder.AppendFormat(format, new object[]
                {
                    dataRow["PurchaseOrderId"].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(),
                    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"),
                    decimal.Parse(dataRow["AdjustedFreight"].ToString()).ToString("F2"),
                    decimal.Parse(dataRow["Profit"].ToString()).ToString("F2"),
                    decimal.Parse(dataRow["PurchaseTotal"].ToString()).ToString("F2"),
                    dataRow["PayDate"].ToString(),
                    dataRow["ShippingDate"].ToString(),
                    dataRow["ReFundStatus"].ToString(),
                    decimal.Parse(dataRow["RefundAmount"].ToString()).ToString("F2"),
                    dataRow["RefundRemark"].ToString(),
                    dataRow["OrderStatus"].ToString(),
                    text,
                    stringBuilder2
                });
            }
            totalrecords = num;
            return(stringBuilder);
        }