예제 #1
0
        private editInf ToEditApAssenger(Passenger pass)
        {
            editInf ed;

            ed = new editInf();
            Console.WriteLine("Enter a firstname of a passenger: {0}", ((pass != null) ?pass.Firstname:String.Empty));
            ed.firstname = Console.ReadLine();
            Console.WriteLine("Enter a lastname of a passenger: {0}", ((pass != null) ? pass.Lastname : String.Empty));
            ed.lastname = Console.ReadLine();
            Console.WriteLine("Enter a sex of passenger:1 - a man, 2 - a woman{0} - ", ((pass != null) ? ((pass.Sex == Sex.Male)?1:2):1));
            ed.sex = (Sex)int.Parse(Console.ReadLine());
            Console.WriteLine("Enter a birthday of a passenger: {0}", ((pass != null) ? pass.Birthday : DateTime.MinValue));
            ed.birthday = InputUtil.TimeEnter();
            Console.WriteLine("Enter a nationaality of a passenger: {0}", ((pass != null) ? pass.Nationality : String.Empty));
            ed.nationality = Console.ReadLine();
            Console.WriteLine("Enter a passport data of a passenger: {0}", ((pass != null) ? pass.Passport : String.Empty));
            ed.passport = Console.ReadLine();
            Console.WriteLine("Enter an identical code of passenger: {0}", ((pass != null) ? pass.Identicalcode.ToString() : String.Empty));
            ed.identical = int.Parse(Console.ReadLine());
            ed.ticket    = (pass != null)? pass.Tct:new Ticket(1, 1, 0);
            Console.WriteLine("Enter a ticket class: {0}", (pass != null) ? pass.Tct.ClassofTicket:TicketClass.Economy);
            ed.ticket.ClassofTicket = (TicketClass)(int.Parse(Console.ReadLine()));
            Console.WriteLine("Enter a ticket category: {0}", (pass != null) ? pass.Tct.TicketCategory:TicketCategory.CategoryA);
            ed.ticket.TicketCategory = (TicketCategory)(int.Parse(Console.ReadLine()));
            Console.WriteLine("Enter a price: {0}", (pass != null) ? pass.Tct.Price:0);
            ed.ticket.Price = Convert.ToDecimal(Console.ReadLine());
            return(ed);
        }
예제 #2
0
        public void AddItem()
        {
            byte   choiceFlight = 0;
            Flight newflight;

            try
            {
                Console.WriteLine("Enter a kind of flight:1 - arrival; 2 - departure");
                choiceFlight = byte.Parse(Console.ReadLine());
            }
            catch (OverflowException ex)
            {
                Console.WriteLine(ex.Message);
            }
            if ((choiceFlight <= 0) || (choiceFlight >= 3))
            {
                Console.WriteLine("You entered a wrong choice!!!");
            }
            DateTime timeofFlight = InputUtil.TimeEnter();

            Console.WriteLine("Flight number:");
            int ourflightnumber = int.Parse(Console.ReadLine());

            Console.WriteLine("City:");
            string ourflightcity = Console.ReadLine();

            Console.WriteLine("Terminal:");
            string       ourflightterminal = Console.ReadLine();
            KindOfFlight ourflightkind     = (KindOfFlight)choiceFlight;
            FlightStatus ourflightstatus   = ChoiceFlightstatus();

            newflight = new Flight(timeofFlight, ourflightnumber, ourflightcity,
                                   ourflightterminal, ourflightkind, ourflightstatus, new List <Ticket>(), true);
            AddToArray(ourflightkind, newflight);
        }
예제 #3
0
 public Flight EditItem(Flight editflight)
 {
     editflight.At = InputUtil.TimeEnter();
     Console.WriteLine("Terminal:");
     editflight.Terminalandgate = Console.ReadLine();
     editflight.Status          = ChoiceFlightstatus();
     return(editflight);
 }
예제 #4
0
        public static void EditAirline(Airline company)
        {
            string   valuestring;
            DateTime valuedDatetime;

            Console.WriteLine("Enter the new name of Airline:(#) - remain one");
            valuestring         = Console.ReadLine();
            company.AirlineName = ((valuestring == "#") ? company.AirlineName : valuestring);
            Console.WriteLine("Enter the new LicenseNumber of Airline:(#) - remain one");
            valuestring           = Console.ReadLine();
            company.LicenseNumber = ((valuestring == "#") ? company.LicenseNumber : valuestring);
            Console.WriteLine("Enter the new expiration date of Airline: (#) - remain one");
            valuestring         = Console.ReadLine();
            valuedDatetime      = ((valuestring == "#") ? company.DateExpired : InputUtil.TimeEnter());
            company.DateExpired = valuedDatetime;
        }
예제 #5
0
        public static Airline CheckAirline(Airline[] AirlineArray)
        {
            string        licensenumber;
            string        airlinename;
            int           incrementAirlineArray = 4;
            FindAnAirline fn = new FindAnAirline
                               (
                () =>
            {
                Console.WriteLine("Enter an Airline to work with:");
                string readAirline = Console.ReadLine();
                for (int i = 0; i < AirlineArray.Length; i++)
                {
                    if (AirlineArray[i]?.AirlineName != null)
                    {
                        if (AirlineArray[i].AirlineName == readAirline)
                        {
                            return(AirlineArray[i]);
                        }
                    }
                }
                return(null);
            }
                               );
            Airline chosenLine = fn();

            if (chosenLine == null)
            {
                Console.WriteLine("The airline you have selected doesn't exist." +
                                  "Do you wish to fill a new one (Y/N)");
                bool yn = ("Y" == Console.ReadLine() ? true : false);
                if (yn)
                {
                    Console.WriteLine("Enter a name of AirLine");
                    incrementAirlineArray++;
                    try
                    {
                        Console.WriteLine("Enter a license nimber of an airlinecompany");
                        licensenumber = Console.ReadLine();
                        airlinename   = Console.ReadLine();
                        AirlineArray[incrementAirlineArray] = new Airline(airlinename, licensenumber,
                                                                          true, InputUtil.TimeEnter());
                        while (true)
                        {
                            Console.WriteLine("To continue filling an information of a current airline press /Y/ or N to stop");
                            string choice = Console.ReadLine();
                            if (choice.ToUpper() != "Y")
                            {
                                break;
                            }
                            AirlineArray[incrementAirlineArray].AddItem();
                        }
                        chosenLine = AirlineArray[incrementAirlineArray];
                    }
                    catch (IndexOutOfRangeException excep)
                    {
                        Console.WriteLine(excep.Message);
                        return(null);
                    }
                }
            }
            return(chosenLine);
        }
예제 #6
0
 public override void GetLicense()
 {
     this.DateExpired    = InputUtil.TimeEnter();
     this.IsLicenseValid = true;
 }