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 AddPassenger() { if (String.IsNullOrEmpty(tbRTSurname.Text)) { MessageBox.Show("Введите фамилию!"); return; } if (String.IsNullOrEmpty(tbRTName.Text)) { MessageBox.Show("Введите имя!"); return; } if (String.IsNullOrEmpty(tbRTPatronymic.Text)) { MessageBox.Show("Введите отчество!"); return; } if (String.IsNullOrEmpty(tbRTPassport.Text)) { MessageBox.Show("Введите серию и номер паспорта через пробел!"); return; } string surname = tbRTSurname.Text; string name = tbRTName.Text; string patronymic = tbRTPatronymic.Text; string passport = tbRTPassport.Text; PassengerDAL.Insert(surname, name, patronymic, passport); dgvRT.DataSource = PassengerDAL.GetAllPassengers(); ClearText(); }
private void FillingPassengers() { foreach (Passenger pas in PassengerDAL.GetAllPassengers()) { cbNew.Items.Add(pas.Surname.Trim(' ') + ' ' + pas.Name[0] + '.' + pas.Patronymic[0] + '.'); } }
private void VisiblePassengers() { dgvRT.Columns[3].DataPropertyName = "Passport"; dgvRT.Columns[3].Name = "Passport"; lbRTPassport.Text = "Паспортные данные"; dgvRT.Columns[3].HeaderText = "Паспортные данные"; dgvRT.DataSource = PassengerDAL.GetAllPassengers(); }
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); }
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 updatePassenger() { string type = dgvRT.SelectedCells[0].OwningColumn.Name; string value = dgvRT.SelectedCells[0].Value.ToString(); int id = (dgvRT.SelectedCells[0].OwningRow.DataBoundItem as Passenger).Id_Passenger; Type typeTable = dgvRT.SelectedCells[0].OwningRow.DataBoundItem.GetType(); fmChangeValueRT f = new fmChangeValueRT(type, value, id, typeTable); f.Text = dgvRT.SelectedCells[0].OwningColumn.HeaderText; if (f.ShowDialog() == DialogResult.OK) { MessageBox.Show("Значение изменено"); dgvRT.DataSource = PassengerDAL.GetAllPassengers(); } }
private void UpdatePassenger(string newValue) { switch (Type) { case PassengerConst.Surname: PassengerDAL.UpdateSurname(newValue, Id); break; case PassengerConst.Name: PassengerDAL.UpdateName(newValue, Id); break; case PassengerConst.Patronymic: PassengerDAL.UpdatePatronymic(newValue, Id); break; case PassengerConst.Passport: PassengerDAL.UpdatePassport(newValue, Id); break; } }
private static List <Ticket> GetTicketsListFromDataReader(SqlDataReader reader) { List <Ticket> result = new List <Ticket>(); while (reader.Read()) { Ticket t = new Ticket() { Id_Ticket = reader.GetInt32(0), Passenger = PassengerDAL.GetPassengerById(reader.GetInt32(2)).Surname.Trim(' ') + ' ' + PassengerDAL.GetPassengerById(reader.GetInt32(2)).Name[0] + '.' + PassengerDAL.GetPassengerById(reader.GetInt32(2)).Patronymic[0] + '.', Id_id_Trip = reader.GetInt32(3), LandingStation = StationDAL.GetStationByIntermediateStation(reader.GetInt32(4)).Name, ExitStation = StationDAL.GetStationByIntermediateStation(reader.GetInt32(5)).Name, CarriageType = CarriageTypeDAL.GetCarriageTypeById(reader.GetInt32(6)).Type, PlaseNumber = reader.GetInt32(7), Price = reader.GetInt32(1), }; result.Add(t); } return(result); }
private void DelPassenger(int id) { PassengerDAL.Delete(id); dgvRT.DataSource = PassengerDAL.GetAllPassengers(); }