public GridEditAirplane(FlightService.Airplane airplane)
 {
     InitializeComponent();
     _fService      = new FlightServiceClient();
     this._airplane = airplane;
     InsertAirplaneData();
 }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FlightServiceClient fService = new FlightServiceClient();

        repAirport.DataSource = fService.GetAllAirports();
        repAirport.DataBind();
    }
 public GridEditAirport(FlightService.Airport airport)
 {
     InitializeComponent();
     _fService = new FlightServiceClient();
     _airport  = airport;
     InsertAirportData();
 }
示例#4
0
 public GridEditCustomer(FlightService.Person person)
 {
     InitializeComponent();
     _fService    = new FlightServiceClient();
     this._person = person;
     InsertCustomerData();
 }
示例#5
0
        private void CheckFlightStatus()
        {
            var flightService  = new FlightServiceClient();
            var bookingService = new BookingServiceClient();

            try {
                Log("start cycles");

                flightService.CheckFlightStatuses(
                    DateTime.UtcNow.Date,
                    DateTime.UtcNow.Date.AddDays(1),
                    DefaultUserId
                    );

                Log("check flight status finished");

                bookingService.SimulateBookings(
                    DateTime.UtcNow.Date,
                    DateTime.UtcNow.Date.AddDays(1),
                    DefaultUserId
                    );

                Log("simulate bookings finished");
            } catch (Exception ex) {
                Error(ex);
            } finally {
                flightService.Close();
            }
        }
示例#6
0
 public GridEditFlight(FlightService.Flight flight)
 {
     InitializeComponent();
     _fService = new FlightServiceClient();
     _flight   = flight;
     InitComboBox();
 }
示例#7
0
        public AirlineSectionTest(WebApplicationFactory <Startup> factory)
            : base(factory)
        {
            var flightsClient = new FlightServiceClient(_flightsHttpClient);

            section = flightsClient.AirlineSection;
        }
示例#8
0
        public GridSaveBooking(FlightService.Person customer, FlightService.Airport @from, FlightService.Airport to, string date, int noOfPass, List <FlightService.Flight> flights)
        {
            InitializeComponent();
            _fService      = new FlightServiceClient();
            _passengerList = new List <FlightService.Person> {
                customer
            };
            _from     = @from;
            _to       = to;
            _date     = date;
            _noOfPass = noOfPass;
            _flights  = flights;
            InitializeTxtboxes();
            InitializeGridData();

            btnNewBooking.Visibility = Visibility.Hidden;

            if (_passengerList.Count < noOfPass)
            {
                contentControl.Content = new GridAddPassenger(this);
            }
            else
            {
                contentControl.Content = null;
                btnCreate.Visibility   = Visibility.Visible;
            }
        }
 public TabBookingList()
 {
     InitializeComponent();
     _fService = new FlightServiceClient();
     LoadGridData();
     ActionBar.RefreshClick += new RoutedEventHandler(RefreshClick);
     ActionBar.AddClick     += new RoutedEventHandler(AddClick);
 }
        public FlightDetails()
        {
            InitializeComponent();
            DataContext = new FlightDetailsViewModel();

            var client = new FlightServiceClient();

            flightDataGrid.ItemsSource = client.RetrieveAvailableFlightInformation();
        }
