//private void PrivateNameLostFocus(object sender, RoutedEventArgs e)
        //{
        //    try
        //    {
        //        guest.PrivateName = privateNameTextBox.Text;
        //    }
        //    catch (Exception exp)
        //    {
        //        privateNameTextBox.BorderBrush = Brushes.CornflowerBlue;
        //    }
        //}
        //private void PrivateNameGotFocus(object sender, RoutedEventArgs e)
        //{
        //    privateNameTextBox.BorderBrush = Brushes.Black;
        //}

        //private void FamilyNameLostFocus(object sender, RoutedEventArgs e)
        //{
        //    try
        //    {
        //        guest.FamilyName = familyNameTextBox.Text;
        //    }
        //    catch (Exception exp)
        //    {
        //        familyNameTextBox.BorderBrush = Brushes.CornflowerBlue;
        //    }
        //}
        //private void FamilyNameGotFocus(object sender, RoutedEventArgs e)
        //{
        //    familyNameTextBox.BorderBrush = Brushes.Black;
        //}

        //private void MailAddressLostFocus(object sender, RoutedEventArgs e)
        //{
        //    try
        //    {
        //        guest.MailAddress = mailAddressTextBox.Text;
        //    }
        //    catch (Exception exp)
        //    {
        //        mailAddressTextBox.BorderBrush = Brushes.CornflowerBlue;
        //    }
        //}
        //private void MailAddressGotFocus(object sender, RoutedEventArgs e)
        //{
        //    mailAddressTextBox.BorderBrush = Brushes.Black;
        //}

        private void updateCodeButton(object sender, RoutedEventArgs e)
        {
            try
            {
                if (newPass.Text == "" || oldPass.Text == "")
                {
                    MessageBox.Show("Missing information", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }
                if (oldPass.Text != guest.Code)
                {
                    MessageBox.Show("Can't change the code because the old password isn't matching", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }
                guest.Code = newPass.Text;
                myBL.UpdateGuestRequestCode(guest);
                Close();
                AddRequestOldUserMainWindow window = new AddRequestOldUserMainWindow(guest);
                window.ShowDialog();
            }
            catch
            {
                MessageBox.Show("There was a problem updating the code", "", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (CodePassBox.Password == "")
            {
                MessageBox.Show("Please enter a code", "", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            var result = from item in myBL.GetGuests()//result saves a list of all the guest requests with the code that was entered
                         where item.Code == CodePassBox.Password
                         select item;

            oneGuest = result.FirstOrDefault();
            guest    = result;
            //result.FirstOrDefault().Code = CodePassBox.Password;
            if (result.Count() == 0)
            {
                CodePassBox.Password = "";
                MessageBox.Show("There is no guest with this code", "Exception", MessageBoxButton.OK, MessageBoxImage.Error);
                //return;
            }
            else
            {
                AddRequestOldUserMainWindow window = new AddRequestOldUserMainWindow(oneGuest);
                Close();
                window.Show();
            }
        }
        //public void RemoveClick(object sender, RoutedEventArgs e)
        //{
        //    try
        //    {
        //        myBL.RemoveGuestRequest(guest);
        //        MessageBox.Show("Your request was successfuly removed", "", MessageBoxButton.OK, MessageBoxImage.Information);
        //    }
        //    catch(System.Exception exp)
        //    {
        //      MessageBox.Show("There was a problem removeing your request", "", MessageBoxButton.OK, MessageBoxImage.Error);
        //    }
        //}

        public void AddNewRequestButton(object sender, RoutedEventArgs e)
        {
            AddRequestOldUser window = new AddRequestOldUser(guest);

            window.ShowDialog();
            Close();
            AddRequestOldUserMainWindow window1 = new AddRequestOldUserMainWindow(guest);

            window1.ShowDialog();
        }