public IQueryable <Location> ddlLocation_GetData() { var db = new AirlineTicketBookingDBContext(); var query = from location in db.Locations orderby location.City ascending select location; return(query); }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin"] == null) { Response.Redirect("../Login.aspx"); } if (!IsPostBack) { if (Request.QueryString["Id"] == null) { Response.Redirect("~/Pages/ListRoute.aspx"); } int id = int.Parse(Request.QueryString["Id"]); using (AirlineTicketBookingDBContext db = new AirlineTicketBookingDBContext()) { var route = db.Routes.Find(id); txtID.Text = route.Route_ID.ToString(); ddlOriginAirport.SelectedValue = route.Origin_Airport.ToString(); ddlDestinationAirport.SelectedValue = route.Destination_Airport.ToString(); txtDistance.Text = route.Distance.ToString(); ViewState["Id"] = route.Route_ID; } } }
public IQueryable <TravelClass> GetTravelClasss() { var db = new AirlineTicketBookingDBContext(); var query = from travelclass in db.TravelClasses orderby travelclass.Travel_Class_ID select travelclass; return(query); }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin"] == null) { Response.Redirect("../Login.aspx"); } if (!IsPostBack) { if (Request.QueryString["Id"] == null) { Response.Redirect("~/Pages/ListPassenger.aspx"); } int id = int.Parse(Request.QueryString["Id"]); using (AirlineTicketBookingDBContext db = new AirlineTicketBookingDBContext()) { var passenger = db.Passengers.Find(id); txtName.Text = passenger.FullName; txtAge.Text = passenger.Age.ToString(); ddlGender.SelectedValue = passenger.Gender.ToString(); txtEmail.Text = passenger.Email; txtStreet.Text = passenger.Street; txtCity.Text = passenger.Location_City; ViewState["Id"] = id; } } }
protected void btnSave_Click(object sender, EventArgs e) { string fullName = txtName.Text; int age = int.Parse(txtAge.Text); bool gender = bool.Parse(ddlGender.SelectedValue); int tel = int.Parse(txtTel.Text); string email = txtEmail.Text; string street = txtStreet.Text; string city = txtCity.Text; using (AirlineTicketBookingDBContext db = new AirlineTicketBookingDBContext()) { var passenger = new Passenger() { FullName = fullName, Gender = gender, Tel = tel, Age = age, Email = email, Location_City = city, Street = street }; db.Passengers.Add(passenger); db.SaveChanges(); Response.Redirect("~/Pages/ListPassenger.aspx"); } }
public IQueryable <Location> GetLocation() { var db = new AirlineTicketBookingDBContext(); var query = from location in db.Locations orderby location.City select location; return(query); }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin"] == null) { Response.Redirect("../Login.aspx"); } if (!IsPostBack) { if (Request.QueryString["Id"] == null) { Response.Redirect("~/Pages/ListAirport.aspx"); } int id = int.Parse(Request.QueryString["Id"]); using (AirlineTicketBookingDBContext db = new AirlineTicketBookingDBContext()) { var airport = db.Airports.Find(id); txtID.Text = airport.Airport_ID.ToString(); txtName.Text = airport.Airport_Name.ToString(); ddlLocation.SelectedValue = airport.Location_City; ViewState["Id"] = airport.Airport_ID; } } }
public static User GetCurrentUser(String userName) { using (AirlineTicketBookingDBContext db = new AirlineTicketBookingDBContext()) { return(db.Users.Find(userName)); } }
private List <Flight> ListFlightArrival(String arrivalTime, String original, String destination) { List <int> originalAp = LoadAirport(original); List <int> destinationAp = LoadAirport(destination); List <int> routes = LoadRoad(originalAp, destinationAp); List <Flight> flights; using (var db = new AirlineTicketBookingDBContext()) { if (arrivalTime.Length != 0) { DateTime depart = Convert.ToDateTime(arrivalTime); var query = from d in db.Flights where routes.Contains((int)d.Route_ID) && depart == ((DateTime)d.Arrival_DateTime).Date select d; flights = query.ToList(); } else { var query = from d in db.Flights where routes.Contains((int)d.Route_ID) select d; flights = query.ToList(); } } return(flights); }
protected void btnSave_Click(object sender, EventArgs e) { int id = int.Parse(ViewState["Id"].ToString()); string fullName = txtName.Text; int age = int.Parse(txtAge.Text); bool gender = bool.Parse(ddlGender.SelectedValue); int tel = int.Parse(txtTel.Text); string email = txtEmail.Text; string street = txtStreet.Text; string city = txtCity.Text; using (AirlineTicketBookingDBContext db = new AirlineTicketBookingDBContext()) { var passenger = db.Passengers.Find(id); if (passenger != null) { passenger.FullName = fullName; passenger.Age = age; passenger.Email = email; passenger.Gender = gender; passenger.Tel = tel; passenger.Street = street; passenger.Location_City = city; db.SaveChanges(); } Response.Redirect("~/Pages/ListPassenger.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin"] == null) { Response.Redirect("../Login.aspx"); } if (!IsPostBack) { String id = Request.QueryString["Id"]; String[] param = id.Split(','); int airplane_ID = int.Parse(param[0]); int seat_No = int.Parse(param[1]); using (AirlineTicketBookingDBContext db = new AirlineTicketBookingDBContext()) { var airplaneSeat = db.AirplaneSeats.Find(airplane_ID, seat_No); txtAirplaneID.Text = airplaneSeat.Airplane_ID.ToString(); txtSeatNo.Text = airplaneSeat.Seat_No.ToString(); DisplayTravelClasses(airplaneSeat.Travel_Class_ID); ViewState["Id"] = id; } } }
public IQueryable <Airplane> GetAirplanes() { var db = new AirlineTicketBookingDBContext(); var query = from airplane in db.Airplanes orderby airplane.Airplane_ID select airplane; return(query); }
public IQueryable <Airport> ddlAirport_GetData() { var db = new AirlineTicketBookingDBContext(); var query = from airport in db.Airports select airport; return(query); }
protected void LogIn(object sender, EventArgs e) { if (IsValid) { String userName = txtUserName.Text; String password = txtPassword.Text; using (AirlineTicketBookingDBContext db = new AirlineTicketBookingDBContext()) { Admin user = db.Admins.Find(userName); if (user == null) { lblError.Text = "Username does not exist"; } else if (user.password != password) { lblError.Text = "Incorrect password"; } else { Session["admin"] = userName; Response.Redirect("Default.aspx"); } } } }
public IQueryable <Route> GetRoutes() { var db = new AirlineTicketBookingDBContext(); var query = from route in db.Routes orderby route.Route_ID select route; return(query); }
public IQueryable <Producer> GetProducers() { var db = new AirlineTicketBookingDBContext(); var query = from producer in db.Producers orderby producer.Producer_ID select producer; return(query); }
public void DisplayData() { var db = new AirlineTicketBookingDBContext(); var query = from user in db.Users select user; grvUser.DataSource = query.ToList(); grvUser.DataBind(); }
public void DisplayData() { var db = new AirlineTicketBookingDBContext(); var query = from producer in db.Producers select producer; grdProducers.DataSource = query.ToList(); grdProducers.DataBind(); }
public void DisplayData() { var db = new AirlineTicketBookingDBContext(); var query = from airport in db.Airports orderby airport.Airport_ID select airport; grvAirports.DataSource = query.ToList(); grvAirports.DataBind(); }
public void DisplayData() { var db = new AirlineTicketBookingDBContext(); var query = from d in db.Payments select d; grvBooking.DataSource = query.ToList(); grvBooking.DataBind(); }
protected double getBlance() { using (var db = new AirlineTicketBookingDBContext()) { User user = db.Users.Find(Session["username"]); return((double)user.Wallet); } }
public void DisplayData() { var db = new AirlineTicketBookingDBContext(); var query = from ticket in db.Tickets orderby ticket.Ticket_ID ascending select ticket; grdTickets.DataSource = query.ToList(); grdTickets.DataBind(); }
public void DisplayData() { var db = new AirlineTicketBookingDBContext(); var query = from passenger in db.Passengers orderby passenger.PassengerID ascending select passenger; grvPassenger.DataSource = query.ToList(); grvPassenger.DataBind(); }
public void DisplayData() { var db = new AirlineTicketBookingDBContext(); var query = from travelclass in db.TravelClasses orderby travelclass.Travel_Class_ID ascending select travelclass; grdTravelClasses.DataSource = query.ToList(); grdTravelClasses.DataBind(); }
public void DisplayData() { var db = new AirlineTicketBookingDBContext(); var query = from flight in db.Flights orderby flight.Flight_No ascending select flight; grdFlights.DataSource = query.ToList(); grdFlights.DataBind(); }
public void DisplayData() { var db = new AirlineTicketBookingDBContext(); var query = from airplane in db.Airplanes orderby airplane.Airplane_ID ascending select airplane; grdAirplanes.DataSource = query.ToList(); grdAirplanes.DataBind(); }
protected void checkExist(object source, ServerValidateEventArgs args) { string stringID = args.Value; int id = int.Parse(stringID); var db = new AirlineTicketBookingDBContext(); var airport = db.Airports.Find(id); args.IsValid = (airport == null); }
public void DisplayAirplanes(int?airplane_ID) { using (var db = new AirlineTicketBookingDBContext()) { var airplanes = (from airplane in db.Airplanes select airplane).ToList(); drpAirplane.DataSource = airplanes; drpAirplane.DataBind(); } drpAirplane.SelectedValue = airplane_ID.ToString(); }
public void DisplayRoutes(int?route_ID) { using (var db = new AirlineTicketBookingDBContext()) { var routes = (from route in db.Routes select route).ToList(); drpRoute.DataSource = routes; drpRoute.DataBind(); } drpRoute.SelectedValue = route_ID.ToString(); }
public void DisplaySeats(int?airplane_ID) { drpSeatNo.Items.Clear(); using (var db = new AirlineTicketBookingDBContext()) { var seats = (from seat in db.AirplaneSeats where seat.Airplane_ID == airplane_ID orderby seat.Seat_No select seat).ToList(); drpSeatNo.DataSource = seats; drpSeatNo.DataBind(); } }