Esempio n. 1
0
        private void btn_StartSQLGeneration_Click(object sender, EventArgs e)
        {
            var failedValidation = false;
            var textBoxValidate  = new List <TextBox> {
                tb_dbName, tb_SQLAmountRows
            };

            foreach (var textBox in textBoxValidate)
            {
                if (!string.IsNullOrWhiteSpace(textBox.Text))
                {
                    continue;
                }
                errorProvider1.SetError(textBox, "Field cannot be empty");
                failedValidation = true;
            }

            if (failedValidation)
            {
                return;
            }


            var rowsToInsert        = Convert.ToInt32(tb_SQLAmountRows.Text);
            var sqlParmsToSerialize = new SqlGeneratorParameters()
            {
                RowsToInsert = rowsToInsert, DbName = tb_dbName.Text
            };

            sqlParmsToSerialize.SerizalizeSqlParamsToFile();

            if (!SqlGenWrapper.DoNotShowSqlPrerequisites)
            {
                var prerequisitesForm = new SQLPrerequisites();
                prerequisitesForm.Show();
            }

            // Start SQL Generation for selected servers with specific parameters

            if (cb_UseCustomCredsSQL.Checked)
            {
                SqlGenWrapper.StartSqlGenerator(lv_SQL, ServerWrapper.SqlServersList, tb_dbName.Text, rowsToInsert,
                                                tb_SQLCustomUsername.Text, tb_SQLCustomPassword.Text);
            }
            else
            {
                SqlGenWrapper.StartSqlGenerator(lv_SQL, ServerWrapper.SqlServersList, tb_dbName.Text, rowsToInsert);
            }

            // Update ListView
            ServerWrapper.UpdateSqlListView(lv_SQL, lbl_SQLGenerationRunningvalue);
        }
Esempio n. 2
0
        private void btn_StartSQLGeneration_Click(object sender, EventArgs e)
        {
            var failedValidation = false;
            var textBoxValidate = new List<TextBox> { tb_dbName, tb_SQLAmountRows };

            foreach (var textBox in textBoxValidate)
            {
                if (!string.IsNullOrWhiteSpace(textBox.Text)) continue;
                errorProvider1.SetError(textBox, "Field cannot be empty");
                failedValidation = true;
            }

            if (failedValidation)
                return;

            var rowsToInsert = Convert.ToInt32(tb_SQLAmountRows.Text);
            var sqlParmsToSerialize = new SqlGeneratorParameters() { RowsToInsert = rowsToInsert, DbName = tb_dbName.Text };
            sqlParmsToSerialize.SerizalizeSqlParamsToFile();

            if (!SqlGenWrapper.DoNotShowSqlPrerequisites)
            {
                var prerequisitesForm = new SQLPrerequisites();
                prerequisitesForm.Show();
            }

            // Start SQL Generation for selected servers with specific parameters

            if (cb_UseCustomCredsSQL.Checked)
            {
                SqlGenWrapper.StartSqlGenerator(lv_SQL, ServerWrapper.SqlServersList, tb_dbName.Text, rowsToInsert,
                    tb_SQLCustomUsername.Text, tb_SQLCustomPassword.Text);
            }
            else
            {
                SqlGenWrapper.StartSqlGenerator(lv_SQL, ServerWrapper.SqlServersList, tb_dbName.Text, rowsToInsert);
            }

            // Update ListView
            ServerWrapper.UpdateSqlListView(lv_SQL, lbl_SQLGenerationRunningvalue);
        }