コード例 #1
0
        public string GetSummaryReport(IBusinessRules businessRules)
        {
            var reportService = new ScheduledFlightReportGenerator(businessRules);

            var dsoForReport = new ScheduledFlightSummaryReportDso()
            {
                FlightDetails    = ScheduledFlightDetails,
                CalculatedValues = FlightParameterCalculator.GetFlightParameterValues(ScheduledFlightDetails),
            };

            return(reportService.GetScheduledFlightSummaryReport(dsoForReport));
        }
コード例 #2
0
        private void GenerateReport(ScheduledFlightSummaryReportDso dso)
        {
            report = "Flight summary for " + dso.FlightDetails.FlightRoute.Title;

            report += VERTICAL_WHITE_SPACE;

            report += "Total passengers: " + dso.CalculatedValues.SeatsTaken;
            report += NEW_LINE;
            report += INDENTATION + "General sales: " + dso.CalculatedValues.GeneralSales;
            report += NEW_LINE;
            report += INDENTATION + "Loyalty member sales: " + dso.CalculatedValues.LoyaltySales;
            report += NEW_LINE;
            report += INDENTATION + "Airline employee comps: " + dso.CalculatedValues.AirlineEmployeeSales;
            report += NEW_LINE;
            report += INDENTATION + "Discounted sales: " + dso.CalculatedValues.DiscountedSales;
            report += VERTICAL_WHITE_SPACE;
            report += "Total expected baggage: " + dso.CalculatedValues.TotalExpectedBaggage;

            report += VERTICAL_WHITE_SPACE;

            report += "Total revenue from flight: " + dso.CalculatedValues.ProfitFromFlight;
            report += NEW_LINE;
            report += "Total costs from flight: " + dso.CalculatedValues.CostOfFlight;
            report += NEW_LINE;

            report += (dso.CalculatedValues.ProfitSurplus > 0 ? "Flight generating profit of: " : "Flight losing money of: ") + dso.CalculatedValues.ProfitSurplus;

            report += VERTICAL_WHITE_SPACE;

            report += "Total loyalty points given away: " + dso.CalculatedValues.TotalLoyaltyPointsAccrued + NEW_LINE;
            report += "Total loyalty points redeemed: " + dso.CalculatedValues.TotalLoyaltyPointsRedeemed + NEW_LINE;

            report += VERTICAL_WHITE_SPACE;

            if (businessRules.CanFlightProceed)
            {
                report += "THIS FLIGHT MAY PROCEED";
            }
            else
            {
                report += "FLIGHT MAY NOT PROCEED";
            }
        }
コード例 #3
0
 public string GetScheduledFlightSummaryReport(ScheduledFlightSummaryReportDso dso)
 {
     GenerateReport(dso);
     return(report);
 }