isdaviddong
11/28/2017 - 2:55 AM

BMIProcessor.cs

    public class BMIProcessor : PolicyInjectionComponentBase
    {
        public int Weight { get; set; }
        public int Height { get; set; }
        public Decimal BMI
        {
            get
            {
                return Calculate();
            }
        }

        [ExceptionNotify(LogFileName = "log.txt")]
        [Logging(LogFileName = "log.txt")]
        //計算BMI
        public Decimal Calculate()
        {
            Decimal result = 0;
            Decimal height = (Decimal)Height / 100;
            result = Weight / (height * height);

            return result;
        }
}