Ejemplo n.º 1
0
        // The function will add flights to our data base.
        private string AddFlightPlansForFake(int longitudeStart, int latitudeStart, int passangers,
                                             int inceaseLong, int increaseLat, string companyName, bool sameId, bool withSegments)
        {
            DateTime current = DateTime.Now;

            current = current.AddSeconds(-10);
            string     date            = current.ToString("yyyy-MM-ddTHH:mm:ss") + "Z";
            FlightPlan flightPlanFake1 = new FlightPlan();

            flightPlanFake1.CompanyName = companyName;
            flightPlanFake1.Passengers  = passangers;
            flightPlanFake1.Location    = new InitialLocation
            {
                Latitude  = latitudeStart,
                Longitude = longitudeStart,
                DateTime  = date
            };
            if (withSegments)
            {
                flightPlanFake1.Segments = new List <Segment>();
                flightPlanFake1.Segments.Add(new Segment
                {
                    Latitude        = latitudeStart + increaseLat,
                    Longitude       = longitudeStart + inceaseLong,
                    TimespanSeconds = 10000
                });
                flightPlanFake1.Segments.Add(new Segment
                {
                    Latitude        = latitudeStart + 2 * increaseLat,
                    Longitude       = longitudeStart + 2 * inceaseLong,
                    TimespanSeconds = 10000
                });
            }
            string id;

            id = dataBase.AddFlightPlan(flightPlanFake1);
            return(id);
        }