public FoodProductDetails(short productId, string foodProductName, AmountValue amountValue, bool isOptional) { FoodProductName = foodProductName; FoodProductId = productId; AmountValue = amountValue; IsOptional = isOptional; }
public void DecreaseAmount(AmountValue amountValue) { if (amountValue.Value > this.Value) { this.Value = 0.0f; } else { this.Value = this.Value - amountValue.Value; } }
public int CompareTo(AmountValue obj) { if (obj.Unit.CompareTo(this.Unit) != 0) { throw new AmountValueException("Error comparing AmountValues", "AmountValues have other units. Can't compare them!"); } if (Math.Abs(Value - obj.Value) < TOLERANCE) { return(0); } if (Value > obj.Value) { return(1); } return(-1); }
public FoodProductDetails(short productId, string foodProductName, AmountValue amountValue) : this(productId, foodProductName, amountValue, false) { }
public FoodProductDetails(short productId, AmountValue amountValue) : this(productId, "", amountValue, false) { }
public FoodProductDetails(FoodProduct foodProduct, AmountValue amountValue) : this(foodProduct.FoodProductId, foodProduct.Name, amountValue, false) { }