Esempio n. 1
0
        private void btnVolver_Click(object sender, EventArgs e)
        {
            this.Close();
            var homeAdmin = new HomeAdmin();

            homeAdmin.Show();
        }
Esempio n. 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string    RoleId;
            UserDAO   userDAO   = new UserDAO();
            Home      home      = new Home();
            HomeAdmin homeAdmin = new HomeAdmin();


            if (!string.IsNullOrEmpty(txtUser.Text) &&
                !string.IsNullOrEmpty(txtPass.Text))
            {
                RoleId = userDAO.getUser(txtUser.Text, txtPass.Text);

                if (RoleId != "" && RoleId != "1")
                {
                    home.Show();
                }
                else if (RoleId == "1")
                {
                    homeAdmin.Show();
                }
                else
                {
                    MessageBox.Show("Wrong username or password", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                this.Hide();
            }
            else
            {
                MessageBox.Show("Please enter username and password.", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtUser.Select();
            }
        }
Esempio n. 3
0
 private void GetLoginData(SqlDataReader dr)
 {
     if ((string)dr["user_previledge"] == "Admin")
     {
         var adm = new HomeAdmin();
         adm.Show();
         this.Hide();
     }
     else if ((string)dr["user_previledge"] == "Cashier")
     {
         var cashier = new HomeCashier();
         cashier.Show();
         this.Hide();
     }
     else if ((string)dr["user_previledge"] == "Security")
     {
         var sec = new HomeSecurity();
         sec.Show();
         this.Hide();
     }
 }