Exemplo n.º 1
0
        private static void Main()
        {
            var calculator = new ServiceCalc();
            var jule       = new Month(2376, 1644);
            var june       = new Month(2342, 1625);
            var may        = new Month(2160, 1521);

            var summary1 = calculator.SummaryResult(june, may);
            var summary2 = calculator.SummaryResult(jule, june);

            Console.WriteLine("Your previous result is: " + summary1);
            Console.WriteLine("Your current result is: " + summary2);
            Console.ReadKey();
        }
Exemplo n.º 2
0
        public double SummaryResult(Month currentMonth, Month previousMonth)
        {
            var serviceData = new ServiceCalc();
            var tarifs      = new Tarifs();

            var dayDelta = serviceData
                           .CreateDelta(currentMonth.DayTop, previousMonth.DayTop);
            var nightDelta = serviceData
                             .CreateDelta(currentMonth.NightTop, previousMonth.NightTop);

            var daySummary = serviceData
                             .FindPhaseSummary(dayDelta, (int)SocialNormEnum.Day, tarifs.SocialNormEqualDay, tarifs.SocialNormNotEqualDay);
            var nightSummary = serviceData.FindPhaseSummary(nightDelta, (int)SocialNormEnum.Night,
                                                            tarifs.SocialNormEqualNight, tarifs.SocialNormNotEqualNight);

            var summary = ResultSummary(daySummary, nightSummary);

            return(Round(summary, 2));
        }