def insertPlane(): modelCode = request.form.get('modelCode') constructionDay = request.form.get('constructionDay') Model = PlaneModel.SelectPlaneModelsID(modelCode) plane = Plane("NULL", Model, constructionDay) plane.InsertPlane() return redirect('/plane')
def editPlane(): idPlane = request.form.get('idPlane') modelCode = request.form.get('modelCode') constructionDay = request.form.get('constructionDay') Model = PlaneModel.SelectPlaneModelsID(modelCode) plane = Plane.SelectPlaneID(idPlane) plane.UpdatePlane(Model, constructionDay) return redirect('/plane')
def GetFlight(dic): Database = DB() planeCursor = Database.run("SELECT * FROM Plane WHERE idPlane = %s;", str(dic["idPlane"])) planeDict = planeCursor.fetchone() tmpPlane = ClassPlane.GetPlane(planeDict) Plane = ClassPlane(tmpPlane[0], tmpPlane[1], tmpPlane[2]) return dic["idFlight"], dic["departure"], dic["arrival"], Plane, dic["flightDepartureDatetime"],\ dic["flightArrivalDatetime"], dic["percentDiscount"]
def insertFlight(): departure = request.form.get('departure') arrival = request.form.get('arrival') idPlane = request.form.get('idPlane') flightDepartureDatetime = request.form.get('flightDepartureDatetime') flightArrivalDatetime = request.form.get('flightArrivalDatetime') percentDiscount = request.form.get('percentDiscount') plane = Plane.SelectPlaneID(idPlane) flight = Flight("NULL", departure, arrival, plane, flightDepartureDatetime, flightArrivalDatetime, percentDiscount) flight.InsertFlight() return redirect('/flight')
def editFlight(): idFlight = request.form.get('idFlight') departure = request.form.get('departure') arrival = request.form.get('arrival') idPlane = request.form.get('idPlane') flightDepartureDatetime = request.form.get('flightDepartureDatetime') flightArrivalDatetime = request.form.get('flightArrivalDatetime') percentDiscount = request.form.get('percentDiscount') plane = Plane.SelectPlaneID(idPlane) flight = Flight.SelectFlightsID(idFlight) flight.UpdateFlight(departure, arrival, plane, flightDepartureDatetime, flightArrivalDatetime, percentDiscount) return redirect('/flight')
def deltePlane(): idPlane = request.args.get('idPlane') Plane.DeletePlane(idPlane) return redirect('/plane')
def plane(): listaPlane = Plane.SelectPlanes() return render_template('Plane.html', listaPlane=listaPlane)