Esempio n. 1
0
 public void run()
 {
     Main.getInstance().Terrain.Reload("heightmap9", 37.0f, 6.35f);
     //Main.getInstance().AddTerrain(terrain);
     Airport airport1 = new Airport(Main.getInstance(), 37, 6, 1.5, 90);
     Airport airport2 = new Airport(Main.getInstance(), 37, 6.7, 2.5, 60);
     Exit exit1 = new Exit(Main.getInstance(), 40, 7, 230, 0.1);
     Exit exit2 = new Exit(Main.getInstance(), 40, 26.0, 270, 0.1);
     Exit exit3 = new Exit(Main.getInstance(), 10.0, 30, 0, 0.1);
     Exit exit4 = new Exit(Main.getInstance(), 0, 23.0, 90, 0.1);
     Exit exit5 = new Exit(Main.getInstance(), 6.0, 0, 120, 0.1);
     Plane plane1 = new Airbus(Main.getInstance(), 5.0, 13.0, 3000, 220, 60, exit1.GenerateAirbusCallSign(), 1000.0);
     Plane plane2 = new Cesna(Main.getInstance(), 7.0, 2.0, 2000, 180, 90, exit1.GenerateCesnaCallSign(), 1000.0);
     Plane plane3 = new Airbus(Main.getInstance(), 25.0, 16.0, 4000, 250, 0, exit1.GenerateAirbusCallSign(), 1000.0);
     Plane plane4 = new Boeing(Main.getInstance(), 10.0, 23.0, 5000, 280, 300, exit1.GenerateBoeingCallSign(), 1000.0);
     Main.getInstance().AddAirport(airport1);
     Main.getInstance().AddAirport(airport2);
     Main.getInstance().AddExit(exit1);
     Main.getInstance().AddExit(exit2);
     Main.getInstance().AddExit(exit3);
     Main.getInstance().AddExit(exit4);
     Main.getInstance().AddExit(exit5);
     Main.getInstance().AddPlane(plane1);
     Main.getInstance().AddPlane(plane2);
     Main.getInstance().AddPlane(plane3);
     Main.getInstance().AddPlane(plane4);
 }
        public static void initSimulation(Airport.Airport airport, Boolean enableMultiThreading)
        {
            Simulation.airport = airport;
            Simulation.multiThreadingEnabled = enableMultiThreading;

            Console.ForegroundColor = ConsoleColor.White;
        }
 public ScheduleForm(Airport.Airport airport)
 {
     this.airport = airport;
     InitializeComponent();
     this.FormClosing += new FormClosingEventHandler(ScheduleForm_FormClosing);
     listView1.ItemSelectionChanged += new ListViewItemSelectionChangedEventHandler(selectionChange);
     loadPLanes();
 }
 static AirportList()
 {
     IEnumerable<string> entries = Properties.Resources.AirportGeocodes.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
     foreach (var entry in entries)
     {
         var parts = entry.Split(',').Select(part => part.Trim('"')).ToList();
         var airport = new Airport(parts[0], parts[1], new State(parts[2]), new Geocode(double.Parse(parts[3]), double.Parse(parts[4])));
         Airports.Add(airport);
     }
 }
        public MainForm(Airport.Airport airport)
        {
            this.airport = airport;

            InitializeComponent();

            mapControl.init(airport);
            airplaneStatsControl.init(airport);

            nuScale.Value = (Decimal) TimeKeeper.targetScale;
        }
Esempio n. 6
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            airport = new Airport("airports/fape");//TODO: this should be dynamic from whatever is in /airports

            Display.Initialise(spriteBatch, GraphicsDevice, Content.Load<SpriteFont>("sego"), airport.width, airport.height); //Display helps us with drawing. It's static

            aircraft.Add(new Aircraft(Content.Load<Texture2D>("aircraft/737"), airport, airport.taxiways.Vertices[0], 0));
            List<TaxiNode> path = airport.taxiways.Dijkstra(airport.taxiways.Vertices[0], airport.taxiways.Vertices[31],null).ToList();

            aircraft[0].Queue(path);
        }
Esempio n. 7
0
 public void run()
 {
     Main.getInstance().Terrain.Reload("heightmap1", 6.6f, 5.2f);
     //Main.getInstance().AddTerrain(terrain);
     Airport airport = new Airport(Main.getInstance(), 6.6, 5.2, 2.5, 300);
     Main.getInstance().AddAirport(airport);
     Exit exit1 = new Exit(Main.getInstance(), 10, 30, 22.0, 0.5);
     Exit exit2 = new Exit(Main.getInstance(), 40, 10, 250.0, 0.1);
     Main.getInstance().AddExit(exit1);
     Main.getInstance().AddExit(exit2);
     Plane plane1 = new Boeing(Main.getInstance(), 13.0, 25.0, 4000, 280, 30, exit1.GenerateBoeingCallSign(), 1000.0);
     Plane plane2 = new Airbus(Main.getInstance(), 15.0, 10.0, 2500, 180, 300, exit1.GenerateAirbusCallSign(), 630.0);
     Main.getInstance().AddPlane(plane1);
     Main.getInstance().AddPlane(plane2);
 }
Esempio n. 8
0
		public LocationFinderItem (Airport airport)
		{

			if (airport.IsTrainStation)
				this.Type = LocationFinderItemType.Train;
			else
				this.Type = LocationFinderItemType.Airport;
			this.DataItem = airport;

			this.Text = airport.AirportName;
			this.Detail = airport.AirportCode;

			//this.Lat = airport.Lat;
			//this.Lng = airport.Lng;
			this.FormattedAddress = null;

		}
        public SearchAirLeg CreateAirLeg(string originAirportCode, string destAirportCode)
        {
            typeSearchLocation originLoc = new typeSearchLocation();
            typeSearchLocation destLoc = new typeSearchLocation();

            // airport objects are just wrappers for their codes
            Airport origin = new Airport(), dest = new Airport();
            origin.Code = originAirportCode;
            dest.Code = destAirportCode;

            // search locations can be things other than airports but we are using
            // the airport version...
            originLoc.Item = origin;
            destLoc.Item = dest;

            return CreateLeg(originLoc, destLoc);
        }
 //[TestMethod]
 public void GetAirportsAndAddToAssetTest()
 {
     var target = new LuceneAirportProvider();
     List<SearchItem> actual = target.GetAirports();
     Assert.IsNotNull(actual);
     var serializer = new JavaScriptSerializer();
     var airports = new List<Airport>();
     foreach (SearchItem searchItem in actual)
     {
         var airport = new Airport();
         airport.id = searchItem.Code;
         airport.label = searchItem.CityName + ", " + searchItem.CountryCode + " - " + searchItem.Name + " (" +
                         searchItem.Code + ")";
         airport.value = searchItem.CityName + " - " + searchItem.Code;
         airports.Add(airport);
     }
     string jsonAirports = serializer.Serialize(airports);
     File.WriteAllText(@"D:\AllAirports.html", jsonAirports);
 }
Esempio n. 11
0
 public void run()
 {
     Main.getInstance().Terrain.Reload("heightmap5", 3.0f, 3.0f);
     //Main.getInstance().AddTerrain(terrain);
     Airport airport = new Airport(Main.getInstance(), 3.0, 3, 2.5, 315);
     Exit exit1 = new Exit(Main.getInstance(), 22.0, 0, 180, 0.2);
     Exit exit2 = new Exit(Main.getInstance(), 40, 17.0, 270, 0.2);
     Exit exit3 = new Exit(Main.getInstance(), 10.0, 30, 0, 0.1);
     Exit exit4 = new Exit(Main.getInstance(), 0, 8, 90, 0.1);
     Plane plane1 = new Boeing(Main.getInstance(), 22.0, 6.0, 5000, 280, 180, exit1.GenerateBoeingCallSign(), 1000.0);
     Plane plane2 = new Airbus(Main.getInstance(), 20.0, 17.0, 3000, 260, 290, exit1.GenerateAirbusCallSign(), 1000.0);
     Plane plane3 = new Cesna(Main.getInstance(), 25.0, 20.0, 4000, 250, 290, exit1.GenerateCesnaCallSign(), 1000.0);
     Main.getInstance().AddAirport(airport);
     Main.getInstance().AddExit(exit1);
     Main.getInstance().AddExit(exit2);
     Main.getInstance().AddExit(exit3);
     Main.getInstance().AddExit(exit4);
     Main.getInstance().AddPlane(plane1);
     Main.getInstance().AddPlane(plane2);
     Main.getInstance().AddPlane(plane3);
 }
