private void btnEmployeeLogin_Click(object sender, EventArgs e)        //Take User to the Login Form
        {
            AdminArea admin = new AdminArea();

            this.Hide();
            admin.Show();
        }
Пример #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            EmployeeRegisterLogin login = new EmployeeRegisterLogin();

            if (cmbLogEmpID.Text == "" || txtLogEmpMail.Text == "" || txtLogEmpPass.Text == "" || cmbLogType.Text == "")
            {
                MessageBox.Show("Fill All the Fields");
            }
            else if (cmbLogEmpID.Text != "" && txtLogEmpMail.Text != "" && txtLogEmpPass.Text != "" && cmbLogType.Text != "")
            {
                string   Category     = cmbLogType.Text;
                int      EmpID        = Convert.ToInt32(cmbLogEmpID.Text);
                string   Mail         = txtLogEmpMail.Text;
                string   Password     = txtLogEmpPass.Text;
                DateTime attendance   = DateTime.Now;
                string   EmpAttendace = attendance.ToString("yyyy-MM-dd");
                string   Time         = attendance.ToString("hh:mm:ss");

                if (chkAttendance.Checked)
                {
                    login.Attendance(EmpID, EmpAttendace, Time);
                }

                if (login.EmployeeLogin(Category, Mail, Password))
                {
                    if (Category == "Manager")
                    {
                        AdminArea admin = new AdminArea();
                        this.Hide();
                        admin.Show();
                    }

                    else if (Category == "Accountant")
                    {
                        AccounantArea account = new AccounantArea();
                        this.Hide();
                        account.Show();
                    }

                    if (Category == "Cashier")
                    {
                        Employee.Cashier cash = new Employee.Cashier();
                        this.Hide();
                        cash.Show();
                    }

                    else if (Category == "Chef")
                    {
                        ChefArea chef = new ChefArea();
                        this.Hide();
                        chef.Show();
                    }

                    else if (Category == "Delivery Agent")
                    {
                        DeliveryAgentArea agent = new DeliveryAgentArea();
                        this.Hide();
                        agent.Show();
                    }
                }
            }
        }