Exemplo n.º 1
0
        public override bool CreatePurchaseOrder(OrderInfo order, DbTransaction dbTran)
        {
            string            str;
            PurchaseOrderInfo info = ConvertOrderToPurchaseOrder(order);

            if (info == null)
            {
                return(false);
            }
            DbCommand     sqlStringCommand = database.GetSqlStringCommand(" ");
            StringBuilder builder          = new StringBuilder();

            builder.Append("INSERT INTO Hishop_PurchaseOrders(PurchaseOrderId, OrderId, Remark, ManagerMark, ManagerRemark, AdjustedDiscount,PurchaseStatus, CloseReason, PurchaseDate, DistributorId, Distributorname,DistributorEmail, DistributorRealName, DistributorQQ, DistributorWangwang, DistributorMSN,ShippingRegion, Address, ZipCode, ShipTo, TelPhone, CellPhone, ShippingModeId, ModeName,RealShippingModeId, RealModeName, RegionId, Freight, AdjustedFreight, ShipOrderNumber, Weight,RefundStatus, RefundAmount, RefundRemark, OrderTotal, PurchaseProfit, PurchaseTotal,ExpressCompanyName,ExpressCompanyAbb)VALUES (@PurchaseOrderId, @OrderId, @Remark, @ManagerMark, @ManagerRemark, @AdjustedDiscount,@PurchaseStatus, @CloseReason, @PurchaseDate, @DistributorId, @Distributorname,@DistributorEmail, @DistributorRealName, @DistributorQQ, @DistributorWangwang, @DistributorMSN,@ShippingRegion, @Address, @ZipCode, @ShipTo, @TelPhone, @CellPhone, @ShippingModeId, @ModeName,@RealShippingModeId, @RealModeName, @RegionId, @Freight, @AdjustedFreight, @ShipOrderNumber, @PurchaseWeight,@RefundStatus, @RefundAmount, @RefundRemark, @OrderTotal, @PurchaseProfit, @PurchaseTotal,@ExpressCompanyName,@ExpressCompanyAbb);");
            database.AddInParameter(sqlStringCommand, "PurchaseOrderId", DbType.String, info.PurchaseOrderId);
            database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, info.OrderId);
            database.AddInParameter(sqlStringCommand, "Remark", DbType.String, info.Remark);
            if (info.ManagerMark.HasValue)
            {
                database.AddInParameter(sqlStringCommand, "ManagerMark", DbType.Int32, (int)info.ManagerMark.Value);
            }
            else
            {
                database.AddInParameter(sqlStringCommand, "ManagerMark", DbType.Int32, DBNull.Value);
            }
            database.AddInParameter(sqlStringCommand, "ManagerRemark", DbType.String, info.ManagerRemark);
            database.AddInParameter(sqlStringCommand, "AdjustedDiscount", DbType.Currency, info.AdjustedDiscount);
            database.AddInParameter(sqlStringCommand, "PurchaseStatus", DbType.Int32, (int)info.PurchaseStatus);
            database.AddInParameter(sqlStringCommand, "CloseReason", DbType.String, info.CloseReason);
            database.AddInParameter(sqlStringCommand, "PurchaseDate", DbType.DateTime, DateTime.Now);
            database.AddInParameter(sqlStringCommand, "DistributorId", DbType.Int32, info.DistributorId);
            database.AddInParameter(sqlStringCommand, "Distributorname", DbType.String, info.Distributorname);
            database.AddInParameter(sqlStringCommand, "DistributorEmail", DbType.String, info.DistributorEmail);
            database.AddInParameter(sqlStringCommand, "DistributorRealName", DbType.String, info.DistributorRealName);
            database.AddInParameter(sqlStringCommand, "DistributorQQ", DbType.String, info.DistributorQQ);
            database.AddInParameter(sqlStringCommand, "DistributorWangwang", DbType.String, info.DistributorWangwang);
            database.AddInParameter(sqlStringCommand, "DistributorMSN", DbType.String, info.DistributorMSN);
            database.AddInParameter(sqlStringCommand, "ShippingRegion", DbType.String, info.ShippingRegion);
            database.AddInParameter(sqlStringCommand, "Address", DbType.String, info.Address);
            database.AddInParameter(sqlStringCommand, "ZipCode", DbType.String, info.ZipCode);
            database.AddInParameter(sqlStringCommand, "ShipTo", DbType.String, info.ShipTo);
            database.AddInParameter(sqlStringCommand, "TelPhone", DbType.String, info.TelPhone);
            database.AddInParameter(sqlStringCommand, "CellPhone", DbType.String, info.CellPhone);
            database.AddInParameter(sqlStringCommand, "ShippingModeId", DbType.Int32, info.ShippingModeId);
            database.AddInParameter(sqlStringCommand, "ModeName", DbType.String, info.ModeName);
            database.AddInParameter(sqlStringCommand, "RealShippingModeId", DbType.Int32, info.RealShippingModeId);
            database.AddInParameter(sqlStringCommand, "RealModeName", DbType.String, info.RealModeName);
            database.AddInParameter(sqlStringCommand, "RegionId", DbType.Int32, info.RegionId);
            database.AddInParameter(sqlStringCommand, "Freight", DbType.Currency, info.Freight);
            database.AddInParameter(sqlStringCommand, "AdjustedFreight", DbType.Currency, info.AdjustedFreight);
            database.AddInParameter(sqlStringCommand, "ShipOrderNumber", DbType.String, info.ShipOrderNumber);
            database.AddInParameter(sqlStringCommand, "PurchaseWeight", DbType.Int32, info.Weight);
            database.AddInParameter(sqlStringCommand, "RefundStatus", DbType.Int32, (int)info.RefundStatus);
            database.AddInParameter(sqlStringCommand, "RefundAmount", DbType.Currency, info.RefundAmount);
            database.AddInParameter(sqlStringCommand, "RefundRemark", DbType.String, info.RefundRemark);
            database.AddInParameter(sqlStringCommand, "OrderTotal", DbType.Currency, info.OrderTotal);
            database.AddInParameter(sqlStringCommand, "PurchaseProfit", DbType.Currency, info.GetPurchaseProfit());
            database.AddInParameter(sqlStringCommand, "PurchaseTotal", DbType.Currency, info.GetPurchaseTotal());
            database.AddInParameter(sqlStringCommand, "ExpressCompanyAbb", DbType.String, info.ExpressCompanyAbb);
            database.AddInParameter(sqlStringCommand, "ExpressCompanyName", DbType.String, info.ExpressCompanyName);
            int num = 0;

            foreach (PurchaseOrderItemInfo info2 in info.PurchaseOrderItems)
            {
                str = num.ToString();
                builder.Append("INSERT INTO Hishop_PurchaseOrderItems(PurchaseOrderId, SkuId, ProductId, SKU, Quantity,  CostPrice, ").Append("ItemListPrice, ItemPurchasePrice, ItemDescription, ItemHomeSiteDescription, SKUContent, ThumbnailsUrl, Weight) VALUES( @PurchaseOrderId").Append(",@SkuId").Append(str).Append(",@ProductId").Append(str).Append(",@SKU").Append(str).Append(",@Quantity").Append(str).Append(",@CostPrice").Append(str).Append(",@ItemListPrice").Append(str).Append(",@ItemPurchasePrice").Append(str).Append(",@ItemDescription").Append(str).Append(",@ItemHomeSiteDescription").Append(str).Append(",@SKUContent").Append(str).Append(",@ThumbnailsUrl").Append(str).Append(",@Weight").Append(str).Append(");");
                database.AddInParameter(sqlStringCommand, "SkuId" + str, DbType.String, info2.SkuId);
                database.AddInParameter(sqlStringCommand, "ProductId" + str, DbType.Int32, info2.ProductId);
                database.AddInParameter(sqlStringCommand, "SKU" + str, DbType.String, info2.SKU);
                database.AddInParameter(sqlStringCommand, "Quantity" + str, DbType.Int32, info2.Quantity);
                database.AddInParameter(sqlStringCommand, "CostPrice" + str, DbType.Currency, info2.ItemCostPrice);
                database.AddInParameter(sqlStringCommand, "ItemListPrice" + str, DbType.Currency, info2.ItemListPrice);
                database.AddInParameter(sqlStringCommand, "ItemPurchasePrice" + str, DbType.Currency, info2.ItemPurchasePrice);
                database.AddInParameter(sqlStringCommand, "ItemDescription" + str, DbType.String, info2.ItemDescription);
                database.AddInParameter(sqlStringCommand, "ItemHomeSiteDescription" + str, DbType.String, info2.ItemHomeSiteDescription);
                database.AddInParameter(sqlStringCommand, "SKUContent" + str, DbType.String, info2.SKUContent);
                database.AddInParameter(sqlStringCommand, "ThumbnailsUrl" + str, DbType.String, info2.ThumbnailsUrl);
                database.AddInParameter(sqlStringCommand, "Weight" + str, DbType.Int32, info2.ItemWeight);
                num++;
            }
            foreach (PurchaseOrderGiftInfo info3 in info.PurchaseOrderGifts)
            {
                str = num.ToString();
                builder.Append("INSERT INTO Hishop_PurchaseOrderGifts(PurchaseOrderId, GiftId, GiftName, CostPrice, PurchasePrice, ").Append("ThumbnailsUrl, Quantity) VALUES( @PurchaseOrderId,").Append("@GiftId").Append(str).Append(",@GiftName").Append(str).Append(",@CostPrice").Append(str).Append(",@PurchasePrice").Append(str).Append(",@ThumbnailsUrl").Append(str).Append(",@Quantity").Append(str).Append(");");
                database.AddInParameter(sqlStringCommand, "GiftId" + str, DbType.Int32, info3.GiftId);
                database.AddInParameter(sqlStringCommand, "GiftName" + str, DbType.String, info3.GiftName);
                database.AddInParameter(sqlStringCommand, "Quantity" + str, DbType.Int32, info3.Quantity);
                database.AddInParameter(sqlStringCommand, "CostPrice" + str, DbType.Currency, info3.CostPrice);
                database.AddInParameter(sqlStringCommand, "PurchasePrice" + str, DbType.Currency, info3.PurchasePrice);
                database.AddInParameter(sqlStringCommand, "ThumbnailsUrl" + str, DbType.String, info3.ThumbnailsUrl);
                num++;
            }
            foreach (PurchaseOrderOptionInfo info4 in info.PurchaseOrderOptions)
            {
                str = num.ToString();
                builder.Append("INSERT INTO Hishop_PurchaseOrderOptions (PurchaseOrderId, LookupListId, LookupItemId, ListDescription, ItemDescription, AdjustedPrice, CustomerTitle, CustomerDescription)").Append(" VALUES (@PurchaseOrderId, @LookupListId").Append(str).Append(", @LookupItemId").Append(str).Append(", @ListDescription").Append(str).Append(", @ItemDescription").Append(str).Append(", @AdjustedPrice").Append(str).Append(", @CustomerTitle").Append(str).Append(", @CustomerDescription").Append(str).Append(");");
                database.AddInParameter(sqlStringCommand, "LookupListId" + str, DbType.Int32, info4.LookupListId);
                database.AddInParameter(sqlStringCommand, "LookupItemId" + str, DbType.Int32, info4.LookupItemId);
                database.AddInParameter(sqlStringCommand, "ListDescription" + str, DbType.String, info4.ListDescription);
                database.AddInParameter(sqlStringCommand, "ItemDescription" + str, DbType.String, info4.ItemDescription);
                database.AddInParameter(sqlStringCommand, "AdjustedPrice" + str, DbType.Currency, info4.AdjustedPrice);
                database.AddInParameter(sqlStringCommand, "CustomerTitle" + str, DbType.String, info4.CustomerTitle);
                database.AddInParameter(sqlStringCommand, "CustomerDescription" + str, DbType.String, info4.CustomerDescription);
                num++;
            }
            sqlStringCommand.CommandText = builder.ToString().Remove(builder.Length - 1);
            if (dbTran != null)
            {
                return(database.ExecuteNonQuery(sqlStringCommand, dbTran) > 0);
            }
            return(database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
0
        public override bool CreatePurchaseOrder(OrderInfo order, System.Data.Common.DbTransaction dbTran)
        {
            PurchaseOrderInfo purchaseOrderInfo = this.ConvertOrderToPurchaseOrder(order);
            bool result;

            if (purchaseOrderInfo == null)
            {
                result = false;
            }
            else
            {
                System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(" ");
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("INSERT INTO Hishop_PurchaseOrders(PurchaseOrderId, OrderId, Remark, ManagerMark, ManagerRemark, AdjustedDiscount,PurchaseStatus, CloseReason, PurchaseDate, DistributorId, Distributorname,DistributorEmail, DistributorRealName, DistributorQQ, DistributorWangwang, DistributorMSN,ShippingRegion, Address, ZipCode, ShipTo, TelPhone, CellPhone, ShipToDate, ShippingModeId, ModeName,RealShippingModeId, RealModeName, RegionId, Freight, AdjustedFreight, ShipOrderNumber, Weight,ExpressCompanyName,ExpressCompanyAbb,RefundStatus, RefundAmount, RefundRemark, OrderTotal, PurchaseProfit, PurchaseTotal,Tax,InvoiceTitle)VALUES (@PurchaseOrderId, @OrderId, @Remark, @ManagerMark, @ManagerRemark, @AdjustedDiscount,@PurchaseStatus, @CloseReason, @PurchaseDate, @DistributorId, @Distributorname,@DistributorEmail, @DistributorRealName, @DistributorQQ, @DistributorWangwang, @DistributorMSN,@ShippingRegion, @Address, @ZipCode, @ShipTo, @TelPhone, @CellPhone, @ShipToDate, @ShippingModeId, @ModeName,@RealShippingModeId, @RealModeName, @RegionId, @Freight, @AdjustedFreight, @ShipOrderNumber, @PurchaseWeight,@ExpressCompanyName,@ExpressCompanyAbb,@RefundStatus, @RefundAmount, @RefundRemark, @OrderTotal, @PurchaseProfit, @PurchaseTotal,@Tax,@InvoiceTitle);");
                this.database.AddInParameter(sqlStringCommand, "PurchaseOrderId", System.Data.DbType.String, purchaseOrderInfo.PurchaseOrderId);
                this.database.AddInParameter(sqlStringCommand, "OrderId", System.Data.DbType.String, purchaseOrderInfo.OrderId);
                this.database.AddInParameter(sqlStringCommand, "Remark", System.Data.DbType.String, purchaseOrderInfo.Remark);
                if (purchaseOrderInfo.ManagerMark.HasValue)
                {
                    this.database.AddInParameter(sqlStringCommand, "ManagerMark", System.Data.DbType.Int32, (int)purchaseOrderInfo.ManagerMark.Value);
                }
                else
                {
                    this.database.AddInParameter(sqlStringCommand, "ManagerMark", System.Data.DbType.Int32, DBNull.Value);
                }
                this.database.AddInParameter(sqlStringCommand, "ManagerRemark", System.Data.DbType.String, purchaseOrderInfo.ManagerRemark);
                this.database.AddInParameter(sqlStringCommand, "AdjustedDiscount", System.Data.DbType.Currency, purchaseOrderInfo.AdjustedDiscount);
                this.database.AddInParameter(sqlStringCommand, "PurchaseStatus", System.Data.DbType.Int32, (int)purchaseOrderInfo.PurchaseStatus);
                this.database.AddInParameter(sqlStringCommand, "CloseReason", System.Data.DbType.String, purchaseOrderInfo.CloseReason);
                this.database.AddInParameter(sqlStringCommand, "PurchaseDate", System.Data.DbType.DateTime, DateTime.Now);
                this.database.AddInParameter(sqlStringCommand, "DistributorId", System.Data.DbType.Int32, purchaseOrderInfo.DistributorId);
                this.database.AddInParameter(sqlStringCommand, "Distributorname", System.Data.DbType.String, purchaseOrderInfo.Distributorname);
                this.database.AddInParameter(sqlStringCommand, "DistributorEmail", System.Data.DbType.String, purchaseOrderInfo.DistributorEmail);
                this.database.AddInParameter(sqlStringCommand, "DistributorRealName", System.Data.DbType.String, purchaseOrderInfo.DistributorRealName);
                this.database.AddInParameter(sqlStringCommand, "DistributorQQ", System.Data.DbType.String, purchaseOrderInfo.DistributorQQ);
                this.database.AddInParameter(sqlStringCommand, "DistributorWangwang", System.Data.DbType.String, purchaseOrderInfo.DistributorWangwang);
                this.database.AddInParameter(sqlStringCommand, "DistributorMSN", System.Data.DbType.String, purchaseOrderInfo.DistributorMSN);
                this.database.AddInParameter(sqlStringCommand, "ShippingRegion", System.Data.DbType.String, purchaseOrderInfo.ShippingRegion);
                this.database.AddInParameter(sqlStringCommand, "Address", System.Data.DbType.String, purchaseOrderInfo.Address);
                this.database.AddInParameter(sqlStringCommand, "ZipCode", System.Data.DbType.String, purchaseOrderInfo.ZipCode);
                this.database.AddInParameter(sqlStringCommand, "ShipTo", System.Data.DbType.String, purchaseOrderInfo.ShipTo);
                this.database.AddInParameter(sqlStringCommand, "TelPhone", System.Data.DbType.String, purchaseOrderInfo.TelPhone);
                this.database.AddInParameter(sqlStringCommand, "CellPhone", System.Data.DbType.String, purchaseOrderInfo.CellPhone);
                this.database.AddInParameter(sqlStringCommand, "ShipToDate", System.Data.DbType.String, purchaseOrderInfo.ShipToDate);
                this.database.AddInParameter(sqlStringCommand, "ShippingModeId", System.Data.DbType.Int32, purchaseOrderInfo.ShippingModeId);
                this.database.AddInParameter(sqlStringCommand, "ModeName", System.Data.DbType.String, purchaseOrderInfo.ModeName);
                this.database.AddInParameter(sqlStringCommand, "RealShippingModeId", System.Data.DbType.Int32, purchaseOrderInfo.RealShippingModeId);
                this.database.AddInParameter(sqlStringCommand, "RealModeName", System.Data.DbType.String, purchaseOrderInfo.RealModeName);
                this.database.AddInParameter(sqlStringCommand, "RegionId", System.Data.DbType.Int32, purchaseOrderInfo.RegionId);
                this.database.AddInParameter(sqlStringCommand, "Freight", System.Data.DbType.Currency, purchaseOrderInfo.Freight);
                this.database.AddInParameter(sqlStringCommand, "AdjustedFreight", System.Data.DbType.Currency, purchaseOrderInfo.AdjustedFreight);
                this.database.AddInParameter(sqlStringCommand, "ShipOrderNumber", System.Data.DbType.String, purchaseOrderInfo.ShipOrderNumber);
                this.database.AddInParameter(sqlStringCommand, "PurchaseWeight", System.Data.DbType.Int32, (int)purchaseOrderInfo.Weight);
                this.database.AddInParameter(sqlStringCommand, "ExpressCompanyAbb", System.Data.DbType.String, purchaseOrderInfo.ExpressCompanyAbb);
                this.database.AddInParameter(sqlStringCommand, "ExpressCompanyName", System.Data.DbType.String, purchaseOrderInfo.ExpressCompanyName);
                this.database.AddInParameter(sqlStringCommand, "RefundStatus", System.Data.DbType.Int32, (int)purchaseOrderInfo.RefundStatus);
                this.database.AddInParameter(sqlStringCommand, "RefundAmount", System.Data.DbType.Currency, purchaseOrderInfo.RefundAmount);
                this.database.AddInParameter(sqlStringCommand, "RefundRemark", System.Data.DbType.String, purchaseOrderInfo.RefundRemark);
                this.database.AddInParameter(sqlStringCommand, "OrderTotal", System.Data.DbType.Currency, purchaseOrderInfo.OrderTotal);
                this.database.AddInParameter(sqlStringCommand, "PurchaseProfit", System.Data.DbType.Currency, purchaseOrderInfo.GetPurchaseProfit());
                this.database.AddInParameter(sqlStringCommand, "PurchaseTotal", System.Data.DbType.Currency, purchaseOrderInfo.GetPurchaseTotal());
                this.database.AddInParameter(sqlStringCommand, "Tax", System.Data.DbType.Currency, purchaseOrderInfo.Tax);
                this.database.AddInParameter(sqlStringCommand, "InvoiceTitle", System.Data.DbType.String, purchaseOrderInfo.InvoiceTitle);
                int num = 0;
                foreach (PurchaseOrderItemInfo current in purchaseOrderInfo.PurchaseOrderItems)
                {
                    string text = num.ToString();
                    stringBuilder.Append("INSERT INTO Hishop_PurchaseOrderItems(PurchaseOrderId, SkuId, ProductId, SKU, Quantity,  CostPrice, ").Append("ItemListPrice, ItemPurchasePrice, ItemDescription, ItemHomeSiteDescription, SKUContent, ThumbnailsUrl, Weight) VALUES( @PurchaseOrderId").Append(",@SkuId").Append(text).Append(",@ProductId").Append(text).Append(",@SKU").Append(text).Append(",@Quantity").Append(text).Append(",@CostPrice").Append(text).Append(",@ItemListPrice").Append(text).Append(",@ItemPurchasePrice").Append(text).Append(",@ItemDescription").Append(text).Append(",@ItemHomeSiteDescription").Append(text).Append(",@SKUContent").Append(text).Append(",@ThumbnailsUrl").Append(text).Append(",@Weight").Append(text).Append(");");
                    this.database.AddInParameter(sqlStringCommand, "SkuId" + text, System.Data.DbType.String, current.SkuId);
                    this.database.AddInParameter(sqlStringCommand, "ProductId" + text, System.Data.DbType.Int32, current.ProductId);
                    this.database.AddInParameter(sqlStringCommand, "SKU" + text, System.Data.DbType.String, current.SKU);
                    this.database.AddInParameter(sqlStringCommand, "Quantity" + text, System.Data.DbType.Int32, current.Quantity);
                    this.database.AddInParameter(sqlStringCommand, "CostPrice" + text, System.Data.DbType.Currency, current.ItemCostPrice);
                    this.database.AddInParameter(sqlStringCommand, "ItemListPrice" + text, System.Data.DbType.Currency, current.ItemListPrice);
                    this.database.AddInParameter(sqlStringCommand, "ItemPurchasePrice" + text, System.Data.DbType.Currency, current.ItemPurchasePrice);
                    this.database.AddInParameter(sqlStringCommand, "ItemDescription" + text, System.Data.DbType.String, current.ItemDescription);
                    this.database.AddInParameter(sqlStringCommand, "ItemHomeSiteDescription" + text, System.Data.DbType.String, current.ItemHomeSiteDescription);
                    this.database.AddInParameter(sqlStringCommand, "SKUContent" + text, System.Data.DbType.String, current.SKUContent);
                    this.database.AddInParameter(sqlStringCommand, "ThumbnailsUrl" + text, System.Data.DbType.String, current.ThumbnailsUrl);
                    this.database.AddInParameter(sqlStringCommand, "Weight" + text, System.Data.DbType.Int32, current.ItemWeight);
                    num++;
                }
                foreach (PurchaseOrderGiftInfo current2 in purchaseOrderInfo.PurchaseOrderGifts)
                {
                    string text = num.ToString();
                    stringBuilder.Append("INSERT INTO Hishop_PurchaseOrderGifts(PurchaseOrderId, GiftId, GiftName, CostPrice, PurchasePrice, ").Append("ThumbnailsUrl, Quantity) VALUES( @PurchaseOrderId,").Append("@GiftId").Append(text).Append(",@GiftName").Append(text).Append(",@CostPrice").Append(text).Append(",@PurchasePrice").Append(text).Append(",@ThumbnailsUrl").Append(text).Append(",@Quantity").Append(text).Append(");");
                    this.database.AddInParameter(sqlStringCommand, "GiftId" + text, System.Data.DbType.Int32, current2.GiftId);
                    this.database.AddInParameter(sqlStringCommand, "GiftName" + text, System.Data.DbType.String, current2.GiftName);
                    this.database.AddInParameter(sqlStringCommand, "Quantity" + text, System.Data.DbType.Int32, current2.Quantity);
                    this.database.AddInParameter(sqlStringCommand, "CostPrice" + text, System.Data.DbType.Currency, current2.CostPrice);
                    this.database.AddInParameter(sqlStringCommand, "PurchasePrice" + text, System.Data.DbType.Currency, current2.PurchasePrice);
                    this.database.AddInParameter(sqlStringCommand, "ThumbnailsUrl" + text, System.Data.DbType.String, current2.ThumbnailsUrl);
                    num++;
                }
                sqlStringCommand.CommandText = stringBuilder.ToString().Remove(stringBuilder.Length - 1);
                if (dbTran != null)
                {
                    result = (this.database.ExecuteNonQuery(sqlStringCommand, dbTran) > 0);
                }
                else
                {
                    result = (this.database.ExecuteNonQuery(sqlStringCommand) > 0);
                }
            }
            return(result);
        }