public OrderItemCollection FetchByQuery(Query qry) { OrderItemCollection coll = new OrderItemCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
/// <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); }
public OrderItemCollection FetchAll() { OrderItemCollection coll = new OrderItemCollection(); Query qry = new Query(OrderItem.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public OrderItemCollection FetchByID(object OrderItemId) { OrderItemCollection coll = new OrderItemCollection().Where("OrderItemId", OrderItemId).Load(); return(coll); }