Example #1
0
 public FoodProductDetails(short productId, string foodProductName, AmountValue amountValue, bool isOptional)
 {
     FoodProductName = foodProductName;
     FoodProductId   = productId;
     AmountValue     = amountValue;
     IsOptional      = isOptional;
 }
Example #2
0
 public void DecreaseAmount(AmountValue amountValue)
 {
     if (amountValue.Value > this.Value)
     {
         this.Value = 0.0f;
     }
     else
     {
         this.Value = this.Value - amountValue.Value;
     }
 }
Example #3
0
        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);
        }
Example #4
0
 public FoodProductDetails(short productId, string foodProductName, AmountValue amountValue) : this(productId, foodProductName, amountValue, false)
 {
 }
Example #5
0
 public FoodProductDetails(short productId, AmountValue amountValue) : this(productId, "", amountValue, false)
 {
 }
Example #6
0
 public FoodProductDetails(FoodProduct foodProduct, AmountValue amountValue) : this(foodProduct.FoodProductId, foodProduct.Name, amountValue, false)
 {
 }