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