コード例 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     TrainHandling.EditTrain(Id,txtFrom.Text, txtTo.Text, txtDepDate.Text, txtArrDate.Text, int.Parse(txtCarsNum.Text));
      var frm = new EditTrain();
      this.Hide();
      frm.Closed += (hh, uu) => this.Close();
 }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            int  x;
            bool t = int.TryParse(txtTrainID.Text, out x);

            if (t)
            {
                var train = TrainHandling.GetTrainById(x);
                if (train == null)
                {
                    MessageBox.Show("Invalid Train ID");
                }
                else
                {
                    EditTrain tr = new EditTrain();
                    tr.Init(x, train.StartingStation, train.EndingStation,
                            train.DepartureDate, train.ArrivalDate, train.NumberOfCars);
                    tr.Show();
                }
            }
            else
            {
                MessageBox.Show("Invalid Train ID");
            }
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            TrainHandling.EditTrain(Id, txtFrom.Text, txtTo.Text, txtDepDate.Text, txtArrDate.Text, int.Parse(txtCarsNum.Text));
            var frm = new EditTrain();

            this.Hide();
            frm.Closed += (hh, uu) => this.Close();
        }
コード例 #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            int x;
            bool t = int.TryParse(txtTrainID.Text, out x);
            if (t)
            {
                var train = TrainHandling.GetTrainById(x);
                if (train == null)
                {
                    MessageBox.Show("Invalid Train ID");
                }
                else
                {
                    EditTrain tr = new EditTrain();
                    tr.Init(x, train.StartingStation, train.EndingStation,
                        train.DepartureDate, train.ArrivalDate, train.NumberOfCars);
                    tr.Show();
                }

            }
            else MessageBox.Show("Invalid Train ID");
        }