コード例 #1
0
        private void btn_StopSQLGeneration_Click(object sender, EventArgs e)
        {
            // Stop SQLGeneration for selected servers
            SqlGenWrapper.StopSqlGenerator(lv_SQL, ServerWrapper.SqlServersList);

            // Update ListView
            ServerWrapper.UpdateSqlListView(lv_SQL, lbl_SQLGenerationRunningvalue);
        }
コード例 #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);
        }