Esempio n. 12
0
 public void Create(Airport model)
 {
     model.Id = Id;
     _airports.Add(model);
     Id++;
 }
Esempio n. 13
0
        public void TestWeatherService_GetSaveWeather(object sender, WeatherService.GetWeatherCompletedEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Result))
            {
                MessageBox.Show("Αποτυχία ενημέρωσης δεδομώνων. Ξαναπροσπαθήστε"); DownloadResult = SyncState.SyncResult.Failed; return;
            }

            Airport airport = new Airport("NaN", "NaN", "NaN", "NaN", "NaN", "NaN", "NaN", "NaN", "NaN");

            airport.Code         = this.AirportCode;
            airport.AirportImage = this.AirportCode;

            try
            {
                if (!string.IsNullOrEmpty(e.Result))
                {
                    XDocument xdoc = XDocument.Parse(e.Result);

                    var query = xdoc.Descendants("CurrentWeather").Select(r => r.Elements()
                                                                          .Select(b => new { Name = b.Name.LocalName, Value = b.Value }));

                    foreach (var result in query)
                    {
                        foreach (var item in result)
                        {
                            if (item.Name == "SkyConditions")
                            {
                                airport.WeatherCondition = (item.Value == null) ? airport.WeatherCondition = "NaN" : item.Value;
                            }

                            else if (item.Name == "Temperature")
                            {
                                airport.Temperature = (item.Value == null) ? airport.Temperature = "NaN" : item.Value;
                            }

                            else if (item.Name == "RelativeHumidity")
                            {
                                airport.Humidity = (item.Value == null) ? airport.Humidity = "NaN" : item.Value;
                            }

                            else if (item.Name == "Visibility")
                            {
                                airport.Visibility = (item.Value == null) ? airport.Visibility = "NaN" : item.Value;
                            }

                            else if (item.Name == "Wind")
                            {
                                airport.Wind = (item.Value == null) ? airport.Wind = "NaN" : item.Value;
                            }

                            else if (item.Name == "Pressure")
                            {
                                airport.Pressure = (item.Value == null) ? airport.Pressure = "NaN" : item.Value;
                            }

                            else if (item.Name == "Time")
                            {
                                airport.DateTime = (item.Value == null) ? airport.DateTime = "NaN" : item.Value;
                            }
                        }
                    }
                }

                DbEngine DBWorker = new DbEngine();
                DBWorker.UpdateTable("Airport", airport);
                DownloadResult = SyncState.SyncResult.Succeed;
            }
            catch { MessageBox.Show("Αποτυχία ενημέρωσης δεδομώνων. Προέκυψε άγνωστο σφάλμα απο τον Server Ξαναπροσπαθήστε Αργότερα"); DownloadResult = SyncState.SyncResult.Failed; return; }
        }
 public static Airport CreateAirport(int ID, string countryId)
 {
     Airport airport = new Airport();
     airport.Id = ID;
     airport.CountryId = countryId;
     return airport;
 }
