private void GuestRequestButtonClick(object sender, RoutedEventArgs e)
        {
            Window guestRequestWindow = new GuestMainWindow(null);

            guestRequestWindow.Show();
            this.Close();
        }
Example #2
0
        private void Back_Click(object sender, RoutedEventArgs e)
        {
            Window MainGuestWindow = new GuestMainWindow(guest);

            MainGuestWindow.Show();
            this.Close();
        }
Example #3
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            User   user;
            string userName = this.UserName.Text;
            string password = this.UserPassword.Password;

            try
            {
                user = myIBL.GetUser(userName);
                if (password == user.Password)
                {
                    if (user.Type == UserType.Guest)
                    {
                        Window guestMainWindow = new GuestMainWindow(myIBL.GetGuestByUserName(user.UserName));
                        guestMainWindow.Show();
                        this.Close();
                    }
                    else if (user.Type == UserType.Host)
                    {
                        Window hostMainWindow = new HostMainWindow(myIBL.GetHostByUserName(user.UserName));
                        hostMainWindow.Show();
                        this.Close();
                        //}
                    }
                    else if (user.Type == UserType.Admin)
                    {
                        Window adminMainWindow = new AdminMainWindow();
                        adminMainWindow.Show();
                        this.Close();
                    }
                }
                else
                {
                    throw new NotExsitingUserException();
                }
            }
            catch (NotExsitingUserException)
            {
                UserPassword.Focus();
                MessageBox.Show("The Password you entered are incorrect.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (NotExistingKeyException)
            {
                UserName.Focus();
                MessageBox.Show("The UserName you entered doesn't exist", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Example #4
0
 private void AddRequest_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         myIBL.AddGuestRequest(NewGuestRequest);
         Window mainGuest = new GuestMainWindow(guest);
         mainGuest.Show();
         this.Close();
     }
     catch (DateOrderException)
     {
         MessageBox.Show("The entry date must be before the release date.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         EndingDate.SelectedDate = NewGuestRequest.EntryDate.AddDays(1);
     }
     catch (DateComparedToTodayException)
     {
         MessageBox.Show("The vacation cannot be in the past.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         StartingDate.SelectedDate = DateTime.Today;
         EndingDate.SelectedDate   = DateTime.Today.AddDays(1);
     }
     catch (NotValidEmailAddressException)
     {
         MessageBox.Show("The email address must be valid.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         EmailAdd.Focus();
     }
     catch (ChildrenAmountException)
     {
         MessageBox.Show("There cannot be a negative amount of people, this is earth!!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         numChildren.Text = "0";
         numChildren.Focus();
     }
     catch (AdultAmountException)
     {
         MessageBox.Show("if there are no adults, who is requesting the vacation?!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         numAdults.Text = "1";
         numAdults.Focus();
     }
 }