Exemplo n.º 1
0
        private void dashboardPage_Click(object sender, EventArgs e)
        {
            technicianDashboard refresh = new technicianDashboard();

            this.Close();
            refresh.Show();
        }
Exemplo n.º 2
0
 private void dashboardPage_Click(object sender, EventArgs e)
 {
     if (coordButton.Enabled == true || mangButton.Enabled == false)
     {
         dashboardScreen pageDashboard = new dashboardScreen();
         pageDashboard.Show();
         this.Close();
     }
     else if (mangButton.Enabled == true || coordButton.Enabled == false)
     {
         managerDashboard pageDashboard = new managerDashboard();
         pageDashboard.Show();
         this.Close();
     }
     else
     {
         technicianDashboard pageDashboard = new technicianDashboard();
         pageDashboard.Show();
         this.Close();
     }
 }
Exemplo n.º 3
0
        public void submitButton_Click(object sender, EventArgs e)
        {
            Boolean userValid;

            if (loginCount > 1)
            {
                using (OleDbConnection myConnection = new OleDbConnection())
                {
                    myConnection.ConnectionString = "Provider=SQLNCLI11;Data Source=10.135.85.184;User ID=Group6;Password=Grp6s2117;Initial Catalog=GROUP6";
                    myConnection.Open();
                    OleDbCommand cmdNotReturned = myConnection.CreateCommand();
                    cmdNotReturned.CommandText = "SELECT * FROM Users WHERE username = '******'AND password = '******'";

                    OleDbDataReader readerReturnValue = cmdNotReturned.ExecuteReader(CommandBehavior.CloseConnection);

                    if (readerReturnValue.HasRows == true)
                    {
                        OleDbCommand userType = myConnection.CreateCommand();
                        userType.CommandText = "SELECT userType FROM Users WHERE username = '******'";

                        OleDbDataReader userTypeReturn = userType.ExecuteReader();

                        while (userTypeReturn.Read())
                        {
                            int typeReturn = userTypeReturn.GetInt32(0);
                            //if the user is a coordinator
                            if (typeReturn == 1)
                            {
                                dashboardScreen dashboard = new dashboardScreen();
                                this.Hide();
                                dashboard.Show();
                            }
                            //if the user is a unit manager
                            else if (typeReturn == 2)
                            {
                                managerDashboard dashboard = new managerDashboard();
                                this.Hide();
                                dashboard.Show();
                            }
                            //if the user is a technician
                            else if (typeReturn == 3)
                            {
                                technicianDashboard dashboard = new technicianDashboard();
                                dashboard.techName.Text = usernameText.Text;
                                this.Hide();
                                dashboard.Show();
                            }
                            readerReturnValue = null;
                        }
                        technicianDashboard name = new technicianDashboard();
                        name.techName.Text = usernameText.Text;
                        userValid          = true;
                        //MessageBox.Show("You have successfully logged in.");
                        userTypeReturn.Close();
                    }
                    else
                    {
                        loginCount--;
                        MessageBox.Show("Your login attempt has failed.  You have " + loginCount + " login attempt(s) left.");
                        usernameText.Clear();
                        passwordText.Clear();
                    }
                }
            }

            else if (loginCount == 1)
            {
                Application.Exit();
            }
        }