Esempio n. 15
0
        /***********************************************
         * Zkontroluje vhodnost letiště pro letadlo.
         * Pokud je letadlo nevhodné, zruší approach.
         * *********************************************/
        private bool CheckLandingAvailability(Airport landingAirport)
        {
            int targetAirport = (int)(landingAirport.Dir / 10);
            string targetAirportSide = landingAirport.Side;
            if (!landReported)
            {
                Main.getInstance().sound.playSequence(CallSign);
                Main.getInstance().sound.play("request");
                Main.getInstance().sound.playSequence("" + targetAirport);
                if (targetAirportSide != "")
                {
                    Main.getInstance().sound.play(targetAirportSide);
                }
                Main.getInstance().sound.playTowerSequence(this.CallSign);
            }
            if (!landingAirport.Working && landingAirport.GetDistanceOnAxis((float)this.X, (float)this.Y) > 4.5)
            {
                //Main.getInstance().sound.playTowerSequence(CallSign);
                Main.getInstance().sound.play("t_cancel");
                ReactionOffset = Main.getInstance().sound.GetFilledTime();
                //Main.getInstance().sound.playSequence(CallSign);
                //Main.getInstance().sound.play("around");
                cancelApproach();
                return false;
            }
            if ((this is Boeing && landingAirport.Length < 2.5) || (this is Airbus && landingAirport.Length < 2.0))
            {
                //Main.getInstance().sound.playTowerSequence(CallSign);
                Main.getInstance().sound.play("t_cancel");
                Main.getInstance().sound.play("t_toobig");
                Main.getInstance().sound.playTowerSequence("" + targetAirport);
                if (targetAirportSide != "")
                {
                    Main.getInstance().sound.play("t_" + targetAirportSide);
                }
                ReactionOffset = Main.getInstance().sound.GetFilledTime();
                //Main.getInstance().sound.playSequence(CallSign);
                //Main.getInstance().sound.play("around");
                cancelApproach();
                return false;
            }

            if (!landReported)
            {
                Main.getInstance().sound.play("t_cleared");
                landReported = true;
            }
            return true;
        }
    protected bool GetFlights(string pnr)
    {
        string errMsg = string.Empty;
        DpwPNR dpwPNR = new DpwPNR();
        bool isMatchAirline = false;
        bool isMatchDeparture = false;
        bool isMatchBeginDate = false;
        bool isMatchEndDate = false;
        string originalAirline = ((TourOrderItem)Transaction.CurrentTransactionObject.Items[0]).AirLine;
        string originalDeparture = ((TourOrderItem)Transaction.CurrentTransactionObject.Items[0]).DepartureCity;
        //string originalDestination= ((TourOrderItem)Transaction.CurrentTransactionObject.Items[0]).;
        DateTime originalBeginDate = ((TourOrderItem)Transaction.CurrentTransactionObject.Items[0]).BeginDate;
        DateTime originalEndDate = ((TourOrderItem)Transaction.CurrentTransactionObject.Items[0]).EndDate;
        if (pnr.Equals(string.Empty))
        {
            errMsg = "Please Input PNR";

        }
        else if (pnr.Length != 6)
        {
            errMsg = "Please Input Correct PNR";

        }
        else
        {
            dpwPNR = m_airService.GetPnrData(pnr, out errMsg);

        }
        if (errMsg.Equals(string.Empty))
        {
            DpwFlightList flights = dpwPNR.Flights;

            AirMaterial airMaterial = new AirMaterial(new TERMS.Core.Profiles.Profile("air"));
            //int[] divideNumber =

            Hashtable timeSpan = new Hashtable();
            List<AirLeg> airLegList = m_AirLegList;
            bool isOneWay = false;

            if (flights.Count > 0)
            {
                if (!flights[0].DepartureAirport.Equals(flights[flights.Count - 1].ArrivalAirport))
                    isOneWay = true;
            }

            for (int i = 0; i < flights.Count; i++)
            {
                if (flights[i].Airline.Contains(originalAirline))
                    isMatchAirline = true;
                AirLeg air = new AirLeg();
                air.AirLine = new Airline(flights[i].Airline);
                air.ArriveTime = flights[i].ArrivalDateTime;
                air.BookingClass = flights[i].BookingClass;
                Airport deptAirport = new Airport();
                City deptCity = new City();

                Terms.Common.Domain.Airport airport = m_airService.CommAirportDao.FindByAirport(flights[i].DepartureAirport);
                deptCity.Code = airport.City.Code;
                deptCity.Name = airport.City.Name;
                deptAirport.City = deptCity;
                deptAirport.Name = airport.Name;
                deptAirport.Code = airport.Code;
                air.DepartureAirport = deptAirport;
                air.DepartureTime = flights[i].DepartureDateTime;

                if (i == 0)
                {
                    if (deptCity.Code.Contains(originalDeparture))
                        isMatchDeparture = true;
                    if (air.DepartureTime.ToString("MM/dd/yyyy").Equals(originalBeginDate.ToString("MM/dd/yyyy")))
                        isMatchBeginDate = true;
                }

                Airport destAirport = new Airport();
                City destCity = new City();

                Terms.Common.Domain.Airport airtport2 = m_airService.CommAirportDao.FindByAirport(flights[i].ArrivalAirport);
                destCity.Code = airtport2.City.Code;
                destCity.Name = airtport2.City.Name;
                destAirport.City = destCity;
                destAirport.Name = airtport2.Name;
                destAirport.Code = airtport2.Code;
                air.DestinationAirport = destAirport;
                air.FlightNumber = flights[i].FlightNumber;

                if (i > 0)
                {
                    timeSpan.Add(i.ToString() + "-" + (i + 1).ToString(), flights[i].DepartureDateTime.Subtract(flights[i - 1].ArrivalDateTime));

                }

                airLegList.Add(air);
                //SubAirTrip subAirTrip = new SubAirTrip();
                //subAirTrip.
            }

            if (isOneWay)
            {
                SubAirTrip deptSubAirTrip = new SubAirTrip();
                for (int j = 0; j < airLegList.Count; j++)
                {
                    deptSubAirTrip.AddLeg(airLegList[j]);
                }
                airMaterial.AddSubTrip(deptSubAirTrip);
            }
            else
            {
                TimeSpan bigSpan = new TimeSpan();
                string bigSpanKey = string.Empty;
                foreach (string key in timeSpan.Keys)
                {
                    if (bigSpan.CompareTo(timeSpan[key]) < 0)
                    {
                        bigSpan = (TimeSpan)timeSpan[key];
                        bigSpanKey = key;
                    }
                }

                string[] flightNumber = bigSpanKey.Split('-');

                if (flightNumber.Length == 2)
                {
                    SubAirTrip deptSubAirTrip = new SubAirTrip();
                    SubAirTrip retnSubAirTrip = new SubAirTrip();

                    for (int j = 0; j < airLegList.Count; j++)
                    {
                        if (j <= (Convert.ToInt32(flightNumber[0]) - 1))
                            deptSubAirTrip.AddLeg(airLegList[j]);
                        else
                            retnSubAirTrip.AddLeg(airLegList[j]);

                    }

                    airMaterial.AddSubTrip(deptSubAirTrip);
                    airMaterial.AddSubTrip(retnSubAirTrip);
                    if (retnSubAirTrip.Flights[0].DepartureTime.ToString("MM/dd/yyyy").Equals(originalEndDate.ToString("MM/dd/yyyy")))
                        isMatchEndDate = true;
                }
            }

            m_NewAirOrderItem = new AirOrderItem(airMaterial);

            //Fare
            int fareLength = dpwPNR.FareInfo.Fares.Count;
            for (int fareCount = 0; fareCount < fareLength; fareCount++)
            {
                DpwFare fare = dpwPNR.FareInfo.Fares[fareCount];

                switch (fare.PTC)
                {
                    case GTTWSpanClient.PassengerType.Adult:
                        m_NewAirOrderItem.Merchandise.SetAdultBaseFare(fare.BaseFare);
                        m_NewAirOrderItem.Merchandise.SetAdultTax(fare.Tax);
                        break;
                    case GTTWSpanClient.PassengerType.Child:
                        m_NewAirOrderItem.Merchandise.SetChildBaseFare(fare.BaseFare);
                        m_NewAirOrderItem.Merchandise.SetChildTax(fare.Tax);
                        break;
                    case GTTWSpanClient.PassengerType.Infant:
                        break;
                    default:
                        break;
                }
            }
            m_NewAirOrderItem.WSpanRecordLocator = dpwPNR.RecordLoactor;

            Transaction.CurrentTransactionObject.Items.Add(m_NewAirOrderItem);

            int adultNumber = GetPassengers(dpwPNR.Passengers)[0];
            int childNumber = GetPassengers(dpwPNR.Passengers)[1];

            //TourPriceInfoControl1.Tax = m_NewAirOrderItem.Merchandise.AdultTax * adultNumber + m_NewAirOrderItem.Merchandise.ChildTax * childNumber;
            //TourPriceInfoControl1.ShowTotalPrice = GetNetPrice();// +TourPriceInfoControl1.Tax;
            if (Transaction.CurrentTransactionObject.Items[0].AdultNumber != adultNumber || Transaction.CurrentTransactionObject.Items[0].ChildNumber != childNumber)
            {
                lblError.Text = "PNR��s passenger number is not equal order��s traveler number.";
                return false;
            }
            else
            {
                if (!isMatchAirline)
                {
                    lblError.Text = "Warning: Not default airlines price may be different.";

                    lblError.Style.Add("color", "blue");
                }
                else if (!isMatchDeparture)
                {
                    lblError.Text = "Warning: Not default departure city/destination. Be careful.";
                    lblError.Style.Add("color", "blue");
                }
                else if (!isMatchBeginDate || !isMatchEndDate)
                {
                    lblError.Text = "Warning: Not default departure/return date. Be careful.";
                    lblError.Style.Add("color", "blue");
                }
                else
                {
                    lblError.Style.Add("color", "red");
                }
                return true;
            }

        }
        else
        {
            lblError.Text = errMsg;
            return false;
        }
    }
Esempio n. 17
0
        public void SortByMaxLoadCapacityTest()
        {
            List <Plane> planesSortedByMaxLoadCapacity = new Airport(Planes).SortByMaxLoadCapacity().GetPlanes().ToList();

            Assert.That(planesSortedByMaxLoadCapacity, Is.Ordered.By("MaxLoadCapacity"));
        }
Esempio n. 18
0
 private static bool CoordinatesAreValid(this Airport entity)
 {
     return(entity.Latitude != 0 && entity.Longitude != 0);
 }
Esempio n. 19
0
 public AirportProxy(int n, ITimeProvider timeProvider)
 {
     this._timeProvider = timeProvider;
     this._airport = new Airport(n);
 }
Esempio n. 20
0
 public AirlineDestinationMVVM(Airport airport, Boolean isHub)
 {
     this.IsHub = isHub;
     this.Airport = airport;
 }
Esempio n. 21
0
 public CooperationMVVM(Airport airport, Cooperation cooperation)
 {
     this.Airport = airport;
     this.Cooperation = cooperation;
 }
    void Start()
    {
        passenger = GameObject.Find(PassengerGoName).GetComponent<Passenger>();
        airport = GameObject.Find(AirportGoName).GetComponent<Airport>();
        passengerParent = GameObject.Find(passengerParentGoName).transform;

        passenger.gameObject.SetActive(false);
    }
 void Start()
 {
     airport = GameObject.Find("Airport").GetComponent<Airport>();
 }
 public void ReturnsValueOfCapacity()
 {
     _airport = new Airport(20);
     Assert.AreEqual(20, _airport.Capacity);
 }
Esempio n. 25
0
        public void GetTransportMilitaryPlanesTest()
        {
            List <MilitaryPlane> transportMilitaryPlanes = new Airport(Planes).GetTransportMilitaryPlanes().ToList();

            Assert.IsTrue(transportMilitaryPlanes.Exists(x => x.MilitaryPlaneType == MilitaryType.TRANSPORT));
        }
Esempio n. 26
0
 public static bool IsValid(this Airport entity)
 {
     return(entity.NameIsNotNull() &&
            entity.CoordinatesAreValid());
 }
