コード例 #1
0
ファイル: Sale.cs プロジェクト: taoihsu/techartlabs-auction-2
 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;
 }
コード例 #2
0
ファイル: Sale.cs プロジェクト: taoihsu/techartlabs-auction
        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;
        }
コード例 #3
0
ファイル: Series.cs プロジェクト: taoihsu/techartlabs-auction
 public double GetPriceByCategory(Category category)
 {
     return _sales.Where(l => l.Category.Name == category.Name).Select(l => l.CurrentPrice).Sum();
 }
コード例 #4
0
 public void AddCategory(Category category)
 {
     if (!_categories.Any(c => c.Name == category.Name))
     {
         _categories.Add(category);
     }
 }
コード例 #5
0
 public double GetSummaryPriceByCategory(Category category)
 {
     return _series.Select(s => s.GetPriceByCategory(category)).Sum();
 }