コード例 #1
0
        /// <summary>
        /// Adds the item to order.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="productId">The product id.</param>
        /// <param name="name">The name.</param>
        /// <param name="sku">The sku.</param>
        /// <param name="quantity">The quantity.</param>
        /// <param name="pricePaid">The price paid.</param>
        /// <param name="weight">The weight.</param>
        /// <param name="attributes">The attributes.</param>
        public void AddItemToOrder(string userName, int productId, string name, string sku, int quantity, decimal pricePaid, decimal itemTax, decimal weight, string attributes, string extendedProperties)
        {
            int orderId = ProvisionOrder(userName);
            OrderItemCollection orderItemCollection = this.FetchOrderItemBySkuAndAttributes(orderId, sku, attributes);

            if (orderItemCollection.Count == 1)
            {
                orderItemCollection[0].Quantity += quantity;
                orderItemCollection[0].Save(userName);
            }
            else
            {
                OrderItem orderItem = new OrderItem();
                orderItem.OrderId              = orderId;
                orderItem.ProductId            = productId;
                orderItem.Name                 = name;
                orderItem.Sku                  = sku;
                orderItem.Quantity             = quantity;
                orderItem.PricePaid            = pricePaid;
                orderItem.ItemTax              = itemTax;
                orderItem.Attributes           = attributes;
                orderItem.AdditionalProperties = extendedProperties;
                orderItem.Weight               = weight;
                orderItem.Save(userName);
            }
            ResetShippingAndTaxAndDiscount(orderId, userName);
        }
コード例 #2
0
        public void Update(int OrderItemId, int OrderId, int ProductId, string Name, string Sku, int Quantity, decimal PricePaid, string Attributes, string AdditionalProperties, decimal Weight, decimal ItemTax, decimal DiscountAmount, string CreatedBy, DateTime CreatedOn, string ModifiedBy, DateTime ModifiedOn)
        {
            OrderItem item = new OrderItem();

            item.OrderItemId = OrderItemId;

            item.OrderId = OrderId;

            item.ProductId = ProductId;

            item.Name = Name;

            item.Sku = Sku;

            item.Quantity = Quantity;

            item.PricePaid = PricePaid;

            item.Attributes = Attributes;

            item.AdditionalProperties = AdditionalProperties;

            item.Weight = Weight;

            item.ItemTax = ItemTax;

            item.DiscountAmount = DiscountAmount;

            item.CreatedBy = CreatedBy;

            item.CreatedOn = CreatedOn;

            item.ModifiedBy = ModifiedBy;

            item.ModifiedOn = ModifiedOn;

            item.MarkOld();
            item.Save(UserName);
        }
コード例 #3
0
        public void Insert(int OrderId,int ProductId,string Name,string Sku,int Quantity,decimal PricePaid,string Attributes,string AdditionalProperties,decimal Weight,decimal ItemTax,decimal DiscountAmount,string CreatedBy,DateTime CreatedOn,string ModifiedBy,DateTime ModifiedOn)
        {
            OrderItem item = new OrderItem();

            item.OrderId = OrderId;

            item.ProductId = ProductId;

            item.Name = Name;

            item.Sku = Sku;

            item.Quantity = Quantity;

            item.PricePaid = PricePaid;

            item.Attributes = Attributes;

            item.AdditionalProperties = AdditionalProperties;

            item.Weight = Weight;

            item.ItemTax = ItemTax;

            item.DiscountAmount = DiscountAmount;

            item.CreatedBy = CreatedBy;

            item.CreatedOn = CreatedOn;

            item.ModifiedBy = ModifiedBy;

            item.ModifiedOn = ModifiedOn;

            item.Save(UserName);
        }
コード例 #4
0
 /// <summary>
 /// Adds the item to order.
 /// </summary>
 /// <param name="userName">Name of the user.</param>
 /// <param name="productId">The product id.</param>
 /// <param name="name">The name.</param>
 /// <param name="sku">The sku.</param>
 /// <param name="quantity">The quantity.</param>
 /// <param name="pricePaid">The price paid.</param>
 /// <param name="weight">The weight.</param>
 /// <param name="attributes">The attributes.</param>
 public void AddItemToOrder(string userName, int productId, string name, string sku, int quantity, decimal pricePaid, decimal itemTax, decimal weight, string attributes, string extendedProperties)
 {
     int orderId = ProvisionOrder(userName);
       OrderItemCollection orderItemCollection = this.FetchOrderItemBySkuAndAttributes(orderId, sku, attributes);
       if (orderItemCollection.Count == 1) {
     orderItemCollection[0].Quantity += quantity;
     orderItemCollection[0].Save(userName);
       }
       else {
     OrderItem orderItem = new OrderItem();
     orderItem.OrderId = orderId;
     orderItem.ProductId = productId;
     orderItem.Name = name;
     orderItem.Sku = sku;
     orderItem.Quantity = quantity;
     orderItem.PricePaid = pricePaid;
     orderItem.ItemTax = itemTax;
     orderItem.Attributes = attributes;
     orderItem.AdditionalProperties = extendedProperties;
     orderItem.Weight = weight;
     orderItem.Save(userName);
       }
       ResetShippingAndTaxAndDiscount(orderId, userName);
 }