protected void Page_Load(object sender, EventArgs e) { AirportEntities airport = new AirportEntities(); Airoport.DataSource = (from Airoport in airport.Airoport select Airoport).ToList(); Airoport.DataBind(); Partition.DataSource = (from Partition in airport.Partition select Partition).ToList(); Partition.DataBind(); Boss.DataSource = (from Boss in airport.Boss select Boss).ToList(); Boss.DataBind(); Pilot.DataSource = (from Pilot in airport.Pilot select Pilot).ToList(); Pilot.DataBind(); Plane.DataSource = (from Plane in airport.Plane select Plane).ToList(); Plane.DataBind(); Flight.DataSource = (from Flight in airport.Flight select Flight).ToList(); Flight.DataBind(); FreightFlight.DataSource = (from FreightFlight in airport.FreightFlight select FreightFlight).ToList(); FreightFlight.DataBind(); CharterFlight.DataSource = (from CharterFlight in airport.CharterFlight select CharterFlight).ToList(); CharterFlight.DataBind(); PassengersFlight.DataSource = (from PassengersFlight in airport.PassengersFlight select PassengersFlight).ToList(); PassengersFlight.DataBind(); Passenger1.DataSource = (from Passenger1 in airport.Passenger1 select Passenger1).ToList(); Passenger1.DataBind(); }
protected void Butt_OnClick(object sender, EventArgs e) { if (ForPassport.Text != null && ForPassport.Text != "") { Passenger1 passeng = (from Passenger1 in airport.Passenger1.Include("PassengersFlight") where Passenger1.PassportNumber == ForPassport.Text select Passenger1).First(); DatGr.DataSource = (from flight in passeng.PassengersFlight select new { passeng.FirstName, passeng.LastName, passeng.PassportNumber, passeng.Sex, flight.FlightNumb }).ToList(); DatGr.DataBind(); } else { System.Threading.Thread.Sleep(2000); Subm.BackColor = System.Drawing.Color.Red; } }