Exemplo n.º 1
0
        private void Button3_Click(object sender, EventArgs e)
        {
            adminMenu m = new adminMenu();

            this.Hide();
            m.Show();
        }
Exemplo n.º 2
0
        private void Button2_Click(object sender, EventArgs e)
        {
            cmd = new MySqlCommand();
            con.Open();
            cmd.Connection  = con;
            cmd.CommandText = "SELECT * FROM passlogin where username='******' AND password='******'";

            cmd2 = new MySqlCommand();

            cmd2.Connection = con2;
            dr = cmd.ExecuteReader();

            if (dr.Read())


            {
                //   UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;

                con2.Open();
                String tempun = getUserName.Text.ToString(); //'" + tempun + "'
                cmd2.CommandText = "UPDATE temp SET tempUsername = '******' ";
                cmd2.ExecuteNonQuery();

                cmd3 = new MySqlCommand();
                con3.Open();
                cmd3.Connection  = con3;
                cmd3.CommandText = "SELECT * FROM passlogin where username='******' AND password='******' AND privilage = 'admin' ";

                dr3 = cmd3.ExecuteReader();

                if (dr3.Read())
                {
                    MessageBox.Show("Login succesfull ! Directing to Admin Menu ");
                    adminMenu m1 = new adminMenu();
                    LoginPage l1 = new LoginPage();
                    this.Visible = false; //this.close() sıkıntılı neden bilmiyorum...
                    m1.Show();
                    con.Close();
                }
                else
                {
                    MessageBox.Show("Login succesfull ! Directing to Employee Menu ");
                    empMenu e1 = new empMenu();
                    this.Hide();
                    e1.Show();
                }
                /////////////////////////////////////////////////
            }
            else
            {
                MessageBox.Show("Wrong Username,Password or both !");
                con.Close();
            }
        }