Esempio n. 27
0
        private void btnLease_Click(object sender, RoutedEventArgs e)
        {
            Boolean contractedOrder = false;
            Boolean tryOrder        = true;

            if (GameObject.GetInstance().HumanAirline.Contract != null)
            {
                if (GameObject.GetInstance().HumanAirline.Contract.Manufacturer == this.Airliner.Type.Manufacturer)
                {
                    contractedOrder = true;
                }
                else
                {
                    double terminationFee      = GameObject.GetInstance().HumanAirline.Contract.getTerminationFee();
                    WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2010"), string.Format(Translator.GetInstance().GetString("MessageBox", "2010", "message"), GameObject.GetInstance().HumanAirline.Contract.Manufacturer.Name, terminationFee), WPFMessageBoxButtons.YesNo);

                    if (result == WPFMessageBoxResult.Yes)
                    {
                        AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Purchases, -terminationFee);

                        GameObject.GetInstance().HumanAirline.Contract = null;
                    }
                    tryOrder = result == WPFMessageBoxResult.Yes;
                }
            }

            Airport airport = (Airport)cbAirport.SelectedItem;

            if (this.Airliner.getLeasingPrice() * 2 > GameObject.GetInstance().HumanAirline.Money)
            {
                WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2004"), Translator.GetInstance().GetString("MessageBox", "2004", "message"), WPFMessageBoxButtons.Ok);
            }
            else if (airport == null)
            {
                WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2002"), Translator.GetInstance().GetString("MessageBox", "2002", "message"), WPFMessageBoxButtons.Ok);
            }

            else
            {
                if (tryOrder)
                {
                    WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2005"), string.Format(Translator.GetInstance().GetString("MessageBox", "2005", "message"), this.Airliner.Type.Name), WPFMessageBoxButtons.YesNo);

                    if (result == WPFMessageBoxResult.Yes)
                    {
                        if (Countries.GetCountryFromTailNumber(this.Airliner.TailNumber).Name != GameObject.GetInstance().HumanAirline.Profile.Country.Name)
                        {
                            this.Airliner.TailNumber = GameObject.GetInstance().HumanAirline.Profile.Country.TailNumbers.getNextTailNumber();
                        }

                        GameObject.GetInstance().HumanAirline.addAirliner(FleetAirliner.PurchasedType.Leased, this.Airliner, airport);

                        AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Rents, -this.Airliner.LeasingPrice * 2);

                        if (contractedOrder)
                        {
                            GameObject.GetInstance().HumanAirline.Contract.PurchasedAirliners++;
                        }

                        base.ParentPage.removeUsedAirliner(this.Airliner);

                        this.clearPanel();
                    }
                }
            }
        }
Esempio n. 28
0
 private static bool NameIsNotNull(this Airport entity)
 {
     return(!String.IsNullOrEmpty(entity.Name));
 }
 public void Setup(Airport new_airport, GameObject factoryGo)
 {
     airport = new_airport;
     personFactory = factoryGo.GetComponent<PersonFactory>();
 }
Esempio n. 30
0
 //adds a destinaton to the scenario
 public void addDestination(Airport destination)
 {
     this.Destinations.Add(destination);
 }
 public void AddToAirports(Airport airport)
 {
     base.AddObject("Airports", airport);
 }
Esempio n. 32
0
 public void SetFlight(Airport start, Airport destination)
 {
     transform.position = start.transform.position;
     this.destination   = destination.transform.position;
     StartAirport       = start;
 }
        private ListBox lbRunway;//, lbRunwayBuilding;
        public PageAirportRunways(Airport airport)
        {
            InitializeComponent();

            this.Language = XmlLanguage.GetLanguage(new CultureInfo(AppSettings.GetInstance().getLanguage().CultureInfo, true).IetfLanguageTag);

            this.Airport = airport;

            StackPanel panelRunways = new StackPanel();

            panelRunways.Margin = new Thickness(0, 10, 50, 0);

            TextBlock txtRunwaysInfoHeader = new TextBlock();

            txtRunwaysInfoHeader.Uid = "1001";
            txtRunwaysInfoHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtRunwaysInfoHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
            txtRunwaysInfoHeader.FontWeight = FontWeights.Bold;
            txtRunwaysInfoHeader.Text       = Translator.GetInstance().GetString("PageAirportRunways", txtRunwaysInfoHeader.Uid);
            txtRunwaysInfoHeader.Margin     = new Thickness(0, 10, 0, 0);

            panelRunways.Children.Add(txtRunwaysInfoHeader);

            lbRunway = new ListBox();
            lbRunway.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbRunway.ItemTemplate = this.Resources["RunwayItem"] as DataTemplate;

            panelRunways.Children.Add(lbRunway);

            /*
             * TextBlock txtRunwaysBuildHeader = new TextBlock();
             * txtRunwaysBuildHeader.Uid = "1002";
             * txtRunwaysBuildHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
             * txtRunwaysBuildHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2");
             * txtRunwaysBuildHeader.FontWeight = FontWeights.Bold;
             * txtRunwaysBuildHeader.Text = Translator.GetInstance().GetString("PageAirportRunways", txtRunwaysBuildHeader.Uid);
             * txtRunwaysBuildHeader.Margin = new Thickness(0, 5, 0, 0);
             *
             * panelRunways.Children.Add(txtRunwaysBuildHeader);
             *
             * lbRunwayBuilding = new ListBox();
             * lbRunwayBuilding.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
             * lbRunwayBuilding.ItemTemplate = this.Resources["RunwayBuildItem"] as DataTemplate;
             *
             * panelRunways.Children.Add(lbRunwayBuilding);
             *
             * WrapPanel panelButtons = new WrapPanel();
             * panelButtons.Margin = new Thickness(0, 5, 0, 0);
             *
             * Button btnBuildRunway = new Button();
             * btnBuildRunway.SetResourceReference(Button.StyleProperty, "RoundedButton");
             * btnBuildRunway.Uid = "201";
             * btnBuildRunway.Height = Double.NaN;
             * btnBuildRunway.Width = Double.NaN;
             * btnBuildRunway.Content = Translator.GetInstance().GetString("PageAirportRunways", btnBuildRunway.Uid);
             * btnBuildRunway.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");
             * btnBuildRunway.Click += new RoutedEventHandler(btnBuildRunway_Click);
             * btnBuildRunway.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
             * btnBuildRunway.Visibility = System.Windows.Visibility.Collapsed;
             * panelButtons.Children.Add(btnBuildRunway);
             *
             * panelRunways.Children.Add(panelButtons);
             */
            this.Content = panelRunways;

            showRunways();
        }
        public Airport ShowAirport(string airportId)
        {
            Airport airportInDB = dbContext.Airports.FirstOrDefault(a => a.AirportId == airportId);

            return(airportInDB);
        }
Esempio n. 35
0
        static void Main()
        {
            Jornal  jornal  = new Jornal();
            Airport airport = new Airport();

            airport.OnBuy          += () => Console.WriteLine("Покупка зарегистрирована.");
            airport.OnPChanging    += jornal.ChPassanger;
            airport.OnTChanging    += jornal.ChTicket;
            airport.OnTaxeChanging += jornal.ChTaxe;

            bool work = true;

            while (work)
            {
                string exitChoose;
                Console.Write("\nВас приветствуют Российские Императорские авиалинии!\n\nВыберите действие:" +
                              "\n1. Купить билет\n2. Список тарифов\n3. Финансы\n4. " +
                              "Изменение базы\n5. Просмотр журнала\n6. Выход\n");
                int choose;
                do
                {
                    Console.Write("Ваш выбор: ");
                }while (!int.TryParse(Console.ReadLine(), out choose));

                switch (choose)
                {
                case 1:
                    Passenger passenger = airport.AirRegistration();
                    if (passenger != null)
                    {
                        airport.BuyTicket(passenger);
                    }

                    Console.Write("\n\nПродолжить работу (Y/N): ");
                    exitChoose = Console.ReadLine();
                    if (exitChoose == "N")
                    {
                        work = false;
                    }
                    break;

                case 2:
                    airport.ReturnTaxe();
                    Console.Write("\n\nПродолжить работу (Y/N): ");
                    exitChoose = Console.ReadLine();
                    if (exitChoose == "N")
                    {
                        work = false;
                    }
                    break;

                case 3:
                    airport.Financial();
                    Console.Write("\n\nПродолжить работу (Y/N): ");
                    exitChoose = Console.ReadLine();
                    if (exitChoose == "N")
                    {
                        work = false;
                    }
                    break;

                case 4:
                    airport.ChangeBase();
                    Console.Write("\n\nПродолжить работу (Y/N): ");
                    exitChoose = Console.ReadLine();
                    if (exitChoose == "N")
                    {
                        work = false;
                    }
                    break;

                case 5:
                    jornal.ViewLog();
                    Console.Write("\n\nПродолжить работу (Y/N): ");
                    exitChoose = Console.ReadLine();
                    if (exitChoose == "N")
                    {
                        work = false;
                    }
                    break;

                case 6:
                    work = false;
                    break;

                default:
                    Console.WriteLine("\nНеверный ввод.");
                    break;
                }
            }
        }
Esempio n. 36
0
 private static IEnumerable <Route> ToRouteList(Airport fromAirport, List <Airport> toAirports)
 {
     return(toAirports.Select(toAirport => new Route(fromAirport, toAirport)));
 }
Esempio n. 37
0
        public void WeatherService_GetSaveWeather(object sender, WeatherService.GetWeatherCompletedEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Result))
            {
                MessageBox.Show("Αποτυχία ενημέρωσης δεδομώνων. Ξαναπροσπαθήστε"); DownloadResult = SyncState.SyncResult.Failed; return;
            }

            try
            {
                if (!string.IsNullOrEmpty(e.Result))
                {
                    XDocument xdoc = XDocument.Parse(e.Result);

                    var Result = from a in xdoc.Descendants("CurrentWeather")
                                 select new
                    {
                        weathercondition = a.Element("SkyConditions"),
                        temperature      = a.Element("Temperature"),
                        humidity         = a.Element("RelativeHumidity"),
                        visibility       = a.Element("Visibility"),
                        wind             = a.Element("Wind"),
                        pressure         = a.Element("Pressure"),
                        datetime         = a.Element("Time"),
                    };

                    Airport airport = new Airport();

                    foreach (var k in Result)
                    {
                        try
                        {
                            airport.Code             = this.AirportCode;
                            airport.WeatherCondition = (k.weathercondition.Value == null) ? k.weathercondition.Value = "NaN" : k.weathercondition.Value;
                            airport.Temperature      = (k.temperature.Value == null) ? k.temperature.Value = "NaN" : k.temperature.Value;
                            airport.Humidity         = (k.humidity.Value == null) ? k.humidity.Value = "NaN" : k.humidity.Value;
                            airport.Visibility       = (k.visibility.Value == null) ? k.visibility.Value = "NaN" : k.visibility.Value;
                            airport.Wind             = (k.wind.Value == null) ? k.wind.Value = "NaN" : k.wind.Value;
                            airport.Pressure         = (k.pressure.Value == null) ? k.pressure.Value = "NaN" : k.pressure.Value;
                            airport.DateTime         = (k.datetime.Value == null) ? k.datetime.Value = "NaN" : k.datetime.Value;
                        }

                        catch { MessageBox.Show("Αποτυχία ενημέρωσης δεδομώνων. Προέκυψε άγνωστο σφάλμα απο τον Server Ξαναπροσπαθήστε Αργότερα"); DownloadResult = SyncState.SyncResult.Failed; return; }
                    }

                    DbEngine DBWorker = new DbEngine();
                    DBWorker.UpdateTable("Airport", airport);
                    DownloadResult = SyncState.SyncResult.Succeed;
                }
            }
            catch
            {
                if (!string.IsNullOrEmpty(e.Result))
                {
                    XDocument xdoc = XDocument.Parse(e.Result);

                    var Result = from a in xdoc.Descendants("CurrentWeather")
                                 select new
                    {
                        temperature = a.Element("Temperature"),
                        humidity    = a.Element("RelativeHumidity"),
                        visibility  = a.Element("Visibility"),
                        wind        = a.Element("Wind"),
                        pressure    = a.Element("Pressure"),
                        datetime    = a.Element("Time"),
                    };

                    Airport airport = new Airport();

                    foreach (var k in Result)
                    {
                        try
                        {
                            airport.Code        = this.AirportCode;
                            airport.Temperature = (k.temperature.Value == null) ? k.temperature.Value = "NaN" : k.temperature.Value;
                            airport.Humidity    = (k.humidity.Value == null) ? k.humidity.Value = "NaN" : k.humidity.Value;
                            airport.Visibility  = (k.visibility.Value == null) ? k.visibility.Value = "NaN" : k.visibility.Value;
                            airport.Wind        = (k.wind.Value == null) ? k.wind.Value = "NaN" : k.wind.Value;
                            airport.Pressure    = (k.pressure.Value == null) ? k.pressure.Value = "NaN" : k.pressure.Value;
                            airport.DateTime    = (k.datetime.Value == null) ? k.datetime.Value = "NaN" : k.datetime.Value;
                        }
                        catch { MessageBox.Show("Αποτυχία ενημέρωσης δεδομώνων. Προέκυψε άγνωστο σφάλμα απο τον Server Ξαναπροσπαθήστε Αργότερα"); return; }
                    }

                    DbEngine DBWorker = new DbEngine();
                    DBWorker.UpdateTable("Airport", airport);
                    DownloadResult = SyncState.SyncResult.Succeed;
                }
            }
        }
Esempio n. 38
0
 public virtual void AddToAirports(Airport airport)
 {
     base.AddObject("Airports", airport);
 }
 public void Init()
 {
     _airport = new Airport();
     _plane   = new Mock <Plane>();
 }
Esempio n. 40
0
        private void btnBuy_Click(object sender, RoutedEventArgs e)
        {
            Boolean contractedOrder = false;
            Boolean tryOrder        = true;

            double totalPrice = this.SelectedAirliners.Sum(a => a.Airliner.getPrice());


            if (GameObject.GetInstance().HumanAirline.Contract != null)
            {
                Boolean sameManufaturer = this.SelectedAirliners.FirstOrDefault(a => a.Airliner.Type.Manufacturer != GameObject.GetInstance().HumanAirline.Contract.Manufacturer) == null;

                if (sameManufaturer)
                {
                    contractedOrder = true;
                }
                else
                {
                    double terminationFee      = GameObject.GetInstance().HumanAirline.Contract.getTerminationFee();
                    WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2010"), string.Format(Translator.GetInstance().GetString("MessageBox", "2010", "message"), GameObject.GetInstance().HumanAirline.Contract.Manufacturer.Name, terminationFee), WPFMessageBoxButtons.YesNo);

                    if (result == WPFMessageBoxResult.Yes)
                    {
                        AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Purchases, -terminationFee);
                        GameObject.GetInstance().HumanAirline.Contract = null;
                    }
                    tryOrder = result == WPFMessageBoxResult.Yes;
                }
            }


            if (totalPrice > GameObject.GetInstance().HumanAirline.Money)
            {
                WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2001"), Translator.GetInstance().GetString("MessageBox", "2001", "message"), WPFMessageBoxButtons.Ok);
            }
            else

            {
                if (tryOrder)
                {
                    ComboBox cbHomebase = new ComboBox();
                    cbHomebase.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
                    cbHomebase.ItemTemplate        = Application.Current.Resources["AirportCountryItem"] as DataTemplate;
                    cbHomebase.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    cbHomebase.Width = 200;

                    long minRunway = this.SelectedAirliners.Max(a => a.Airliner.Type.MinRunwaylength);

                    var homebases = AirlineHelpers.GetHomebases(GameObject.GetInstance().HumanAirline, minRunway);

                    foreach (Airport airport in homebases)
                    {
                        cbHomebase.Items.Add(airport);
                    }

                    cbHomebase.SelectedIndex = 0;

                    if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PageFleetAirlinerInformation", "1014"), cbHomebase) == PopUpSingleElement.ButtonSelected.OK && cbHomebase.SelectedItem != null)
                    {
                        Airport airport = cbHomebase.SelectedItem as Airport;

                        var selectedAirliners = new List <AirlinerMVVM>(this.SelectedAirliners);
                        foreach (AirlinerMVVM airliner in selectedAirliners)
                        {
                            if (contractedOrder)
                            {
                                AirlineHelpers.BuyAirliner(GameObject.GetInstance().HumanAirline, airliner.Airliner, airport, GameObject.GetInstance().HumanAirline.Contract.Discount);
                            }
                            else
                            {
                                AirlineHelpers.BuyAirliner(GameObject.GetInstance().HumanAirline, airliner.Airliner, airport);
                            }

                            if (contractedOrder)
                            {
                                GameObject.GetInstance().HumanAirline.Contract.PurchasedAirliners++;
                            }

                            airliner.IsSelected = false;
                            this.SelectedAirliners.Remove(airliner);
                            this.AllAirliners.Remove(airliner);
                        }
                    }
                    else
                    {
                        WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2002"), Translator.GetInstance().GetString("MessageBox", "2002", "message"), WPFMessageBoxButtons.Ok);
                    }
                }
            }
        }
 // Mediator' den yani kuleden yeni bir rota talep ederken kullanılan metod.
 public void RequestNewWat(string myWay)
 {
     //Çağrı dikkat edileceği üzere Mediator tipine ait nesne referansına doğru yapılmaktadır. Peki bu referansı nerede verdik. Bknz Register metodu. :)
     Airport.SuggestWay(FlightNumber, myWay);
 }
Esempio n. 42
0
        private void btnLease_Click(object sender, RoutedEventArgs e)
        {
            Boolean contractedOrder = false;
            Boolean tryOrder        = true;

            double totalLeasingPrice = this.SelectedAirliners.Sum(a => a.Airliner.getLeasingPrice() * 2);


            if (GameObject.GetInstance().HumanAirline.Contract != null)
            {
                Boolean sameManufaturer = this.SelectedAirliners.FirstOrDefault(a => a.Airliner.Type.Manufacturer != GameObject.GetInstance().HumanAirline.Contract.Manufacturer) == null;
                if (sameManufaturer)
                {
                    contractedOrder = true;
                }
                else
                {
                    double terminationFee      = GameObject.GetInstance().HumanAirline.Contract.getTerminationFee();
                    WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2010"), string.Format(Translator.GetInstance().GetString("MessageBox", "2010", "message"), GameObject.GetInstance().HumanAirline.Contract.Manufacturer.Name, terminationFee), WPFMessageBoxButtons.YesNo);

                    if (result == WPFMessageBoxResult.Yes)
                    {
                        AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Purchases, -terminationFee);
                        GameObject.GetInstance().HumanAirline.Contract = null;
                    }
                    tryOrder = result == WPFMessageBoxResult.Yes;
                }
            }


            if (totalLeasingPrice > GameObject.GetInstance().HumanAirline.Money)
            {
                WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2004"), Translator.GetInstance().GetString("MessageBox", "2004", "message"), WPFMessageBoxButtons.Ok);
            }
            else
            {
                if (tryOrder)
                {
                    ComboBox cbHomebase = new ComboBox();
                    cbHomebase.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
                    cbHomebase.ItemTemplate        = Application.Current.Resources["AirportCountryItem"] as DataTemplate;
                    cbHomebase.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    cbHomebase.Width = 200;

                    long minRunway = this.SelectedAirliners.Max(a => a.Airliner.Type.MinRunwaylength);

                    var homebases = GameObject.GetInstance().HumanAirline.Airports.FindAll(a => (a.hasContractType(GameObject.GetInstance().HumanAirline, AirportContract.ContractType.Full_Service) || a.getCurrentAirportFacility(GameObject.GetInstance().HumanAirline, AirportFacility.FacilityType.Service).TypeLevel > 0) && a.getMaxRunwayLength() >= minRunway);
                    foreach (Airport airport in homebases)
                    {
                        cbHomebase.Items.Add(airport);
                    }

                    cbHomebase.SelectedIndex = 0;

                    if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PageFleetAirlinerInformation", "1014"), cbHomebase) == PopUpSingleElement.ButtonSelected.OK && cbHomebase.SelectedItem != null)
                    {
                        Airport airport = cbHomebase.SelectedItem as Airport;

                        var selectedAirliners = new List <AirlinerMVVM>(this.SelectedAirliners);
                        foreach (AirlinerMVVM airliner in selectedAirliners)
                        {
                            if (Countries.GetCountryFromTailNumber(airliner.Airliner.TailNumber).Name != GameObject.GetInstance().HumanAirline.Profile.Country.Name)
                            {
                                airliner.Airliner.TailNumber = GameObject.GetInstance().HumanAirline.Profile.Country.TailNumbers.getNextTailNumber();
                            }

                            GameObject.GetInstance().HumanAirline.addAirliner(FleetAirliner.PurchasedType.Leased, airliner.Airliner, airport);

                            AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Rents, -airliner.Airliner.LeasingPrice * 2);

                            if (contractedOrder)
                            {
                                GameObject.GetInstance().HumanAirline.Contract.PurchasedAirliners++;
                            }

                            this.SelectedAirliners.Remove(airliner);
                            this.AllAirliners.Remove(airliner);
                        }
                    }
                    else
                    {
                        WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2002"), Translator.GetInstance().GetString("MessageBox", "2002", "message"), WPFMessageBoxButtons.Ok);
                    }
                }
            }
        }
Esempio n. 43
0
        public void GetPassengerPlanesWithMaxCapacityTest()
        {
            PassengerPlane planeWithMaxPassengersCapacity = new Airport(Planes).GetPassengerPlaneWithMaxPassengersCapacity();

            Assert.AreEqual(_planeWithMaxPassengerCapacity, planeWithMaxPassengersCapacity);
        }
Esempio n. 44
0
 public void RequestNewWay(string myWay)
 {
     Airport.SuggestWay(FlightNumber, myWay);
 }
