// Provide username and password for selected program
        private void passwordListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                connection.Open();

                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.Text;
                string query = "select * from Master_Key_Passwords where Programs='" + passwordListBox.SelectedItem + "'";
                command.CommandText = query;

                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    usernameTextBox.Text = reader["Username"].ToString();
                    passwordTextBox.Text = reader["Passwords"].ToString();
                }

                connection.Close();
            }
            catch (Exception ex)
            {
                // Send bug report
                string       page      = "Master Key Password";
                string       button    = "PasswordListBox";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
        // Load up the data for the list boxes to display
        private void MasterKeyPasswordPage_Load(object sender, EventArgs e)
        {
            int key = int.Parse(keyLabel.Text);

            try
            {
                connection.Open();

                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.Text;
                command.CommandText = "select Programs from Master_Key_Passwords where PrivateKey=" + key + "";

                SqlDataReader programReader = command.ExecuteReader();
                while (programReader.Read())
                {
                    passwordListBox.Items.Add(programReader["Programs"].ToString());
                    updateProgramListBox.Items.Add(programReader["Programs"].ToString());
                }

                connection.Close();
            }
            catch (Exception ex)
            {
                // Send bug report
                string       page      = "Master Key Password";
                string       button    = "Load";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
Esempio n. 3
0
        private void TechnologyAssistantForm_Load(object sender, EventArgs e)
        {
            try
            {
                string[] query = { "select * from Help_Ticket",
                                   "select * from Supply_Information",
                                   "select * from Troubleshoot_Data",
                                   "select * from Exception_Error_Report" };
                string[] table = { "Help", "Supply", "Troubleshoot", "Bug" };

                for (int i = 0; i < query.Length; i++)
                {
                    selectSqlData(query[i], table[i]);
                }
            }
            catch (Exception ex)
            {
                // Send bug report
                string       page      = "TechAssist Load";
                string       button    = "Load";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
Esempio n. 4
0
        private void updateBugButton_Click(object sender, EventArgs e)
        {
            if (bugIDLabel.Text == "")
            {
                MessageBox.Show("There is nothing to update.");
                return;
            }
            try
            {
                string status = bugStatusComboBox.Text;
                string fix    = bugFixTextBox.Text;
                connection.Open();

                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.Text;
                string query = "update Exception_Error_Report set Status='" + status + "',Fix='" + fix + "' where ID=" + bugNumberListBox.SelectedItem + "";
                command.CommandText = query;
                command.ExecuteNonQuery();

                connection.Close();
                MessageBox.Show("Report updated.");
            }
            catch (Exception ex)
            {
                // Create bug report
                string       page      = "TechAssistBugReport";
                string       button    = "Update";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();
                this.Close();
            }
        }
        private void miscDeleteButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (miscListBox.SelectedIndex > -1)
                {
                    string query = "delete from Tutorial_Misc where Topic='" + miscListBox.SelectedItem + "'";
                    deleteTutorial(query);

                    miscListBox.Items.Remove(miscListBox.SelectedItem);
                }
                else
                {
                    MessageBox.Show("Please select an option to delete.");
                }
            }
            catch (Exception ex)
            {
                string       page      = "Tutorial";
                string       button    = "Delete - Misc";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
        // Delete information for program for user
        private void deleteButton_Click(object sender, EventArgs e)
        {
            // Check to see if boxes are blank
            if (programTextBox.Text == "" || newUsernameTextBox.Text == "" || newPasswordTextBox.Text == "")
            {
                MessageBox.Show("All 3 fields must be filled out to delete.");
                return;
            }
            else if (idLabel.Text == "")
            {
                MessageBox.Show("Must select a program to delete.");
                return;
            }
            else
            {
                // Variables to hold required information
                int    ID       = int.Parse(idLabel.Text);
                int    key      = int.Parse(keyLabel.Text);
                string program  = programTextBox.Text;
                string username = newUsernameTextBox.Text;
                string password = newPasswordTextBox.Text;
                // Open and remove information from database
                try
                {
                    connection.Open();

                    SqlCommand command = connection.CreateCommand();
                    command.CommandType = CommandType.Text;
                    string query = "delete from Master_Key_Passwords where Programs='" + program + "' AND PrivateKey=" + key + " AND ID=" + ID + "";
                    command.CommandText = query;
                    command.ExecuteNonQuery();

                    connection.Close();

                    // Confirm add and display in listbox
                    MessageBox.Show("Information for \"" + program + "\" was deleted.");
                    updateProgramListBox.Items.Remove(program);
                    passwordListBox.Items.Remove(program);

                    // Clear textboxes
                    programTextBox.Text     = "";
                    newUsernameTextBox.Text = "";
                    newPasswordTextBox.Text = "";
                    usernameTextBox.Text    = "";
                    passwordTextBox.Text    = "";
                }
                catch (Exception ex)
                {
                    // Send bug report
                    string       page      = "Master Key Password";
                    string       button    = "Delete";
                    string       exception = ex.ToString();
                    BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                    bugSplat.ShowDialog();

                    this.Close();
                }
            }
        }
Esempio n. 7
0
        // Create a key and check to see if it exist or not
        private int CreateKey()
        {
            int  privateKey;
            bool newKey = false;

            // Create random private key number
            Random randomKey = new Random();

            privateKey = randomKey.Next(1000, 9999);

            // Convert key to string
            string privateKeyString = privateKey.ToString();

            while (newKey == false)
            {
                // Array to hold all private key to check if existing key is there
                string[] allKeys = new string[2500];
                int      i       = 0;

                // Read all data to check for existing key
                try
                {
                    connection.Open();

                    SqlCommand command = connection.CreateCommand();
                    command.CommandType = CommandType.Text;
                    command.CommandText = "select * from Master_Key_Login";

                    SqlDataReader keyReader = command.ExecuteReader();
                    while (keyReader.Read())
                    {
                        allKeys[i] = keyReader["PrivateKey"].ToString();
                        if (allKeys[i] == privateKeyString)
                        {
                            connection.Close();
                            return(100);
                        }
                    }
                    connection.Close();
                    return(int.Parse(privateKeyString));
                }
                catch (Exception ex)
                {
                    // Send bug report
                    string       page      = "Master Key Register";
                    string       button    = "CreateKey";
                    string       exception = ex.ToString();
                    BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                    bugSplat.ShowDialog();

                    this.Close();
                }
            }
            connection.Close();
            return(int.Parse(privateKeyString));
        }
Esempio n. 8
0
        // Add a new problem and solution to troubleshoot data
        private void addTroubleButton_Click(object sender, EventArgs e)
        {
            string issue       = problemTextBox.Text;
            string solution    = solutionTextBox.Text;
            string keyWords    = keyWordsTextBox.Text;
            string explanation = "";

            if (explanationTextBox.Text == "")
            {
                explanation = "";
            }
            else
            {
                explanation = explanationTextBox.Text;
            }

            // Check to make sure at least problem and solutin is filled in
            if (issue != "" && solution != "")
            {
                try
                {
                    connection.Open();

                    SqlCommand command = connection.CreateCommand();
                    command.CommandType = CommandType.Text;
                    string query = "insert into Troubleshoot_Data (Issue,KeyWords,Explanation,Resolution) values('" + issue + "','" + keyWords + "','" + explanation + "','" + solution + "')";
                    command.CommandText = query;
                    command.ExecuteNonQuery();

                    connection.Close();

                    MessageBox.Show("Problem and solution was added successfully.");
                    currentSolutionListBox.Items.Add(issue);
                    problemTextBox.Text     = "";
                    keyWordsTextBox.Text    = "";
                    explanationTextBox.Text = "";
                    solutionTextBox.Text    = "";
                }
                catch (Exception ex)
                {
                    // Send bug report
                    string       page      = "TechAssist Troubleshoot";
                    string       button    = "Add";
                    string       exception = ex.ToString();
                    BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                    bugSplat.ShowDialog();

                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Please input both problem and solution.");
            }
        }
        // Refresh information on selected category
        private void refreshButton_Click(object sender, EventArgs e)
        {
            string category = categorySearchComboBox.Text;
            string query    = "";

            try
            {
                if (categorySearchComboBox.Text == "Desktop" || categorySearchComboBox.Text == "Laptop" ||
                    categorySearchComboBox.Text == "Monitor" || categorySearchComboBox.Text == "Printer" ||
                    categorySearchComboBox.Text == "Smartboard" || categorySearchComboBox.Text == "Projector" ||
                    categorySearchComboBox.Text == "Tablet" || categorySearchComboBox.Text == "Accessories" ||
                    categorySearchComboBox.Text == "Webber")
                {
                    query = "select * from Main_Inventory where Type='" + categorySearchComboBox.Text + "'";
                }
                else if (categorySearchComboBox.Text == "Active" || categorySearchComboBox.Text == "Inactive" || categorySearchComboBox.Text == "Repair" ||
                         categorySearchComboBox.Text == "Surplus" || categorySearchComboBox.Text == "Unknown")
                {
                    query = "select * from Main_Inventory where Status='" + categorySearchComboBox.Text + "'";
                }
                else if (categorySearchComboBox.Text == "Office" || categorySearchComboBox.Text == "District" || categorySearchComboBox.Text == "MPR" ||
                         categorySearchComboBox.Text == "A1" || categorySearchComboBox.Text == "A2" || categorySearchComboBox.Text == "A3" ||
                         categorySearchComboBox.Text == "A4" || categorySearchComboBox.Text == "B1" || categorySearchComboBox.Text == "B2" ||
                         categorySearchComboBox.Text == "B3" || categorySearchComboBox.Text == "B4" || categorySearchComboBox.Text == "C1" ||
                         categorySearchComboBox.Text == "C2" || categorySearchComboBox.Text == "C3" || categorySearchComboBox.Text == "C4" ||
                         categorySearchComboBox.Text == "D1" || categorySearchComboBox.Text == "D2" || categorySearchComboBox.Text == "D3" ||
                         categorySearchComboBox.Text == "D4" || categorySearchComboBox.Text == "E1" || categorySearchComboBox.Text == "E2" ||
                         categorySearchComboBox.Text == "E3" || categorySearchComboBox.Text == "E4" || categorySearchComboBox.Text == "F1" ||
                         categorySearchComboBox.Text == "F2" || categorySearchComboBox.Text == "F3" || categorySearchComboBox.Text == "F4" ||
                         categorySearchComboBox.Text == "Other")
                {
                    query = "select * from Main_Inventory where Location='" + categorySearchComboBox.Text + "'";
                }
                else
                {
                    MessageBox.Show("Select a category.");
                    return;
                }

                SelectSQLData(query);
            }
            catch (Exception ex)
            {
                // Get and send information to bug report
                string       page      = "Search";
                string       button    = "Refresh";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
        // Update data for current programs
        private void updateButton_Click(object sender, EventArgs e)
        {
            if (programTextBox.Text == "" || newUsernameTextBox.Text == "" || newPasswordTextBox.Text == "")
            {
                MessageBox.Show("All 3 fields must be filled out to update.");
                return;
            }
            else if (idLabel.Text == "")
            {
                MessageBox.Show("Must select a program to update.");
                return;
            }
            else
            {
                int    ID       = int.Parse(idLabel.Text);
                int    key      = int.Parse(keyLabel.Text);
                string program  = programTextBox.Text;
                string username = newUsernameTextBox.Text;
                string password = newPasswordTextBox.Text;

                try
                {
                    connection.Open();

                    SqlCommand command = connection.CreateCommand();
                    command.CommandType = CommandType.Text;
                    string query = "update Master_Key_Passwords set Username='******',Passwords='" + password + "' where Programs='" + program + "' AND PrivateKey=" + key + " AND ID=" + ID + "";
                    command.CommandText = query;
                    command.ExecuteNonQuery();

                    connection.Close();

                    // Confirm add and display in listbox
                    MessageBox.Show("Update for \"" + program + "\" was successful.");

                    // Clear textboxes
                    programTextBox.Text     = "";
                    newUsernameTextBox.Text = "";
                    newPasswordTextBox.Text = "";
                }
                catch (Exception ex)
                {
                    // Send bug report
                    string       page      = "Master Key Password";
                    string       button    = "Update";
                    string       exception = ex.ToString();
                    BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                    bugSplat.ShowDialog();

                    this.Close();
                }
            }
        }
Esempio n. 11
0
        private void SuppliesInformationForm_Load(object sender, EventArgs e)
        {
            // Check for which type is selected
            try
            {
                connection.Open();

                SqlCommand commandType = connection.CreateCommand();
                commandType.CommandType = CommandType.Text;
                string query = "select Type from Supply_Information";
                commandType.CommandText = query;

                //st<string> typeList = new List<string>();
                string[] typeList = new String[1000];
                int      i        = 0;

                // Add type to list
                SqlDataReader readerType = commandType.ExecuteReader();
                while (readerType.Read())
                {
                    typeList[i] = readerType["Type"].ToString();
                    i++;
                }

                // Checks for copy of same type and only display one
                // Brute force algorithm, will slow as list gets bigger
                int listLength = i;
                for (int a = 0; a < listLength; a++)
                {
                    typeComboBox.Items.Add(typeList[a]);
                    for (int b = a + 1; b < listLength; b++)
                    {
                        if (typeList[b] == typeList[a])
                        {
                            typeComboBox.Items.Remove(typeList[a]);
                        }
                    }
                }
                connection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("The connection with the database could not be established. The program will now exit. Please try again later or contact your administrator if the problem persists.");
                // Get bug info and send report
                string       page      = "Supply";
                string       button    = "Page Load";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
        // Populate the how to textbox for each tab
        private void TutorialForm_Load(object sender, EventArgs e)
        {
            try
            {
                string[] query = { "select Topic from Tutorial_Office",
                                   "select Topic from Tutorial_Chromebook",
                                   "select Topic from Tutorial_EdSoftware",
                                   "select Topic from Tutorial_Outlook",
                                   "select Topic from Tutorial_Google",
                                   "select Topic from Tutorial_Misc" };

                string[] subject = { "office",  "chromebook", "edSoftware",
                                     "outlook", "google",     "misc", };

                for (int i = 0; i < 6; i++)
                {
                    SelectSQLData(query[i], subject[i]);
                }

                // Sort listbox
                wordListBox.Sorted       = true;
                excelListBox.Sorted      = true;
                powerpointListBox.Sorted = true;
                outlookListBox.Sorted    = true;
                googleListBox.Sorted     = true;
                miscListBox.Sorted       = true;

                // If user is admin show delete button
                if (userLabel.Text == "A")
                {
                    wordDeleteButton.Visible       = true;
                    excelDeleteButton.Visible      = true;
                    powerpointDeleteButton.Visible = true;
                    outlookDeleteButton.Visible    = true;
                    googleDeleteButton.Visible     = true;
                    miscDeleteButton.Visible       = true;
                }

                CheckAddCheckState();
            }
            catch (Exception ex)
            {
                MessageBox.Show("The connection with the database could not be established. Some features may not be working correctly. Please try again later or contact your administrator if the problem persists.");
                string       page      = "Tutorial";
                string       button    = "Page Load";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
Esempio n. 13
0
        // List box
        private void openTicketListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                connection.Open();

                SqlCommand commandID = connection.CreateCommand();
                commandID.CommandType = CommandType.Text;
                string query = "select * from Help_Ticket where ID=" + openTicketListBox.SelectedItem + "";
                commandID.CommandText = query;

                SqlDataReader reader = commandID.ExecuteReader();
                while (reader.Read())
                {
                    idLabel.Text            = reader["ID"].ToString();
                    dateCreatedLabel.Text   = reader["DateCreated"].ToString();
                    staffLabel.Text         = reader["Staff"].ToString();
                    roomLabel.Text          = reader["Room"].ToString();
                    importanceLabel.Text    = reader["Importance"].ToString();
                    categoryLabel.Text      = reader["Category"].ToString();
                    timePreferredLabel.Text = reader["TimePreferred"].ToString();
                    descriptionLabel.Text   = reader["Description"].ToString();
                    statusComboBox.Text     = reader["Status"].ToString();
                    dateClosedLabel.Text    = reader["DateClosed"].ToString();
                    fixDateTextBox.Text     = reader["PlannedFixDate"].ToString();
                }
                connection.Close();

                if (statusComboBox.Text == "Closed")
                {
                    statusComboBox.Enabled = false;
                    fixDateTextBox.Enabled = false;
                }
                else
                {
                    statusComboBox.Enabled = true;
                    fixDateTextBox.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                // Send bug report
                string       page      = "TechAssist Ticket";
                string       button    = "Index Changed";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
Esempio n. 14
0
        // Update fields
        private void updateSupplyButton_Click(object sender, EventArgs e)
        {
            string type     = typeLabel.Text;
            string brand    = brandLabel.Text;
            string model    = modelLabel.Text;
            string category = catLabel.Text;
            string supply   = supplyLabel.Text;
            string link     = linkLabel.Text;

            // Check link for front requirements of www or https
            bool linkCheck = false;

            if (link.StartsWith("www.") || link.StartsWith("https://"))
            {
                linkCheck = true;
            }

            if (linkCheck)
            {
                try
                {
                    connection.Open();

                    SqlCommand command = connection.CreateCommand();
                    command.CommandType = CommandType.Text;
                    string query = "update Supply_Information set Type='" + type + "',Brand='" + brand + "',Model='" + model + "',Category='" + category + "',Supply='" + supply + "',Link='" + link + "' where ID=" + suppliesListBox.SelectedItem + "";
                    command.CommandText = query;
                    command.ExecuteNonQuery();

                    connection.Close();
                    MessageBox.Show("Item updated.");
                }
                catch (Exception ex)
                {
                    // Send bug report
                    string       page      = "TechAssist Supply";
                    string       button    = "Update";
                    string       exception = ex.ToString();
                    BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                    bugSplat.ShowDialog();

                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Please include https:// or www. in your link.");
            }
        }
Esempio n. 15
0
        // Populate the bug information to be displayed
        private void bugNumberListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                connection.Open();

                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.Text;
                string query = "select * from Exception_Error_Report where ID=" + bugNumberListBox.SelectedItem + "";
                command.CommandText = query;

                SqlDataReader bugReader = command.ExecuteReader();
                while (bugReader.Read())
                {
                    bugIDLabel.Text          = bugReader["ID"].ToString();
                    bugPageLabel.Text        = bugReader["Page"].ToString();
                    bugButtonLabel.Text      = bugReader["Button"].ToString();
                    bugErrorLinkLabel.Text   = bugReader["Error"].ToString();
                    bugPersonLabel.Text      = bugReader["Person"].ToString();
                    bugDescriptionLabel.Text = bugReader["Description"].ToString();
                    bugStatusComboBox.Text   = bugReader["Status"].ToString();
                    bugFixTextBox.Text       = bugReader["Fix"].ToString();
                }

                connection.Close();

                if (bugStatusComboBox.Text == "Closed")
                {
                    bugStatusComboBox.Enabled = false;
                    bugFixTextBox.Enabled     = false;
                }
                else
                {
                    bugStatusComboBox.Enabled = true;
                    bugFixTextBox.Enabled     = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(" hi" + ex);
                // Create bug report
                string       page      = "TechAssistBugReport";
                string       button    = "Selected Index";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();
                this.Close();
            }
        }
        // Add new program data set to the database
        private void addButton_Click(object sender, EventArgs e)
        {
            int    key      = int.Parse(keyLabel.Text);
            string program  = programTextBox.Text;
            string username = newUsernameTextBox.Text;
            string password = newPasswordTextBox.Text;

            if (program == "" || username == "" || password == "")
            {
                MessageBox.Show("All 3 fields must be filled out to add.");
                return;
            }
            else
            {
                try
                {
                    connection.Open();

                    SqlCommand command = connection.CreateCommand();
                    command.CommandType = CommandType.Text;
                    string query = "insert into Master_Key_Passwords (PrivateKey,Programs,Username,Passwords) values(" + key + ",'" + program + "','" + username + "','" + password + "')";
                    command.CommandText = query;
                    command.ExecuteNonQuery();

                    connection.Close();

                    // Confirm add and display in listbox
                    MessageBox.Show("Username and password for \"" + program + "\" was successfully added to your records.");
                    passwordListBox.Items.Add(program);
                    updateProgramListBox.Items.Add(program);

                    // Clear textboxes
                    programTextBox.Text     = "";
                    newUsernameTextBox.Text = "";
                    newPasswordTextBox.Text = "";
                }
                catch (Exception ex)
                {
                    // Send bug report
                    string       page      = "Master Key Password";
                    string       button    = "Add";
                    string       exception = ex.ToString();
                    BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                    bugSplat.ShowDialog();

                    this.Close();
                }
            }
        }
        private bool CheckUsername(string name)
        {
            string recordFullName = "";

            string[] firstNameArray = new string[2500];
            string[] lastNameArray  = new string[2500];
            int      i = 0;

            try
            {
                connection.Open();

                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.Text;
                string query = "select * from Master_Key_Login";
                command.CommandText = query;

                // Get both names and add them together, return false if same
                SqlDataReader nameReader = command.ExecuteReader();
                while (nameReader.Read())
                {
                    firstNameArray[i] = nameReader["FirstName"].ToString();
                    lastNameArray[i]  = nameReader["LastName"].ToString();
                    recordFullName    = firstNameArray[i] + " " + lastNameArray[i];
                    if (recordFullName == name)
                    {
                        connection.Close();
                        return(true);
                    }
                }
                connection.Close();
                return(false);
            }
            catch (Exception ex)
            {
                // Send bug report
                string       page      = "Master Key";
                string       button    = "CheckUsername";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
            connection.Close();
            return(false);
        }
        private bool ConfirmUser(string name, string key)
        {
            int keyPin = int.Parse(key);

            string[] allKeys   = new string[2500];
            string[] firstName = new string[2500];
            string[] lastName  = new string[2500];
            string   fullName  = "";
            int      i         = 0;

            try
            {
                connection.Open();

                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.Text;
                command.CommandText = "select FirstName,LastName from Master_Key_Login where PrivateKey=" + keyPin + "";

                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    firstName[i] = reader["FirstName"].ToString();
                    lastName[i]  = reader["LastName"].ToString();
                    fullName     = firstName[i] + " " + lastName[i];
                    if (fullName == name)
                    {
                        connection.Close();
                        return(true);
                    }
                }
                connection.Close();
                return(false);
            }
            catch (Exception ex)
            {
                // Send bug report
                string       page      = "Master Key";
                string       button    = "ConfirmUser";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
            connection.Close();
            return(false);
        }
Esempio n. 19
0
        // Open link in a new tab
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                Process.Start(link);
            }
            catch (Exception ex)
            {
                string       page      = "Supply";
                string       button    = "Link";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
        // Search for items
        private void findButton_Click(object sender, EventArgs e)
        {
            int    number = categorySearchComboBox.SelectedIndex;
            string query  = "";

            try
            {
                if (number >= 0 && number <= 44)
                {
                    if (categorySearchComboBox.SelectedIndex >= 0 && categorySearchComboBox.SelectedIndex <= 8)
                    {
                        query = "select * from Main_Inventory where Type='" + categorySearchComboBox.Text + "'";
                    }
                    else if (categorySearchComboBox.SelectedIndex >= 9 && categorySearchComboBox.SelectedIndex <= 13)
                    {
                        query = "select * from Main_Inventory where Status='" + categorySearchComboBox.Text + "'";
                    }
                    else if (categorySearchComboBox.SelectedIndex >= 14 && categorySearchComboBox.SelectedIndex <= 44)
                    {
                        query = "select * from Main_Inventory where Location='" + categorySearchComboBox.Text + "'";
                    }
                    else
                    {
                        MessageBox.Show("Select an option.");
                        return;
                    }

                    SelectSQLData(query);
                }
                else
                {
                    MessageBox.Show("Please select a given option.");
                }
            }
            catch (Exception ex)
            {
                // Get and send information to bug report
                string       page      = "Search";
                string       button    = "Find";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
Esempio n. 21
0
        // Make changes to troubleshoot data
        private void editTroubleButton_Click(object sender, EventArgs e)
        {
            if (problemIDLabel.Text == "")
            {
                MessageBox.Show("There is nothing to update.");
            }
            else
            {
                int    id          = int.Parse(problemIDLabel.Text);
                string issue       = problemTextBox.Text;
                string explanation = explanationTextBox.Text;
                string solution    = solutionTextBox.Text;
                string keyWords    = keyWordsTextBox.Text;

                try
                {
                    connection.Open();

                    SqlCommand command = connection.CreateCommand();
                    command.CommandType = CommandType.Text;
                    string query = "update Troubleshoot_Data set Issue='" + issue + "',KeyWOrds='" + keyWords + "',Explanation='" + explanation + "',Resolution='" + solution + "' where ID=" + id + "";
                    command.CommandText = query;
                    command.ExecuteNonQuery();

                    connection.Close();

                    MessageBox.Show("Problem and solution was updated successfully.");
                    problemIDLabel.Text     = "";
                    problemTextBox.Text     = "";
                    explanationTextBox.Text = "";
                    solutionTextBox.Text    = "";
                    keyWordsTextBox.Text    = "";
                }
                catch (Exception ex)
                {
                    // Send bug report
                    string       page      = "TechAssist Troubleshoot";
                    string       button    = "Edit";
                    string       exception = ex.ToString();
                    BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                    bugSplat.ShowDialog();

                    this.Close();
                }
            }
        }
Esempio n. 22
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            if (idLabel.Text == "")
            {
                MessageBox.Show("There is nothing to update.");
                return;
            }

            string status  = statusComboBox.Text;
            string fixDate = fixDateTextBox.Text;

            try
            {
                connection.Open();

                string     date      = DateTime.Now.ToString();
                SqlCommand commandID = connection.CreateCommand();
                commandID.CommandType = CommandType.Text;
                string query;
                if (statusComboBox.Text == "Closed")
                {
                    query = "update Help_Ticket set Status='" + status + "',DateClosed='" + date + "',PlannedFixDate='" + fixDate + "' where ID=" + openTicketListBox.SelectedItem + "";
                }
                else
                {
                    query = "update Help_Ticket set Status='" + status + "',PlannedFixDate='" + fixDate + "' where ID=" + openTicketListBox.SelectedItem + "";
                }
                commandID.CommandText = query;
                commandID.ExecuteNonQuery();

                connection.Close();
                MessageBox.Show("Updated.");
            }
            catch (Exception ex)
            {
                // Send bug report
                string       page      = "TechAssist Ticket";
                string       button    = "Update";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
Esempio n. 23
0
        // Display all chromebook data
        private void showAllChromeButton_Click(object sender, EventArgs e)
        {
            try
            {
                string query = "select * from Chromebook_Information";
                SelectDataDisplayOnGrid(query);
            }
            catch (Exception ex)
            {
                // Get information for bug report
                string       page      = "Chromebook";
                string       button    = "Show All";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
Esempio n. 24
0
        private void deleteSupplyButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (suppliesListBox.SelectedIndex < 0)
                {
                    MessageBox.Show("There is nothing to delete.");
                    return;
                }

                string item = supplyID.Text;
                connection.Open();

                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.Text;
                string query = "delete from Supply_Information where ID=" + suppliesListBox.SelectedItem + "";
                command.CommandText = query;
                command.ExecuteNonQuery();

                connection.Close();

                MessageBox.Show("Supply information deleted.");
                suppliesListBox.Items.Remove(item);
                supplyID.Text    = "";
                typeLabel.Text   = "";
                brandLabel.Text  = "";
                modelLabel.Text  = "";
                catLabel.Text    = "";
                supplyLabel.Text = "";
                linkLabel.Text   = "";
            }
            catch (Exception ex)
            {
                // Send bug report
                string       page      = "TechAssist Supply";
                string       button    = "Delete";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
        // Show all data of all items in main inventory
        private void showAllButton_Click(object sender, EventArgs e)
        {
            try
            {
                string query = "select * from Main_Inventory";
                SelectSQLData(query);
            }
            catch (Exception ex)
            {
                // Get and send information to bug report
                string       page      = "Search";
                string       button    = "Show All";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
Esempio n. 26
0
        // Delete all data about troubleshoot problem
        private void deleteTroubleButton_Click(object sender, EventArgs e)
        {
            if (problemIDLabel.Text == "")
            {
                MessageBox.Show("There is nothing to delete.");
            }
            else
            {
                int    id          = int.Parse(problemIDLabel.Text);
                string removedItem = problemTextBox.Text;
                try
                {
                    connection.Open();

                    SqlCommand command = connection.CreateCommand();
                    command.CommandType = CommandType.Text;
                    string query = "delete from Troubleshoot_Data where ID =" + id + "";
                    command.CommandText = query;
                    command.ExecuteNonQuery();

                    connection.Close();

                    MessageBox.Show("Problem and solution was deleted successfully.");
                    problemIDLabel.Text     = "";
                    problemTextBox.Text     = "";
                    explanationTextBox.Text = "";
                    solutionTextBox.Text    = "";
                    keyWordsTextBox.Text    = "";
                    currentSolutionListBox.Items.Remove(removedItem);
                }
                catch (Exception ex)
                {
                    // Send bug report
                    string       page      = "TechAssist Troubleshoot";
                    string       button    = "Delete";
                    string       exception = ex.ToString();
                    BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                    bugSplat.ShowDialog();

                    this.Close();
                }
            }
        }
        private bool CheckPrivateKey(string key)
        {
            string[] allKeys = new string[2500];
            int      i       = 0;

            // Read all data to check for existing key
            try
            {
                connection.Open();

                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.Text;
                command.CommandText = "select * from Master_Key_Login";

                SqlDataReader keyReader = command.ExecuteReader();
                while (keyReader.Read())
                {
                    allKeys[i] = keyReader["PrivateKey"].ToString();
                    if (allKeys[i] == key)
                    {
                        connection.Close();
                        return(true);
                    }
                }
                connection.Close();
                return(false);
            }
            catch (Exception ex)
            {
                // Send bug report
                string       page      = "Master Key";
                string       button    = "CheckPrivateKey";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
            connection.Close();
            return(false);
        }
Esempio n. 28
0
        private void modelComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            catComboBox.Items.Clear();
            catComboBox.Text  = "";
            nameRTextBox.Text = "";
            linkLabel1.Text   = "";

            string modelItem = modelComboBox.Text;
            string brandItem = brandComboBox.Text;
            string typeItem  = typeComboBox.Text;

            // Check for which brand is selected
            try
            {
                connection.Open();

                SqlCommand commandCat = connection.CreateCommand();
                commandCat.CommandType = CommandType.Text;
                string query = "select * from Supply_Information where Model='" + modelItem + "' and Brand='" + brandItem + "' and Type='" + typeItem + "'";
                commandCat.CommandText = query;

                SqlDataReader readerCat = commandCat.ExecuteReader();
                while (readerCat.Read())
                {
                    catComboBox.Items.Add(readerCat["Category"].ToString());
                }

                connection.Close();
            }
            catch (Exception ex)
            {
                // Send bug report
                string       page      = "Supply";
                string       button    = "Model";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();

                this.Close();
            }
        }
Esempio n. 29
0
        private void deleteButton_Click(object sender, EventArgs e)
        {
            // Check for entry
            if (deleteTextBox.Text == "")
            {
                MessageBox.Show("Please enter a number.");
            }
            else
            {
                CheckDigitClass checkDigit = new CheckDigitClass();
                bool            digit      = checkDigit.digitOnly(deleteTextBox.Text);
                if (digit == true)
                {
                    try
                    {
                        int deleteItem = int.Parse(deleteTextBox.Text);

                        string query = "delete from Chromebook_Information where ID=" + deleteItem + "";
                        SQLDatabaseCommands(query);

                        MessageBox.Show("All data was deleted for Chromebook #" + deleteTextBox.Text + ".");
                        deleteTextBox.Text = "";
                    }
                    catch (Exception ex)
                    {
                        // Gather information to send to bug report
                        string       page      = "Chromebook";
                        string       button    = "Delete";
                        string       exception = ex.ToString();
                        BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                        bugSplat.ShowDialog();

                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Please input numbers only.");
                }
            }
        }
Esempio n. 30
0
        // Delete a bug report
        private void deleteBugButton_Click(object sender, EventArgs e)
        {
            if (bugIDLabel.Text == "")
            {
                MessageBox.Show("There is nothing to delete.");
                return;
            }

            try
            {
                connection.Open();

                SqlCommand command = connection.CreateCommand();
                command.CommandType = CommandType.Text;
                string query = "delete from Exception_Error_Report where ID=" + bugNumberListBox.SelectedItem + "";
                command.CommandText = query;
                command.ExecuteNonQuery();

                connection.Close();
                MessageBox.Show("Bug Report " + bugNumberListBox.SelectedItem + " was deleted.");
                bugIDLabel.Text          = "";
                bugPageLabel.Text        = "";
                bugButtonLabel.Text      = "";
                bugErrorLinkLabel.Text   = "";
                bugPersonLabel.Text      = "";
                bugDescriptionLabel.Text = "";
                bugStatusComboBox.Text   = "";
                bugFixTextBox.Text       = "";
            }
            catch (Exception ex)
            {
                // Create bug report
                string       page      = "TechAssistBugReport";
                string       button    = "Delete";
                string       exception = ex.ToString();
                BugSplatForm bugSplat  = new BugSplatForm(page, button, exception);
                bugSplat.ShowDialog();
                this.Close();
            }
        }