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