TheAirline.Models.Routes.Route.GetRouteInvoiceAmount C# (CSharp) Method

GetRouteInvoiceAmount() public method

public GetRouteInvoiceAmount ( Invoice type ) : double
type Invoice
return double
        public double GetRouteInvoiceAmount(Invoice.InvoiceType type)
        {
            double amount = Stopovers.Sum(stopover => stopover.Legs.Sum(l => l.GetRouteInvoiceAmount(type)));

            if (type == Invoice.InvoiceType.Total)
            {
                amount += Invoices.GetAmount();
            }
            else
            {
                amount += Invoices.GetAmount(type);
            }

            return amount;
        }

Same methods

Route::GetRouteInvoiceAmount ( Invoice type, DateTime startTime, DateTime endTime ) : double

Usage Example

Ejemplo n.º 1
0
        public HumanRouteMVVM(Route route)
        {
            Route = route;
            ShowCargoInformation = Route.Type == Route.RouteType.Cargo
                                        || Route.Type == Route.RouteType.Mixed;
            ShowPassengersInformation = Route.Type == Route.RouteType.Passenger
                                             || Route.Type == Route.RouteType.Mixed || Route.Type == Route.RouteType.Helicopter;

            IsEditable = true;
            // !this.Route.getAirliners().Exists(a => a.Status != FleetAirliner.AirlinerStatus.Stopped);

            Invoices = new List<MonthlyInvoice>();

            foreach (Invoice.InvoiceType type in Route.GetRouteInvoiceTypes())
            {
                Invoices.Add(new MonthlyInvoice(type, 1950, 1,1, Route.GetRouteInvoiceAmount(type)));
            }

            Legs = new List<Route>();
            Legs.Add(Route);
            Legs.AddRange(Route.Stopovers.SelectMany(s => s.Legs));

            Distance = MathHelpers.GetDistance(Route.Destination1, Route.Destination2);

            setFeedback();
        }