Esempio n. 1
0
        /// <summary>
        /// NAME: Austin Gee
        /// DATE: 3/12/2020
        /// CHECKED BY: Michael Thompson
        ///
        /// This is used to insert appointments into the database
        /// </summary>
        /// <remarks>
        /// UPDATED BY: NA
        /// UPDATE DATE: NA
        /// WHAT WAS CHANGED: NA
        ///
        /// </remarks>
        public int InsertAdoptionAppointment(AdoptionAppointment adoptionAppointment)
        {
            int rows = 0;
            var conn = DBConnection.GetConnection();

            var cmd = new SqlCommand("sp_insert_appointment", conn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@AdoptionApplicationID", adoptionAppointment.AdoptionApplicationID);
            cmd.Parameters.AddWithValue("@AppointmentTypeID", adoptionAppointment.AppointmentTypeID);
            cmd.Parameters.AddWithValue("@DateTime", adoptionAppointment.AppointmentDateTime);
            cmd.Parameters.AddWithValue("@LocationID", adoptionAppointment.LocationID);


            try
            {
                conn.Open();
                rows = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
            return(rows);
        }
Esempio n. 2
0
 /// <summary>
 /// Creator: Mohamed Elamin
 /// Created: 2020/02/29
 /// Approver: Awaab Elamin, 2020/02/21
 /// This is the Constructor method for Interviewer page
 /// </summary>
 /// <remarks>
 /// Updater Name
 /// Updated: yyyy/mm/dd
 /// Update: ()
 /// </remarks>
 /// <param name="adoptionAppointment"></param>
 /// <param name="adoptionInterviewerManager"></param>
 public pgAdoptionInterviewerNotes(AdoptionAppointment adoptionAppointment,
                                   IAdoptionInterviewerManager adoptionInterviewerManager)
 {
     InitializeComponent();
     _adoptionAppointment        = adoptionAppointment;
     _adoptionInterviewerManager = adoptionInterviewerManager;
 }
        public int UpdateAdoptionAppopintment(AdoptionAppointment oldAppointment, AdoptionAppointment newAppointment)
        {
            int rows = 0;

            foreach (var a in _adoptionAppointments)
            {
                if (a.AppointmentID == oldAppointment.AppointmentID &&
                    a.AdoptionApplicationID == oldAppointment.AdoptionApplicationID &&
                    a.AppointmentActive == oldAppointment.AppointmentActive &&
                    a.AppointmentDateTime == oldAppointment.AppointmentDateTime &&
                    a.AppointmentTypeID == oldAppointment.AppointmentTypeID &&
                    a.Decision == oldAppointment.Decision &&
                    a.LocationID == oldAppointment.LocationID)
                {
                    a.AdoptionApplicationID = newAppointment.AdoptionApplicationID;
                    a.AppointmentActive     = newAppointment.AppointmentActive;
                    a.AppointmentDateTime   = newAppointment.AppointmentDateTime;
                    a.AppointmentTypeID     = newAppointment.AppointmentTypeID;
                    a.Decision   = newAppointment.Decision;
                    a.LocationID = newAppointment.LocationID;
                    rows        += 1;
                }
            }
            return(rows);
        }
        public void TestEditAppointment()
        {
            bool expected = true;
            bool result;
            AdoptionAppointment oldAdoptionAppointment
                = new AdoptionAppointment()
                {
                AppointmentID         = 100001,
                AdoptionApplicationID = 100001,
                AppointmentTypeID     = "facilitator",
                AppointmentDateTime   = DateTime.Now,
                Notes      = "These are my notes",
                Decision   = "facilitator",
                LocationID = 12033
                };
            AdoptionAppointment newAdoptionAppointment
                = new AdoptionAppointment()
                {
                AppointmentID         = 100001,
                AdoptionApplicationID = 100001,
                AppointmentTypeID     = "facilitator",
                AppointmentDateTime   = DateTime.Now,
                Notes      = "These are my notes",
                Decision   = "Deny",
                LocationID = 12033
                };

            result = _adoptionInterviewerManager.EditAppointment(oldAdoptionAppointment, newAdoptionAppointment);
            Assert.AreEqual(expected, result);
        }
Esempio n. 5
0
        /// <summary>
        /// Creator: Mohamed Elamin
        /// Created: 2020/02/19
        /// Approver: Awaab Elamin, 2020/02/21
        /// This is an Event on Save button is clicked.
        /// </summary>
        /// <remarks>
        /// Updater Name
        /// Updated: yyyy/mm/dd
        /// Update: ()
        /// </remarks>
        /// <param name=" sender"></param>
        /// <param name=" e"></param>
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            AdoptionAppointment newAdoptionAppointment = new AdoptionAppointment()
            {
                AppointmentID = Convert.ToInt32(txtAppointmentID.Text),
                Notes         = txtNotes.Text,
            };

            if (_addMode)
            {
                try
                {
                    if (_adoptionInterviewerManager.EditAppointment(_adoptionAppointment,
                                                                    newAdoptionAppointment))
                    {
                        this.NavigationService?.Navigate(new pgAdoptionInterviewer());
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + "\n\n"
                                    + ex.InnerException.Message);
                }
            }
            else
            {
                throw new ApplicationException("Data not Saved.",
                                               new ApplicationException("User may no longer exist."));
            }
        }
Esempio n. 6
0
 /// <summary>
 /// NAME: Austin Gee
 /// DATE: 5/2/2020
 /// CHECKED BY: Michael Thompson
 ///
 /// updates an Appointment
 /// </summary>
 /// <remarks>
 /// UPDATED BY: NA
 /// UPDATE DATE: NA
 /// WHAT WAS CHANGED: NA
 ///
 /// </remarks>
 /// <param name="oldAppointment"></param>
 /// <param name="newAppointment"></param>
 /// <returns></returns>
 public bool EditAdoptionAppointment(AdoptionAppointment oldAppointment, AdoptionAppointment newAppointment)
 {
     try
     {
         return(1 == _adoptionAppointmentAccessor.UpdateAdoptionAppopintment(oldAppointment, newAppointment));
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Database Error", ex);
     }
 }
Esempio n. 7
0
        /// <summary>
        /// NAME: Austin Gee
        /// DATE: 3/12/2020
        /// CHECKED BY: Michael Thompson
        ///
        /// passes an adoption appointment to the data acces layer
        /// </summary>
        /// <remarks>
        /// UPDATED BY: NA
        /// UPDATE DATE: NA
        /// WHAT WAS CHANGED: NA
        ///
        /// </remarks>
        /// <param name="adoptionAppointment"></param>
        /// <returns></returns>
        public bool AddAdoptionAppointment(AdoptionAppointment adoptionAppointment)
        {
            bool result = false;

            try
            {
                result = 1 == _adoptionAppointmentAccessor.InsertAdoptionAppointment(adoptionAppointment);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
        /// <summary>
        /// Creator: Mohamed Elamin
        /// Created: 2020/02/29
        /// Approver: Awaab Elamin, 2020/03/03
        /// This is an Event on the Open Button clicked.
        /// </summary>
        /// <remarks>
        /// Updater Name
        /// Updated: yyyy/mm/dd
        /// Update: ()
        /// </remarks>
        /// <param name=" sender"></param>
        /// <param name=" e"></param>
        private void btnOpen_Click(object sender, RoutedEventArgs e)
        {
            AdoptionAppointment selectedAappointment =
                (AdoptionAppointment)dgAdoptionAappointmentList.SelectedItem;

            if (selectedAappointment == null)
            {
                MessageBox.Show("Please select an appliction to see the details");
                return;
            }

            this.NavigationService?.Navigate(new pgAdoptionInterviewerNotes
                                                 (selectedAappointment, _adoptionInterviewerManager));
        }
        /// <summary>
        /// Creator: Mohamed Elamin
        /// Created: 2020/02/29
        /// Approver: Awaab Elamin, 2020/03/03
        /// This method used to edit the Appointment notes.
        /// </summary>
        /// <remarks>
        /// Updater: Mohamed Elamin
        /// Updated: 2020/04/22
        /// Update: Fixed Comments format.
        /// </remarks>
        /// <param name="newAdoptionAppointment"></param>
        /// <param name="oldAdoptionAppointment"></param>
        /// <returns>True or false depending if the record was updated</returns>
        public bool EditAppointment(AdoptionAppointment oldAdoptionAppointment, AdoptionAppointment newAdoptionAppointment)
        {
            bool result = false;

            try
            {
                result = (1 == _adoptionInterviewerAccessor.UpdateAppoinment
                              (oldAdoptionAppointment, newAdoptionAppointment));
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Update failed.", ex);
            }
            return(result);
        }
        /// <summary>
        /// NAME: Austin Gee
        /// DATE: 3/12/2020
        /// CHECKED BY: Michael Thompson
        ///
        /// This method inserts a Adoption Appointment into the Fake
        /// </summary>
        /// <remarks>
        /// UPDATED BY: NA
        /// UPDATE DATE: NA
        /// WHAT WAS CHANGED: NA
        ///
        /// </remarks>
        /// <param name="adoptionAppointment"></param>
        /// <returns></returns>
        public int InsertAdoptionAppointment(AdoptionAppointment adoptionAppointment)
        {
            int rows = 0;

            try
            {
                _adoptionAppointments.Add(adoptionAppointment);
                rows = 1;
            }
            catch (Exception)
            {
                throw;
            }
            return(rows);
        }
        /// <summary>
        /// Creator: Mohamed Elamin
        /// Created: 02/29/2020
        /// Approver:  Awaab Elamin, 03/03/2020
        /// This is a fake Update Appoinment method.
        /// </summary>
        /// <remarks>
        /// Updater Name
        /// Updated: yyyy/mm/dd
        /// Update: ()
        /// </remarks>
        /// <param name="AdoptionAppointment"></param>
        /// <param name="AdoptionAppointment"></param>
        /// <returns>result</returns>
        public int UpdateAppoinment(AdoptionAppointment oldAdoptionAppointment, AdoptionAppointment newAdoptionAppointment)
        {
            int result = 0;

            foreach (AdoptionAppointment adoption in adoptionAppointments)
            {
                if ((adoption.AppointmentID == oldAdoptionAppointment.AppointmentID) &&
                    (adoption.Notes == oldAdoptionAppointment.Notes))
                {
                    adoption.Notes = newAdoptionAppointment.Notes;
                    result++;
                }
            }
            return(result);
        }
Esempio n. 12
0
        /// <summary>
        /// Creator: Austin Gee
        /// Created: 4/27/2020
        /// Approver: Michael Thompson
        ///
        /// updates an adoption appointment
        /// </summary>
        /// <remarks>
        /// Updater: NA
        /// Updated: NA
        /// Update: NA
        /// </remarks>
        /// <param name="oldAppointment"></param>
        /// <param name="newAppointment"></param>
        /// <returns></returns>
        public int UpdateAdoptionAppopintment(AdoptionAppointment oldAppointment, AdoptionAppointment newAppointment)
        {
            int rows = 0;
            var conn = DBConnection.GetConnection();

            var cmd = new SqlCommand("sp_update_adoption_appointment", conn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@OldAppointmentID", oldAppointment.AppointmentID);

            cmd.Parameters.AddWithValue("@OldAdoptionApplicationID", oldAppointment.AdoptionApplicationID);
            cmd.Parameters.AddWithValue("@OldAppointmentTypeID", oldAppointment.AppointmentTypeID);
            cmd.Parameters.AddWithValue("@OldDateTime", oldAppointment.AppointmentDateTime);
            //if (oldAppointment.Notes != null) oldAppointment.Notes = "";
            //cmd.Parameters.AddWithValue("@OldNotes", oldAppointment.Notes);
            //cmd.Parameters.AddWithValue("@OldDecision", oldAppointment.Decision);
            cmd.Parameters.AddWithValue("@OldLocationID", oldAppointment.LocationID);
            cmd.Parameters.AddWithValue("@OldActive", oldAppointment.AppointmentActive);

            cmd.Parameters.AddWithValue("@NewAdoptionApplicationID", newAppointment.AdoptionApplicationID);
            cmd.Parameters.AddWithValue("@NewAppointmentTypeID", newAppointment.AppointmentTypeID);
            cmd.Parameters.AddWithValue("@NewDateTime", newAppointment.AppointmentDateTime);
            cmd.Parameters.AddWithValue("@NewNotes", newAppointment.Notes);
            cmd.Parameters.AddWithValue("@NewDecision", newAppointment.Decision);
            cmd.Parameters.AddWithValue("@NewLocationID", newAppointment.LocationID);
            cmd.Parameters.AddWithValue("@NewActive", newAppointment.AppointmentActive);

            try
            {
                conn.Open();
                rows = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
            return(rows);
        }
        /// <summary>
        /// Creator: Mohamed Elamin
        /// Created: 2020/02/29
        /// Approver:  Awaab Elamin, 2020/03/03
        /// This method used to update an Adoptin Appliction notes.
        /// </summary>
        /// <remarks>
        /// Updater Name
        /// Updated: yyyy/mm/dd
        /// Update: ()
        /// </remarks>
        /// <param name="oldAdoptionAppointment"></param>
        /// <param name="newAdoptionAppointment"></param>
        /// <returns>Zero or one depending if the record was updated </returns>
        public int UpdateAppoinment(AdoptionAppointment oldAdoptionAppointment, AdoptionAppointment newAdoptionAppointment)
        {
            int rows = 0;
            var conn = DBConnection.GetConnection();
            var cmd  = new SqlCommand("sp_update_Adoption_appointment_notes", conn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@AppointmentID", newAdoptionAppointment
                                        .AppointmentID);



            cmd.Parameters.AddWithValue("@NewNotes",
                                        newAdoptionAppointment.Notes);

            cmd.Parameters.AddWithValue("@OldNotes",
                                        oldAdoptionAppointment.Notes);
            try
            {
                conn.Open();
                rows = cmd.ExecuteNonQuery();
                if (rows == 0)
                {
                    throw new ApplicationException("Record not found.");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }

            return(rows);
        }
        public void TestAdoptionAppointmentAddAdoptionAppointment()
        {
            // arrange
            bool result = false;
            var  adoptionAppointment = new AdoptionAppointment()
            {
                AdoptionApplicationID = 000,
                AppointmentActive     = true,
                AppointmentDateTime   = DateTime.Now,
                AppointmentID         = 000,
                AppointmentTypeID     = "Fake",
                Decision   = "Fake",
                LocationID = 000,
                Notes      = "Fake"
            };
            IAdoptionAppointmentManager adoptionAppointmentManager = new AdoptionAppointmentManager(_adoptionAppointmentAccessor);

            // act
            result = adoptionAppointmentManager.AddAdoptionAppointment(adoptionAppointment);

            // assert
            Assert.IsTrue(result);
        }
        public void TestAdoptionAppointmentUpdateAdoptionAppointment()
        {
            // arrange
            bool result = false;
            var  oldAdoptionAppointment = new AdoptionAppointment
            {
                AppointmentID         = 000,
                AdoptionApplicationID = 000,
                AppointmentActive     = true,
                AppointmentDateTime   = DateTime.Parse("7/12/1984"),
                AppointmentTypeID     = "FAKE",
                Decision     = "Fake",
                LocationID   = 000,
                LocationName = "Fake",
                Notes        = "Fake",
            };

            var newAdoptionAppointment = new AdoptionAppointment
            {
                AppointmentID         = 000,
                AdoptionApplicationID = 001,
                AppointmentActive     = true,
                AppointmentDateTime   = DateTime.Parse("7/12/1984"),
                AppointmentTypeID     = "FAKE",
                Decision     = "Fake",
                LocationID   = 000,
                LocationName = "Fake",
                Notes        = "Fake",
            };
            IAdoptionAppointmentManager adoptionAppointmentManager = new AdoptionAppointmentManager(_adoptionAppointmentAccessor);

            // act
            result = adoptionAppointmentManager.EditAdoptionAppointment(oldAdoptionAppointment, newAdoptionAppointment);

            // assert
            Assert.IsTrue(result);
        }
        /// <summary>
        /// NAME: Austin Gee
        /// DATE: 3/19/2020
        /// CHECKED BY: Michael Thompson
        ///
        /// adds an appointment
        /// </summary>
        /// <remarks>
        /// UPDATED BY: NA
        /// UPDATE DATE: NA
        /// WHAT WAS CHANGED: NA
        ///
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmitScheduledAppointment_Click(object sender, RoutedEventArgs e)
        {
            DateTime dateTime = new DateTime();

            try
            {
                if (!cmbAppointmentType.SelectedItem.ToString().IsValidString())
                {
                    WPFErrorHandler.ErrorMessage("Must Choose a Valid Appointment Type.");
                    cmbAppointmentType.Focus();
                    return;
                }
            }
            catch (Exception)
            {
                WPFErrorHandler.ErrorMessage("Must Choose a Valid Appointment Type.");
                cmbAppointmentType.Focus();
                return;
            }

            if (!txtScheduledAnimalName.Text.IsValidString())
            {
                WPFErrorHandler.ErrorMessage("Must choose a valid animal from the list.");
                dgAdoptionApplications.Focus();
                return;
            }
            if (!txtScheduledLocationName.Text.IsValidString())
            {
                WPFErrorHandler.ErrorMessage("Must choose a valid location from the list.");
                dgLocations.Focus();
                return;
            }
            try
            {
                DateTime.Parse(txtAppointmentTime.Text);
            }
            catch (Exception)
            {
                txtAppointmentTime.Focus();
                WPFErrorHandler.ErrorMessage("Must enter a valid time");
                return;
            }

            try
            {
                DateTime.Parse(dpAppointmentDate.SelectedDate.ToString());
            }
            catch (Exception)
            {
                cmbAppointmentType.Focus();
                WPFErrorHandler.ErrorMessage("Must enter a valid date");
                return;
            }
            try
            {
                DateTime.TryParse((dpAppointmentDate.SelectedDate.Value.ToShortDateString() + " " + txtAppointmentTime.Text), out dateTime);
                var appointment = new AdoptionAppointment()
                {
                    AdoptionApplicationID = ((ApplicationVM)dgAdoptionApplications.SelectedItem).AdoptionApplicationID,
                    AppointmentTypeID     = cmbAppointmentType.SelectedItem.ToString(),
                    AppointmentDateTime   = dateTime,
                    LocationID            = ((Location)dgLocations.SelectedItem).LocationID,
                };
                _adoptionAppointmentManager.AddAdoptionAppointment(appointment);
                MessageBox.Show("Appointment Added for " + _adoptionCustomerVM.FirstName + " " + _adoptionCustomerVM.LastName
                                + "\non " + dateTime.ToShortDateString() + " at " + dateTime.ToShortTimeString());
                txtAppointmentTime.Text = "00h: 00m am/pm";
            }
            catch (Exception)
            {
                WPFErrorHandler.ErrorMessage("Appointment not added");
            }
            cmbAppointmentType.SelectedItem = null;
            dpAppointmentDate.Text          = null;
            txtAppointmentTime.Clear();
            txtScheduledLocationName.Clear();
            txtScheduledAnimalName.Clear();

            showCustomerProfiles();
        }
        /// <summary>
        /// Creator: Mohamed Elamin
        /// Created: 2020/02/29
        /// Approver:  Awaab Elamin, 2020/03/03
        /// This method used to get Adoption Applications by the adoption type.
        /// </summary>
        /// <remarks>
        /// Updater Name
        /// Updated: yyyy/mm/dd
        /// Update: ()
        /// </remarks>
        /// <returns>Adoption Applications list</returns>
        public List <AdoptionAppointment> SelectAdoptionAappointmentsByAppointmentType()
        {
            List <AdoptionAppointment> adoptionAppointments = new List <AdoptionAppointment>();

            var conn = DBConnection.GetConnection();
            var cmd  = new SqlCommand("sp_select_interviewer_Appointments_by_AppointmentType", conn);

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            try
            {
                conn.Open();
                var reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        var adoptionAppointment = new AdoptionAppointment();

                        adoptionAppointment.AppointmentID         = reader.GetInt32(0);
                        adoptionAppointment.AdoptionApplicationID = reader.GetInt32(1);
                        adoptionAppointment.AppointmentTypeID     = reader.GetString(2);
                        if (!reader.IsDBNull(3))
                        {
                            adoptionAppointment.AppointmentDateTime = reader.GetDateTime(3);
                        }
                        if (!reader.IsDBNull(4))
                        {
                            adoptionAppointment.Notes = reader.GetString(4);
                        }
                        else
                        {
                            adoptionAppointment.Notes = "";
                        }
                        if (!reader.IsDBNull(5))
                        {
                            adoptionAppointment.Decision = reader.GetString(5);
                        }
                        else
                        {
                            adoptionAppointment.Decision = "";
                        }

                        adoptionAppointment.LocationName =
                            RetrieveLocationNameByLocationID(reader.GetInt32(6));

                        adoptionAppointments.Add(adoptionAppointment);
                    }
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
            return(adoptionAppointments);
        }
Esempio n. 18
0
        /// <summary>
        /// NAME: Austin Gee
        /// DATE: 3/4/2020
        /// CHECKED BY: Michael Thompson
        ///
        /// Event handler that is fired when the save button is clicked. validates input, then updates appointment decision and notes
        /// and updates the application status
        /// </summary>
        /// <remarks>
        /// UPDATED BY: NA
        /// UPDATE DATE: NA
        /// WHAT WAS CHANGED: NA
        ///
        ///
        /// </remarks>
        private void btnSaveNotes_Click(object sender, RoutedEventArgs e)
        {
            if (!txtNotesMeetAndGreet.Text.IsValidString())
            {
                WPFErrorHandler.ErrorMessage("You must enter Valid notes.");
                txtNotesMeetAndGreet.Focus();
                return;
            }
            if (!cmbDecision.Text.IsValidString())
            {
                WPFErrorHandler.ErrorMessage("You Must enter a valid decision.");
                cmbDecision.Focus();
                return;
            }
            AdoptionAppointment oldAppointment = new AdoptionAppointment
            {
                AdoptionApplicationID = _adoptionAppointment.AdoptionApplicationID,
                AppointmentActive     = _adoptionAppointment.AppointmentActive,
                AppointmentDateTime   = _adoptionAppointment.AppointmentDateTime,
                AppointmentID         = _adoptionAppointment.AppointmentID,
                AppointmentTypeID     = _adoptionAppointment.AppointmentTypeID,
                Decision     = _adoptionAppointment.Decision,
                LocationID   = _adoptionAppointment.LocationID,
                LocationName = _adoptionAppointment.LocationName,
                Notes        = _adoptionAppointment.Notes
            };
            AdoptionAppointment newAppointment = new AdoptionAppointment
            {
                AdoptionApplicationID = _adoptionAppointment.AdoptionApplicationID,
                AppointmentActive     = _adoptionAppointment.AppointmentActive,
                AppointmentDateTime   = _adoptionAppointment.AppointmentDateTime,
                AppointmentID         = _adoptionAppointment.AppointmentID,
                AppointmentTypeID     = _adoptionAppointment.AppointmentTypeID,
                Decision     = cmbDecision.SelectedItem.ToString(),
                LocationID   = _adoptionAppointment.LocationID,
                LocationName = _adoptionAppointment.LocationName,
                Notes        = txtNotesMeetAndGreet.Text
            };

            try
            {
                IAdoptionAppointmentManager adoptionAppointmentManager = new AdoptionAppointmentManager();
                adoptionAppointmentManager.EditAdoptionAppointment(oldAppointment, newAppointment);

                if (newAppointment.Decision == "Approved")
                {
                    AdoptionApplicationManager adoptionApplicationManager = new AdoptionApplicationManager();
                    ApplicationVM oldApplicationVM = adoptionApplicationManager.RetrieveAdoptionApplicationByID(oldAppointment.AdoptionApplicationID);

                    string newStatus = "";

                    if (_adoptionAppointment.AppointmentTypeID == "Interview")
                    {
                        newStatus = "Home Inspection";
                    }
                    else if (_adoptionAppointment.AppointmentTypeID == "Home Inspection")
                    {
                        newStatus = "Meet and Greet";
                    }
                    else if (_adoptionAppointment.AppointmentTypeID == "Meet and Greet")
                    {
                        newStatus = "Animal Pick-up";
                    }
                    else if (_adoptionAppointment.AppointmentTypeID == "Animal Pick-up")
                    {
                        newStatus = "Adoption Complete";
                    }

                    DataTransferObjects.Application oldApplication = new DataTransferObjects.Application
                    {
                        AdoptionApplicationID = oldApplicationVM.AdoptionApplicationID,
                        AnimalID          = oldApplicationVM.AnimalID,
                        ApplicationActive = oldApplicationVM.ApplicationActive,
                        CustomerEmail     = oldApplicationVM.CustomerEmail,
                        RecievedDate      = oldApplicationVM.RecievedDate,
                        Status            = oldApplicationVM.Status
                    };


                    DataTransferObjects.Application newApplication = new DataTransferObjects.Application
                    {
                        AdoptionApplicationID = oldApplicationVM.AdoptionApplicationID,
                        AnimalID          = oldApplicationVM.AnimalID,
                        ApplicationActive = oldApplicationVM.ApplicationActive,
                        CustomerEmail     = oldApplicationVM.CustomerEmail,
                        RecievedDate      = oldApplicationVM.RecievedDate,
                        Status            = newStatus
                    };

                    adoptionApplicationManager.UpdateAdoptionApplication(oldApplication, newApplication);

                    _adoptionAppointmentManager.EditAdoptionAppointmentActive(oldAppointment.AppointmentID, false);
                }
            }
            catch (Exception)
            {
                WPFErrorHandler.ErrorMessage("Appointment update failed");
            }
            dgAppointments.Items.Refresh();
            _adoptionAppointment = _adoptionAppointmentManager.RetrieveAdoptionAppointmentByAppointmentID(_adoptionAppointment.AppointmentID);
            populateNoteFields();
            populateTextBoxes();

            disableNotes();
            btnEditNotes.Visibility = Visibility.Visible;
            btnSaveNotes.Visibility = Visibility.Hidden;
            return;
        }