Example #1
0
 public Sale(string name, Lot lot, Series series, Seller seller, double startPrice,
     double increment, TimeSpan duration, Category category)
 {
     Name = name;
     Number = 0;
     Lot = lot;
     Series = series;
     StartPrice = startPrice;
     Increment = increment;
     Seller = seller;
     Duration = duration;
     Category = category;
 }
Example #2
0
        public Sale(string name, Lot lot, Seller seller, double startPrice, 
            double increment, TimeSpan duration, Category category)
        {
            Name = name;
            Number = 0;
            Lot = lot;
            StartTime = DateTime.Now;
            _bids = new List<Bid>();
            StartPrice = startPrice;
            Increment = increment;
            Seller = seller;

            if (duration < TimeSpan.FromMinutes(1))
            {
                duration = TimeSpan.FromSeconds(1); //исправить! FromMinutes(1)
            }
            Duration = duration;
            Category = category;
        }
Example #3
0
 public double GetPriceByCategory(Category category)
 {
     return _sales.Where(l => l.Category.Name == category.Name).Select(l => l.CurrentPrice).Sum();
 }
Example #4
0
 public void AddCategory(Category category)
 {
     if (!_categories.Any(c => c.Name == category.Name))
     {
         _categories.Add(category);
     }
 }
Example #5
0
 public double GetSummaryPriceByCategory(Category category)
 {
     return _series.Select(s => s.GetPriceByCategory(category)).Sum();
 }