Ejemplo n.º 1
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Convert.ToString(listDatabase.SelectedValue)))
            {
                MessageBox.Show(string.Format("Please Select Database Name"));
                return;
            }
            else if (string.IsNullOrEmpty(Convert.ToString(listboxProcedure.SelectedValue)))
            {
                MessageBox.Show(string.Format("Please Select Stored procedure"));
                return;
            }
            else if (ValidateStoreProcedure(Convert.ToString(listboxProcedure.SelectedValue), ConnectionString) != string.Empty)
            {
                var message = ValidateStoreProcedure(Convert.ToString(listboxProcedure.SelectedValue), ConnectionString);
                MessageBox.Show(message);
                return;
            }
            else
            {
                var table    = Convert.ToString(listboxProcedure.SelectedValue);
                var database = Convert.ToString(listDatabase.SelectedValue);

                DataPasser dataPasser = new DataPasser()
                {
                    DatabaseName = database,
                    TableName    = table
                };

                backgroundWorker1.RunWorkerAsync(dataPasser);
                backgroundWorker1.ReportProgress(10, "Process Started");
            }
        }
Ejemplo n.º 2
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Convert.ToString(listDatabase.SelectedValue)))
            {
                btnGenerate.BackColor = Color.DarkRed;
                MessageBox.Show(string.Format("Please Select Database Name"), @"Error Message");
                return;
            }
            else if (string.IsNullOrEmpty(Convert.ToString(listboxTables.SelectedValue)))
            {
                MessageBox.Show(string.Format("Please Select Table Name"), @"Error Message");
                return;
            }
            else if (ValidateDatatype(Convert.ToString(listboxTables.SelectedValue), ConnectionString) == "invalid")
            {
                MessageBox.Show(
                    $@"The Table {Convert.ToString(listboxTables.SelectedValue)} contains Binary Data Types",
                    @"Error Message");
                return;
            }
            else if (ValidateTableCount(Convert.ToString(listboxTables.SelectedValue), ConnectionString))
            {
                MessageBox.Show(
                    $@"The Table {Convert.ToString(listboxTables.SelectedValue)} does not have data to export",
                    @"Error Message");
                return;
            }
            else
            {
                btnGenerate.BackColor = Color.LimeGreen;
                btnshowtbl.Enabled    = false;
                listboxTables.Enabled = false;

                if (backgroundWorker1.IsBusy)
                {
                    MessageBox.Show(@"Please Wait ... Process is under Exceution");
                    return;
                }
                else
                {
                    var table    = Convert.ToString(listboxTables.SelectedValue);
                    var database = Convert.ToString(listDatabase.SelectedValue);

                    DataPasser dataPasser = new DataPasser()
                    {
                        DatabaseName = database,
                        TableName    = table
                    };

                    backgroundWorker1.RunWorkerAsync(dataPasser);
                    backgroundWorker1.ReportProgress(10, "Process Started");
                }
            }
        }