/// <summary>
        /// Constructor for the page that takes in a student application
        /// </summary>
        /// <param name="studentApp"></param>
        public ApplicationDetailsPage(StudentApplication studentApp)
        {
            InitializeComponent();

            app = studentApp;
            fillInData();
        }
        /// <summary>
        /// Saves Registration state so it can be loaded from this state if the user naviates away from the ocme and comes
        /// back at a later time.
        /// </summary>
        private void SaveRegistration()
        {
            StudentApplication inProgressApplication = GetApplicationData();

            inProgressApplication.Email = StudentUser.Email;
            inProgressApplication.SaveApplication();
        }
        /// <summary>
        /// Submits the registration
        /// </summary>
        /// <param name="sender">Go back button.</param>
        /// <param name="e">Button clicked event args.</param>
        private async void SubmitRegistration(object sender, EventArgs e)
        {
            StudentApplication completedApplication = GetApplicationData();
            var response = completedApplication.CompleteApplication();

            if (response == StudentApplication.ApplicationResult.Success)
            {
                await DisplayAlert("Application Submitted", "You can log in and check the status of your application at any time", "OK");

                await Navigation.PopAsync();
            }
            else
            {
                switch (response)
                {
                case StudentApplication.ApplicationResult.MissingField:
                    await DisplayAlert("Missing Fields", "Please check and make sure all fields are filled out", "OK");

                    break;

                case StudentApplication.ApplicationResult.InvalidFirstName:
                    await DisplayAlert("Invalid Field", "The first name field is invalid, Please check the information entered", "OK");

                    break;

                case StudentApplication.ApplicationResult.InvalidLastName:
                    await DisplayAlert("Invalid Field", "The last name field is invalid, Please check the information entered", "OK");

                    break;

                case StudentApplication.ApplicationResult.InvalidStreet:
                    await DisplayAlert("Invalid Field", "The street Address field is invalid, Please check the information entered", "OK");

                    break;

                case StudentApplication.ApplicationResult.InvalidCity:
                    await DisplayAlert("Invalid Field", "The city field is invalid, Please check the information entered", "OK");

                    break;

                case StudentApplication.ApplicationResult.InvalidState:
                    await DisplayAlert("Invalid Field", "The state field is invalid, Please check the information entered", "OK");

                    break;

                case StudentApplication.ApplicationResult.InvalidZip:
                    await DisplayAlert("Invalid Field", "The zip code field is invalid, Please check the information entered", "OK");

                    break;

                default:
                    await DisplayAlert("Unkonwn", "An unkonwn error has occured when submitting the application", "OK");

                    break;
                }
            }
        }
 /// <summary>
 /// Fills out the application with any previously saved data.
 /// </summary>
 private void FillFormWithSavedData(StudentApplication savedApplication)
 {
     this.FirstName.Text = savedApplication.FirstName;
     this.LastName.Text  = savedApplication.LastName;
     this.Street.Text    = savedApplication.Street;
     this.City.Text      = savedApplication.City;
     this.State.Text     = savedApplication.State;
     this.Zip.Text       = savedApplication.Zip;
 }
        private async void LoadApplication(Student user)
        {
            string headerString = "No Applications Found";
            var    connection   = DependencyService.Get <ISQLiteDb>().GetConnection();

            var savedApplication = await connection.QueryAsync <StudentApplication>($"select * from StudentApplication where Email = \"{user.Email}\"");

            if (savedApplication.Any())
            {
                StudentApplication app = savedApplication[0];
                if (app.submitted == 1)
                {
                    headerString           = "Submitted Application";
                    this.StudentName.Text  = app.FirstName + " " + app.LastName;
                    this.Email.Text        = app.Email;
                    this.AddressLine1.Text = app.Street;
                    this.AddressLien2.Text = app.City + " " + app.State + " " + app.Zip;

                    if (app.applicationFinalized > 0)
                    {
                        if (app.accepted > 0)
                        {
                            this.Status.Text = "Status = Accepted";
                        }
                        else
                        {
                            this.Status.Text = "Status = Denied";
                        }
                    }
                    else
                    {
                        this.Status.Text = "Status = Pending";
                    }
                }
            }

            this.Header.Text = headerString;
        }