private void UpdateTicket(int newVId, string newValue)
        {
            switch (Type)
            {
            case TicketConst.Trip:
                TicketDAL.UpdateTrip(int.Parse(newValue), Id);
                break;

            case TicketConst.Passenger:
                TicketDAL.UpdatePassenger(PassengerDAL.GetAllPassengers()[newVId].Id_Passenger, Id);
                break;

            case TicketConst.LandingStation:
                TicketDAL.UpdateLS(IntermediateStationDAL.GetAllIntermediateStations()[newVId].Id_IntermediateStation, Id);
                break;

            case TicketConst.ExitStation:
                TicketDAL.UpdateES(IntermediateStationDAL.GetAllIntermediateStations()[newVId].Id_IntermediateStation, Id);
                break;

            case TicketConst.Price:
                TicketDAL.UpdatePrice(int.Parse(newValue), Id);
                break;

            case TicketConst.CarriageType:
                TicketDAL.UpdateType(CarriageTypeDAL.GetAllCarriageTypes()[newVId].Id_CarriageType, Id);
                break;

            case TicketConst.PlaseNumber:
                TicketDAL.UpdatePlaseNumber(int.Parse(newValue), Id);
                break;
            }
        }
 private void FillingIntermediateStations()
 {
     foreach (IntermediateStation i in IntermediateStationDAL.GetAllIntermediateStations())
     {
         cbNew.Items.Add(StationDAL.GetStationByIntermediateStation(i.Id_IntermediateStation).Name);
     }
 }
Пример #3
0
 private void IntermediateStationsFilling()
 {
     foreach (IntermediateStation i in IntermediateStationDAL.GetAllIntermediateStations())
     {
         cbTicDS.Items.Add(StationDAL.GetStationByIntermediateStation(i.Id_IntermediateStation).Name);
         cbTicAS.Items.Add(StationDAL.GetStationByIntermediateStation(i.Id_IntermediateStation).Name);
     }
     cbTicDS.SelectedIndex = cbTicAS.SelectedIndex = 0;
 }
Пример #4
0
 private bool TicketSearchByArrivalStation()
 {
     if (cbTicAS.SelectedIndex != 0)
     {
         dgvTickets.DataSource = TicketDAL.GetTicketsByAs(IntermediateStationDAL.GetIntermediateStationByName(cbTicAS.Text).Id_IntermediateStation);
         return(true);
     }
     return(false);
 }
Пример #5
0
 private bool TicketSearchByArrivalStationAndPrise()
 {
     if (cbTicAS.SelectedIndex != 0 && GetPrice() != null)
     {
         dgvTickets.DataSource = TicketDAL.GetTicketsByAsPrice(IntermediateStationDAL.GetIntermediateStationByName(cbTicAS.Text).Id_IntermediateStation, GetPrice());
         return(true);
     }
     return(false);
 }
Пример #6
0
 private void btnISAddStation_Click(object sender, EventArgs e)
 {
     if (btnISAddStation.Text == "Добавить")
     {
         AddStation();
     }
     else
     {
         dgvIS.DataSource = IntermediateStationDAL.GetIntermediateStationsByTrip(Id_Trip);
     }
 }
Пример #7
0
        private void InsertTicket()
        {
            int price    = int.Parse(tbPrice.Text);
            int FIO      = PassengerDAL.GetAllPassengers()[cbFIO.SelectedIndex].Id_Passenger;
            int trip     = int.Parse(cbNumTrip.Text);
            int dSt      = IntermediateStationDAL.GetIntermediateStationByName(cbDS.Text).Id_IntermediateStation;
            int aSt      = IntermediateStationDAL.GetIntermediateStationByName(cbAS.Text).Id_IntermediateStation;
            int type     = CarriageTypeDAL.GetCarriageTypeByType(cbType.Text).Id_CarriageType;
            int plaseNum = int.Parse(nPlase.Value.ToString());

            TicketDAL.Insert(price, FIO, trip, dSt, aSt, type, plaseNum);
        }
Пример #8
0
        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);;
        }