Exemplo n.º 1
0
        private void EditPeron()
        {
            Console.Write("Enter ID of the peron:");
            int editID = Helper.CheckIntInput();

            Peron CheckID = peronList.Where(x => x.PeronID == editID).FirstOrDefault();

            if (CheckID != null)
            {
                Console.Write("Enter new ID:");
                int newID = Helper.CheckIntInput();

                Console.Write("Enter date and time(2019/5/20 5:30:00):");
                DateTime newTime = DateTime.Parse(Console.ReadLine());

                Peron editPeron = new Peron {
                    PeronID = newID, ArrivalDeparture = newTime
                };

                int findIndex = peronList.IndexOf(CheckID);
                peronList[findIndex] = editPeron;
            }
            else
            {
                Console.WriteLine("That ID does not exits!");
            }
        }
Exemplo n.º 2
0
        private void LoadData()
        {
            Autobus autobus1 = new Autobus {
                AutobusType = TipAutobusa.MiniBus, AutobusRegNumber = 382729172
            };
            Autobus autobus2 = new Autobus {
                AutobusType = TipAutobusa.Jednospratni, AutobusRegNumber = 55667788
            };

            TransportationCompany tc1 = new TransportationCompany {
                TransportationCompanyID = 2727, TransportationCompanyName = "Lasta", TransportationCompanyLocation = "Kragujevac"
            };
            TransportationCompany tc2 = new TransportationCompany {
                TransportationCompanyID = 2638, TransportationCompanyName = "Janjusevic", TransportationCompanyLocation = "Subotica"
            };

            Peron peron1 = new Peron {
                PeronID = 242, ArrivalDeparture = new DateTime(2019, 4, 27, 6, 30, 00)
            };
            Peron peron2 = new Peron {
                PeronID = 532, ArrivalDeparture = new DateTime(2019, 3, 30, 9, 30, 00)
            };

            BusStation busStation1 = new BusStation {
                BusStationID = 5832, Location = "Beograd", Peron = peron1
            };
            BusStation busStation2 = new BusStation {
                BusStationID = 9281, Location = "Smederevo", Peron = peron2
            };

            Ticket ticket1 = new Ticket {
                TicketId = 4334, TransportationCompany = tc1, Autobus = autobus1, BusStationArrival = busStation1, BusStationStarting = busStation2
            };
            Ticket ticket2 = new Ticket {
                TicketId = 5555, TransportationCompany = tc2, Autobus = autobus2, BusStationArrival = busStation2, BusStationStarting = busStation1
            };

            autobusList.Add(autobus1);
            autobusList.Add(autobus2);

            transportationCompanyList.Add(tc1);
            transportationCompanyList.Add(tc2);

            peronList.Add(peron1);
            peronList.Add(peron2);

            busStationList.Add(busStation1);
            busStationList.Add(busStation2);

            ticketList.Add(ticket1);
            ticketList.Add(ticket2);
        }
Exemplo n.º 3
0
        private void AddPeron()
        {
            Console.Write("Enter new peron ID:");
            int newID = Helper.CheckIntInput();

            Console.Write("Enter date and time(2019/5/20 5:30:00):");
            DateTime newTime = Helper.CheckDateTimeInput();

            Peron addPeron = new Peron {
                PeronID = newID, ArrivalDeparture = newTime
            };

            peronList.Add(addPeron);
        }
Exemplo n.º 4
0
        private void RemovePeron()
        {
            Console.Write("Enter peron ID:");
            int removeID = Helper.CheckIntInput();

            Peron CheckID = peronList.Where(x => x.PeronID == removeID).FirstOrDefault();

            if (CheckID != null)
            {
                peronList.Remove(CheckID);
                Console.WriteLine("Peron has deleted!");
            }
            else
            {
                Console.WriteLine("That ID does not exits!");
            }
        }
Exemplo n.º 5
0
        private void EditBusStation()
        {
            Console.WriteLine("Enter ID of the bus station:");
            int select = Helper.CheckIntInput();

            BusStation CheckID = busStationList.Where(x => x.BusStationID == select).FirstOrDefault();

            Peron peronEdit = new Peron();

            if (CheckID != null)
            {
                Console.Write("Enter a new ID of the bus station:");
                int newID = Helper.CheckIntInput();

                Console.Write("Enter a new location of the bus station:");
                string newLocation = Helper.CheckStringInput();

                WriteAllPerons();
                Console.Write("Enter a new peron across ID:");
                int newPeron = Helper.CheckIntInput();

                Peron FindPeronID = peronList.Where(x => x.PeronID == newPeron).FirstOrDefault();

                if (FindPeronID != null)
                {
                    peronEdit = FindPeronID;
                }
                else
                {
                    Console.WriteLine("Sorry,but that peron does not exits!");
                }

                BusStation editBusStation = new BusStation {
                    BusStationID = newID, Location = newLocation, Peron = peronEdit
                };

                int indexObject = busStationList.IndexOf(CheckID);
                busStationList[indexObject] = editBusStation;
            }
            else
            {
                Console.WriteLine("Sorry,but that id does not exits!");
            }
        }
Exemplo n.º 6
0
        private void AddBusStation()
        {
            Console.Write("Enter a new ID:");
            int newID = Helper.CheckIntInput();

            BusStation CheckID = busStationList.Where(x => x.BusStationID == newID).FirstOrDefault();

            if (CheckID != null)
            {
                Console.WriteLine("That ID is aleardy exits!");
            }
            else
            {
                Console.Write("Enter a new location:");
                string newLocation = Helper.CheckStringInput();

                WriteAllPerons();
                Console.Write("Enter peron ID:");
                int peronID = Helper.CheckIntInput();

                Peron FindPeron = peronList.Where(x => x.PeronID == peronID).FirstOrDefault();

                if (FindPeron != null)
                {
                    Peron newPeron;
                    newPeron = FindPeron;

                    BusStation newBusStation = new BusStation {
                        BusStationID = newID, Location = newLocation, Peron = FindPeron
                    };

                    busStationList.Add(newBusStation);
                }
                else
                {
                    Console.WriteLine("That ID does not exits!");
                }
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Constructor of the class
 /// </summary>
 public BusStation()
 {
     Peron = new Peron();
 }
Exemplo n.º 8
0
 public int CompareTo(Peron <T> other)
 {
     throw new NotImplementedException();
 }