Esempio n. 1
0
        private void button10_Click(object sender, EventArgs e)
        {
            this.Hide();
            EmployeeHome eh = new EmployeeHome();

            eh.Show();
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                SqlDataAdapter sda  = new SqlDataAdapter("select count(*) from logininfo where Username = '******' and Password = '******'   ", con);
                SqlDataAdapter sda2 = new SqlDataAdapter("select count(*) from logininfo2 where Username = '******' and Password = '******'   ", con);
                DataTable      dt   = new DataTable();
                DataTable      dt2  = new DataTable();
                sda.Fill(dt);
                sda2.Fill(dt2);
                if (textBox1.Text != "" && textBox2.Text != "")
                {
                    if (dt.Rows[0][0].ToString() == "1")
                    {
                        this.Hide();
                        Form1 fm1 = new Form1();
                        fm1.Show();
                    }

                    else if (dt2.Rows[0][0].ToString() == "1")
                    {
                        this.Hide();
                        EmployeeHome eh = new EmployeeHome();
                        eh.Show();
                    }

                    else
                    {
                        MessageBox.Show("Wrong User ID & Password combination !\nPlease try again !", "Information", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }
                }
                else
                {
                    MessageBox.Show("You can't leave any fields empty !\nPlease try again !", "Information", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }

            catch
            {
                MessageBox.Show("An error occured during inserting credentials !\nPlease try again !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }