예제 #1
0
        private void usernameOK_Click(object sender, EventArgs e)
        {
            this.Hide();
            usernameText.Focus();

            if (status_code == 1)
            {
                try
                {
                    String message = resetPass.checkPasswordExpire(usernameText.Text);
                    try
                    {
                        infoWindow.updateInfo(message, "OK", "OK");
                        infoWindow.info_OK.Hide();
                        infoWindow.Show();
                    }
                    catch
                    {
                        InfoWindow infoWindow = new InfoWindow();
                        infoWindow.Hide();
                        infoWindow.updateInfo(message, "OK", "OK");
                        infoWindow.info_OK.Hide();
                        infoWindow.Show();
                    }
                }
                catch (InvalidUserException ex)
                {
                    InfoWindow exception = new InfoWindow();
                    exception.status = -50;
                    exception.updateInfo("Something went wrong. The error thrown by the application was: " + ex.Message + "\nPlease try again", "OK", "OK");
                    exception.info_OK.Hide();
                    exception.Show();
                }

                this.usernameText.Text = "";
                usernameText.Focus();
                return;
            }
            if (status_code == 2)
            {
                try
                {
                    String message = resetPass.getPassExpire(usernameText.Text);
                    try
                    {
                        infoWindow.updateInfo(message, "OK", "OK");
                        infoWindow.info_OK.Hide();
                        infoWindow.Show();
                    }
                    catch
                    {
                        InfoWindow infoWindow = new InfoWindow();
                        infoWindow.Hide();
                        infoWindow.updateInfo(message, "OK", "OK");
                        infoWindow.info_OK.Hide();
                        infoWindow.Show();
                    }
                    this.usernameText.Text = "";
                    usernameText.Focus();
                    return;
                }
                catch (InvalidUserException ex)
                {
                    InfoWindow exception = new InfoWindow();
                    exception.status = -50;
                    exception.updateInfo("Something went wrong. The error thrown by the application was: " + ex.Message + "\nPlease try again", "OK", "OK");
                    exception.info_OK.Hide();
                    exception.Show();
                }
            }
            this.usernameText.Text = "";
            usernameText.Focus();
        }