Пример #1
0
        /// <summary>
        /// 将购物车对象转换成OrderInfo
        /// </summary>
        /// <param name="shoppingCart"></param>
        /// <returns></returns>
        public static OrderInfo Convert2OrderInfo(ShoppingCart shoppingCart)
        {
            OrderInfo orderInfo = new OrderInfo();

            orderInfo.Customer           = new CustomerInfo();
            orderInfo.Customer.SysNo     = shoppingCart.CustomerSysNo;
            orderInfo.Receipt            = new ReceiptInfo();
            orderInfo.GiftItemList       = new List <OrderGiftItem>();
            orderInfo.AttachmentItemList = new List <OrderAttachment>();
            orderInfo.DiscountDetailList = new List <OrderItemDiscountInfo>();

            orderInfo.LanguageCode       = shoppingCart.LanguageCode;
            orderInfo.ChannelID          = shoppingCart.ChannelID;
            orderInfo.OrderItemGroupList = new List <OrderItemGroup>();
            foreach (ShoppingItemGroup itemGroup in shoppingCart.ShoppingItemGroupList)
            {
                OrderItemGroup orderItemGroup = new OrderItemGroup();
                if (itemGroup.PackageChecked)
                {
                    orderItemGroup.PackageChecked = true;
                }
                orderItemGroup.PackageType     = itemGroup.PackageType;
                orderItemGroup.PackageNo       = itemGroup.PackageNo;
                orderItemGroup.Quantity        = itemGroup.Quantity;
                orderItemGroup.ProductItemList = new List <OrderProductItem>();
                foreach (ShoppingItem item in itemGroup.ShoppingItemList)
                {
                    OrderProductItem orderProductItem = new OrderProductItem();
                    if (item.ProductChecked)
                    {
                        orderProductItem.ProductChecked = true;
                    }
                    orderProductItem.ProductSysNo = item.ProductSysNo;
                    orderProductItem.UnitQuantity = item.UnitQuantity;
                    orderItemGroup.ProductItemList.Add(orderProductItem);
                }
                orderInfo.OrderItemGroupList.Add(orderItemGroup);
            }
            orderInfo["ShoppingCart"] = shoppingCart;

            return(orderInfo);
        }
Пример #2
0
        public override ExtensibleObject CloneObject()
        {
            OrderProductItem gi = new OrderProductItem()
            {
                ProductSysNo               = this.ProductSysNo,
                ConsumptionDate            = this.ConsumptionDate,
                ProductID                  = this.ProductID,
                ProductName                = this.ProductName,
                UnitQuantity               = this.UnitQuantity,
                UnitCostPrice              = this.UnitCostPrice,
                UnitSalePrice              = this.UnitSalePrice,
                DefaultImage               = this.DefaultImage,
                Weight                     = this.Weight,
                UnitMarketPrice            = this.UnitMarketPrice,
                MerchantSysNo              = this.MerchantSysNo,
                MerchantName               = this.MerchantName,
                SplitGroupPropertyDescList = this.SplitGroupPropertyDescList == null ? null : this.SplitGroupPropertyDescList,
                TotalInventory             = this.TotalInventory,
                UnitTaxFee                 = this.UnitTaxFee,
                WarehouseCountryCode       = this.WarehouseCountryCode,
                WarehouseName              = this.WarehouseName,
                WarehouseNumber            = this.WarehouseNumber,
                SpecialActivitySysNo       = this.SpecialActivitySysNo,
                SpecialActivityType        = this.SpecialActivityType,
                UnitRewardedPoint          = this.UnitRewardedPoint,
                ProductChecked             = this.ProductChecked,
            };

            if (this.SplitGroupPropertyDescList != null)
            {
                gi.SplitGroupPropertyDescList = new List <KeyValuePair <string, string> >();
                this.SplitGroupPropertyDescList.ForEach(f => gi.SplitGroupPropertyDescList.Add(new KeyValuePair <string, string>(f.Key, f.Value)));
            }

            return(gi);
        }