Ejemplo n.º 1
0
 public PaxValue(int fromYear, int toYear, GeneralHelpers.Size size, double pax)
 {
     this.Pax      = pax;
     this.FromYear = fromYear;
     this.ToYear   = toYear;
     this.Size     = size;
 }
Ejemplo n.º 2
0
 public StartDataRoutes(string origin, int destinations, GeneralHelpers.Size minimumsize, Route.RouteType routetype)
 {
     this.Countries    = new List <Country>();
     this.Origin       = origin;
     this.Destinations = destinations;
     this.MinimumSize  = minimumsize;
     this.RouteType    = routetype;
 }
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            string searchText = txtTextSearch.Text.ToUpper();


            Country country = (Country)cbCountry.SelectedItem;
            Region  region  = (Region)cbRegion.SelectedItem;

            Boolean humansOnly = cbHumanAirports.IsChecked.Value;
            Boolean hubsOnly   = cbHubs.IsChecked.Value;

            List <Airport> airports = Airports.GetAllActiveAirports();

            if (humansOnly)
            {
                airports = airports.FindAll(delegate(Airport airport) { return(GameObject.GetInstance().HumanAirline.Airports.Contains(airport)); });
            }

            if (hubsOnly)
            {
                airports = airports.FindAll(delegate(Airport airport) { return(airport.IsHub); });
            }

            if (country.Uid != "100")
            {
                airports = airports.FindAll(a => ((Country) new CountryCurrentCountryConverter().Convert(a.Profile.Country)) == country || a.Profile.Country == country);                     //airports.FindAll(delegate(Airport airport) { return airport.Profile.Country == country; });
            }
            if (country.Uid == "100" && region.Uid != "100")
            {
                airports = airports.FindAll(delegate(Airport airport) { return(airport.Profile.Country.Region == region); });
            }

            CompareType sizeCompare = (CompareType)(((ComboBoxItem)cbCompareSize.SelectedItem).Tag);

            GeneralHelpers.Size size = (GeneralHelpers.Size)cbSize.SelectedItem;

            switch (sizeCompare)
            {
            case CompareType.Equal_to:
                airports = airports.FindAll(a => a.Profile.Size == size);
                break;

            case CompareType.Larger_than:
                airports = airports.FindAll(a => a.Profile.Size > size);
                break;

            case CompareType.Lower_than:
                airports = airports.FindAll(a => a.Profile.Size < size);
                break;
            }


            airports = airports.FindAll(a => a.Profile.Name.ToUpper().Contains(searchText) || a.Profile.ICAOCode.ToUpper().Contains(searchText) || a.Profile.IATACode.ToUpper().Contains(searchText) || a.Profile.Town.Name.ToUpper().Contains(searchText) || ((Country) new CountryCurrentCountryConverter().Convert(a.Profile.Country)).Name.ToUpper().Contains(searchText));
            // airports = airports.FindAll((delegate(Airport airport) { return airport.Profile.Name.ToUpper().Contains(searchText) || airport.Profile.ICAOCode.ToUpper().Contains(searchText) || airport.Profile.IATACode.ToUpper().Contains(searchText) || airport.Profile.Town.ToUpper().Contains(searchText) || airport.Profile.Country.Name.ToUpper().Contains(searchText); }));

            this.ParentPage.showAirports(airports);
        }
Ejemplo n.º 4
0
 public CooperationType(string section, string uid, GeneralHelpers.Size airportsizerequired, int fromyear, double price, double monthlyprice, int servicelevel, double incomeperpax)
 {
     CooperationType.Section  = section;
     this.AirportSizeRequired = airportsizerequired;
     this.Price        = price;
     this.MonthlyPrice = monthlyprice;
     this.Uid          = uid;
     this.FromYear     = fromyear;
     this.ServiceLevel = servicelevel;
     this.IncomePerPax = incomeperpax;
 }
