Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            dashboard dsb = new dashboard();

            dsb.Show();
        }
Exemplo n.º 2
0
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == Convert.ToChar(Keys.Return))
            {
                n_string = textBox1.Text;
                try
                {
                    string sqlCmd = "SELECT Username FROM Login_db WHERE Username='******'";
                    cmd = new OleDbCommand(sqlCmd, con);
                    con.Open();
                    dr = cmd.ExecuteReader();
                    int num = 0;
                    while (dr.Read())
                    {
                        num += 1;
                    }

                    if (num == 1 && textBox1.Text == "admin")
                    {
                        dashboard dsb = new dashboard();
                        n_string = textBox1.Text;
                        dsb.Show();
                        this.Hide();
                    }
                    else if (dr.HasRows)
                    {
                        Employee_view emv = new Employee_view();
                        n_string = textBox1.Text;
                        emv.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("INCORRECT ACCOUNT");
                    }

                    con.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    con.Close();
                }
            }
        }