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; }
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(); }
public static Product CreateANewProduct(string name, SalesPeriod salesPeriod, Dictionary <Wholesale.IngredientId, int> recipe, double costRate) { return(new Product(ProductIdRepository.NextIdentifier(), name, salesPeriod, recipe, costRate)); }
public void PostponeTheEndOfSelling(int month, RoughDay day) { this._salesPeriod = this._salesPeriod.PostponeTheEndOfSelling(month, day); }
public void StartSellingEarlier(int month, RoughDay day) { this._salesPeriod = this._salesPeriod.StartSellingEarlier(month, day); }
public void SellYearRound() { this._salesPeriod = SalesPeriod.SellYearRound(); }
public void SellInLimitedTime(int fromMonth, RoughDay fromDay, int tillMonth, RoughDay tillDay) { this._salesPeriod = SalesPeriod.SellInLimitedTime(fromMonth, fromDay, tillMonth, tillDay); }