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("Моля въведете необходимите данни!"); } }
private void DisplayData_Load(object sender, EventArgs e) { try { InitTables(); } catch (Exception ex) { TrainsException.ShowDefault(this, ex); } }