Exemplo n.º 1
0
        public DateTime this[FlightsTime Time]
        {
            get
            {
                switch (Time)
                {
                case FlightsTime.arrival:
                    return(Arrival);

                case FlightsTime.departure:
                    return(Departure);

                default: return(DateTime.MinValue);
                }
            }
        }
Exemplo n.º 2
0
        public Flight FindByDate(FlightsTime mode)
        {
            List <int> Indices = new List <int>();
            int        Ind     = -1;

            var Time = (earliestTime : DateTime.MinValue, latestTime : DateTime.MinValue);

            do
            {
                do
                {
                    Console.Write($" < Enter earliest {(mode == FlightsTime.arrival ? "arrival" : "departure")} time of flight > \n>");
                    Time.earliestTime = Flight.EnterDateTime();
                } while (Time.earliestTime == DateTime.MinValue);
                do
                {
                    Console.Write($" < Enter latest {(mode == FlightsTime.arrival ? "arrival" : "departure")} time of flight > \n>");
                    Time.latestTime = Flight.EnterDateTime();
                } while (Time.latestTime == DateTime.MinValue);
            } while (!Flight.CheckTime(Time.earliestTime, Time.latestTime));

            Indices = FindIndbyDate(Time, mode);

            if (Indices.Count == 0)
            {
                Console.WriteLine(" < No flights were found > ");
                return(null);
            }
            else
            {
                OutputFlights(Indices);
                if (Indices.Count > 1)
                {
                    Ind = ChooseItem(Indices);
                }
                else
                {
                    Ind = Indices[0];
                }
            }

            return(Ind == -1 ?  null : Base[Ind]);
        }