コード例 #1
0
        /// <summary>
        /// Generate Additional Flights
        /// </summary>
        /// <param name="database"></param>
        /// <param name="a1">Airport Start Point</param>
        /// <param name="a2">Airport End Point</param>
        /// <param name="distance">Distance of Flight</param>
        /// <returns></returns>
        public static FLIGHT generateFlight(DatabaseClassDataContext database, AIRPORT a1, AIRPORT a2, int distance)
        {
            string flightid = GenerateFlightNumber();

            while (database.FLIGHTs.SingleOrDefault(x => x.Flight_id.Equals(flightid)) != null)
            {
                flightid = GenerateFlightNumber();
                Console.WriteLine("Generating New Unique Flight Number");
            }
            DateTime deptTime = DateTime.Now.AddMinutes(30 * _random.Next(0, 4));

            DataScriptsCPSC471.FLIGHT flight = new DataScriptsCPSC471.FLIGHT()
            {
                Flight_id         = flightid,
                arrival_airport   = a1.Name,
                departure_airport = a2.Name,
                departure_time    = deptTime,
                arrival_time      = deptTime.AddMinutes((((double)distance / (double)926) * _random.Next(600, 1000)) * 3),
                distance          = distance,
                base_price        = 600
            };
            return(flight);
        }
コード例 #2
0
 private void detach_AIRPORTs(AIRPORT entity)
 {
     this.SendPropertyChanging();
     entity.MAJOR_CITY = null;
 }
コード例 #3
0
 partial void DeleteAIRPORT(AIRPORT instance);
コード例 #4
0
 partial void UpdateAIRPORT(AIRPORT instance);
コード例 #5
0
 partial void InsertAIRPORT(AIRPORT instance);