public static XPCollection <MovieItem> CreateFewItems(MovieItem pattern, int count) { XPCollection <MovieItem> ret = new XPCollection <MovieItem>(pattern.Session, false); for (int i = 0; i < count; ++i) { MovieItem item = new MovieItem(pattern.Movie, pattern.Format); item.AvailableForSell = pattern.AvailableForSell; item.SellingPrice = pattern.SellingPrice; ret.Add(item); } return(ret); }
/// <summary> /// Buys an item given by the specified rentInfo. /// </summary> /// <param name="rentsInfo">The rents info.</param> /// <returns></returns> public Receipt Buy(ICollection <RentInfo> rentsInfo) { Receipt receipt = null; foreach (RentInfo rentInfo in rentsInfo) { MovieItem item = rentInfo.Item.SellItem; if (item == null) { continue; } if (receipt == null) { receipt = new Receipt(this, ReceiptType.Purchases); } new Rent(receipt, item, rentInfo.Days); } if (receipt != null) { receipt.CalcPayment(); } return(receipt); }
public Rent(Receipt receipt, MovieItem item) : this(receipt, item, 0) { }