private void loadBookingGridData() { string sql = "SELECT booking.bid,airplane.acompany, airplane.take_of_time, airplane.landing_time, airplane.totalTime, schedule.sdate, route.take_of_place, route.landing_place " + "from booking inner join airplane inner join schedule inner join seat inner join route inner join seattype " + "on booking.airplane_id = airplane.airplane_id and booking.seat_id = seat.seat_id and " + "seat.seattype_id = seattype.seattype_id and seattype.seattype_name ='" + stype + "' and seat.status = 'free' and " + "booking.sid = schedule.sid and schedule.rid = route.rid and route.rid = " + rid + " and schedule.sdate = '" + DDate + "'; "; comm = new MySqlCommand(sql, con); DataSet ds = new DataSet(); MySqlDataAdapter da = new MySqlDataAdapter(comm); da.Fill(ds, "booking"); BookingGrid.DataSource = ds.Tables["booking"].DefaultView; BookingGrid.Columns[0].HeaderText = "Booking ID"; BookingGrid.Columns[1].HeaderText = "Company"; BookingGrid.Columns[2].HeaderText = "Depart\nTime"; BookingGrid.Columns[3].HeaderText = "Arrive In\nTime"; BookingGrid.Columns[4].HeaderText = "Total\nTime"; BookingGrid.Columns[5].HeaderText = "Date"; BookingGrid.Columns[6].HeaderText = "Depart\nPlace"; BookingGrid.Columns[7].HeaderText = "Arrive In\nPlace"; BookingGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; BookingGrid.AutoResizeColumns(); }
protected void LoadBooking() { myDAL obj = new myDAL(); if ((string)Session["sender"] == "Airline") { BookingGrid.DataSource = obj.getBookingsAir(); Session["sender"] = "null"; } if ((string)Session["sender"] == "Train") { BookingGrid.DataSource = obj.getBookingsTrain(); Session["sender"] = "null"; } if ((string)Session["sender"] == "Cinema") { BookingGrid.DataSource = obj.getBookingsCinema(); Session["sender"] = "null"; } BookingGrid.DataBind(); }