示例#11
0
 public TabBooking()
 {
     InitializeComponent();
     _fService = new FlightServiceClient();
     InitializeComboboxes();
     dpDate.SelectedDate     = DateTime.Now;
     dpDate.DisplayDateStart = DateTime.Now;
     dpDate.DisplayDateEnd   = new DateTime(2015, 2, 28);
     txtNoOfPass.Text        = "1";
 }
    protected void btnBook_Click(object sender, EventArgs e)
    {
        bool extraPassResult = true;
        var  passList        = new List <FlightServiceReference.Person>();
        var  fService        = new FlightServiceClient();

        if (txtFName != null && txtLName != null && txtAddress != null && txtEmail != null && txtPhoneNo != null)
        {
            //foreach (Control ctl in otherPassengers.Controls)
            //{
            //    if (ctl is UserControls_AddPassenger)
            //    {
            //        UserControls_AddPassenger p = (UserControls_AddPassenger) ctl;
            //        if (p.GetFName() != null && p.GetLName() != null)
            //        {
            //            passList.Add(fService.CreateNewPersonBooking(p.GetFName(), p.GetLName()));
            //        }
            //        else
            //        {
            //            //TODO Fejl besked, det må ikke være null
            //            extraPassResult = false;
            //        }

            //    }
            //}

            if (extraPassResult)
            {
                passList.Add(fService.CreateNewPersonBookingFull(txtFName.Text, txtLName.Text, ddlGender.SelectedValue,
                                                                 txtAddress.Text,
                                                                 txtPhoneNo.Text, txtEmail.Text));
                var route = AppSession.BHelper.route;

                var    fl        = route.Select(f => f.flightID).ToArray();
                var    pl        = passList.ToArray();
                string totalCost = (from f in route
                                    select f.price).Sum().ToString();
                string totalTime = (from f in AppSession.BHelper.route
                                    select f.traveltime).Sum().ToString();

                if (fService.CreateNewBooking(fl, pl, totalTime, Double.Parse(totalCost)))
                {
                    Response.Redirect("~/BookingSuccess.aspx");
                }
                else
                {
                    //Fejl
                }
            }
            else
            {
                //fejl
            }
        }
    }
 public TabAirport()
 {
     InitializeComponent();
     ContentControlTitle.Content = _addTitle;
     contentControl.Content      = _gridAddAirport;
     _fService = new FlightServiceClient();
     LoadGridData();
     ActionBar.RefreshClick += new RoutedEventHandler(RefreshClick);
     ActionBar.AddClick     += new RoutedEventHandler(AddClick);
     //ActionBar.DeleteClick += new RoutedEventHandler(DeleteClick);
 }
 public TabFlight()
 {
     InitializeComponent();
     ContentControlTitle.Content   = _addTitle;
     ContentControlAddEdit.Content = _gridAddFlight;
     _fService = new FlightServiceClient();
     LoadGridData(DateTime.Now);
     ActionBar.RefreshClick += new RoutedEventHandler(RefreshClick);
     ActionBar.AddClick     += new RoutedEventHandler(AddClick);
     //ActionBar.DeleteClick += new RoutedEventHandler(DeleteClick);
 }
        public GridFlightRoutes(FlightService.Person customer, FlightService.Airport @from, FlightService.Airport to, string date, int noOfPass)
        {
            InitializeComponent();
            _fService = new FlightServiceClient();
            _customer = customer;
            _from     = @from;
            _to       = to;
            _date     = date;
            _noOfPass = noOfPass;

            InitializeGridData();
        }
        public FlightFilter()
        {
            InitializeComponent();

            using (FlightServiceClient fsc = new FlightServiceClient())
            {
                foreach (string s in fsc.getCountries())
                {
                    cb_a_land.Items.Add(s);
                    cb_v_land.Items.Add(s);
                }

                foreach (string s in fsc.getAirPlaneClasses())
                    cb_klasse.Items.Add(s);
            }
        }
        public FlightBook(Flight f)
        {
            InitializeComponent();

            this.selectedFlight = f;

            tb_vid.Text = f.flightID + "";

            using (FlightServiceClient fsc = new FlightServiceClient())
            {
                foreach (string s in fsc.getAirPlaneClasses())
                    cb_klasse.Items.Add(s);

                cb_klasse.SelectedIndex = 0;
            }
        }
示例#18
0
        public void CheckFlightStatuses()
        {
            FlightServiceClient flightService = new FlightServiceClient();

            try {
                flightService.CheckFlightStatuses(
                    DateTime.UtcNow.Date,
                    DateTime.UtcNow.Date.AddDays(1),
                    DefaultUserId
                    );
            } catch (Exception ex) {
                Assert.Fail(message: $"Failed to Check Flight Statuses, message: {ex.Message}");
            } finally {
                flightService.Close();
            }
        }
