Esempio n. 1
0
        private void btn_login_Click_1(object sender, EventArgs e)
        {
            conn.Open();
            cmd.Connection = conn;
            string LOGIN = "******";

            cmd.Parameters.AddWithValue("un", txt_un.Text);
            cmd.Parameters.AddWithValue("pwd", txt_pw.Text);
            cmd.Parameters.AddWithValue("rl", cBoxUser.Text);
            cmd.CommandText = LOGIN;
            SqlDataReader reader = cmd.ExecuteReader();

            if (reader.HasRows)
            {
                if (cBoxUser.Text == "Admin")
                {
                    MetroMessageBox.Show(this, "Welcome " + txt_un.Text, "System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    userType = cBoxUser.Text;
                    Frm_Main fmain = new Frm_Main();
                    fmain.Show();
                    Hide();
                }
                else if (cBoxUser.Text == "Cashier")
                {
                    MetroMessageBox.Show(this, "Welcome " + txt_un.Text, "System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    userType = cBoxUser.Text;
                    Frm_POS fpos = new Frm_POS();
                    fpos.Show();
                    Hide();
                }
            }
            else
            {
                MetroMessageBox.Show(this, "Wrong password/username/usertype. Please check again.", "System", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            conn.Close();
            cmd.Parameters.Clear();
        }
Esempio n. 2
0
        private void metroTile4_Click(object sender, EventArgs e)
        {
            Frm_POS fpos = new Frm_POS();

            fpos.ShowDialog();
        }