private void DelCancelledTrip() { int idCanceledTrip = (dgvCT.SelectedCells[0].OwningRow.DataBoundItem as CanceledTrip).Id_CanceledTrip; CanceledTripDAL.Delete(idCanceledTrip); if (listBoxCT.SelectedIndex >= 0) { int idReason = CancellationReasonDAL.GetCancellationReasonByReason(CancellationReasonDAL.GetAllCancellationReasons()[listBoxCT.SelectedIndex].Reason).Id_Reason; dgvCT.DataSource = CanceledTripDAL.GetCancelledTripsByReason(idReason); } else { dgvCT.DataSource = CanceledTripDAL.GetAllCancelledTrips(); } MessageBox.Show("Строка удалена"); }
private void btnChange_Click_1(object sender, EventArgs e) { string txt = cbNewV.Text; int idNewV = Type == CancelledTripConst.Id_canTrip ? int.Parse(txt.Trim()): CancellationReasonDAL.GetCancellationReasonByReason(txt).Id_Reason; UpdateCancelledTrip(idNewV); }
private void listBoxCT_SelectedIndexChanged(object sender, EventArgs e) { int idReason = CancellationReasonDAL.GetCancellationReasonByReason(CancellationReasonDAL.GetAllCancellationReasons()[listBoxCT.SelectedIndex].Reason).Id_Reason; dgvCT.DataSource = CanceledTripDAL.GetCancelledTripsByReason(idReason); }