Пример #1
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            this.Hide();
            DashboardCoordinator dashboardCoordinator = new DashboardCoordinator();

            dashboardCoordinator.Show();
        }
Пример #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            AdminLogin aLogin = new AdminLogin();

            aLogin.username = tbUser.Text;
            aLogin.password = tbPassword.Text;

            Patient patient = new Patient();

            patient.username = tbUser.Text;
            patient.password = tbPassword.Text;

            Coordinator coordinator = new Coordinator();

            coordinator.username = tbUser.Text;
            coordinator.password = tbPassword.Text;

            CurrentUserValue currentUser = new CurrentUserValue();

            currentUser.currentUser = tbUser.Text;

            username = tbUser.Text;

            if (tbUser.Text == "")
            {
                MessageBox.Show("Username required!", "Login Validation", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (tbPassword.Text == "")
            {
                MessageBox.Show("Password required!", "Login validation", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                bool b  = loginRepo.LoginAdmin(aLogin);
                bool bp = patientRepo.PatientLogin(patient);
                bool bc = coordinatorRepo.CoordinatorLogin(coordinator);
                bool c  = userRepo.CurrentUserStore(currentUser);



                if (b == true && c == true)
                {
                    MessageBox.Show("Login Successful admin");
                    this.Hide();
                    ManagementDashboard management = new ManagementDashboard();
                    management.Show();
                    this.Hide();
                }
                else if (bp == true && c == true)
                {
                    MessageBox.Show("Login Successful Patient");

                    this.Hide();
                    Dashboard dashboard = new Dashboard();
                    dashboard.Show();
                }
                else if (bc == true && c == true)
                {
                    MessageBox.Show("Login Successful Coordinator");
                    this.Hide();
                    DashboardCoordinator dashboardCoordinator = new DashboardCoordinator();
                    dashboardCoordinator.Show();
                }
                else
                {
                    MessageBox.Show("Login Failed!", "Login Validation", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }