Example #1
0
        private void BunifuThinButton23_Click(object sender, EventArgs e)
        {
            this.Hide();
            EmployeeDashboard ed = new EmployeeDashboard();

            ed.ShowDialog();
        }
Example #2
0
        private void BunifuThinButton21_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("All fields should filled");
            }
            else
            {
                SetValueForId = int.Parse(textBox1.Text);

                try
                {
                    Dao      con = new Dao();
                    Employee emp = new Employee()
                    {
                        Id       = textBox1.Text,
                        Password = textBox2.Text
                    };
                    Manager man = new Manager()
                    {
                        Id       = textBox1.Text,
                        Password = textBox2.Text
                    };
                    Admin ad = new Admin()
                    {
                        Id       = textBox1.Text,
                        Password = textBox2.Text
                    };
                    con.Connect();

                    if (con.LogAdmin(ad) > 0)
                    {
                        con.Disconnect();
                        this.Hide();
                        AdminDashboard adds = new AdminDashboard();
                        adds.ShowDialog();
                    }
                    con.Disconnect();
                    con.Connect();
                    if (con.LogEmployee(emp) > 0)
                    {
                        con.Disconnect();
                        Post = "Employee";
                        this.Hide();

                        EmployeeDashboard adds = new EmployeeDashboard();
                        adds.ShowDialog();
                    }

                    con.Disconnect();
                    con.Connect();
                    if (con.LogManager(man) > 0)
                    {
                        con.Disconnect();
                        Post = "Manager";
                        this.Hide();
                        SelectorEM s = new SelectorEM();
                        s.ShowDialog();

                        //ManagerDashboard adds = new ManagerDashboard();
                        //adds.ShowDialog();
                    }
                    con.Disconnect();
                    con.Connect();
                    if (con.LogEmployee(emp) == 0)
                    {
                        con.Disconnect();
                        con.Connect();
                        if (con.LogManager(man) == 0)
                        {
                            con.Disconnect();
                            con.Connect();
                            if (con.LogAdmin(ad) == 0)
                            {
                                con.Disconnect();
                                con.Connect();

                                MessageBox.Show("try again", "wrong password");
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }