当前位置: 首页>>代码示例>>C#>>正文


C# Airline.GetAirlineValue方法代码示例

本文整理汇总了C#中TheAirline.Models.Airlines.Airline.GetAirlineValue方法的典型用法代码示例。如果您正苦于以下问题:C# Airline.GetAirlineValue方法的具体用法?C# Airline.GetAirlineValue怎么用?C# Airline.GetAirlineValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TheAirline.Models.Airlines.Airline的用法示例。


在下文中一共展示了Airline.GetAirlineValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPricePerAirlineShare

        //returns the current price per share for an airline
        public static double GetPricePerAirlineShare(Airline airline)
        {
            var rnd = new Random();

            double price = 0;
            Airline.AirlineValue value = airline.GetAirlineValue();

            switch (value)
            {
                case Airline.AirlineValue.Low:
                    price = 15 + (rnd.NextDouble()*10);
                    break;
                case Airline.AirlineValue.VeryLow:
                    price = 5 + (rnd.NextDouble()*10);
                    break;
                case Airline.AirlineValue.Normal:
                    price = 25 + (rnd.NextDouble()*10);
                    break;
                case Airline.AirlineValue.High:
                    price = 40 + (rnd.NextDouble()*10);
                    break;
                case Airline.AirlineValue.VeryHigh:
                    price = 55 + (rnd.NextDouble()*10);
                    break;
            }

            return GeneralHelpers.GetInflationPrice(price);
        }
开发者ID:TheAirlineProject,项目名称:tap-desktop,代码行数:29,代码来源:AirlineHelpers.cs

示例2: CanCreateHub

        //returns if an airline can create a hub at an airport
        public static bool CanCreateHub(Airline airline, Airport airport, HubType type)
        {
            Terminal.TerminalType terminaltype = airline.AirlineRouteFocus == Route.RouteType.Cargo ? Terminal.TerminalType.Cargo : Terminal.TerminalType.Passenger;

            bool 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(terminaltype))*100;

            switch (type.Type)
            {
                case HubType.TypeOfHub.FocusCity:
                    return !airlineHub && airline.Money > AirportHelpers.GetHubPrice(airport, type);
                case HubType.TypeOfHub.RegionalHub:
                    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.FortressHub:
                    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) && (airlineGatesPercent > 20) && (totalAirlineHubs < airlineValue) &&
                           (airport.GetHubs(HubType.TypeOfHub.Hub).Count < (int) airport.Profile.Size);
            }

            return false;
        }
开发者ID:TheAirlineProject,项目名称:tap-desktop,代码行数:29,代码来源:AirlineHelpers.cs


注:本文中的TheAirline.Models.Airlines.Airline.GetAirlineValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。