Ejemplo n.º 1
0
 private void tabSqlScripts_Click(object sender, EventArgs e)
 {
     pnlInsertControls.Controls.Clear();
     chkListBoxColumns.Items.Clear();
     txtoutput.BringToFront();
     GridSelect.SendToBack();
     txtoutput.Text = "";
 }
Ejemplo n.º 2
0
        //In this function we will check for the Select query type as user entered or user selected columns to display.

        private void buildSelectScript()
        {
            DataTable dt = new DataTable();

            Cursor.Current = Cursors.WaitCursor;

            if (chkWriteSelectQuery.Checked == true)
            {
                if (txtSelectQuery.Text.Trim() == "")
                {
                    MessageBox.Show("Enter Select Query");
                    txtSelectQuery.Focus();
                    return;
                }

                string sqlSelectQuery = txtSelectQuery.Text.ToLower().Trim();
                if (sqlSelectQuery.Contains("select") == true)
                {
                    if (!objSQL.sqlInjectionCheck(sqlSelectQuery))
                    {
                        return;
                    }
                    dt = objSQL.selectRecordsfromTableQuery(txtDBNAME.Text.Trim(), txtSelectQuery.Text.Trim());
                }
            }
            else
            {
                if (cboTable.Items.Count <= 0)
                {
                    MessageBox.Show("Select valid Table to select Column");
                    return;
                }
                if (cboTable.SelectedItem.ToString() == "")
                {
                    MessageBox.Show("Select valid Table to select Column");
                    return;
                }

                bool isAllcolumn = false;
                if (chkAllColumns.Checked == true)
                {
                    isAllcolumn = true;
                }
                else
                {
                    if (chkListBoxColumns.CheckedItems.Count <= 0)
                    {
                        MessageBox.Show("Select Columns ");
                        return;
                    }
                }
                GridSelect.DataSource = null;
                dt = objSQL.selectRecordsfromTableQuery(isAllcolumn, chkListBoxColumns, txtDBNAME.Text.Trim(), cboTable.SelectedItem.ToString());
            }

            if (dt.Rows.Count > 0)
            {
                txtoutput.SendToBack();
                GridSelect.BringToFront();
                GridSelect.DataSource = dt;
            }
            else
            {
                txtoutput.BringToFront();
                GridSelect.SendToBack();
                txtoutput.ForeColor = Color.DarkRed;
                txtoutput.Text      = "Sorry No records to Display";
                MessageBox.Show("Sorry No records to Display");
            }
            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 3
0
    private void OnGUI()
    {
        //scroll pos
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false);

        //vertical space
        GUILayout.Space(30);

        #region display match data
        GUILayout.FlexibleSpace();
        GUILayout.Label("Print Match Data", EditorStyles.boldLabel);
        EditorGUILayout.Space();
        EditorGUILayout.HelpBox("Print specified match data (zero index) or all match data into the console. ", MessageType.Info);
        EditorGUILayout.Space();
        matchToLoad = EditorGUILayout.IntField("Enter a match number:", matchToLoad);
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Print Single Match Data", GUILayout.MaxWidth(150), GUILayout.MinHeight(40)))
        {
            PrintMatchData(matchToLoad);
        }
        //column test
        if (GUILayout.Button("Print All Matches", GUILayout.MaxWidth(150), GUILayout.MinHeight(40)))
        {
            PrintAllMatches();
        }
        GUILayout.EndHorizontal();
        #endregion

        /**divider line for spacing**/

        //vertical space
        GUILayout.Space(15);
        EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
        GUILayout.FlexibleSpace();
        /**end divider line **/

        #region New Board Generation
        /**Section for generating new board **/
        EditorGUILayout.Space();
        GUILayout.Label("Generate a New Board", EditorStyles.boldLabel);
        EditorGUILayout.Space();
        EditorGUILayout.HelpBox("Generate a new board. Functions similarly to starting a new game. " +
                                "Enter play mode, select settings, and press the button to generate a new board. Can generate at any time during the game but will end any match being played.", MessageType.Info);
        EditorGUILayout.Space();
        //Enter data
        newGridSize   = (GridSelect)EditorGUILayout.EnumPopup("New Board Dimensions: ", newGridSize);
        PlayerOne     = (IconSelect)EditorGUILayout.EnumPopup("Player 1 Icon: ", PlayerOne);
        PlayerTwo     = (IconSelect)EditorGUILayout.EnumPopup("Player 2 Icon: ", PlayerTwo);
        playerToStart = (Player)EditorGUILayout.EnumPopup("Player to Start: ", playerToStart);
        //Generate Button
        if (GUILayout.Button("Generate New Board"))
        {
            //check if game manager exists
            if (GameManager.instance == null)
            {
                Debug.LogError("Error: Game Manager not detected. Perhaps you need to start a game first?");
                return;
            }
            //check if icons are different
            if (PlayerOne == PlayerTwo)
            {
                Debug.LogError("Error: Cannot set both player icons to the same icon");
                return;
            }
            else
            {
                BoardGenerator();
            }
        }
        GUILayout.FlexibleSpace();
        /**end section**/
        #endregion


        /**divider line for spacing**/

        //vertical space
        GUILayout.Space(15);
        EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
        GUILayout.FlexibleSpace();
        /**end divider line **/


        #region Board State testing
        /**Section for testing board states **/
        //vertical space
        GUILayout.Space(15);
        GUILayout.Label("Board State Tester", EditorStyles.boldLabel);
        EditorGUILayout.Space();
        EditorGUILayout.HelpBox("Test different board states. Select which player should win. Use the slider to select a specific row or column to test. Use the drop down to select which diagonal to check for. You can also set the speed between test moves" +
                                " Board must be generated before using. Will end any match currently being played or exit out of menu", MessageType.Info);

        //Test Settings
        playerToWin       = (Player)EditorGUILayout.EnumPopup("Player to Win: ", playerToWin);
        dimensionToSelect = EditorGUILayout.IntSlider("Row/Column to Test: ", dimensionToSelect, 0, BoardState.BoardDimension - 1);
        SelectDiag        = (DiagSelect)EditorGUILayout.EnumPopup("Diagonal: ", SelectDiag);
        betweenMoves      = EditorGUILayout.FloatField("Time Between Moves: ", betweenMoves);

        EditorGUILayout.Space();
        //row test
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Test Row", GUILayout.MaxWidth(150), GUILayout.MinHeight(40)))
        {
            TestRows();
        }
        //column test
        if (GUILayout.Button("Test Column", GUILayout.MaxWidth(150), GUILayout.MinHeight(40)))
        {
            TestColumns();
        }
        GUILayout.EndHorizontal();
        EditorGUILayout.Space();
        GUILayout.BeginHorizontal();
        //diagonal test
        if (GUILayout.Button("Test Diagonal", GUILayout.MaxWidth(150), GUILayout.MinHeight(40)))
        {
            TestDiagonal();
        }
        //draw test
        if (GUILayout.Button("Test Draw", GUILayout.MaxWidth(150), GUILayout.MinHeight(40)))
        {
            TestDraw();
        }
        GUILayout.EndHorizontal();
        EditorGUILayout.Space(); EditorGUILayout.Space();

        EditorGUILayout.HelpBox("Pressing any UI buttons, generating a map from the debug window , or starting a new test will immediately end any test. When testing all, just simply let it run through. Set the time between test either here or in the BoardStateTester inspector to set the speed between tests", MessageType.Warning);
        betweenReset = EditorGUILayout.FloatField("Time between tests: ", betweenReset);

        GUILayout.BeginHorizontal();
        //test all rows
        if (GUILayout.Button("Test All Rows", GUILayout.MaxWidth(150), GUILayout.MinHeight(40)))
        {
            TestAllRows();
        }
        //test all columns
        if (GUILayout.Button("Test All Columns", GUILayout.MaxWidth(150), GUILayout.MinHeight(40)))
        {
            TestAllCols();
        }

        //all diag test
        if (GUILayout.Button("Test ALL Diags", GUILayout.MaxWidth(150), GUILayout.MinHeight(40)))
        {
            TestAllDiags();
        }
        GUILayout.EndHorizontal();

        if (GUILayout.Button("TEST ALL", GUILayout.MinHeight(40)))
        {
            TestAll();
        }


        //vertical space
        GUILayout.Space(30);


        EditorGUILayout.EndScrollView();
        #endregion
    }