コード例 #1
0
        private void logoutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!LoggedInDetails.GetLoggedInState())
            {
                // login
                openForm(new FormLogin());
            }
            else
            {
                //logout
                LoggedInDetails.SetLoggedInState(false);
            }

            setLoginLogoutState(LoggedInDetails.GetLoggedInState());
            setTsUserName();
        }
コード例 #2
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            var userRepository = new UserRepository();

            var response = userRepository.Login(txtBox_login.Text, txtbox_password.Text);

            if (response == LoginEnum.Successful)
            {
                LoggedInDetails.SetUserLogged(txtBox_login.Text);
                LoggedInDetails.SetLoggedInState(true);
                Close();
                return;
            }

            if (response == LoginEnum.IncorrectLogin)
            {
                GeneralTools.WarningBox("Incorrect login.");
            }

            if (response == LoginEnum.IncorrectPassword)
            {
                GeneralTools.WarningBox("Incorrect password.");
            }
        }
コード例 #3
0
 private void FormLogin_Load(object sender, EventArgs e)
 {
     LoggedInDetails.SetLoggedInState();
 }