private void buttonLogin_Click(object sender, EventArgs e)
        {
            //new Views.AdminForm().Show();
            string username = textBoxUsername.Text;
            string password = textBoxPass.Text;

            var resultA = AdminController.AuthenticateAdmin(username, password);
            var resultE = EmployeeController.AuthenticateEmployee(username, password);
            var resultC = CustomerController.AuthenticateCustomer(username, password);

            if (resultA != null)
            {
                new Views.AdminForm().Show();
            }
            else if (resultE != null)
            {
                new Views.EmployeeForm().Show();
            }
            else if (resultC != null)
            {
                new Views.CustomerForm().Show();
            }

            else
            {
                MessageBox.Show("User not Valid");
            }
        }
Exemple #2
0
        private void LogInButton_Click(object sender, EventArgs e)
        {
            string username = UsernameBox.Text;
            string password = PasswordBox.Text;
            var    r        = CustomerController.AuthenticateCustomer(username, password);

            if (r != null)
            {
                //new DashboardCustomerForm().Show();
                MessageBox.Show("User valid");
            }
            else
            {
                MessageBox.Show("User not valid");
            }
        }
Exemple #3
0
        private void loginClicked(object sender, EventArgs e)
        {
            string UserName = userName.Text;
            string Password = password.Text;
            string catagory = Catagory.SelectedItem.ToString();

            if (catagory.Equals("Admin"))
            {
                dynamic AdminResult = AdminController.AuthenticateAdmin(UserName, Password);

                if (AdminResult != null)
                {
                    string welcomeName = AdminResult.Name;
                    new AdminPortal(welcomeName).Show();
                }
                else
                {
                    MessageBox.Show("User Not Valid", "Invalid Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (catagory.Equals("Customer"))
            {
                var CustomerResult = CustomerController.AuthenticateCustomer(UserName, Password);
                if (CustomerResult != null)
                {
                    string welcome = CustomerResult.Name;
                    new CustomerPortal(welcome).Show();
                }
                else
                {
                    MessageBox.Show("User Not Valid", "Invalid Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (catagory.Equals("Employee"))
            {
                var EmployeeResult = EmployeeController.AuthenticEmployee(UserName, Password);
                if (EmployeeResult != null)
                {
                    string welcome = EmployeeResult.Name;
                    new EmployeePortal(welcome).Show();
                }
                else
                {
                    MessageBox.Show("User Not Valid", "Invalid Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string Email    = email.Text.Trim();
            string Password = password.Text.Trim();

            if (admin.Checked == false && employee.Checked == false && customer.Checked == false)
            {
                MessageBox.Show("Please select a category", "Invalid Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (string.IsNullOrEmpty(Email) || string.IsNullOrEmpty(Password))
            {
                if (string.IsNullOrEmpty(Email))
                {
                    emailallert.Visible = true;
                }
                else
                {
                    emailallert.Visible = false;
                }
                if (string.IsNullOrEmpty(Password))
                {
                    passwordallert.Visible = true;
                }
                else
                {
                    passwordallert.Visible = false;
                }
                MessageBox.Show("Please enter your Information", "Invalid Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (admin.Checked == true)
                {
                    dynamic AdminResult = AdminController.AuthenticateAdmin(Email, Password);
                    if (AdminResult != null)
                    {
                        this.Hide();

                        new AdminPortal().Show();
                    }
                    else
                    {
                        MessageBox.Show("User Not Valid", "Invalid Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (employee.Checked == true)
                {
                    dynamic EmployeeResult = EmployeeController.AuthenticEmployee(Email, Email, Password);
                    if (EmployeeResult != null)
                    {
                        this.Hide();
                        new EmployeePortal().Show();
                    }
                    else
                    {
                        MessageBox.Show("User Not Valid", "Invalid Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (customer.Checked == true)
                {
                    dynamic CustomerResult = CustomerController.AuthenticateCustomer(Email, Email, Password);
                    if (CustomerResult != null)
                    {
                        this.Hide();
                        new Customer_Portal().Show();
                    }
                    else
                    {
                        MessageBox.Show("User Not Valid", "Invalid Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }