示例#1
0
 public void SaveUserFlightData(int userID, FlightsList flights)
 {
     for (int i = 0; i < flights.Number; i++)
     {
         DateTime      today = DateTime.Today;
         string        query = "INSERT INTO dataUserFlight VALUES('" + userID + "','" + today + "','" + flights.Flights[i].FlightID + "','" + flights.Flights[i].Company + "','" + flights.Flights[i].PositionX + "','" + flights.Flights[i].PositionY + "','" + flights.Flights[i].OriginX + "','" + flights.Flights[i].OriginY + "','" + flights.Flights[i].DestinationX + "','" + flights.Flights[i].DestinationY + "','" + flights.Flights[i].Velocity + "')";
         SQLiteCommand comm  = new SQLiteCommand(query, this.cnx);
         comm.ExecuteNonQuery();
     }
 }
示例#2
0
        //Copia la lista de vuelos y la devuelve (evita que al cambiar la copia o el origen se sobreescriba la otra)
        public FlightsList Copy()
        {
            FlightsList fl = new FlightsList();

            fl.Number = this.Number;
            int i;

            for (i = 0; i < number; i++)
            {
                fl.Flights[i] = this.Flights[i].CopyFlightList();
            }
            return(fl);
        }
示例#3
0
        //Muestra el trafico aereo que hay en el sector
        public int GetTraffic(FlightsList flightsList)
        {
            int insideSectorCount = 0;

            float positionMarginSectorX = (float)this.PositionX + this.Width;
            float positionMarginSectorY = (float)this.PositionY + this.Height;

            for (int i = 0; i < flightsList.Number; i++)
            {
                Flight Flight = flightsList.Flights[i];

                if ((this.PositionX <= Flight.PositionX) && (Flight.PositionX <= positionMarginSectorX) && (this.PositionY <= Flight.PositionY) && (Flight.PositionY <= positionMarginSectorY))
                {
                    insideSectorCount++;
                }
            }
            return(insideSectorCount);
        }
示例#4
0
 public void SetUserData(int userID, FlightsList flights)
 {
     db.Start();
     db.SaveUserFlightData(userID, flights);
     db.End();
 }