예제 #1
0
 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 UpdateCancelledTrip(int newVId)
        {
            switch (Type)
            {
            case CancelledTripConst.Id_canTrip:
                CanceledTripDAL.UpdateTrip(newVId, Id);
                break;

            case CancelledTripConst.Reason:
                CanceledTripDAL.UpdateReason(newVId, Id);
                break;
            }
        }
예제 #3
0
        private void ChangeCanTrip()
        {
            string type             = dgvCT.SelectedCells[0].OwningColumn.Name;
            string value            = dgvCT.SelectedCells[0].Value.ToString();
            int    id               = (dgvCT.SelectedCells[0].OwningRow.DataBoundItem as CanceledTrip).Id_CanceledTrip;
            fmChangeCancelledTrip f = new fmChangeCancelledTrip(type, value, id);

            f.Text = dgvCT.SelectedCells[0].OwningColumn.HeaderText;
            if (f.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show("Значение изменено");
                dgvCT.DataSource = CanceledTripDAL.GetAllCancelledTrips();
            }
        }
예제 #4
0
        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 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;
        }
예제 #6
0
        private void btnCTAdd_Click(object sender, EventArgs e)
        {
            fmAddCancelledtrip f = new fmAddCancelledtrip();

            if (f.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show("Строка добавлена");
                if (listBoxCT.SelectedIndex >= 0)
                {
                    int idReason = CancellationReasonDAL.GetAllCancellationReasons()[listBoxCT.SelectedIndex].Id_Reason;
                    dgvCT.DataSource = CanceledTripDAL.GetCancelledTripsByReason(idReason);
                }
                else
                {
                    dgvCT.DataSource = CanceledTripDAL.GetAllCancelledTrips();
                }
            }
        }
예제 #7
0
        private void listBoxCT_SelectedIndexChanged(object sender, EventArgs e)
        {
            int idReason = CancellationReasonDAL.GetCancellationReasonByReason(CancellationReasonDAL.GetAllCancellationReasons()[listBoxCT.SelectedIndex].Reason).Id_Reason;

            dgvCT.DataSource = CanceledTripDAL.GetCancelledTripsByReason(idReason);
        }