private void button4_Click(object sender, EventArgs e)
        {
            this.Hide();
            LOGIN obj = new LOGIN();

            obj.Show();
        }
예제 #2
0
        private void button17_Click(object sender, EventArgs e)
        {
            MessageBox.Show("LOGOUT SUCCESSFUL");
            this.Hide();
            LOGIN obj = new LOGIN();

            obj.Show();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int    Flag       = 0;
            String connection = "Provider=OraOLEDB.Oracle;Data Source=localhost;Workspace=Malcolm;User Id=MALCOLM;Password=madeira;OLEDB.NET=True";

            OleDbConnection obj1 = new OleDbConnection(connection);

            obj1.Open();

            string s1 = comboBox1.SelectedItem.ToString();

            try
            {
                OleDbDataAdapter sda = new OleDbDataAdapter("SELECT COUNT(*) AS val from Login where User_ID= '" + textBox1.Text + "' AND Password ='******'AND Account_type='" + s1 + "'", connection);

                DataTable dt = new DataTable();
                sda.Fill(dt);
                if (dt.Rows[0][0].ToString() == "1")
                {
                    Flag = 1;
                }

                if (Flag == 1)
                {
                    if (comboBox1.SelectedItem.ToString() == "Administrator")
                    {
                        MessageBox.Show("LOGIN SUCCESSFUL");
                        this.Hide();
                        ADMIN obj = new ADMIN();
                        obj.Show();
                    }


                    else if (comboBox1.SelectedItem.ToString() == "Customer")
                    {
                        MessageBox.Show("LOGIN SUCCESSFUL");
                        this.Hide();
                        customer obj = new customer();
                        obj.Show();
                    }

                    else if (comboBox1.SelectedItem.ToString() == "Employee")
                    {
                        MessageBox.Show("LOGIN SUCCESSFUL");
                        this.Hide();
                        Home obj = new Home();
                        obj.Show();
                    }
                }

                else
                {
                    this.Hide();
                    MessageBox.Show("INVALID Username OR Password");
                    LOGIN obj = new LOGIN();
                    obj.Show();
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }