private void button3_Click(object sender, EventArgs e)
        {
            this.Hide();
            AdminControls ar = new AdminControls();

            ar.Show();
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection con;

            con = new SqlConnection(ConfigurationManager.ConnectionStrings["Test"].ConnectionString);
            con.Open();
            if (attempt == 0)
            {
                lblMsg.Text = ("ALL 3 ATTEMPTS HAVE FAILED - CONTACT ADMIN");
                return;
            }

            SqlCommand scmd = new SqlCommand("select count (*) as cnt from dbo.TM_USERMASTER where userName=@usr and password=@pwd", con);

            scmd.Parameters.Clear();
            scmd.Parameters.AddWithValue("@usr", textBox1.Text);
            scmd.Parameters.AddWithValue("@pwd", textBox2.Text);


            if (scmd.ExecuteScalar().ToString() == "1")
            {
                pictureBox1.Image = new Bitmap(@"C:\Users\30661\Documents\Visual Studio 2015\Projects\TrafficManagement\acgt.gif");
                lblMsg.Text       = ("                                 Congrats");
                MessageBox.Show("YOU ARE GRANTED WITH ACCESS");

                this.Hide();
                AdminControls f2 = new AdminControls();
                f2.Show();
            }

            else
            {
                pictureBox1.Image = new Bitmap(@"C:\Users\30661\Documents\Visual Studio 2015\Projects\TrafficManagement\acd.gif");
                MessageBox.Show("YOU ARE NOT GRANTED WITH ACCESS");
                lblMsg.Text = ("You Have Only " + Convert.ToString(attempt) + " Attempt Left To Try");
                --attempt;
            }
            con.Close();
        }