private void button2_addATrack_Click(object sender, EventArgs e) { string station1 = comboBox2_station1.Text; string station2 = comboBox3_station2.Text; string station3 = comboBox4_station3.Text; string ArrivalTime1 = dateTimePicker1.Value.Date.ToString("yyyy-MM-dd") + " " + comboBox7_at1.Text; string ArrivalTime2 = dateTimePicker1.Value.Date.ToString("yyyy-MM-dd") + " " + comboBox6_at2.Text; string ArrivalTime3 = dateTimePicker1.Value.Date.ToString("yyyy-MM-dd") + " " + comboBox5_at3.Text; string DepartureTime = dateTimePicker1.Value.Date.ToString("yyyy-MM-dd") + " " + comboBox1_DT.Text; if (textBox2_trackID.Text.Length == 0) { MessageBox.Show("Please Enter a valid ID"); return; } else if (controllerObj.TrackCheckerByID(int.Parse(textBox2_trackID.Text.ToString())) == 1) { MessageBox.Show("This Track ID Already Exists!" + newLine + "Please, Try Another One."); return; } int ID = int.Parse(textBox2_trackID.Text); if (comboBox1_DT.Text.Length == 0) { MessageBox.Show("Please Enter Departure Time for the Track!"); return; } if (station1 == station2 || station1 == station3 || station2 == station3) { MessageBox.Show("Please Choose Different Locations for each Bus-Stop!"); return; } if (comboBox7_at1.Text.Length == 0 || comboBox6_at2.Text.Length == 0 || comboBox5_at3.Text.Length == 0) { MessageBox.Show("Please Enter Arrival Times for each Station!"); return; } if (textBox3_price.Text.Length == 0) { MessageBox.Show("Please Enter a valid Price, This is not Charity!"); return; } double price = double.Parse(textBox3_price.Text); controllerObj.AddTrack(DepartureTime, price, ID, station1, station2, station3, ArrivalTime1, ArrivalTime2, ArrivalTime3); MessageBox.Show("Track Added with Departure Time: " + DepartureTime + " and ID: " + ID + " and Price: " + price); }