Exemple #1
0
        private void Loginbutton_Click(object sender, EventArgs e)
        {
            SqlConnection  sqlcon = new SqlConnection(@"Data Source=TSR1998\SQLEXPRESS;Initial Catalog=SuperShopDB;Integrated Security=True;");
            SqlDataAdapter sda    = new SqlDataAdapter("SELECT COUNT(*) FROM LOGIN WHERE USER_ID= '" + UserID_textBox.Text + "'and PASSWORD='******'and ROLE='" + RoleSelect.Text + "'", sqlcon);
            DataTable      dtbl   = new DataTable();

            sda.Fill(dtbl);
            if (dtbl.Rows[0][0].ToString() == "1")
            {
                this.Hide();
                if (RoleSelect.Text == "Admin")
                {
                    AdminDashboard ss = new AdminDashboard();
                    ss.Show();
                }
                if (RoleSelect.Text == "Salesman")
                {
                    SalesmanDashboar sdb = new SalesmanDashboar();
                    sdb.Show();
                }
            }
            else
            {
                MessageBox.Show("ERROR PASSWORD TRY AGAIN");
                Login log = new Login();
                log.Show();
            }
        }
        private void Inventory_Click(object sender, EventArgs e)
        {
            AdminDashboard add = new AdminDashboard();

            this.Hide();
            add.Show();
        }