private void btnISAddStation_Click(object sender, EventArgs e) { if (btnISAddStation.Text == "Добавить") { AddStation(); } else { dgvIS.DataSource = IntermediateStationDAL.GetIntermediateStationsByTrip(Id_Trip); } }
private void AddStation() { if (!GetStation()) { return; } int idStation = StationDAL.GetStationByName(cbStation.Text).Id_Station; string departureDate = dtpIS2.Text; string departureTime = dtpIS1.Text; string arrivalDate = dtpIS4.Text; string arrivalTime = dtpIS3.Text; IntermediateStationDAL.Insert(idStation, Id_Trip, departureDate, departureTime, arrivalDate, arrivalTime); MessageBox.Show("Строка добавлена"); dgvIS.DataSource = IntermediateStationDAL.GetIntermediateStationsByTrip(Id_Trip);; }