Esempio n. 1
0
        private void btnProdDept_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmProductManagement prod = new frmProductManagement();

            prod.Show();
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                var staff = CRUD.Login(txtUsername.Text, txtPassword.Text);
                if (staff != null)
                {
                    switch (staff.Department)
                    {
                    case "Technical Support":
                    {
                        this.Hide();
                        frmTechnicalSupport support = new frmTechnicalSupport();
                        support.Login(staff);
                        support.Show();
                        break;
                    }

                    case "Product Management":
                    {
                        this.Hide();
                        frmProductManagement prodMng = new frmProductManagement();
                        prodMng.Login(staff);
                        prodMng.Show();
                        break;
                    }

                    case "Customer Support":
                    {
                        this.Hide();
                        frmCustomerService custSupport = new frmCustomerService();
                        custSupport.Login(staff);
                        custSupport.Show();
                        break;
                    }

                    case "Employee Services":
                    {
                        this.Hide();
                        EmployeeService emp = new EmployeeService();
                        emp.Login(staff);
                        emp.Show();
                        break;
                    }

                    default:
                    {
                        MessageBox.Show("Unauthorized Access Detected!");
                        break;
                    }
                    }
                }
                else
                {
                    MessageBox.Show("Unauthorized Access Detected!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unauthorized Access Detected!");
            }
        }