Ejemplo n.º 1
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();
                }
            }
        }
Ejemplo n.º 2
0
        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Employee_view emv = new Employee_view();

            emv.Show();
        }
Ejemplo n.º 3
0
        private void newFormToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Employee_view emp = new Employee_view();

            emp.Show();
        }