private void button1_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(textBox2.Text) && !string.IsNullOrEmpty(textBox3.Text))
     {
         try
         {
             DateTime date   = dateTimePicker1.Value;
             var      trains = _trainNet.GetTrainsBeforeDeparture(textBox3.Text, textBox2.Text, date);
             if (trains == null || !trains.Any())
             {
                 MessageBox.Show("Няма намерени влакове");
             }
             else
             {
                 DisplayData ddf = new DisplayData(trains.ToList());
                 ddf.ShowDialog();
             }
         }
         catch (Exception ex)
         {
             TrainsException.ShowDefault(this, ex);
         }
     }
     else
     {
         MessageBox.Show("Моля въведете необходимите данни!");
     }
 }
Exemple #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(textBox1.Text) && !string.IsNullOrEmpty(textBox2.Text))
     {
         var trains = _trainNet.GetTrains(textBox1.Text, textBox2.Text);
         if (trains == null || !trains.Any())
         {
             MessageBox.Show("Няма намерени влакове");
         }
         else
         {
             DisplayData ddf = new DisplayData(trains.ToList());
             ddf.ShowDialog();
         }
     }
     else
     {
         MessageBox.Show("Моля въведете необходимите данни!");
     }
 }
Exemple #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(textBox1.Text) && !string.IsNullOrEmpty(textBox2.Text))
     {
         KindTrain train = _trainNet.GetFastestTrain(textBox1.Text, textBox2.Text);
         if (train == null)
         {
             MessageBox.Show("Няма намерен влак");
         }
         else
         {
             DisplayData ddf = new DisplayData(new List <KindTrain>()
             {
                 train
             });
             ddf.ShowDialog();
         }
     }
     else
     {
         MessageBox.Show("Моля въведете необходимите данни!");
     }
 }