Esempio n. 45
0
        public void GetFlights()
        {
            FlightDatabase db = new FlightDatabase(@"C:\Users\Grandvizir\Documents\GitHub\Algo-2015-1\ThirdParty\FlightData\");

            {
                var f0 = db.GetFlights(new DateTime(2010, 7, 26), Airport.FindByCode("BER"), Airport.FindByCode("LHR"));
                var f1 = db.GetFlights(new DateTime(2010, 7, 26), Airport.FindByCode("CDG"), Airport.FindByCode("LHR"));
                var f2 = db.GetFlights(new DateTime(2010, 7, 26), Airport.FindByCode("MRS"), Airport.FindByCode("LHR"));
                var f3 = db.GetFlights(new DateTime(2010, 7, 26), Airport.FindByCode("LYS"), Airport.FindByCode("LHR"));
                var f4 = db.GetFlights(new DateTime(2010, 7, 26), Airport.FindByCode("MAN"), Airport.FindByCode("LHR"));
                var f5 = db.GetFlights(new DateTime(2010, 7, 26), Airport.FindByCode("BIO"), Airport.FindByCode("LHR"));
                var f6 = db.GetFlights(new DateTime(2010, 7, 26), Airport.FindByCode("JFK"), Airport.FindByCode("LHR"));
                var f7 = db.GetFlights(new DateTime(2010, 7, 26), Airport.FindByCode("TUN"), Airport.FindByCode("LHR"));
                var f8 = db.GetFlights(new DateTime(2010, 7, 26), Airport.FindByCode("MXP"), Airport.FindByCode("LHR"));
            }
            {
                var f0 = db.GetFlights(new DateTime(2010, 7, 27), Airport.FindByCode("BER"), Airport.FindByCode("LHR"));
                var f1 = db.GetFlights(new DateTime(2010, 7, 27), Airport.FindByCode("CDG"), Airport.FindByCode("LHR"));
                var f2 = db.GetFlights(new DateTime(2010, 7, 27), Airport.FindByCode("MRS"), Airport.FindByCode("LHR"));
                var f3 = db.GetFlights(new DateTime(2010, 7, 27), Airport.FindByCode("LYS"), Airport.FindByCode("LHR"));
                var f4 = db.GetFlights(new DateTime(2010, 7, 27), Airport.FindByCode("MAN"), Airport.FindByCode("LHR"));
                var f5 = db.GetFlights(new DateTime(2010, 7, 27), Airport.FindByCode("BIO"), Airport.FindByCode("LHR"));
                var f6 = db.GetFlights(new DateTime(2010, 7, 27), Airport.FindByCode("JFK"), Airport.FindByCode("LHR"));
                var f7 = db.GetFlights(new DateTime(2010, 7, 27), Airport.FindByCode("TUN"), Airport.FindByCode("LHR"));
                var f8 = db.GetFlights(new DateTime(2010, 7, 27), Airport.FindByCode("MXP"), Airport.FindByCode("LHR"));
            }

            {
                var f0 = db.GetFlights(new DateTime(2010, 8, 3), Airport.FindByCode("LHR"), Airport.FindByCode("BER"));
                var f1 = db.GetFlights(new DateTime(2010, 8, 3), Airport.FindByCode("LHR"), Airport.FindByCode("CDG"));
                var f2 = db.GetFlights(new DateTime(2010, 8, 3), Airport.FindByCode("LHR"), Airport.FindByCode("MRS"));
                var f3 = db.GetFlights(new DateTime(2010, 8, 3), Airport.FindByCode("LHR"), Airport.FindByCode("LYS"));
                var f4 = db.GetFlights(new DateTime(2010, 8, 3), Airport.FindByCode("LHR"), Airport.FindByCode("MAN"));
                var f5 = db.GetFlights(new DateTime(2010, 8, 3), Airport.FindByCode("LHR"), Airport.FindByCode("BIO"));
                var f6 = db.GetFlights(new DateTime(2010, 8, 3), Airport.FindByCode("LHR"), Airport.FindByCode("JFK"));
                var f7 = db.GetFlights(new DateTime(2010, 8, 3), Airport.FindByCode("LHR"), Airport.FindByCode("TUN"));
                var f8 = db.GetFlights(new DateTime(2010, 8, 3), Airport.FindByCode("LHR"), Airport.FindByCode("MXP"));
            }
            {
                var f0 = db.GetFlights(new DateTime(2010, 8, 4), Airport.FindByCode("LHR"), Airport.FindByCode("BER"));
                var f1 = db.GetFlights(new DateTime(2010, 8, 4), Airport.FindByCode("LHR"), Airport.FindByCode("CDG"));
                var f2 = db.GetFlights(new DateTime(2010, 8, 4), Airport.FindByCode("LHR"), Airport.FindByCode("MRS"));
                var f3 = db.GetFlights(new DateTime(2010, 8, 4), Airport.FindByCode("LHR"), Airport.FindByCode("LYS"));
                var f4 = db.GetFlights(new DateTime(2010, 8, 4), Airport.FindByCode("LHR"), Airport.FindByCode("MAN"));
                var f5 = db.GetFlights(new DateTime(2010, 8, 4), Airport.FindByCode("LHR"), Airport.FindByCode("BIO"));
                var f6 = db.GetFlights(new DateTime(2010, 8, 4), Airport.FindByCode("LHR"), Airport.FindByCode("JFK"));
                var f7 = db.GetFlights(new DateTime(2010, 8, 4), Airport.FindByCode("LHR"), Airport.FindByCode("TUN"));
                var f8 = db.GetFlights(new DateTime(2010, 8, 4), Airport.FindByCode("LHR"), Airport.FindByCode("MXP"));
            }
        }
Esempio n. 46
0
 /// <summary>
 /// Constructs a new aircraft
 /// </summary>
 /// <param name="texture">The texture used to draw the aircraft</param>
 /// <param name="startAt">What node the aircraft will begin at</param>
 /// <param name="direction">What direction (radians) the aircraft will face</param>
 public Aircraft(Texture2D texture, Airport airport, TaxiNode startAt, float direction)
 {
     this.texture = texture;
     this.airport = airport;
     this.JumpTo(startAt, direction);
 }
Esempio n. 47
0
        private void btnBuy_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            Boolean contractedOrder = false;
            Boolean tryOrder        = true;

            if (GameObject.GetInstance().HumanAirline.Contract != null)
            {
                if (GameObject.GetInstance().HumanAirline.Contract.Manufacturer == this.Airliner.Type.Manufacturer)
                {
                    contractedOrder = true;
                }
                else
                {
                    double terminationFee      = GameObject.GetInstance().HumanAirline.Contract.getTerminationFee();
                    WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2010"), string.Format(Translator.GetInstance().GetString("MessageBox", "2010", "message"), GameObject.GetInstance().HumanAirline.Contract.Manufacturer.Name, terminationFee), WPFMessageBoxButtons.YesNo);

                    if (result == WPFMessageBoxResult.Yes)
                    {
                        AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Purchases, -terminationFee);
                        GameObject.GetInstance().HumanAirline.Contract = null;
                    }
                    tryOrder = result == WPFMessageBoxResult.Yes;
                }
            }

            Airport airport = (Airport)cbAirport.SelectedItem;

            if (this.Airliner.getPrice() > GameObject.GetInstance().HumanAirline.Money)
            {
                WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2006"), Translator.GetInstance().GetString("MessageBox", "2006", "message"), WPFMessageBoxButtons.Ok);
            }
            else if (airport == null)
            {
                WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2002"), Translator.GetInstance().GetString("MessageBox", "2002", "message"), WPFMessageBoxButtons.Ok);
            }

            else
            {
                if (tryOrder)
                {
                    WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2007"), string.Format(Translator.GetInstance().GetString("MessageBox", "2007", "message"), this.Airliner.Type.Name), WPFMessageBoxButtons.YesNo);

                    if (result == WPFMessageBoxResult.Yes)
                    {
                        if (contractedOrder)
                        {
                            AirlineHelpers.BuyAirliner(GameObject.GetInstance().HumanAirline, this.Airliner, airport, GameObject.GetInstance().HumanAirline.Contract.Discount);
                        }
                        else
                        {
                            AirlineHelpers.BuyAirliner(GameObject.GetInstance().HumanAirline, this.Airliner, airport);
                        }


                        base.ParentPage.removeUsedAirliner(this.Airliner);

                        if (contractedOrder)
                        {
                            GameObject.GetInstance().HumanAirline.Contract.PurchasedAirliners++;
                        }

                        this.clearPanel();
                    }
                }
            }
        }
Esempio n. 48
0
 /***********************************************
  * Zruší přiblížení na letiště a provede potřebná
  * doprovodná nastavení
  * *********************************************/
 public void cancelApproach()
 {
     Main.getInstance().sound.playSequence(CallSign);
     Main.getInstance().sound.play("around");
     this.isApproaching = this.isDescendingToRunway = this.isLanding = false;
     landingAirport = null;
     landReported = false;
     if (speed < 200)
     {
         wantedSpeed = 200;
     }
     if (alt < 3000)
     {
         wantedAlt = 3000;
     }
 }
Esempio n. 49
0
 public void MyTest2()
 {
     Airport        airport = new Airport(planes);
     PassengerPlane expectedPlaneWithMaxPassengersCapacity = airport.GetPassengerPlaneWithMaxPassengersCapacity();
 }
 void Start()
 {
     airport = airport_go.GetComponent<Airport> ();
 }
Esempio n. 51
0
 void Start()
 {
     base.Start();
     Setup ();
     airport = GameObject.Find(airportObjectName).GetComponent<Airport>();
 }
Esempio n. 52
0
        public FleetAirliner(PurchasedType purchased, DateTime purchasedDate, Airline airline, Airliner airliner, Airport homebase)
        {
            this.Airliner         = airliner;
            this.Purchased        = purchased;
            this.PurchasedDate    = purchasedDate;
            this.Airliner.Airline = airline;
            this.Homebase         = homebase;
            this.Name             = airliner.TailNumber;
            this.Statistics       = new AirlinerStatistics(this);
            this.LastCMaintenance = this.Airliner.BuiltDate;
            this.LastAMaintenance = this.Airliner.BuiltDate;
            this.LastBMaintenance = this.Airliner.BuiltDate;
            this.LastDMaintenance = this.Airliner.BuiltDate;
            this.Status           = AirlinerStatus.Stopped;
            this.MaintRoutes      = new List <RouteModel.Route>();

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

            this.Routes             = new List <Route>();
            this.Pilots             = new List <Pilot>();
            this.InsurancePolicies  = new List <AirlinerInsurance>();
            this.MaintenanceHistory = new Dictionary <Invoice, string>();
        }
