Inheritance: BaseModel
        public static object ShowPopUp(Airline airline,Airport airport)
        {
            PopUpWindow window = new PopUpAddCooperation(airline,airport);
            window.ShowDialog();

            return window.Selected;
        }
        public FleetAirliner(
            PurchasedType purchased,
            DateTime purchasedDate,
            Airline airline,
            Airliner airliner,
            Airport homebase)
        {
            Airliner = airliner;
            Purchased = purchased;
            PurchasedDate = purchasedDate;
            Airliner.Airline = airline;
            Homebase = homebase;
            Name = airliner.TailNumber;
            Statistics = new AirlinerStatistics(this);
            LastCMaintenance = Airliner.BuiltDate;
            LastAMaintenance = Airliner.BuiltDate;
            LastBMaintenance = Airliner.BuiltDate;
            LastDMaintenance = Airliner.BuiltDate;
            Status = AirlinerStatus.Stopped;
            MaintRoutes = new List<Route>();

            CurrentPosition = Homebase;
            //new GeoCoordinate(this.Homebase.Profile.Coordinates.Latitude,this.Homebase.Profile.Coordinates.Longitude);

            Routes = new List<Route>();
            Pilots = new List<Pilot>();
            InsurancePolicies = new List<AirlinerInsurance>();
            MaintenanceHistory = new Dictionary<Invoice, string>();

            Data = new OperatingData();

            if (Purchased == PurchasedType.Bought || Purchased == PurchasedType.BoughtDownPayment)
                Airliner.Owner = Airliner.Airline;
        }
 public Scenario(
     string name,
     string description,
     Airline airline,
     Airport homebase,
     int startyear,
     int endyear,
     long startcash,
     DifficultyLevel difficulty)
 {
     Name = name;
     Airline = airline;
     Homebase = homebase;
     StartYear = startyear;
     StartCash = startcash;
     Description = description;
     Difficulty = difficulty;
     EndYear = endyear;
     OpponentAirlines = new List<ScenarioAirline>();
     Destinations = new List<Airport>();
     Fleet = new Dictionary<AirlinerType, int>();
     Routes = new List<ScenarioAirlineRoute>();
     Failures = new List<ScenarioFailure>();
     PassengerDemands = new List<ScenarioPassengerDemand>();
 }
 public ScenarioPassengerDemand(double factor, DateTime enddate, Country country, Airport airport)
 {
     Country = country;
     Factor = factor;
     EndDate = enddate;
     Airport = airport;
 }
        /// <summary>
        ///     Calculates the distance from
        ///     the start airport to all other airports
        /// </summary>
        /// <param name="start">Startknoten</param>
        public void CalculateDistance(Airport start)
        {
            Dist[start.Profile.IATACode] = 0;

            while (Basis.Count > 0)
            {
                Airport u = GetNodeWithSmallestDistance();
                if (u == null)
                {
                    Basis.Clear();
                }
                else
                {
                    foreach (Airport v in GetNeighbors(u))
                    {
                        double alt = Dist[u.Profile.IATACode] + getDistanceBetween(u, v);
                        if (alt < Dist[v.Profile.IATACode])
                        {
                            Dist[v.Profile.IATACode] = alt;
                            Previous[v.Profile.IATACode] = u;
                        }
                    }
                    Basis.Remove(u);
                }
            }
        }
 public AirlineAirportFacility(Airline airline, Airport airport, AirportFacility facility, DateTime date)
 {
     Airline = airline;
     Facility = facility;
     FinishedDate = date;
     Airport = airport;
 }
        public static object ShowPopUp(Airport airport)
        {
            PopUpWindow window = new PopUpAirportContract(airport);
            window.ShowDialog();

            return window.Selected;
        }
 public AirportContract(
     Airline airline,
     Airport airport,
     ContractType type,
     Terminal.TerminalType terminaltype,
     DateTime date,
     int numberOfGates,
     int length,
     double yearlyPayment,
     bool autorenew,
     bool payFull = false,
     bool isExclusiveDeal = false,
     Terminal terminal = null)
 {
     Type = type;
     PayFull = payFull;
     Airline = airline;
     Airport = airport;
     ContractDate = date;
     Length = length;
     YearlyPayment = yearlyPayment;
     NumberOfGates = numberOfGates;
     IsExclusiveDeal = isExclusiveDeal;
     Terminal = terminal;
     ExpireDate = ContractDate.AddYears(Length);
     AutoRenew = autorenew;
     TerminalType = terminaltype;
 }
 public ScenarioAirlineRoute(Airport destination1, Airport destination2, AirlinerType airlinertype, int quantity)
 {
     Destination1 = destination1;
     Destination2 = destination2;
     AirlinerType = airlinertype;
     Quantity = quantity;
 }
        public PopUpAirportContract(Airport airport)
        {
            this.Airport = airport;

            this.DataContext = this.Airport;

            InitializeComponent();
        }
 public Alliance(DateTime formationDate, string name, Airport headquarter)
 {
     FormationDate = formationDate;
     Name = name;
     Members = new List<AllianceMember>();
     PendingMembers = new List<PendingAllianceMember>();
     Headquarter = headquarter;
 }
 public CargoRoute(
     string id,
     Airport destination1,
     Airport destination2,
     DateTime startDate,
     double pricePerUnit)
     : base(RouteType.Cargo, id, destination1, destination2, startDate)
 {
     PricePerUnit = pricePerUnit;
 }
        public Terminal(Airport airport, Airline airline, string name, int gates, DateTime deliveryDate, TerminalType type)
        {
            Airport = airport;
            Airline = airline;
            Name = name;
            DeliveryDate = new DateTime(deliveryDate.Year, deliveryDate.Month, deliveryDate.Day);
            Type = type;

            Gates = new Gates(gates, DeliveryDate, airline);
        }
 public HelicopterRoute(
     string id,
     Airport destination1,
     Airport destination2,
     DateTime startDate,
     double farePrice)
     : base(id, destination1, destination2, startDate, farePrice)
 {
     Type = RouteType.Helicopter;
 }
        public FlightSchool(Airport airport)
        {
            Guid id = Guid.NewGuid();

            Airport = airport;
            Name = $"Flight School {Airport.Profile.Town.Name}";
            Students = new List<PilotStudent>();
            Instructors = new List<Instructor>();
            TrainingAircrafts = new List<TrainingAircraft>();
            ID = id.ToString();
        }
        public CombiRoute(
            string id,
            Airport destination1,
            Airport destination2,
            DateTime startDate,
            double farePrice,
            double pricePerUnit)
            : base(id, destination1, destination2, startDate, farePrice)
        {
            Type = RouteType.Mixed;

            PricePerUnit = pricePerUnit;
        }
        public PopUpAddCooperation(Airline airline, Airport airport)
        {
            this.Types = new List<CooperationType>();

            this.Airline = airline;
            this.Airport = airport;

            foreach (CooperationType type in CooperationTypes.GetCooperationTypes())
            {
                if (!this.Airport.Cooperations.Exists(c => c.Airline == airline && c.Type == type) && type.AirportSizeRequired<=this.Airport.Profile.Size)
                    this.Types.Add(type);
            }

            InitializeComponent();
        }
        //changes the demand between two airports
        public static void ChangePaxDemand(Airport airport1, Airport airport2, int value)
        {
            DestinationDemand destPax = airport1.GetDestinationPassengersObject(airport2);

            if (destPax != null && value > 0)
            {
                destPax.Rate += Convert.ToUInt16(value);
            }
            else
            {
                if (value > 0)
                {
                    airport1.AddDestinationPassengersRate(airport2, Convert.ToUInt16(value));
                }
            }
        }
        protected Route(RouteType type, string id, Airport destination1, Airport destination2, DateTime startDate)
        {
            Type = type;
            Id = id;
            Destination1 = destination1;
            Destination2 = destination2;
            StartDate = startDate;

            TimeTable = new RouteTimeTable(this);
            Invoices = new Invoices();
            Statistics = new RouteStatistics();
            Banned = false;
            Stopovers = new List<StopoverRoute>();

            Season = Weather.Season.AllYear;
        }
 public FutureSubsidiaryAirline(
     string name,
     string iata,
     Airport airport,
     Airline.AirlineMentality mentality,
     AirlineFocus market,
     Route.RouteType airlineRouteFocus,
     string logo)
 {
     Name = name;
     IATA = iata;
     PreferedAirport = airport;
     Mentality = mentality;
     Market = market;
     Logo = logo;
     AirlineRouteFocus = airlineRouteFocus;
 }
        public PassengerRoute(
            string id,
            Airport destination1,
            Airport destination2,
            DateTime startDate,
            double farePrice)
            : base(RouteType.Passenger, id, destination1, destination2, startDate)
        {
            Classes = new List<RouteAirlinerClass>();

            foreach (AirlinerClass.ClassType ctype in Enum.GetValues(typeof (AirlinerClass.ClassType)))
            {
                var cl = new RouteAirlinerClass(ctype, RouteAirlinerClass.SeatingType.ReservedSeating, farePrice);

                Classes.Add(cl);
            }
        }
        public PageAirport(Airport airport)
        {
            Loaded += PageAirport_Loaded;
            Airport = new AirportMVVM(airport);

            Distances = new List<AirportDistanceMVVM>();

            foreach (
                Airport destination in
                    GameObject.GetInstance().HumanAirline.Airports.Where(a => a != Airport.Airport))
            {
                Distances.Add(
                    new AirportDistanceMVVM(destination, MathHelpers.GetDistance(destination, Airport.Airport)));
            }

            InitializeComponent();
        }
        public PopUpShowConnectingRoutes(Airport destination1, Airport destination2)
        {
            List<Route> connectingRoutes = new List<Route>();

            var codesharingRoutes = GameObject.GetInstance().HumanAirline.Codeshares.Where(c => c.Airline2 == GameObject.GetInstance().HumanAirline || c.Type == CodeshareAgreement.CodeshareType.BothWays).Select(c => c.Airline1 == GameObject.GetInstance().HumanAirline ? c.Airline2 : c.Airline1).SelectMany(a => a.Routes);
            var humanConnectingRoutes = GameObject.GetInstance().HumanAirline.Routes.Where(r => r.Destination1 == destination1 || r.Destination2 == destination1 || r.Destination1 == destination2 || r.Destination2 == destination2);

            var codesharingConnectingRoutes = codesharingRoutes.Where(r => r.Destination1 == destination1 || r.Destination2 == destination1 || r.Destination1 == destination2 || r.Destination2 == destination2);

            foreach (Route route in humanConnectingRoutes)
                connectingRoutes.Add(route);

            foreach (Route route in codesharingConnectingRoutes)
                connectingRoutes.Add(route);

            this.DataContext = connectingRoutes;

            InitializeComponent();
        }
 public WeatherAverage(
     int month,
     double temperatureMin,
     double temperatureMax,
     int precipitation,
     Weather.eWindSpeed windspeedMin,
     Weather.eWindSpeed windspeedMax,
     Airport airport)
     : this(month,
         temperatureMin,
         temperatureMax,
         precipitation,
         windspeedMin,
         windspeedMax,
         airport.Profile.Town.Country,
         airport.Profile.Town,
         airport)
 {
 }
 public WeatherAverage(
     int month,
     double temperatureMin,
     double temperatureMax,
     int precipitation,
     Weather.eWindSpeed windspeedMin,
     Weather.eWindSpeed windspeedMax,
     Country country,
     Town town,
     Airport airport)
 {
     Month = month;
     Airport = airport;
     Country = country;
     Town = town;
     TemperatureMin = temperatureMin;
     TemperatureMax = temperatureMax;
     WindSpeedMax = windspeedMax;
     WindSpeedMin = windspeedMin;
     Precipitation = precipitation;
 }
        /*!loads the airliner images
         */
        private static void LoadAirports(string filename)
        {
            string id = "";
            try
            {
                var doc = new XmlDocument();
                doc.Load(filename);
                XmlElement root = doc.DocumentElement;

                XmlNodeList airportsList = root?.SelectNodes("//airport");

                if (airportsList != null)
                    foreach (XmlElement airportElement in airportsList)
                    {
                        string name = airportElement.Attributes["name"].Value;
                        string icao = airportElement.Attributes["icao"].Value;
                        string iata = airportElement.Attributes["iata"].Value;

                        id = name + " iata: " + iata;

                        var type =
                            (AirportProfile.AirportType)
                                Enum.Parse(typeof (AirportProfile.AirportType), airportElement.Attributes["type"].Value);
                        var season =
                            (Weather.Season) Enum.Parse(typeof (Weather.Season), airportElement.Attributes["season"].Value);

                        var periodElement = (XmlElement) airportElement.SelectSingleNode("period");

                        Period<DateTime> airportPeriod;
                        if (periodElement != null)
                        {
                            DateTime airportFrom = Convert.ToDateTime(
                                periodElement.Attributes["from"].Value,
                                new CultureInfo("en-US", false));
                            DateTime airportTo = Convert.ToDateTime(
                                periodElement.Attributes["to"].Value,
                                new CultureInfo("en-US", false));

                            airportPeriod = new Period<DateTime>(airportFrom, airportTo);
                        }
                        else
                        {
                            airportPeriod = new Period<DateTime>(new DateTime(1959, 12, 31), new DateTime(2199, 12, 31));
                        }

                        var townElement = (XmlElement) airportElement.SelectSingleNode("town");
                        string town = townElement.Attributes["town"].Value;
                        string country = townElement.Attributes["country"].Value;
                        TimeSpan gmt = TimeSpan.Parse(townElement.Attributes["GMT"].Value);
                        TimeSpan dst = TimeSpan.Parse(townElement.Attributes["DST"].Value);

                        var latitudeElement = (XmlElement) airportElement.SelectSingleNode("coordinates/latitude");
                        var longitudeElement = (XmlElement) airportElement.SelectSingleNode("coordinates/longitude");
                        string[] latitude = latitudeElement.Attributes["value"].Value.Split(
                            new[] {'°', '\''},
                            StringSplitOptions.RemoveEmptyEntries);
                        string[] longitude =
                            longitudeElement.Attributes["value"].Value.Split(
                                new[] {'°', '\''},
                                StringSplitOptions.RemoveEmptyEntries);
                        var coords = new int[6];

                        //latitude
                        coords[0] = int.Parse(latitude[0]);
                        coords[1] = int.Parse(latitude[1]);
                        coords[2] = int.Parse(latitude[2]);

                        if (latitude[3] == "S")
                        {
                            coords[0] = -coords[0];
                        }

                        //longitude
                        coords[3] = int.Parse(longitude[0]);
                        coords[4] = int.Parse(longitude[1]);
                        coords[5] = int.Parse(longitude[2]);

                        if (longitude[3] == "W")
                        {
                            coords[3] = -coords[3];
                        }

                        /*
                    foreach(string l in latitude )
                    {
                        //int.TryParse(l, out coords[c]);
                        coords[c] = int.Parse(l);
                        c++;
                    }
                    c = 3;

                    foreach (string l in longitude)
                    {
                        //int.TryParse(l, out coords[c]);
                        coords[c] = int.Parse(l);

                        c++;
                    }*/

                        //cleaning up

                        //GeoCoordinate pos = new GeoCoordinate(MathHelpers.DMStoDeg(coords[0], coords[1], coords[2]),MathHelpers.DMStoDeg(coords[3],coords[4],coords[5]));
                        var pos = new Coordinates(
                            new Coordinate(coords[0], coords[1], coords[2]),
                            new Coordinate(coords[3], coords[4], coords[5]));

                        //double longitude = Coordinate.Parse(longitudeElement.Attributes["value"].Value);

                        var sizeElement = (XmlElement) airportElement.SelectSingleNode("size");

                        var paxValues = new List<PaxValue>();

                        if (!sizeElement.HasChildNodes)
                        {
                            var size =
                                (GeneralHelpers.Size)
                                    Enum.Parse(typeof (GeneralHelpers.Size), sizeElement.Attributes["value"].Value);
                            int pax = sizeElement.HasAttribute("pax")
                                ? Convert.ToInt32(sizeElement.Attributes["pax"].Value)
                                : 0;

                            paxValues.Add(new PaxValue(airportPeriod.From.Year, airportPeriod.To.Year, size, pax));
                        }
                        else
                        {
                            XmlNodeList yearsList = sizeElement.SelectNodes("yearvalues/yearvalue");

                            foreach (XmlElement yearElement in yearsList)
                            {
                                int fromYear = Convert.ToInt16(yearElement.Attributes["from"].Value);
                                int toYear = Convert.ToInt16(yearElement.Attributes["to"].Value);
                                var size =
                                    (GeneralHelpers.Size)
                                        Enum.Parse(typeof (GeneralHelpers.Size), yearElement.Attributes["value"].Value);
                                int pax = Convert.ToInt32(yearElement.Attributes["pax"].Value);

                                var paxValue = new PaxValue(fromYear, toYear, size, pax);

                                if (yearElement.HasAttribute("inflationafter"))
                                {
                                    paxValue.InflationAfterYear =
                                        Convert.ToDouble(
                                            yearElement.Attributes["inflationafter"].Value,
                                            CultureInfo.GetCultureInfo("en-US").NumberFormat);
                                }
                                if (yearElement.HasAttribute("inflationbefore"))
                                {
                                    paxValue.InflationBeforeYear =
                                        Convert.ToDouble(
                                            yearElement.Attributes["inflationbefore"].Value,
                                            CultureInfo.GetCultureInfo("en-US").NumberFormat);
                                }

                                paxValues.Add(paxValue);
                            }
                        }

                        GeneralHelpers.Size cargoSize;
                        double cargovolume = sizeElement.HasAttribute("cargovolume")
                            ? Convert.ToDouble(
                                sizeElement.Attributes["cargovolume"].Value,
                                CultureInfo.GetCultureInfo("en-US").NumberFormat)
                            : 0;

                        if (sizeElement.HasAttribute("cargo"))
                        {
                            cargoSize =
                                (GeneralHelpers.Size)
                                    Enum.Parse(typeof (GeneralHelpers.Size), sizeElement.Attributes["cargo"].Value);
                        }
                        else
                        {
                            //calculates the cargo size
                            var cargoSizes = (GeneralHelpers.Size[]) Enum.GetValues(typeof (GeneralHelpers.Size));

                            int i = 0;

                            var list = new Dictionary<GeneralHelpers.Size, int>();

                            while (i < cargoSizes.Length && cargoSizes[i] <= paxValues.First().Size)
                            {
                                list.Add(cargoSizes[i], 10 - i);
                                i++;
                            }

                            cargoSize = AIHelpers.GetRandomItem(list);
                        }

                        Town eTown;
                        if (town.Contains(","))
                        {
                            State state = States.GetState(Countries.GetCountry(country), town.Split(',')[1].Trim());

                            eTown = state == null ? new Town(town.Split(',')[0], Countries.GetCountry(country)) : new Town(town.Split(',')[0], Countries.GetCountry(country), state);
                        }
                        else
                        {
                            eTown = new Town(town, Countries.GetCountry(country));
                        }

                        var profile = new AirportProfile(
                            name,
                            iata,
                            icao,
                            type,
                            airportPeriod,
                            eTown,
                            gmt,
                            dst,
                            pos,
                            cargoSize,
                            cargovolume,
                            season) {PaxValues = paxValues};

                        var airport = new Airport(profile);

                        var destinationsElement = (XmlElement) airportElement.SelectSingleNode("destinations");

                        if (destinationsElement != null)
                        {
                            XmlNodeList majorDestinationsList = destinationsElement.SelectNodes("destination");

                            var majorDestinations = new Dictionary<string, int>();

                            foreach (XmlElement majorDestinationNode in majorDestinationsList)
                            {
                                string majorDestination = majorDestinationNode.Attributes["airport"].Value;
                                int majorDestinationPax = Convert.ToInt32(majorDestinationNode.Attributes["pax"].Value);

                                majorDestinations.Add(majorDestination, majorDestinationPax);
                            }

                            airport.Profile.MajorDestionations = majorDestinations;
                        }

                        XmlNodeList terminalList = airportElement.SelectNodes("terminals/terminal");

                        foreach (XmlElement terminalNode in terminalList)
                        {
                            string terminalName = terminalNode.Attributes["name"].Value;
                            int terminalGates = XmlConvert.ToInt32(terminalNode.Attributes["gates"].Value);

                            Terminal.TerminalType terminalType;

                            if (terminalNode.HasAttribute("type"))
                                terminalType =
                                    (Terminal.TerminalType)
                                        Enum.Parse(typeof (Terminal.TerminalType), terminalNode.Attributes["type"].Value);
                            else
                                terminalType = Terminal.TerminalType.Passenger;

                            airport.Terminals.AddTerminal(
                                new Terminal(airport, null, terminalName, terminalGates, new DateTime(1950, 1, 1), terminalType));
                        }

                        XmlNodeList runwaysList = airportElement.SelectNodes("runways/runway");

                        foreach (XmlElement runwayNode in runwaysList)
                        {
                            string runwayName = runwayNode.Attributes["name"].Value;
                            long runwayLength = XmlConvert.ToInt32(runwayNode.Attributes["length"].Value);
                            var surface =
                                (Runway.SurfaceType)
                                    Enum.Parse(typeof (Runway.SurfaceType), runwayNode.Attributes["surface"].Value);

                            var runwayType = Runway.RunwayType.Regular;

                            if (runwayNode.HasAttribute("type"))
                            {
                                runwayType =
                                    (Runway.RunwayType)
                                        Enum.Parse(typeof (Runway.RunwayType), runwayNode.Attributes["type"].Value);
                            }

                            airport.Runways.Add(
                                new Runway(runwayName, runwayLength, runwayType, surface, new DateTime(1900, 1, 1), true));
                        }

                        XmlNodeList expansionsList = airportElement.SelectNodes("expansions/expansion");

                        foreach (XmlElement expansionNode in expansionsList)
                        {
                            var expansionType =
                                (AirportExpansion.ExpansionType)
                                    Enum.Parse(typeof (AirportExpansion.ExpansionType), expansionNode.Attributes["type"].Value);

                            DateTime expansionDate = Convert.ToDateTime(
                                expansionNode.Attributes["date"].Value,
                                new CultureInfo("en-US", false));

                            bool expansionNotify = Convert.ToBoolean(expansionNode.Attributes["notify"].Value);

                            var expansion = new AirportExpansion(expansionType, expansionDate, expansionNotify);

                            if (expansionType == AirportExpansion.ExpansionType.Name)
                            {
                                string expansionName = expansionNode.Attributes["name"].Value;

                                expansion.Name = expansionName;
                            }
                            if (expansionType == AirportExpansion.ExpansionType.RunwayLength)
                            {
                                string expansionName = expansionNode.Attributes["name"].Value;
                                long length = Convert.ToInt64(expansionNode.Attributes["length"].Value);

                                expansion.Name = expansionName;
                                expansion.Length = length;
                            }
                            if (expansionType == AirportExpansion.ExpansionType.NewRunway)
                            {
                                string expansionName = expansionNode.Attributes["name"].Value;
                                long length = Convert.ToInt64(expansionNode.Attributes["length"].Value);

                                var surface =
                                    (Runway.SurfaceType)
                                        Enum.Parse(typeof (Runway.SurfaceType), expansionNode.Attributes["surface"].Value);

                                expansion.Name = expansionName;
                                expansion.Length = length;
                                expansion.Surface = surface;
                            }

                            if (expansionType == AirportExpansion.ExpansionType.NewTerminal)
                            {
                                string expansionName = expansionNode.Attributes["name"].Value;
                                int gates = Convert.ToInt16(expansionNode.Attributes["gates"].Value);

                                Terminal.TerminalType terminalType;

                                if (expansionNode.HasAttribute("terminaltype"))
                                    terminalType =
                                        (Terminal.TerminalType)
                                            Enum.Parse(typeof (Terminal.TerminalType), expansionNode.Attributes["terminaltype"].Value);
                                else
                                    terminalType = Terminal.TerminalType.Passenger;

                                expansion.Name = expansionName;
                                expansion.Gates = gates;
                                expansion.TerminalType = terminalType;
                            }
                            if (expansionType == AirportExpansion.ExpansionType.ExtraGates)
                            {
                                string expansionName = expansionNode.Attributes["name"].Value;
                                int gates = Convert.ToInt16(expansionNode.Attributes["gates"].Value);

                                expansion.Name = expansionName;
                                expansion.Gates = gates;
                            }
                            if (expansionType == AirportExpansion.ExpansionType.CloseTerminal)
                            {
                                string expansionName = expansionNode.Attributes["name"].Value;
                                int gates = Convert.ToInt16(expansionNode.Attributes["gates"].Value);

                                expansion.Name = expansionName;
                                expansion.Gates = gates;
                            }
                            airport.Profile.AddExpansion(expansion);
                        }

                        //30.06.14: Added for loading of landing fees

                        double landingFee = airportElement.HasAttribute("landingfee") ? Convert.ToDouble(airportElement.Attributes["landingfee"].Value, new CultureInfo("en-US", false)) : AirportHelpers.GetStandardLandingFee(airport);

                        airport.LandingFee = landingFee;

                        if (Airports.GetAirport(a => a.Profile.ID == airport.Profile.ID) == null)
                        {
                            Airports.AddAirport(airport);
                        }
                    }
            }
            catch (Exception e)
            {
                /*
                System.IO.StreamWriter file = new System.IO.StreamWriter(AppSettings.getCommonApplicationDataPath() + "\\theairlinestartup.log", true);
                file.WriteLine("Airport failing: " + id);
                file.WriteLine(e.ToString());
                file.WriteLine(e.StackTrace);
                file.Close();
                 * */

                Logger.Error("Airport {0} failing to load", id);
                Logger.Error(e);
            }
        }
        public static void CreateStopoverRoute(Route route, Airport stopover1, Airport stopover2 = null)
        {
            if (stopover1 != null)
            {
                if (stopover2 != null)
                {
                    route.AddStopover(CreateStopoverRoute(route.Destination1, stopover1, stopover2, route, false, route.Type));
                    route.AddStopover(CreateStopoverRoute(stopover1, stopover2, route.Destination2, route, true, route.Type));
                }
                else
                    route.AddStopover(CreateStopoverRoute(route.Destination1, stopover1, route.Destination2, route, false, route.Type));
            }

            /*
            if (stopover1 != null)
            {
                if (stopover2 != null)
                    route.addStopover(FleetAirlinerHelpers.CreateStopoverRoute(route.Destination1, stopover1, stopover2, route, false, route.Type));
                else
                    route.addStopover(FleetAirlinerHelpers.CreateStopoverRoute(route.Destination1, stopover1, route.Destination2, route, false, route.Type));
            }

            if (stopover2 != null && stopover1!=null)
            {
               route.addStopover(FleetAirlinerHelpers.CreateStopoverRoute(stopover1, stopover2, route.Destination2, route, true, route.Type));
              
            }
             * */
        }
        //creates the stop over route based on the main route
        public static StopoverRoute CreateStopoverRoute(Airport dest1, Airport stopover, Airport dest2, Route mainroute, bool oneLegged, Route.RouteType type)
        {
            var stopoverRoute = new StopoverRoute(stopover);

            Guid id = Guid.NewGuid();

            if (!oneLegged)
            {
                if (mainroute.Type == Route.RouteType.Passenger || mainroute.Type == Route.RouteType.Mixed)
                {
                    var routeLegTwo = new PassengerRoute(id.ToString(), dest1, stopover, GameObject.GetInstance().GameTime, 0);

                    foreach (RouteAirlinerClass aClass in ((PassengerRoute) mainroute).Classes)
                    {
                        //routeLegTwo.getRouteAirlinerClass(aClass.Type).FarePrice = aClass.FarePrice;
                        routeLegTwo.GetRouteAirlinerClass(aClass.Type).FarePrice = PassengerHelpers.GetPassengerPrice(dest1, stopover)*GeneralHelpers.ClassToPriceFactor(aClass.Type);

                        foreach (RouteFacility facility in aClass.GetFacilities())
                            routeLegTwo.GetRouteAirlinerClass(aClass.Type).AddFacility(facility);

                        routeLegTwo.GetRouteAirlinerClass(aClass.Type).Seating = aClass.Seating;
                    }


                    stopoverRoute.AddLeg(routeLegTwo);
                }
                if (mainroute.Type == Route.RouteType.Cargo || mainroute.Type == Route.RouteType.Mixed)
                {
                    var routeLegTwo = new CargoRoute(id.ToString(), dest1, stopover, GameObject.GetInstance().GameTime, ((CargoRoute) mainroute).PricePerUnit);

                    stopoverRoute.AddLeg(routeLegTwo);
                }
            }

            if (mainroute.Type == Route.RouteType.Mixed || mainroute.Type == Route.RouteType.Passenger)
            {
                id = Guid.NewGuid();

                var routeLegOne = new PassengerRoute(id.ToString(), stopover, dest2, GameObject.GetInstance().GameTime, 0);

                foreach (RouteAirlinerClass aClass in ((PassengerRoute) mainroute).Classes)
                {
                    //routeLegOne.getRouteAirlinerClass(aClass.Type).FarePrice = aClass.FarePrice;

                    routeLegOne.GetRouteAirlinerClass(aClass.Type).FarePrice = PassengerHelpers.GetPassengerPrice(stopover, dest2)*GeneralHelpers.ClassToPriceFactor(aClass.Type);


                    foreach (RouteFacility facility in aClass.GetFacilities())
                        routeLegOne.GetRouteAirlinerClass(aClass.Type).AddFacility(facility);

                    routeLegOne.GetRouteAirlinerClass(aClass.Type).Seating = aClass.Seating;
                }

                stopoverRoute.AddLeg(routeLegOne);
            }
            if (mainroute.Type == Route.RouteType.Cargo || mainroute.Type == Route.RouteType.Mixed)
            {
                var routeLegOne = new CargoRoute(id.ToString(), stopover, dest2, GameObject.GetInstance().GameTime, ((CargoRoute) mainroute).PricePerUnit);

                stopoverRoute.AddLeg(routeLegOne);
            }


            return stopoverRoute;
        }
 public static void ReceiveInsurancePayout(Airline airline, Airport airport)
 {
 }
 public static void FileInsuranceClaim(Airline airline, Airport airport, AirportFacilities facility)
 {
 }