示例#19
0
        public ActionResult FlightEdit(System.Guid flightId)
        {
            ViewBag.FlightId = flightId;

            FlightContract flightContract =
                new FlightServiceClient().GetFlight(
                    flightId,
                    Logging.UserId(User.Identity, ViewBag)
                    );

            ViewBag.AirlineId =
                new SelectList(new CrudeAirlineServiceClient().FetchAll(),
                               "AirlineId",
                               "AirlineName",
                               flightContract.Flight.AirlineId
                               );

            ViewBag.AircraftTypeRcd =
                new SelectList(new CrudeAircraftTypeRefServiceClient().FetchAll(),
                               "AircraftTypeRcd",
                               "AircraftTypeName",
                               flightContract.Flight.AircraftTypeRcd
                               );

            ViewBag.DepartureAirportId =
                new SelectList(new CrudeAirportServiceClient().FetchAll(),
                               "AirportId",
                               "AirportName",
                               flightContract.Flight.DepartureAirportId
                               );

            ViewBag.ArrivalAirportId =
                new SelectList(new CrudeAirportServiceClient().FetchAll(),
                               "AirportId",
                               "AirportName",
                               flightContract.Flight.ArrivalAirportId
                               );

            ViewBag.DefaultUserName =
                new CrudeDefaultUserServiceClient().FetchByDefaultUserId(flightContract.Flight.UserId).DefaultUserName;

            return(View(
                       MVCHelper.Resolve(Request, "Flight", "FlightEdit"),
                       flightContract
                       ));
        }
示例#20
0
        public void SimulateBookings()
        {
            FlightServiceClient  flightService  = new FlightServiceClient();
            BookingServiceClient bookingService = new BookingServiceClient();

            try {
                bookingService.SimulateBookings(
                    DateTime.UtcNow.Date,
                    DateTime.UtcNow.Date.AddDays(1),
                    DefaultUserId
                    );
            } catch (Exception ex) {
                Assert.Fail(message: $"Failed to Simulate Bookings, message: {ex.Message}");
            } finally {
                bookingService.Close();
            }
        }
