Exemplo n.º 1
0
        private void executeQuery(object sender, DoWorkEventArgs e)
        {
            int queryId = (int)e.Argument;

            DataTable output = new DataTable();

            switch (queryId)
            {
            case 1:
                Query1 q1 = new Query1();

                /* execute query */
                q1.exec();

                output = q1.getResults();

                /*update stats */
                if (statman.retrieveStat("count.query1") == -1)
                {
                    statman.batchUpdateStats(q1.getStats());
                }
                break;

            case 2:
                Query2 q2 = new Query2();

                /* execute query */
                q2.exec();

                output = q2.getResults();

                /* update stats */
                if (statman.retrieveStat("count.query2") == -1)
                {
                    statman.batchUpdateStats(q2.getStats());
                }
                break;

            case 3:
                Query3 q3 = new Query3();

                /* execute query */
                q3.exec();

                output = q3.getResults();

                /* update stats */
                if (statman.retrieveStat("count.query3") == -1)
                {
                    statman.batchUpdateStats(q3.getStats());
                }
                break;

            case 4:
                Query4 q4 = new Query4();

                /* execute query */
                q4.exec();

                output = q4.getResults();

                /* update stats */
                if (statman.retrieveStat("count.query4") == -1)
                {
                    statman.batchUpdateStats(q4.getStats());
                }
                break;

            case 5:
                Query5 q5 = new Query5();

                /* execute query */
                q5.exec();

                output = q5.getResults();

                /* update stats */
                if (statman.retrieveStat("count.query5") == -1)
                {
                    statman.batchUpdateStats(q5.getStats());
                }

                break;

            case 6:
                Query6 q6 = new Query6();

                /* execute query */
                q6.passForm(this, output);

                q6.exec();

                output = q6.getResults();

                break;

            case 7:
                Query7 q7 = new Query7();

                /* execute query */
                q7.passForm(this, output);
                q7.exec();

                output = q7.getResults();

                /* update stats */
                if (statman.retrieveStat("count.query7") == -1)
                {
                    statman.batchUpdateStats(q7.getStats());
                }
                break;

            case 8:
                Query8 q8 = new Query8();

                /* execute query */
                q8.passForm(this, output);

                q8.exec();

                output = q8.getResults();

                /* update stats */
                if (statman.retrieveStat("count.query8") == -1)
                {
                    statman.batchUpdateStats(q8.getStats());
                }
                break;

            case 9:
                Query9 q9 = new Query9();

                /* execute query */
                q9.passForm(this, output);

                q9.exec();

                output = q9.getResults();

                /* update stats */
                if (statman.retrieveStat("count.query9") == -1)
                {
                    statman.batchUpdateStats(q9.getStats());
                }
                break;

            case 10:
                Query10 q10 = new Query10();

                /* execute query */
                q10.passForm(this, output);

                q10.exec();

                output = q10.getResults();

                /* update stats */
                if (statman.retrieveStat("count.query10") == -1)
                {
                    statman.batchUpdateStats(q10.getStats());
                }
                break;

            case 11:
                Query11 q11 = new Query11();

                /* execute query */
                q11.exec();

                output = q11.getResults();

                /* update stats */
                if (statman.retrieveStat("count.query11") == -1)
                {
                    statman.batchUpdateStats(q11.getStats());
                }
                break;

            case 12:
                Query12 q12 = new Query12();

                /* execute query */
                q12.exec();

                output = q12.getResults();

                /* update stats */
                if (statman.retrieveStat("count.query12") == -1)
                {
                    statman.batchUpdateStats(q12.getStats());
                }
                break;

            case 13:
                Query13 q13 = new Query13();

                /* execute query */
                q13.exec();

                output = q13.getResults();

                /* update stats */
                if (statman.retrieveStat("count.query13") == -1)
                {
                    statman.batchUpdateStats(q13.getStats());
                }
                break;

            case 14:
                Query14 q14 = new Query14();

                /* execute query */
                q14.exec();

                output = q14.getResults();

                /* update stats */
                if (statman.retrieveStat("count.query14") == -1)
                {
                    statman.batchUpdateStats(q14.getStats());
                }
                break;

            case 15:
                Query15 q15 = new Query15();

                /* execute query */
                q15.exec();

                output = q15.getResults();

                /* update stats */
                if (statman.retrieveStat("count.query15") == -1)
                {
                    statman.batchUpdateStats(q15.getStats());
                }
                break;

            default:
                Aux.print("Invalid option.");
                output.Columns.Add("Invalid Option", System.Type.GetType("System.String"));
                break;
            } /* end switch */

            e.Result = output;
        }
Exemplo n.º 2
0
        private void displayExpressionTrees(int queryId)
        {
            List <string> expressionItems = null;

            switch (queryId)
            {
            case 1:
                expressionItems = Query1.express();
                break;

            case 2:
                expressionItems = Query2.express();
                break;

            case 3:
                expressionItems = Query3.express();
                break;

            case 4:
                expressionItems = Query4.express();
                break;

            case 5:
                expressionItems = Query5.express();
                break;

            case 6:
                expressionItems = Query6.express();
                break;

            case 7:
                expressionItems = Query7.express();
                break;

            case 8:
                expressionItems = Query8.express();
                break;

            case 9:
                expressionItems = Query9.express();
                break;

            case 10:
                expressionItems = Query10.express();
                break;

            case 11:
                expressionItems = Query11.express();
                break;

            case 12:
                expressionItems = Query12.express();
                break;

            case 13:
                expressionItems = Query13.express();
                break;

            case 14:
                expressionItems = Query14.express();
                break;

            case 15:
                expressionItems = Query15.express();
                break;

            default:
                break;
            }

            /* make sure queryId was valid */
            if (queryId <= 15 && queryId > 0)
            {
                foreach (string es in expressionItems)
                {
                    this.listBox3.Items.Add(es);
                }
            }
        }