private void btnTripsCarriage_Click(object sender, EventArgs e) { int idTrip = TripDAL.GetAllTrips()[dgvTrips.SelectedCells[0].OwningRow.Index].Id_Trip; fmCarriageList f = new fmCarriageList(idTrip); f.Show(); }
private void FillingTrips() { foreach (Trip tr in TripDAL.GetAllTrips()) { cbNumTrip.Items.Add(tr.Id_Trip); } }
private void btnTripsSearch_Click(object sender, EventArgs e) { if (dtpTrips.Checked) { dgvTrips.DataSource = TripDAL.GetTripsByDate(dtpTrips.Value.ToString()); } SearchTripByStations(); SearchByDriverAndTrain(); }
private void btnTripsAdd_Click(object sender, EventArgs e) { fmAddTrip fm = new fmAddTrip(); if (fm.ShowDialog() == DialogResult.OK) { MessageBox.Show("Строка добавлена"); dgvTrips.DataSource = TripDAL.GetAllTrips(); } }
/*private void AddSoftCount(int idAddedTrip) * { * int cnt = int.Parse(numericUpDown1.Value.ToString()); * foreach (CarriageType t in CarriageTypeDAL.GetAllCarriageTypes()) * { * if (t.Type.Trim() == CarriageTypeConst.Soft) Trip_CarriageDAL.Insert(t.Id_CarriageType, idAddedTrip, cnt); * } * } * * private void AddCoupeCount(int idAddedTrip) * { * int cnt = int.Parse(numericUpDown2.Value.ToString()); * foreach (CarriageType t in CarriageTypeDAL.GetAllCarriageTypes()) * { * if (t.Type.Trim() == CarriageTypeConst.Coupe)Trip_CarriageDAL.Insert(t.Id_CarriageType, idAddedTrip, cnt); * } * } * * private void AddLuxCount(int idAddedTrip) * { * int cnt = int.Parse(numericUpDown3.Value.ToString()); * foreach (CarriageType t in CarriageTypeDAL.GetAllCarriageTypes()) * { * if (t.Type.Trim() == CarriageTypeConst.Lux)Trip_CarriageDAL.Insert(t.Id_CarriageType, idAddedTrip, cnt); * } * } * * private void AddSittingCount(int idAddedTrip) * { * int cnt = int.Parse(numericUpDown4.Value.ToString()); * foreach (CarriageType t in CarriageTypeDAL.GetAllCarriageTypes()) * { * if (t.Type.Trim() == CarriageTypeConst.Sitting)Trip_CarriageDAL.Insert(t.Id_CarriageType, idAddedTrip, cnt); * } * } * * private void AddReserverSeatCount(int idAddedTrip) * { * int cnt = int.Parse(numericUpDown5.Value.ToString()); * foreach (CarriageType t in CarriageTypeDAL.GetAllCarriageTypes()) * { * if (t.Type.Trim() == CarriageTypeConst.ReserverSeat)Trip_CarriageDAL.Insert(t.Id_CarriageType, idAddedTrip, cnt); * } * } * * private void AddCarriageCount() * { * int id = TripDAL.GetAllTrips()[TripDAL.GetAllTrips().Count - 1].Id_Trip; * AddCoupeCount(id); * AddLuxCount(id); * AddReserverSeatCount(id); * AddSittingCount(id); * AddSoftCount(id); * }*/ private void InsertTrip() { int driver = DriverDAL.GetAllDrivers()[cbDriver.SelectedIndex].Id_Driver; int train = TrainDAL.GetAllTrains()[cbTrain.SelectedIndex].Id_Train; string departureDate = dtpDate1.Text; string departureTime = dtpTime1.Text; string arrivalDate = dtpDate2.Text; string arrivalTime = dtpTime2.Text; TripDAL.Insert(Id_Table, driver, train, departureDate, departureTime, arrivalDate, arrivalTime); }
private void DataGridVeiwFilling() { dgvRT.AutoGenerateColumns = false; dgvRT.DataSource = PassengerDAL.GetAllPassengers(); dgvTable.AutoGenerateColumns = false; dgvTable.DataSource = TrainTableDAL.GetAllTrainTables(); dgvCT.AutoGenerateColumns = false; dgvCT.DataSource = CanceledTripDAL.GetAllCancelledTrips(); dgvTrips.AutoGenerateColumns = false; dgvTrips.DataSource = TripDAL.GetAllTrips(); dgvTickets.AutoGenerateColumns = false; dgvTickets.DataSource = TicketDAL.GetAllTickets(); }
private void btnAddTrips_Click(object sender, EventArgs e) { if (!GetReason()) { return; } if (!GetTrip()) { return; } int idReason = CancellationReasonDAL.GetAllCancellationReasons()[cbReason.SelectedIndex].Id_Reason; int idTrip = TripDAL.GetAllTrips()[cbNumTrip.SelectedIndex].Id_Trip; CanceledTripDAL.Insert(idReason, idTrip); DialogResult = DialogResult.OK; }
private void SearchByDriverAndTrain() { int idDriver = cbTripsDriver.SelectedIndex != 0 ? DriverDAL.GetAllDrivers()[cbTripsDriver.SelectedIndex].Id_Driver: 0; int idTrain = cbTripsTrain.SelectedIndex != 0? idTrain = TrainDAL.GetAllTrains()[cbTripsTrain.SelectedIndex].Id_Train : 0; if (cbTripsDriver.SelectedIndex != 0 && cbTripsTrain.SelectedIndex != 0) { dgvTrips.DataSource = TripDAL.GetTripsByDriverAndTrain(idDriver, idTrain); } if (cbTripsTrain.SelectedIndex != 0) { dgvTrips.DataSource = TripDAL.GetTripsByTrain(idTrain); } if (cbTripsDriver.SelectedIndex != 0) { dgvTrips.DataSource = TripDAL.GetTripsByDriver(idDriver); } }
private void SearchTripByStations() { int IdDepartureStation = cbTripsDS.SelectedIndex != 0?IdDepartureStation = StationDAL.GetStationByName(cbTripsDS.Text).Id_Station:0; int IdArrivalStation = cbTripsAS.SelectedIndex != 0?IdArrivalStation = StationDAL.GetStationByName(cbTripsAS.Text).Id_Station:0; if (cbTripsDS.SelectedIndex != 0 && cbTripsAS.SelectedIndex != 0) { dgvTrips.DataSource = TripDAL.GetTripsByStations(IdDepartureStation, IdArrivalStation); } if (cbTripsAS.SelectedIndex != 0) { dgvTrips.DataSource = TripDAL.GetTripsByAStation(IdArrivalStation); } if (cbTripsDS.SelectedIndex != 0) { dgvTrips.DataSource = TripDAL.GetTripsByDStation(IdDepartureStation); } }
public fmChangeCancelledTrip(string TypeV, string Value, int id) { InitializeComponent(); Type = TypeV; Id = id; tbValue.Text = Value; if (Type == CancelledTripConst.Id_canTrip) { foreach (Trip tr in TripDAL.GetAllTrips()) { cbNewV.Items.Add(tr.Id_Trip); } } else { foreach (CancellationReason cr in CancellationReasonDAL.GetAllCancellationReasons()) { cbNewV.Items.Add(cr.Reason); } } }
private void btnTripsDel_Click(object sender, EventArgs e) { TripDAL.Delete((dgvTrips.SelectedCells[0].OwningRow.DataBoundItem as Trip).Id_Trip); dgvTrips.DataSource = TripDAL.GetAllTrips(); MessageBox.Show("Строка удалена"); }