示例#21
0
        private void Add_Button_Click(object sender, RoutedEventArgs e)
        {
            Console.WriteLine(DepartureDateTime);

            Console.WriteLine(ArrivalDateTime);
            bool success = false;

            try
            {
                var planeDetail = (PlaneDetailDao)planeTypeCombobox.SelectedItem;

                var flightInfo = new FlightInfo()
                {
                    FlightNo           = FlightNoTextbox,
                    PlaneId            = planeDetail.PlaneId,
                    DepartureAirport   = DepartureAirportTextbox,
                    ArrivalAirport     = ArrivalAirportTextbox,
                    DepartureTime      = DepartureDateTime,
                    ArrivalTime        = ArrivalDateTime,
                    FirstClassPrice    = FirstClassPriceTextbox,
                    EconomyClassPrice  = EconomyClassPriceTextbox,
                    FirstClassCapacity = FirstClassCapacityTextbox,
                    EcoClassCapacity   = EconomyClassCapacityTextbox,
                    IsAvailable        = IsAvailable,
                };

                var flightServiceClient = new FlightServiceClient();
                success = flightServiceClient.InsertFlightInfo(flightInfo);
            }
            catch (Exception)
            {
            }


            if (success)
            {
                var flightDetails = new FlightDetails();
                NavigationService.Navigate(flightDetails);
            }
            else
            {
                ErrorDisplay.Text = "Cannot add flight information. Invalid input.";
            }
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Match mat = Regex.Match(tb_personen.Text, "[0-9]*");

            if (mat.Success)
            {
                using (FlightServiceClient fsc = new FlightServiceClient())
                {
                    Person p = new Person();

                    p.name = CommonMethods.loginUser.name;
                    p.lastName = CommonMethods.loginUser.lastname;
                    p.phone = CommonMethods.loginUser.telefoon;
                    p.email = CommonMethods.loginUser.email;

                    string bookid = fsc.bookFlight(selectedFlight.flightID, p,  Int32.Parse(tb_personen.Text), (string)cb_klasse.SelectedValue);

                    if (bookid.Equals(""))
                    {
                        tb_err.Foreground = Brushes.Red;
                        tb_err.Text = "Er is een error voorgekomen tijdens het boeken.";
                    }
                    else
                    {
                        OracleConnection oc = CommonMethods.GetConnection();
                        oc.Open();

                        OracleCommand ocmd = oc.CreateCommand();
                        ocmd.CommandText = String.Format("INSERT INTO BOOKING (IDENTIFIER, IDENTIFIER2,  TYPE, END_PERSOON) VALUES ('{0}', '{1}', '{2}', '{3}')",
                            bookid,
                            selectedFlight.flightID,
                            "flight",
                            CommonMethods.loginUser.id);
                        ocmd.ExecuteNonQuery();
                        oc.Close();

                        CommonMethods.GetFrame(this).Navigate(new ResultPage());
                    }
                }
            }
        }
        public ActionResult ProcessSearchFormInput(SearchForm model)
        {
            // this method works out what the search type is.
            // from here we can then work out how we do the search.

            // for now we are going to pretend it is a package search
            // this call will prep the search
            FlightServiceClient flightServiceClient = new FlightServiceClient();
            var flightSearchResult = flightServiceClient.StartSearch(new FlightSearch
            {
                IsPackage = true,
                SearchType = "Package"
            });

            // save this into session
            SessionService sessionService = new SessionService();
            sessionService.SetItem(SessionEnum.FlightSearch, flightSearchResult.FlightSearchId.ToString(), flightSearchResult);

            // this will change depending on the search type
            return Redirect("search/package-flight-wait/?id=" + flightSearchResult.FlightSearchId);
        }
        public ActionResult ProcessFlightSearch(FlightSearch flightSearch)
        {
            if (ModelState.IsValid)
            {
                // for now we are going to pretend it is a package search
                // this call will prep the search
                FlightServiceClient flightServiceClient = new FlightServiceClient();
                var flightSearchResult = flightServiceClient.StartSearch(flightSearch);

                // save this into session
                SessionService sessionService = new SessionService();
                sessionService.SetItem(SessionEnum.FlightSearch, flightSearchResult.FlightSearchId.ToString(), flightSearchResult);

                // this will change depending on the search type
                return Redirect("search/package-flight-wait/?id=" + flightSearchResult.FlightSearchId);
            }
            else
            {
                return View("flightSearch");
            }
        }
        public ActionResult ProcessFlightSearch(FlightSearch flightSearch)
        {
            if (ModelState.IsValid)
            {
                // for now we are going to pretend it is a package search
                // this call will prep the search
                FlightServiceClient flightServiceClient = new FlightServiceClient();
                var flightSearchResult = flightServiceClient.StartSearch(flightSearch);

                // save this into session
                SessionService sessionService = new SessionService();
                sessionService.SetItem(SessionEnum.FlightSearch, flightSearchResult.FlightSearchId.ToString(), flightSearchResult);

                // this will change depending on the search type
                return(Redirect("search/package-flight-wait/?id=" + flightSearchResult.FlightSearchId));
            }
            else
            {
                return(View("flightSearch"));
            }
        }
        private void LoadData(string depCountry, string depCity, string arrCountry, string arrCity, string depAirport, string arrAirport, DateTime startDate, DateTime endDate, string clas, int numPers)
        {
            using (FlightServiceClient fsc = new FlightServiceClient())
            {
                this.lastFlightResults = fsc.getFlights(depCountry, depCity, arrCountry, arrCity, depAirport, arrAirport, startDate, endDate, clas, numPers);

                if (this.lastFlightResults == null)
                {
                    textBlock1.Text = "Geen resultaten gevonden, probeer de filter aan te passen.";
                }
                else
                {
                    textBlock1.Text = this.lastFlightResults.Count() + " vluchten gevonden.";

                    foreach (Flight f in this.lastFlightResults)
                        listBox1.Items.Add(f.departureCountry + ", " + f.departureCity + " -> " + f.arrivalCountry + ", " + f.arrivalCity);

                    if (listBox1.Items.Count > 0)
                        listBox1.SelectedIndex = 0;
                }
            }
        }
        public ActionResult ProcessSearchFormInput(SearchForm model)
        {
            // this method works out what the search type is.
            // from here we can then work out how we do the search.

            // for now we are going to pretend it is a package search
            // this call will prep the search
            FlightServiceClient flightServiceClient = new FlightServiceClient();
            var flightSearchResult = flightServiceClient.StartSearch(new FlightSearch
            {
                IsPackage  = true,
                SearchType = "Package"
            });

            // save this into session
            SessionService sessionService = new SessionService();

            sessionService.SetItem(SessionEnum.FlightSearch, flightSearchResult.FlightSearchId.ToString(), flightSearchResult);

            // this will change depending on the search type
            return(Redirect("search/package-flight-wait/?id=" + flightSearchResult.FlightSearchId));
        }
        public BookingFlightInfo(ClientBooking b)
        {
            InitializeComponent();

            this.cb = b;
            using (FlightServiceClient fsc = new FlightServiceClient())
            {
               this.book = fsc.getBooking(Int32.Parse(b.bookingidentifier2), Int32.Parse(b.bookingidentifier));
               this.fl = fsc.getFlight(book.flightID);
            }

            tb_v_land.Text = fl.departureCountry;
            tb_v_stad.Text = fl.departureCity;
            tb_v_vliegveld.Text = fl.departureAirport;

            tb_a_land.Text = fl.arrivalCountry;
            tb_a_stad.Text = fl.arrivalCity;
            tb_a_vliegveld.Text = fl.arrivalAirport;

            tb_klasse.Text = book.classs;
            tb_personen.Text = book.numOfPersons + "";
            tb_dat.Text = fl.departureDate.ToString("dd-MM-yyyy");
        }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
            FlightServiceClient flightService = new FlightServiceClient();

            string fromAs = airportFrom.SelectedValue;
            string toAs   = airportTo.SelectedValue;
            //int noOfPass = Int32.Parse(txtNoOfPassengers.Text);

            if (dateBox.SelectedDate != null)
            {
                if (fromAs != toAs)
                {
                    string AirportFromID = fromAs;
                    string AirportToID   = toAs;
                    string DateString    = dateBox.SelectedDate.ToString().Substring(0, 10);
                    //string NoOfPassengers = noOfPass.ToString();

                    Response.Redirect("~/SearchResult.aspx?fromA=" + AirportFromID + "&toA=" + AirportToID + "&date=" +
                                      DateString);
                }
                else
                {
                    CompareValidator1.Text = "Luftehavne må ikke være ens";
                }
            }
        }

        catch (NullReferenceException err)
        {
        }
        catch (FormatException err)
        {
        }
    }
 private void cb_v_land_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     using (FlightServiceClient fsc = new FlightServiceClient())
     {
         cb_v_vliegveld.Items.Clear();
         foreach (string s in fsc.getAirports(cb_v_land.SelectedValue.ToString()))
             cb_v_vliegveld.Items.Add(s);
     }
 }
 public GridAddPassenger(GridSaveBooking grid)
 {
     InitializeComponent();
     _fService = new FlightServiceClient();
     _grid     = grid;
 }
 public GridAddCustomer()
 {
     InitializeComponent();
     _fService = new FlightServiceClient();
 }
 public GridAddAirplane()
 {
     InitializeComponent();
     _fService = new FlightServiceClient();
 }
示例#34
0
        private PlaneDetailDao[] GetAllAvailablePlanes()
        {
            var flightServiceClient = new FlightServiceClient();

            return(flightServiceClient.RetrieveAllPlaneInformation());
        }