예제 #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);
 }