示例#1
0
        private void SignIn_OnClick(object sender, RoutedEventArgs e)
        {
            //if (
            //    TextBoxUserName.Background != Brushes.White && TextBoxUserName.BorderBrush != Brushes.Gray
            //    || PasswordBoxInLoginWindow.Background != Brushes.White &&
            //    PasswordBoxInLoginWindow.BorderBrush != Brushes.Gray ||
            //    TextBoxUserName.Text.Length == 0 || PasswordBoxInLoginWindow.Password.Length == 0)
            //{
            //    MessageBox.Show("Some details you entered are incorrect, please try again", "Failed",
            //        MessageBoxButton.OK, MessageBoxImage.Information,
            //        MessageBoxResult.None);
            //    //return;
            //}

            try
            {
                LoginExist.Password = PasswordBoxInLoginWindow.Password;
                if (_instance.IsUsernameMatchPassword(LoginExist, "Host"))
                {
                    AccomUnitUpdateWindow accomUnitUpdateWindow =
                        new AccomUnitUpdateWindow(_instance.GetHostKey(LoginExist));
                    accomUnitUpdateWindow.Show();
                    this.Close();
                }
                else if (_instance.IsUsernameMatchPassword(LoginExist, "SiteOwner"))
                {
                    SiteOwnerPanel siteOwnerPanel = new SiteOwnerPanel(LoginExist);
                    siteOwnerPanel.Show();
                    this.Close();
                }
                else if (_instance.IsUsernameMatchPassword(LoginExist, "Customer"))
                {
                    var newGuestRequest = new NewGuestRequest(LoginExist);
                    newGuestRequest.Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Some details you entered are incorrect, please try again", "Failed",
                                    MessageBoxButton.OK, MessageBoxImage.Information,
                                    MessageBoxResult.None);
                    return;
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.ToString(), "Failed",
                                MessageBoxButton.OK, MessageBoxImage.Information,
                                MessageBoxResult.None);
                return;
            }
        }
示例#2
0
        private void SignIn_OnClick(object sender, RoutedEventArgs e)
        {
            CustomerWindow.ClientInfo.LoginDetails.Password = PasswordBox.Password;


            if (firstName.Background != Brushes.White && firstName.BorderBrush != Brushes.Gray ||
                lastName.Background != Brushes.White && lastName.BorderBrush != Brushes.Gray ||
                phon.Background != Brushes.White && phon.BorderBrush != Brushes.Gray ||
                email.Background != Brushes.White && email.BorderBrush != Brushes.Gray ||
                userName.Background != Brushes.White && userName.BorderBrush != Brushes.Gray ||
                PasswordBox.Background != Brushes.White && PasswordBox.BorderBrush != Brushes.Gray ||
                confirme.Background != Brushes.White && confirme.BorderBrush != Brushes.Gray ||
                Gender.SelectedIndex == -1 /* dp1.Length == 0*/)
            {
                MessageBox.Show("Some details you entered are incorrect, please try again", "Failed",
                                MessageBoxButton.OK, MessageBoxImage.Information,
                                MessageBoxResult.None);
                return;
            }

            try
            {
                try
                {
                    _instance.AddCustomerContactInfo(CustomerWindow);
                    MessageBox.Show("Your registration has been successfully completed");

                    NewGuestRequest newRequest = new NewGuestRequest(CustomerWindow.ClientInfo.LoginDetails);
                    newRequest.Show();
                    this.Close();
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                    return;
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                return;
            }
        }