コード例 #1
0
ファイル: Login.cs プロジェクト: Kamo0205/PRG282_Project_V3
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            bool logged = false;

            if ((TxtUsername.Text.Length > 0) && (TxtPassword.Text.Length > 0))
            {
                foreach (string[] login in lm.Logins)
                {
                    if ((login[0].ToLower() == TxtUsername.Text.ToLower()) && (login[1] == cipher.Shift(TxtPassword.Text, 3)))
                    {
                        logged = true;
                        MessageBox.Show("Successful Login", "Login Attempt", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        FrmWelcomeScreen welcomeScreen = new FrmWelcomeScreen(pm.IsAboveOfficer(login[0]), login[0]);
                        this.Hide();
                        welcomeScreen.ShowDialog();
                        this.Close();
                    }
                }
            }
            if (!logged)
            {
                MessageBox.Show("Wrong credentials");
                TxtPassword.Clear();
                TxtUsername.Clear();
            }
        }
コード例 #2
0
        private void BtnBack_Click(object sender, EventArgs e)
        {
            FrmWelcomeScreen welcomeScreen = new FrmWelcomeScreen(this.isOfficerHigher, this.username);

            this.Hide();
            welcomeScreen.ShowDialog();
            this.Close();
        }