private void FillingCancellationReasons()
 {
     foreach (CancellationReason cr in CancellationReasonDAL.GetAllCancellationReasons())
     {
         cbReason.Items.Add(cr.Reason);
     }
 }
Example #2
0
 private void CancellationReasonsFilling()
 {
     foreach (CancellationReason r in CancellationReasonDAL.GetAllCancellationReasons())
     {
         listBoxCT.Items.Add(r.Reason);
     }
 }
Example #3
0
 private void VisibleReason()
 {
     lbRTPassport.Text                 = "Причина";
     dgvRT.Columns[0].HeaderText       = "Причина";
     dgvRT.Columns[0].DataPropertyName = "Reason";
     dgvRT.Columns[0].Name             = "Reason";
     dgvRT.DataSource = CancellationReasonDAL.GetAllCancellationReasons();
 }
Example #4
0
        private void AddReasons()
        {
            if (String.IsNullOrEmpty(tbRTPassport.Text))
            {
                MessageBox.Show("Введите причину!");
                return;
            }
            string reason = tbRTPassport.Text;

            CancellationReasonDAL.Insert(reason);
            dgvRT.DataSource = CancellationReasonDAL.GetAllCancellationReasons();
            ClearText();
        }
Example #5
0
        private void updateCancellationReason()
        {
            string          type      = dgvRT.SelectedCells[0].OwningColumn.Name;
            string          value     = dgvRT.SelectedCells[0].Value.ToString();
            Type            typeTable = dgvRT.SelectedCells[0].OwningRow.DataBoundItem.GetType();
            int             id        = (dgvRT.SelectedCells[0].OwningRow.DataBoundItem as CancellationReason).Id_Reason;
            fmChangeValueRT f         = new fmChangeValueRT(type, value, id, typeTable);

            f.Text = dgvRT.SelectedCells[0].OwningColumn.HeaderText;
            if (f.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show("Значение изменено");
                dgvRT.DataSource = CancellationReasonDAL.GetAllCancellationReasons();
            }
        }
Example #6
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;
        }
Example #8
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();
                }
            }
        }
 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);
         }
     }
 }
Example #10
0
 private void DelCancellationReason(int id)
 {
     CancellationReasonDAL.Delete(id);
     dgvRT.DataSource = CancellationReasonDAL.GetAllCancellationReasons();
 }
Example #11
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);
        }