Beispiel #1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            main = new MainMenuClass();

            //hide the recep form
            frmReceptionist recep = new frmReceptionist();

            recep.Hide();

            //load menu into list box
            for (int x = 0; x < main.Menu.Length; x++)
            {
                lstBxMenu.Items.Add(main.Menu[x]);
            }
        }
        //boolean method to validate username
        public void ValidateUsernameAndPassword(Administrators admin)
        {
            //validate username and password
            if (username.Length == 0)
            {
                txtUsername.BackColor = Color.White;
                lblErrorMsg.Text      = "";
                lblErrorMsg.Text      = "*";
            }
            else if (password.Length == 0)
            {
                lblErrorMsg2.Text     = "";
                lblErrorMsg2.Text     = "*";
                txtPassword.BackColor = Color.White;
            }
            else if (admin.Username.Equals(username) && admin.Password.Equals(password))
            {
                lblErrorMsg.Text  = "";
                lblErrorMsg2.Text = "";

                frmReceptionist recep = new frmReceptionist();
                recep.Show();

                frmAminLogin adminfrm = new frmAminLogin();
                adminfrm.Hide();
            }
            else if (admin.Username != username)
            {
                txtUsername.ForeColor = Color.Red;
                lblErrorMsg.Text      = "INVALID USERNAME!!";
            }
            else if (admin.Password != password)
            {
                txtPassword.ForeColor = Color.Red;
                lblErrorMsg2.Text     = "INVALID PASSWORD!!";
            }
        }