private void VisibleTypeCarriage() { btnRTAdd.Enabled = false; btnDel.Enabled = false; dgvRT.Columns[2].Visible = false; dgvRT.Columns[3].Visible = false; dgvRT.Columns[0].DataPropertyName = "Type"; dgvRT.Columns[1].DataPropertyName = "PlasesCount"; dgvRT.Columns[0].Name = "Type"; dgvRT.Columns[1].Name = "PlasesCount"; lbRTSurname.Visible = false; tbRTSurname.Visible = false; tbRTName.Visible = false; lbRTName.Visible = false; lbRTPatronymic.Visible = false; tbRTPatronymic.Visible = false; lbRTPassport.Visible = false; tbRTPassport.Visible = false; dgvRT.Columns[0].HeaderText = "Тип вагона"; dgvRT.Columns[0].Name = "Type"; dgvRT.Columns[1].HeaderText = "Количество мест в вагоне"; dgvRT.Columns[1].Name = "PlasesCount"; dgvRT.Columns[1].Visible = true; dgvRT.DataSource = CarriageTypeDAL.GetAllCarriageTypes(); }
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 FillingCarriageTypes() { foreach (CarriageType tr in CarriageTypeDAL.GetAllCarriageTypes()) { cbNew.Items.Add(tr.Type); } }
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 static List <Trip_Carriage> GetTrip_CarriageListFromDataReader(SqlDataReader reader) { List <Trip_Carriage> result = new List <Trip_Carriage>(); while (reader.Read()) { Trip_Carriage t = new Trip_Carriage() { Id_Trip = reader.GetInt32(1), Type = CarriageTypeDAL.GetCarriageTypeById(reader.GetInt32(0)).Type, Id_CarriageType = reader.GetInt32(0), Count = reader.GetInt32(2) }; result.Add(t); } return(result); }
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 DelCarriageType(int id) { CarriageTypeDAL.Delete(id); dgvRT.DataSource = CarriageTypeDAL.GetAllCarriageTypes(); }