Ejemplo n.º 5
0
        //returns the brush for a specific airport size
        private Brush getSizeColor(GeneralHelpers.Size size)
        {
            Color color = Colors.DarkRed;

            switch (size)
            {
            case GeneralHelpers.Size.Large:
                color = Colors.DarkBlue;
                break;

            case GeneralHelpers.Size.Largest:
                color = Colors.DarkRed;
                break;

            case GeneralHelpers.Size.Medium:
                color = Colors.Black;
                break;

            case GeneralHelpers.Size.Small:
                color = Colors.White;
                break;

            case GeneralHelpers.Size.Smallest:
                color = Colors.Gray;
                break;

            case GeneralHelpers.Size.Very_large:
                color = Colors.Yellow;
                break;

            case GeneralHelpers.Size.Very_small:
                color = Colors.Violet;
                break;
            }

            TypeConverter colorConverter = new ColorConverter();

            Color c2 = Color.FromArgb(25, color.R, color.G, color.B);

            LinearGradientBrush colorBrush = new LinearGradientBrush();

            colorBrush.StartPoint = new Point(0, 0);
            colorBrush.EndPoint   = new Point(0, 1);
            colorBrush.GradientStops.Add(new GradientStop(c2, 0.15));
            colorBrush.GradientStops.Add(new GradientStop(color, 0.85));
            colorBrush.GradientStops.Add(new GradientStop(c2, 1));

            return(colorBrush);
        }
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            GeneralHelpers.Size          size        = (GeneralHelpers.Size)ccAirportSize.SelectedValue;
            ComparerControl.CompareTypes compareType = ccAirportSize.SelectedCompareType;

            string  text    = txtText.Text.Trim();
            Country country = (Country)cbCountry.SelectedItem;
            Region  region  = (Region)cbRegion.SelectedItem;

            var airports = Airports.GetAllAirports().Where(a => a.Profile.IATACode.StartsWith(text) && ((country.Uid == "100" && (region.Uid == "100" || a.Profile.Country.Region == region)) || new CountryCurrentCountryConverter().Convert(a.Profile.Country) as Country == country));

            if (compareType == ComparerControl.CompareTypes.Equal_to)
            {
                airports = airports.Where(a => a.Profile.Size == size);
            }

            if (compareType == ComparerControl.CompareTypes.Large_than)
            {
                airports = airports.Where(a => a.Profile.Size > size);
            }

            if (compareType == ComparerControl.CompareTypes.Lower_than)
            {
                airports = airports.Where(a => a.Profile.Size < size);
            }

            Frame frmContent = UIHelpers.FindChild <Frame>(this.Tag as Page, "frmContent");

            if (frmContent != null)
            {
                frmContent.Navigate(new PageShowAirports(airports.ToList())
                {
                    Tag = this.Tag
                });
            }
        }
Ejemplo n.º 7
0
 //returns all airports with a specific size
 public static List <Airport> GetAirports(GeneralHelpers.Size size)
 {
     return(GetAirports(delegate(Airport airport) { return airport.Profile.Size == size; }));
 }
Ejemplo n.º 8
0
        public AirportProfile(string name, string code, string icaocode, AirportType type, Period <DateTime> period, Town town, TimeSpan offsetGMT, TimeSpan offsetDST, Coordinates coordinates, GeneralHelpers.Size cargo, double cargovolume, Weather.Season season)
        {
            this.PaxValues = new List <PaxValue>();

            this.Name               = name;
            this.Period             = period;
            this.IATACode           = code;
            this.ICAOCode           = icaocode;
            this.Type               = type;
            this.Town               = town;
            this.Coordinates        = coordinates;
            this.CargoVolume        = cargovolume;
            this.MajorDestionations = new Dictionary <string, int>();
            this.Cargo              = cargo;
            this.Logo               = "";
            this.OffsetDST          = offsetDST;
            this.OffsetGMT          = offsetGMT;
            this.Season             = season;
            this.ID = string.Format("{0:00}-{1:00}-{2:00}-{3:00}-{4:00}-{5:00}", char.ConvertToUtf32(this.IATACode, 0), char.ConvertToUtf32(this.IATACode, 1), char.ConvertToUtf32(this.IATACode, 2), name.Length, char.ConvertToUtf32(this.Name, this.Name.Length / 2), (int)this.Cargo);
        }