Exemple #1
0
        /// <summary>
        /// This method handles the event that the sign in button on the left side is pressed.
        /// We will check to see if the user can sign in. If they can, lets notify them that
        /// their connection was successful and load the combobox with the database list on the left.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Signin_1_Click(object sender, EventArgs e)
        {
            // Check that user 1 can successfully connect. If he can, lets prompt the result
            lbl_Error_User_1.Show();
            string connectionString = SignInChecker(USER_ONE);

            if (connectionString != "Failed")
            {
                LabelChanger.ChangeText("Successfully Logged in.", lbl_Error_User_1);
                LabelChanger.ChangeColor("Green", lbl_Error_User_1);
                SQLLaptop.LoadSchemaList(connectionString, cb_DataBase_1);
                connectionString1 = connectionString;
                if (assignmentRequirement)
                {
                    connectionString2 = connectionString1;
                    SQLLaptop.LoadSchemaList(connectionString, cb_DataBase_2);
                }
            }
            else
            {
                LabelChanger.ChangeText("Invalid Credentials.", lbl_Error_User_1);
                LabelChanger.ChangeColor("Red", lbl_Error_User_1);
                connectionString1 = "Failed";
            }
        }
Exemple #2
0
 /// <summary>
 /// This method handles the assignment requirement checkbox. If the requirement button is toggled on or
 /// off, it will show/hide the correct information.
 /// </summary>
 private void HandleAssignmentRequirements()
 {
     // If we are following the assignment requirements, we need to disable a few buttons
     // text fields, and data that is linked to those
     // Otherwise lets duplicate all info
     if (assignmentRequirement == true)
     {
         HideSecondUserLogin();
         btn_Second_Account.Hide();
         lbl_Or.Hide();
         btn_Copy.Hide();
         lbl_Error_User_2.Hide();
         cb_DataBase_2.Items.Clear();
         cb_Table_2.Items.Clear();
         connectionString2         = connectionString1;
         connectionString2Database = connectionString1Database;
         selectedCombo2Database    = selectedCombo1Database;
         selectedCombo2Table       = selectedCombo1Table;
         lbl_Error_Copy.Hide();
         if (connectionString2 != null && connectionString2Database != null)
         {
             SQLLaptop.LoadSchemaList(connectionString2, cb_DataBase_2);
             SQLLaptop.LoadSchemaList(connectionString2Database, cb_Table_2);
         }
     }
     else
     {
         btn_Second_Account.Show();
         lbl_Or.Show();
         btn_Copy.Show();
         lbl_Error_Copy.Hide();
         connectionString2         = null;
         connectionString2Database = null;
         selectedCombo2Database    = null;
         selectedCombo2Table       = null;
         cb_DataBase_2.Items.Clear();
         cb_Table_2.Items.Clear();
     }
 }
Exemple #3
0
        /// <summary>
        /// This method handles the sign in button on the right side. Its pretty identicle to the above
        /// method, but handles the right side fields and right side combo box.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Signin_2_Click(object sender, EventArgs e)
        {
            lbl_Error_User_2.Show();
            // Find the provider. If none is selected, loop through them all


            string connectionString = SignInChecker(USER_TWO);

            if (connectionString != "Failed")
            {
                LabelChanger.ChangeText("Successfully Logged in.", lbl_Error_User_2);
                LabelChanger.ChangeColor("Green", lbl_Error_User_2);
                SQLLaptop.LoadSchemaList(connectionString, cb_DataBase_2);
                connectionString2 = connectionString;
            }
            else
            {
                LabelChanger.ChangeText("Invalid Credentials.", lbl_User_2);
                LabelChanger.ChangeColor("Red", lbl_Error_User_2);
                connectionString2 = "Failed";
            }
        }
Exemple #4
0
        /// <summary>
        /// This method is support in non-assignment mode. Is just duplicates the first account
        /// into the second account
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Same_Account(object sender, EventArgs e)
        {
            HideSecondUserLogin();

            // Retrieve information from the first sign in form
            string connectionString = SignInChecker(USER_ONE);

            lbl_Error_User_2.Show();
            // If successfully logged in, display success
            if (connectionString != "Failed")
            {
                SQLLaptop.LoadSchemaList(connectionString, cb_DataBase_2);
                LabelChanger.ChangeText("Successfully Logged in.", lbl_Error_User_2);
                LabelChanger.ChangeColor("Green", lbl_Error_User_2);
                connectionString2 = connectionString;
            }
            else
            {
                LabelChanger.ChangeText("Invalid Credentials.", lbl_User_2);
                LabelChanger.ChangeColor("Red", lbl_Error_User_2);
            }
            // else if failed to log in, display error
        }