public Order PlaceOrder(int productId, int quantity, string accountName, string cardNumber, SupplierCode supplier) { if (Suppliers.All(p => p.SupplierCode != supplier)) { throw new NotSupportedException(string.Format("Could not place order " + "because the supplier '{0}' was not found in the aggregator.", supplier)); } return(Suppliers.First(p => p.SupplierCode == supplier) .PlaceOrder(productId, quantity, accountName, cardNumber)); }
public GiftWrappingProduct GetGiftWrappingProductById(int id, SupplierCode supplier) { if (Suppliers.All(p => p.SupplierCode != supplier)) { throw new NotSupportedException(string.Format("Could not get product " + "by ID because the supplier '{0}' was not found in the aggregator.", supplier)); } return(Suppliers.First(p => p.SupplierCode == supplier) .GetGiftWrappingProductById(id)); }
public virtual bool CanDelete(ISession session) { var maxPayment = session.QueryOver <Payment>() .Where(p => p.Payer == this) .SelectList(l => l.SelectMax(p => p.PayedOn)) .SingleOrDefault <DateTime>(); var documentDates = new[] { maxPayment }; return(Reports.Count == 0 && Clients.All(c => c.CanDelete(session)) && Suppliers.All(s => s.CanDelete(session)) && documentDates.Max().AddMonths(15) < DateTime.Now); }
private bool CanSave() { return(Suppliers == null || Suppliers.All(a => !a.HasErrors)); }