Exemple #1
0
 public Description(Product product)
 {
     this.Id                 = product._id.IdString;
     this.Name               = product._name;
     this.CostRate           = product._costRate;
     this.Price              = product._price;
     this.IngredientsTable   = product._ingredientsTable.ToDictionary(x => x.Key.IdString, x => x.Value);
     this.IsSellingYearRound = SalesPeriod.SellYearRound().SameValueAs(product._salesPeriod);
     this.SellingFromMonth   = product._salesPeriod.From.Month;
     this.SellingFromDay     = product._salesPeriod.From.RoughDay;
     this.SellingTillMonth   = product._salesPeriod.Till.Month;
     this.SellingTillDay     = product._salesPeriod.Till.RoughDay;
 }
Exemple #2
0
        private Product(ProductId id, string name, SalesPeriod salesPeriod,
                        Dictionary <Wholesale.IngredientId, int> recipe, double costRate)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            this._id               = id ?? throw new ArgumentNullException(nameof(id));
            this._name             = name;
            this._salesPeriod      = salesPeriod ?? throw new ArgumentNullException(nameof(salesPeriod));
            this._ingredientsTable = recipe ?? new Dictionary <Wholesale.IngredientId, int>();
            this._costRate         = costRate;

            this.CalculatePrice();
        }
Exemple #3
0
 public static Product CreateANewProduct(string name, SalesPeriod salesPeriod,
                                         Dictionary <Wholesale.IngredientId, int> recipe, double costRate)
 {
     return(new Product(ProductIdRepository.NextIdentifier(), name, salesPeriod, recipe, costRate));
 }
Exemple #4
0
 public void PostponeTheEndOfSelling(int month, RoughDay day)
 {
     this._salesPeriod = this._salesPeriod.PostponeTheEndOfSelling(month, day);
 }
Exemple #5
0
 public void StartSellingEarlier(int month, RoughDay day)
 {
     this._salesPeriod = this._salesPeriod.StartSellingEarlier(month, day);
 }
Exemple #6
0
 public void SellYearRound()
 {
     this._salesPeriod = SalesPeriod.SellYearRound();
 }
Exemple #7
0
 public void SellInLimitedTime(int fromMonth, RoughDay fromDay, int tillMonth, RoughDay tillDay)
 {
     this._salesPeriod = SalesPeriod.SellInLimitedTime(fromMonth, fromDay, tillMonth, tillDay);
 }