Example #1
0
        public static AirportFacility MinimumServiceFacility = AirportFacilities.GetFacility("Basic ServiceCenter"); //AirportFacilities.GetFacility("Large ServiceCenter");

        #endregion Fields

        #region Constructors

        public Hub(Airline airline, HubType type)
        {
            this.Airline = airline;
            this.Type = type;
        }
Example #2
0
        //returns the price for a hub at an airport
        public static double GetHubPrice(Airport airport, HubType type)
        {
            double price = type.Price;

            price = price +25000 * ((int)airport.Profile.Size);
            return Convert.ToInt64(GeneralHelpers.GetInflationPrice(price));
        }
Example #3
0
 //adds a hub type to the list
 public static void AddHubType(HubType type)
 {
     types.Add(type);
 }
Example #4
0
 //returns a hub type of a specific type
 public static HubType GetHubType(HubType.TypeOfHub type)
 {
     return types.Find(t => t.Type == type);
 }
Example #5
0
        //returns all hubs of a specific type
        public List<Hub> getHubs(HubType.TypeOfHub type)
        {
            List<Hub> hubs;
            lock (this._Hubs)
                hubs = new List<Hub>(this._Hubs);

            return hubs.FindAll(h => h.Type.Type == type);
        }
Example #6
0
        //returns if an airline can create a hub at an airport
        public static Boolean CanCreateHub(Airline airline, Airport airport, HubType type)
        {
            Boolean airlineHub = airport.getHubs().Exists(h => h.Airline == airline);

            int airlineValue = (int)airline.getAirlineValue() + 1;

            int totalAirlineHubs = airline.getHubs().Count;// 'Airports.GetAllActiveAirports().Sum(a => a.Hubs.Count(h => h.Airline == airline));
            double airlineGatesPercent = Convert.ToDouble(airport.Terminals.getNumberOfGates(airline)) / Convert.ToDouble(airport.Terminals.getNumberOfGates()) * 100;

            switch (type.Type)
            {
                case HubType.TypeOfHub.Focus_city:
                    return !airlineHub && airline.Money > AirportHelpers.GetHubPrice(airport, type);
                case HubType.TypeOfHub.Regional_hub:
                    return !airlineHub && airline.Money > AirportHelpers.GetHubPrice(airport, type) && (airport.Profile.Size == GeneralHelpers.Size.Large || airport.Profile.Size == GeneralHelpers.Size.Medium) && airport.getHubs().Count < 7;
                case HubType.TypeOfHub.Fortress_hub:
                    return !airlineHub && airline.Money > AirportHelpers.GetHubPrice(airport, type) && (airport.Profile.Size > GeneralHelpers.Size.Medium) && airlineGatesPercent > 70 && (totalAirlineHubs < airlineValue);
                case HubType.TypeOfHub.Hub:
                    return !airlineHub && airline.Money > AirportHelpers.GetHubPrice(airport, type) && (!airlineHub) && (airlineGatesPercent > 20) && (totalAirlineHubs < airlineValue) && (airport.getHubs(HubType.TypeOfHub.Hub).Count < (int)airport.Profile.Size);
            }

            return false;


        }
        //creates the radio button for a hub type
        private RadioButton createHubType(HubType type, Panel panel)
        {
            RadioButton rbHub = new RadioButton();
            rbHub.Content = string.Format("{0} ({1})", type.Name, new ValueCurrencyConverter().Convert(AirportHelpers.GetHubPrice(this.Airport, type)));
            rbHub.GroupName = "Hub";
            rbHub.Tag = new KeyValuePair<HubType,Panel>(type,panel);
            rbHub.Checked += rbHub_Checked;
            rbHub.IsChecked = true;

            return rbHub;
        }
Example #8
0
 //adds a hub type to the list
 public static void AddHubType(HubType type)
 {
     types.Add(type);
 }
Example #9
0
 public static AirportFacility MinimumServiceFacility = AirportFacilities.GetFacility("Basic ServiceCenter"); //AirportFacilities.GetFacility("Large ServiceCenter");
 public Hub(Airline airline, HubType type)
 {
     this.Airline = airline;
     this.Type    = type;
 }