Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (searchTrains.Checked)
            {
                List<Train> trains = Train.Search(pointArrive.Text, pointDeparture.Text);

                if (trains.Count == 0)
                {
                    FormMessage Message         = new FormMessage();
                    Message.messageLabel.Text   = "Поиск не дал результатов.";
                    Message.ShowDialog();
                }
                else
                {
                    PsgResultByParams f     = new PsgResultByParams();
                    f.showTrains.Checked    = true;
                    f.FillTable(trains);
                    f.ShowDialog();
                }
            }

            if (searchPassengers.Checked)
            {
                List<Passenger> passengers  = Passenger.Search(lastName.Text, firstName.Text, ticketType.Text);

                if (passengers.Count == 0)
                {
                    FormMessage Message         = new FormMessage();
                    Message.messageLabel.Text   = "Поиск не дал результатов.";
                    Message.ShowDialog();
                }
                else
                {
                    PsgResultByParams f         = new PsgResultByParams();
                    f.showPassengers.Checked    = true;
                    f.FillTable(passengers);
                    f.ShowDialog();
                }
            }
        }
Пример #2
0
        private void FillResultFormAndShowIt(List<Passenger> Psgs)
        {
            PsgResultByParams FormResultPasByParams = new PsgResultByParams();
            FormResultPasByParams.Owner             = this;

            foreach (Passenger Psg in Psgs)
            {
                FormResultPasByParams.TablePas.Rows.Add(Psg.ID, Psg.LastName, Psg.FirstName, Psg.CountOfTickets);
            }

            FormResultPasByParams.ShowDialog();
        }