コード例 #1
0
 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));
 }
コード例 #2
0
 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));
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 private bool CanSave()
 {
     return(Suppliers == null || Suppliers.All(a => !a.HasErrors));
 }