public EditFlightPage(Flights_Table _currentFlight)
        {
            InitializeComponent();
            currentFlight = _currentFlight;
            Title         = currentFlight.AirlineName + "  " + currentFlight.FlightNumber;

            conn = DependencyService.Get <ITravelApp_db>().GetConnection();
        }
Ejemplo n.º 2
0
        public FlightInfoPage(Flights_Table currentFlight)
        {
            InitializeComponent();

            _currentFlight = currentFlight;

            Title = _currentFlight.AirlineName;

            conn = DependencyService.Get <ITravelApp_db>().GetConnection();
        }
Ejemplo n.º 3
0
        public FlightNotesPage(Flights_Table _currentFlight)
        {
            InitializeComponent();
            currentFlight = _currentFlight;
            conn          = DependencyService.Get <ITravelApp_db>().GetConnection();

            Title = $"{currentFlight.AirlineName}" + " " + $"{ currentFlight.FlightNumber}" + " Notes";

            courseNotesEditor.Text = $"{currentFlight.FlightNotes}";
        }
Ejemplo n.º 4
0
        private async void SaveButton_Clicked(object sender, EventArgs e)
        {
            string dDate1 = departDatePicker.Date.ToString("MM/dd/yyyy");
            string dDate2 = DateTime.Today.Add(departTimePicker.Time).ToString(departTimePicker.Format);

            DateTime dDate3 = Convert.ToDateTime(dDate1 + " " + dDate2);

            string   aDate1 = arriveDatePicker.Date.ToString("MM/dd/yyyy");
            string   aDate2 = DateTime.Today.Add(arriveTimePicker.Time).ToString(arriveTimePicker.Format);
            DateTime aDate3 = Convert.ToDateTime(aDate1 + " " + aDate2);


            var newFlightInfo = new Flights_Table();

            newFlightInfo.AirlineName         = airlineNameEntry.Text;
            newFlightInfo.FlightNumber        = flightNumberEntry.Text;
            newFlightInfo.DepartGate          = departGateEntry.Text;
            newFlightInfo.DepartLocation      = departLocEntry.Text;
            newFlightInfo.DepartTime          = dDate3;
            newFlightInfo.ArriveLocation      = arriveLocEntry.Text;
            newFlightInfo.ArriveTime          = aDate3;
            newFlightInfo.FlightNotifications = notificationSwitch.IsToggled == true ? 1 : 0;
            newFlightInfo.TripId = currentTrip.TripId;

            if ((UserHelper.IsNull(airlineNameEntry.Text) || UserHelper.IsNull(flightNumberEntry.Text)))
            {
                if (newFlightInfo.DepartLocation.Length <= 3 || newFlightInfo.ArriveLocation.Length <= 3)
                {
                    if (newFlightInfo.DepartTime <= newFlightInfo.ArriveTime)
                    {
                        conn.Insert(newFlightInfo);
                        await DisplayAlert("Notice", "Flight added!", "Ok");

                        await Navigation.PopModalAsync();
                    }
                    else
                    {
                        await DisplayAlert("Warning", "Arrival Date and Time cannot be before Departure Date and Time", "Ok");
                    }
                }
                else
                {
                    await DisplayAlert("Warning", "Airport code may only contain 3 letters", "Ok");
                }
            }
            else
            {
                await DisplayAlert("Warning", "Airline Name and Flight Number are required", "Ok");
            }
        }
 private async void Flight_Tapped(object sender, ItemTappedEventArgs e)
 {
     Flights_Table currentFlight = (Flights_Table)e.Item;
     await Navigation.PushAsync(new FlightInfoPage(currentFlight));
 }
        public MainPage()
        {
            InitializeComponent();

            Title = "Welcome";

            conn = DependencyService.Get <ITravelApp_db>().GetConnection();

            NavigationPage.SetHasNavigationBar(this.Main, true);

            conn.CreateTable <Admin_Table>();
            conn.CreateTable <User_Table>();
            conn.CreateTable <Trips_Table>();
            conn.CreateTable <Flights_Table>();
            conn.CreateTable <Dining_Table>();
            conn.CreateTable <Entertainment_Table>();
            conn.CreateTable <Lodging_Table>();
            conn.CreateTable <Transportation_Table>();

            var _UserList = conn.Query <User_Table>($"SELECT * FROM User_Table");
            var adminList = conn.Query <Admin_Table>($"SELECT * FROM Admin_Table");

            if (!adminList.Any())
            {
                var admin = new Admin_Table();
                admin.AdminUserName = "******";
                admin.AdminPassword = "******";
                admin.AdminEmail    = "*****@*****.**";
                conn.Insert(admin);
                adminList.Add(admin);
            }

            if (!_UserList.Any())
            {
                #region User Data
                var newUser = new User_Table();
                newUser.UserName  = "******";
                newUser.Password  = "******";
                newUser.FirstName = "User";
                newUser.LastName  = "Test";
                newUser.UserEmail = "*****@*****.**";

                conn.Insert(newUser);
                _UserList.Add(newUser);

                var newUser1 = new User_Table();
                newUser1.UserName  = "******";
                newUser1.Password  = "******";
                newUser1.FirstName = "John";
                newUser1.LastName  = "Doe";
                newUser1.UserEmail = "*****@*****.**";

                conn.Insert(newUser1);
                _UserList.Add(newUser1);

                #endregion

                #region Trips Data

                var newTrip2 = new Trips_Table();
                newTrip2.UserName          = newUser.UserName;
                newTrip2.TripName          = "Disneyland 2021";
                newTrip2.TripStart         = new DateTime(2021, 11, 12);
                newTrip2.TripEnd           = new DateTime(2021, 11, 17);
                newTrip2.Notes             = "We're In Disneyland Evan";
                newTrip2.TripNotifications = 0;
                newTrip2.UserId            = newUser.UserId;

                conn.Insert(newTrip2);

                var newTrip3 = new Trips_Table();
                newTrip3.UserName          = newUser1.UserName;
                newTrip3.TripName          = "Utah 2020";
                newTrip3.TripStart         = new DateTime(2020, 11, 12);
                newTrip3.TripEnd           = new DateTime(2020, 11, 17);
                newTrip3.Notes             = "Request time off";
                newTrip3.TripNotifications = 1;
                newTrip3.UserId            = newUser1.UserId;

                conn.Insert(newTrip3);

                #endregion

                #region Dining Data
                var newRes = new Dining_Table();
                newRes.ResName          = "Carnation Cafe";
                newRes.ResAddress       = "Disneyland Park, Anaheim, CA 92802";
                newRes.ResPhone         = "(714)781-3463";
                newRes.ResDate          = DateTime.Today;
                newRes.ResNotes         = "Dinner with my wife";
                newRes.ResNotifications = 1;
                newRes.TripId           = newTrip2.TripId;

                conn.Insert(newRes);

                var newRes2 = new Dining_Table();
                newRes2.ResName          = "Rainforest Cafe";
                newRes2.ResAddress       = "123 Downtown Disney District, Anaheim, CA 92802";
                newRes2.ResPhone         = "(714)866-5555";
                newRes2.ResDate          = new DateTime(2020, 11, 12);
                newRes2.ResNotes         = "Birthday Dinner";
                newRes2.ResNotifications = 1;
                newRes2.TripId           = newTrip2.TripId;

                conn.Insert(newRes2);
                #endregion

                #region Entertainment Data
                var newActivity = new Entertainment_Table();
                newActivity.EntertainName          = "Disneyland";
                newActivity.EntertaninStart        = new DateTime(2020, 11, 12, 08, 00, 00);
                newActivity.EntertainEnd           = new DateTime(2020, 11, 12, 23, 00, 00);
                newActivity.EnterainAddress        = "1313 Disneyland Dr, Anaheim, CA 92802";
                newActivity.EntertainPhone         = "(714)781-4636";
                newActivity.EntertainNotes         = "Get to the park at 7:00";
                newActivity.EntertainNotifications = 1;
                newActivity.TripId = newTrip2.TripId;

                conn.Insert(newActivity);

                var newActivity2 = new Entertainment_Table();
                newActivity2.EntertainName          = "Disneyland";
                newActivity2.EntertaninStart        = new DateTime(2020, 11, 14, 07, 00, 00);
                newActivity2.EntertainEnd           = new DateTime(2020, 11, 15, 00, 00, 00);
                newActivity2.EnterainAddress        = "1313 Disneyland Dr, Anaheim, CA 92802";
                newActivity2.EntertainPhone         = "(714)781-4636";
                newActivity2.EntertainNotes         = "Get to the park at 6:00";
                newActivity2.EntertainNotifications = 1;
                newActivity2.TripId = newTrip2.TripId;

                conn.Insert(newActivity2);
                #endregion

                #region Flights Data
                var newflight = new Flights_Table();
                newflight.FlightNumber        = "SWA123";
                newflight.AirlineName         = "Southwest";
                newflight.DepartTime          = new DateTime(2020, 11, 12, 1, 45, 00);
                newflight.ArriveTime          = new DateTime(2020, 11, 12, 3, 30, 00);
                newflight.DepartLocation      = "SLC";
                newflight.ArriveLocation      = "LAX";
                newflight.DepartGate          = "A5";
                newflight.FlightNotifications = 1;
                newflight.TripId = newTrip2.TripId;

                conn.Insert(newflight);

                var newflight1 = new Flights_Table();
                newflight1.FlightNumber        = "SWA987";
                newflight1.AirlineName         = "Southwest";
                newflight1.DepartTime          = new DateTime(2020, 11, 17, 8, 00, 00);
                newflight1.ArriveTime          = new DateTime(2020, 11, 17, 10, 10, 00);
                newflight1.DepartLocation      = "LAX";
                newflight1.ArriveLocation      = "SLC";
                newflight1.DepartGate          = "G13";
                newflight1.FlightNotifications = 0;
                newflight1.TripId = newTrip2.TripId;

                conn.Insert(newflight1);

                #endregion

                #region Lodging Data
                var newLodge = new Lodging_Table();
                newLodge.LodgeName          = "Best Western Plus Pavilions";
                newLodge.LodgeLocation      = "1176 W Katella Ave, Anaheim, CA 92802";
                newLodge.LodgePhone         = "(714)776-0140";
                newLodge.LodgeStart         = new DateTime(2020, 11, 12, 11, 00, 00);
                newLodge.LodgeEnd           = new DateTime(2020, 11, 15, 9, 00, 00);
                newLodge.LodgeNotifications = 1;
                newLodge.TripId             = newTrip2.TripId;

                conn.Insert(newLodge);

                var newLodge1 = new Lodging_Table();
                newLodge1.LodgeName          = "Best Western Plus Stovals";
                newLodge1.LodgeLocation      = "1100 W Katella Ave, Anaheim, CA 92802";
                newLodge1.LodgePhone         = "(714)776-5555";
                newLodge1.LodgeStart         = new DateTime(2020, 11, 15, 11, 00, 00);
                newLodge1.LodgeEnd           = new DateTime(2020, 11, 17, 9, 00, 00);
                newLodge1.LodgeNotifications = 0;
                newLodge1.TripId             = newTrip2.TripId;

                conn.Insert(newLodge1);

                #endregion

                #region Transportation Data
                var newRental = new Transportation_Table();
                newRental.RentalName          = "Hertz";
                newRental.ConfNumber          = "1E0C2G";
                newRental.PickUpDate          = new DateTime(2020, 11, 12);
                newRental.ReturnDate          = new DateTime(2020, 11, 17);
                newRental.PickUpLocation      = "Los Angeles International Airport";
                newRental.ReturnLocation      = "Los Angeles International Airport";
                newRental.RentalPhone         = "(555)888-5555";
                newRental.RentalNotifications = 1;
                newRental.TripId = newTrip2.TripId;

                conn.Insert(newRental);

                #endregion
            }
        }