예제 #1
0
 private void btnTicketSearch_Click(object sender, EventArgs e)
 {
     if (TicketSearchByDepartureStationAndArrivalStationAndPrise())
     {
         return;
     }
     if (TicketSearchByDepartureStationAndArrivalStation())
     {
         return;
     }
     if (TicketSearchByDepartureStationAndPrice())
     {
         return;
     }
     if (TicketSearchByArrivalStationAndPrise())
     {
         return;
     }
     if (TicketSearchByArrivalStation())
     {
         return;
     }
     if (TicketSearchByDepartureStation())
     {
         return;
     }
     if (TicketSearchByPrise())
     {
         return;
     }
     dgvTickets.DataSource = TicketDAL.GetAllTickets();
 }
        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;
            }
        }
예제 #3
0
 private void TicketsFilling()
 {
     foreach (Ticket tic in TicketDAL.GetAllTickets())
     {
         cbTicPrice.Items.Add(tic.Price);
     }
     cbTicPrice.SelectedIndex = 0;
 }
예제 #4
0
 private bool TicketSearchByPrise()
 {
     if (GetPrice() != null)
     {
         dgvTickets.DataSource = TicketDAL.GetTicketsByPrice(GetPrice());
         return(true);
     }
     return(false);
 }
예제 #5
0
 private bool TicketSearchByArrivalStation()
 {
     if (cbTicAS.SelectedIndex != 0)
     {
         dgvTickets.DataSource = TicketDAL.GetTicketsByAs(IntermediateStationDAL.GetIntermediateStationByName(cbTicAS.Text).Id_IntermediateStation);
         return(true);
     }
     return(false);
 }
예제 #6
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);
 }
예제 #7
0
        private void btnTicketAdd_Click(object sender, EventArgs e)
        {
            fmAddTicket f = new fmAddTicket();

            if (f.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show("Строка добавлена");
                dgvTickets.DataSource = TicketDAL.GetAllTickets();
            }
        }
예제 #8
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);
        }
예제 #9
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();
 }
예제 #10
0
        private void btnChange_Click(object sender, EventArgs e)
        {
            string         type  = dgvTickets.SelectedCells[0].OwningColumn.Name;
            string         value = dgvTickets.SelectedCells[0].Value.ToString();
            int            id    = (dgvTickets.SelectedCells[0].OwningRow.DataBoundItem as Ticket).Id_Ticket;
            fmChangeTicket f     = new fmChangeTicket(type, value, id);

            f.Text = dgvTickets.SelectedCells[0].OwningColumn.HeaderText;
            if (f.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show("Значение изменено");
                dgvTickets.DataSource = TicketDAL.GetAllTickets();
            }
        }
예제 #11
0
 private void btnTicketDel_Click(object sender, EventArgs e)
 {
     TicketDAL.Delete((dgvTickets.SelectedCells[0].OwningRow.DataBoundItem as Ticket).Id_Ticket);
     dgvTickets.DataSource = TicketDAL.GetAllTickets();
     MessageBox.Show("Строка удалена");
 }