Esempio n. 53
0
        /************************************************************
         * Provádí instrukce autopilota při přiblížení na letiště
         * **********************************************************/
        public void approach(Airport airport)
        {
            float distanceOnAxis = airport.GetDistanceOnAxis((float)this.X, (float)this.Y);
            if (distanceOnAxis < 2.0 && !isLanding)
            {
                cancelApproach();
            }
            else
            {
                Vector2 navigationPoint = distanceOnAxis > 12 ? airport.GetPointOnAxis(10) : airport.GetPointOnAxis(distanceOnAxis - 2);
                navX = navigationPoint.X;
                navY = navigationPoint.Y;
                WantedDir = Main.getCourse((float)this.X, (float)this.Y, navigationPoint.X, navigationPoint.Y);

                // sestupová fáze
                if (distanceOnAxis <= 10.0)
                {
                    if (airport.GetAngleFromAxis((float)this.X, (float)this.Y) <= 2.5)
                    {
                        IsDescendingToRunway = true;
                    }
                    if (IsDescendingToRunway)     // Tento a ten horní IF musí zůstat oddělené, jinak nefunguje správně sestup na výšku 0
                    {
                        int newWantedAlt = (int)MathHelper.Lerp(3000, 0, 1.0f - distanceOnAxis / 10.0f);
                        wantedAlt = newWantedAlt < wantedAlt ? newWantedAlt : wantedAlt;
                        if (wantedAlt < 0)
                        {
                            wantedAlt = 0;
                        }
                    }
                }
                if (distanceOnAxis <= 5.0)
                {
                    if (airport.GetAngleFromAxis((float)this.X, (float)this.Y) <= 2.5 && CheckLandingAvailability(airport))
                    {
                        IsLanding = true;
                    }
                    if (IsLanding)  // Tento a ten horní IF musí zůstat oddělené!
                    {
                        int newWantedSpeed = (int)MathHelper.Lerp(200, 130, 1.0f - distanceOnAxis / 5.0f);
                        wantedSpeed = newWantedSpeed < wantedSpeed ? newWantedSpeed : wantedSpeed;
                        if (wantedSpeed < 130)
                        {
                            wantedSpeed = 130;
                        }
                    }
                }
                // Runway touch
                if (!this.falling && Alt == 0)
                {
                    wantedSpeed = (int)MathHelper.Lerp(130, 100, distanceOnAxis == 0 ? 0 : -distanceOnAxis / (float)airport.Length);
                }
                // Landing finished
                if (-distanceOnAxis > 0.5 * airport.Length)
                {
                    if (isLanding && Alt == 0)
                    {
                        landed = true;
                    }
                    else
                    {
                        cancelApproach();
                    }
                }
            }
        }
Esempio n. 54
0
 public Form1()
 {
     model = new Airport();
     InitializeComponent();
 }
Esempio n. 55
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            if (Main.state.CurrentState == GameState.GAME_2D || Main.state.CurrentState == GameState.GAME_3D)
            {
                timeFromAppearance += gameTime.ElapsedGameTime.Milliseconds;
                if (Falling)
                {
                    fall();
                }
                if (IsApproaching)
                {
                    Airport a = Main.getInstance().GetLandingAirport(this.X, this.Y);
                    if (landingAirport == null)
                    {
                        landingAirport = a;
                    }
                    approach(landingAirport);
                }
                else
                {
                    navX = -1;
                    navY = -1;
                }

                changeSpeed(gameTime);
                changeDir(gameTime);
                changeAlt(gameTime);
                changeFuel(gameTime);

                if (fuel <= 0 && !fallReported)
                {
                    fallReported = true;
                    Main.getInstance().sound.play("mayday");
                    // Main.getInstance().sound.play("space");
                    // Main.getInstance().sound.playSequence(CallSign);
                }
                if (fuel < fuelChange * 300 && !_5minFuelReported)
                {
                    _10minFuelReported = _5minFuelReported = true;
                    Main.getInstance().sound.playSequence(CallSign);
                    Main.getInstance().sound.play("space");
                    Main.getInstance().sound.play("fuel5");
                    //lowFuel = true;   // <- už není potřeba, stačí používat _5minFuelReported a _10minFuelReported
                }
                else if (fuel < fuelChange * 600 && !_10minFuelReported)
                {
                    _10minFuelReported = true;
                    Main.getInstance().sound.playSequence(CallSign);
                    Main.getInstance().sound.play("space");
                    Main.getInstance().sound.play("fuel10");
                }

                /*
                 * X = X[mil] + speed[knts = 1.151 mil/h] * time[ms]
                 * X = X[mil] + (1.151*speed)[mil/h] * time[ms]
                 * X = X[mil] + (1.151*speed/60)[mil/min] * time[ms]
                 * X = X[mil] + (1.151*speed/3600)[mil/s] * time[ms]
                 * X = X[mil] + (1.151*speed/3600000)[mil/ms] * time[ms]
                 * */
                double speedX = 1.151 * Math.Sin(MathHelper.ToRadians((float)Dir)) * Speed / 3600000;
                double speedY = 1.151 * Math.Cos(MathHelper.ToRadians((float)Dir)) * Speed * (-1) / 3600000;
                X += speedX * gameTime.ElapsedGameTime.Milliseconds;
                Y += speedY * gameTime.ElapsedGameTime.Milliseconds;
            }
            base.Update(gameTime);
        }
Esempio n. 56
0
 public AirportProxy(int n)
 {
     this._timeProvider = new TimeProvider();
     this._airport = new Airport(n);
 }
Esempio n. 57
0
 public static void Setup(Airport new_airport)
 {
     buildingList = new List<Building>();
     employeeBuildingList = new List<BuildingPassenger> ();
     airport = new_airport;
 }
Esempio n. 58
0
 public Passenger(int id, Airport from, Airport to)
 {
     Id = id;
     AirportFrom = from;
     AirportTo = to;
 }
Esempio n. 59
0
 /// <summary>
 /// Update the airport value - this is called from a grounded flight that just got a better airport reading
 /// </summary>
 private void UpdateLastGroundedFlight(Airport airport)
 {
     LastAirport = airport;
     LastGroundedFlight.ArrivalAirport = airport.Identifier;
 }
        public async Task <IActionResult> FlightInfo(TimeSpan?time, int flightId)
        {
            CustomerFlightInfoViewModel customerFlight = new CustomerFlightInfoViewModel();
            var userId   = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var customer = _repo.Customer.GetCustomer(userId);

            if (flightId != 0)
            {
                customer.flightId = flightId;
            }
            var flight = _repo.Flight.GetFlight(customer.flightId);

            if (time != null)
            {
                flight.SelectedArrivalTime = time;
            }
            _repo.Customer.EditCustomer(customer);
            _repo.Flight.EditFlight(flight);
            await _context.SaveChangesAsync();

            customerFlight.Customer   = customer;
            customerFlight.FlightInfo = flight;
            Airport airport = await _tsaWaitTimesService.GetWaitTimes(flight.AirportCode);

            string firstTimeSlot = airport.estimated_hourly_times[0].timeslot;
            char   firstChar     = firstTimeSlot[0];
            int    firstTime     = Convert.ToInt32(Char.GetNumericValue(firstChar));
            double?transitMins;
            bool   withinTime;

            if (flight.SelectedArrivalTime.HasValue || time.HasValue)
            {
                if (flight.SelectedArrivalTime.Value.Hours < firstTime || flight.SelectedArrivalTime.Value.Hours > airport.estimated_hourly_times.Length)
                {
                    withinTime        = true;
                    ViewBag.TimeCheck = withinTime;
                    return(View(customerFlight));
                }
                for (int i = firstTime; i < airport.estimated_hourly_times.Length; i++)
                {
                    TimeSpan start = new TimeSpan(i, 0, 0);
                    TimeSpan end   = new TimeSpan((i + 1), 0, 0);
                    if ((flight.SelectedArrivalTime >= start) && (flight.SelectedArrivalTime <= end))
                    {
                        flight.TSAWaitTimeOnArrival = airport.estimated_hourly_times[i].waittime;
                        break;
                    }
                }
                _repo.Flight.EditFlight(flight);
                await _context.SaveChangesAsync();

                EpochTimeConverter(flight);
                TravelInfo travelInfo = await _directions.GetDirections(customer, flight);

                SetDirectionsInfo(travelInfo, customer);
                transitMins         = customer.duration + flight.TSAWaitTimeOnArrival;
                ViewBag.TransitTime = transitMins;
                DateTime leaveTime = ConvertTime(transitMins, flight);
                ViewBag.LeaveTimeData = leaveTime;
                string dateToDisplay = leaveTime.ToShortDateString();
                string timeToDisplay = leaveTime.ToString("hh:mm:ss tt");
                ViewBag.LeaveTime = $"{dateToDisplay} {timeToDisplay}";
            }
            return(View(customerFlight));
        }