public override OrderItem ToOrderItem(string option, int quantity)
 {
     OrderItem item = new OrderItem();
     item.Quantity = 1;
     item.Price = 39.95m;
     item.ProductDescription = "Priority listing";
     item.ProductOption = true.ToString();
     item.ProductId = this.Name;
     return item;
 }
예제 #2
0
        public override OrderItem ToOrderItem(string option, int quantity)
        {
            DateTime dateUtc;

            if(!DateTime.TryParse(option, out dateUtc))
                throw new InvalidOperationException("The product option must be a date");

            // get local date, this will be stored in product description (not utc date)
            TimeZoneInfo mstTZ = TimeZoneInfo.FindSystemTimeZoneById("Mountain Standard Time");
            DateTime dateLocal = TimeZoneInfo.ConvertTimeFromUtc(dateUtc, mstTZ);

            OrderItem item = new OrderItem();
            item.Quantity = quantity;
            item.Price = 9.95m;
            item.ProductDescription = "Feature listing on " + dateLocal.ToShortDateString();
            item.ProductOption = dateUtc.ToString("G");
            item.ProductId = this.Name;
            return item;
        }
예제 #3
0
 public override Product FromOrderItem(OrderItem item)
 {
     FeaturedDateProduct product = new FeaturedDateProduct();
     product.Item = item;
     return product;
 }
 public override Product FromOrderItem(OrderItem item)
 {
     PriorityListingProduct product = new PriorityListingProduct();
     product.Item = item;
     return product;
 }
예제 #5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the OrderItems EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOrderItems(OrderItem orderItem)
 {
     base.AddObject("OrderItems", orderItem);
 }
예제 #6
0
 /// <summary>
 /// Create a new OrderItem object.
 /// </summary>
 /// <param name="orderItemId">Initial value of the OrderItemId property.</param>
 /// <param name="orderId">Initial value of the OrderId property.</param>
 /// <param name="quantity">Initial value of the Quantity property.</param>
 /// <param name="productId">Initial value of the ProductId property.</param>
 /// <param name="productDescription">Initial value of the ProductDescription property.</param>
 /// <param name="price">Initial value of the Price property.</param>
 public static OrderItem CreateOrderItem(global::System.Int32 orderItemId, global::System.Int32 orderId, global::System.Int32 quantity, global::System.String productId, global::System.String productDescription, global::System.Decimal price)
 {
     OrderItem orderItem = new OrderItem();
     orderItem.OrderItemId = orderItemId;
     orderItem.OrderId = orderId;
     orderItem.Quantity = quantity;
     orderItem.ProductId = productId;
     orderItem.ProductDescription = productDescription;
     orderItem.Price = price;
     return orderItem;
 }