Пример #1
0
        public void CalculateValues(StartingMaterial sm)
        {
            nValue = sm.nValue * Ratio;

            nValue = Math.Round(nValue, 3);

            mValue = Math.Round(nValue * MW, 1);


            if (Den.HasValue)
            {
                VValue = Math.Round(mValue / Den.Value, 3);
            }
            //else VValue = null;
            MW = Math.Round(MW, 2);

            if (mValue > mAvailable)
            {
                //nincs elég anyag
                throw new Exception("Not enough resources!");
                //result.Add(new OutputMessage { Message = "Not enough resources!", Level = "error" });
            }
            if (Den.HasValue)
            {
                if (VValue > VAvailable)
                {
                    throw new Exception("Not enough resources!");
                    //result.Add(new OutputMessage { Message = "Not enough resources!", Level = "error" });
                }
            }
        }
Пример #2
0
Файл: Product.cs Проект: FTim/ch
 public void CalculateValues(StartingMaterial sm)
 {
     nValue = Math.Round(Ratio * sm.nValue, 3);
     mValue = nValue * MW;
     MW     = Math.Round(MW, 2);
 }