예제 #1
0
        private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            puf_popUpForm popup  = (puf_popUpForm)e.UserState;
            int           stepId = e.ProgressPercentage;

            if (puf_popUpForm.isBackgroundWorkerCancelled == true)
            {
                backgroundWorker1.CancelAsync();
                puf_popUpForm.isBackgroundWorkerCancelled = false; // reset
            }
            else
            {
                FeedbackSteps.TryGetValue(stepId, out string feedbackText);

                popup.lb_ProgressFeedback.Items.Add(feedbackText);
                popup.lb_ProgressFeedback.SelectedIndex = popup.lb_ProgressFeedback.Items.Count - 1;
                popup.lb_ProgressFeedback.SelectedIndex = -1;

                if (!(popup.pb_progressBar.Value >= popup.pb_progressBar.Maximum))
                {
                    popup.pb_progressBar.PerformStep();
                }

                popup.Refresh();
            }

            if (stepId == FeedbackSteps.Keys.Last <int>())
            {
                popup.Dispose();
                popup.Close();
            }
        }
예제 #2
0
        private void bt_runOsDiagTool_Click(object sender, EventArgs e, OSDiagToolConf.ConfModel.strConfModel configurations)
        {
            var           formConfigurations = new OSDiagToolForm.OsDiagFormConfModel.strFormConfigurationsModel();
            List <string> tableNameHelper    = new List <string>();

            if (tb_iptSaUsername.Text.Equals("") || tb_iptSaPwd.Text.Equals(""))  // if no input is provided in user or pwd, then DBTroubleshoot doesn't run
            {
                cb_dbTroubleshoot.Checked = false;
            }

            formConfigurations.saUser          = tb_iptSaUsername.Text.ToString();
            formConfigurations.saPwd           = tb_iptSaPwd.Text.ToString();
            formConfigurations.iisLogsNrDays   = Convert.ToInt32(nud_iisLogsNrDays.Value);
            formConfigurations.osLogTopRecords = Convert.ToInt32(nud_topLogs.Value);
            foreach (object item in lb_metamodelTables.Items)
            {
                tableNameHelper.Add(item.ToString());
            }

            formConfigurations.metamodelTables = tableNameHelper;

            Dictionary <string, bool> dictHelper = new Dictionary <string, bool>()
            {
                { _tdIis, cb_iisThreads.Checked },
                { _tdOsServices, cb_osServicesThreads.Checked },
                { _mdIis, cb_iisMemDumps.Checked },
                { _mdOsServices, cb_osMemDumps.Checked },
                { _slEvt, cb_EvtViewerLogs.Checked },
                { _slIisLogs, cb_iisAccessLogs.Checked },
                { _diMetamodel, cb_dbPlatformMetamodel.Checked },
                { _diDbTroubleshoot, cb_dbTroubleshoot.Checked },
                { _plPlatformLogs, cb_platformLogs.Checked },
                { _plPlatformAndServerFiles, cb_platformAndServerFiles.Checked },
            };

            formConfigurations.cbConfs = dictHelper;

            var configurationsHelper = new DataHelperClass.strConfigurations();

            configurationsHelper.FormConfigurations = new OSDiagToolForm.OsDiagFormConfModel.strFormConfigurationsModel();
            configurationsHelper.FormConfigurations = formConfigurations;

            int           numberOfSteps = OSDiagToolHelper.CountSteps(configurationsHelper.FormConfigurations.cbConfs);
            puf_popUpForm popup         = new puf_popUpForm(puf_popUpForm._feedbackWaitType, OsDiagForm._waitMessage, totalSteps: numberOfSteps + 2); // totalSteps + 2 for the zipping and pop up close

            popup.Show();
            popup.Refresh();
            configurationsHelper.popup = popup;

            configurationsHelper.ConfigFileConfigurations = new OSDiagToolConf.ConfModel.strConfModel();
            configurationsHelper.ConfigFileConfigurations = configurations;


            backgroundWorker1.RunWorkerAsync(configurationsHelper);
            Cursor = Cursors.Arrow;
        }
예제 #3
0
        public static void ChangeFeedbackLabelAndProgressBar(puf_popUpForm popUpForm, string labelText)
        {
            popUpForm.lb_ProgressFeedback.Items.Add(labelText);
            popUpForm.lb_ProgressFeedback.SelectedIndex = popUpForm.lb_ProgressFeedback.Items.Count - 1;
            popUpForm.lb_ProgressFeedback.SelectedIndex = -1;

            if (!(popUpForm.pb_progressBar.Value >= popUpForm.pb_progressBar.Maximum))
            {
                popUpForm.pb_progressBar.PerformStep();
            }

            popUpForm.Refresh();
        }
예제 #4
0
        private void bt_addMetamodelTables_Click(object sender, EventArgs e)
        {
            MetamodelTables mtTables = new MetamodelTables();

            List <string> listBoxTableList = lb_metamodelTables.Items.Cast <string>().ToList();

            if (mtTables.ValidateMetamodelTableName(tb_inptMetamodelTables.Text.ToString().ToLower(), listBoxTableList.ConvertAll(d => d.ToLower())))
            {
                string escapedTableName = mtTables.TableNameEscapeCharacters(tb_inptMetamodelTables.Text.ToString());

                this.lb_metamodelTables.Items.Add(escapedTableName);
                this.tb_inptMetamodelTables.Text = "";
            }
            else
            {
                puf_popUpForm popup = new puf_popUpForm(puf_popUpForm._feedbackErrorType, "Failed to add table: " + Environment.NewLine + "Input contains spaces, already exists or " + Environment.NewLine + "does not have prefix OSSYS or OSLTM.");
                DialogResult  dg    = popup.ShowDialog();
            }
        }
예제 #5
0
        private void bt_TestSaConnection_Click(object sender, EventArgs e, string dbms, DBConnector.SQLConnStringModel SQLConnectionString = null, DBConnector.OracleConnStringModel OracleConnectionString = null)
        {
            string testConnectionResult = null;

            if (dbms.ToLower().Equals("sqlserver"))
            {
                SQLConnectionString.userId = this.tb_iptSaUsername.Text;
                SQLConnectionString.pwd    = this.tb_iptSaPwd.Text;

                try {
                    var           connector  = new DBConnector.SLQDBConnector();
                    SqlConnection connection = connector.SQLOpenConnection(SQLConnectionString);
                    connector.SQLCloseConnection(connection);
                    testConnectionResult = _successConnectionTest;
                } catch {
                    testConnectionResult = _failedConnectionTest;
                }
            }
            else if (dbms.ToLower().Equals("oracle"))
            {
                OracleConnectionString.userId = this.tb_iptSaUsername.Text;
                OracleConnectionString.pwd    = this.tb_iptSaPwd.Text;

                try {
                    var connector = new DBConnector.OracleDBConnector();
                    OracleConnection connection = connector.OracleOpenConnection(OracleConnectionString);
                    connector.OracleCloseConnection(connection);
                    testConnectionResult = _successConnectionTest;
                } catch {
                    testConnectionResult = _failedConnectionTest;
                }
            }

            puf_popUpForm popup = new puf_popUpForm(puf_popUpForm._feedbackTestConnectionType, testConnectionResult);
            DialogResult  dg    = popup.ShowDialog();
        }
예제 #6
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            /* REFACTOR */

            OSDiagToolForm.DataHelperClass.strConfigurations configurationsHelper = (OSDiagToolForm.DataHelperClass.strConfigurations)e.Argument;

            // Initialization
            Program.OSDiagToolInitialization();


            // Get Platform and Server files
            if (!backgroundWorker1.CancellationPending)
            {
                if (configurationsHelper.FormConfigurations.cbConfs.TryGetValue(OSDiagToolForm.OsDiagForm._plPlatformAndServerFiles, out bool getPSandServerConfFiles) && getPSandServerConfFiles == true)
                {
                    backgroundWorker1.ReportProgress(8, configurationsHelper.popup);
                    Program.GetPlatformAndServerFiles();
                }
            }


            // Export Event Viewer and Server logs
            if (!backgroundWorker1.CancellationPending)
            {
                if (configurationsHelper.FormConfigurations.cbConfs.TryGetValue(OSDiagToolForm.OsDiagForm._slEvt, out bool getEvt) && getEvt == true)
                {
                    backgroundWorker1.ReportProgress(5, configurationsHelper.popup);
                    Program.ExportEventViewerAndServerLogs();
                }
            }

            // Copy IIS Access logs
            if (!backgroundWorker1.CancellationPending)
            {
                if (configurationsHelper.FormConfigurations.cbConfs.TryGetValue(OSDiagToolForm.OsDiagForm._slIisLogs, out bool getIisLogs) && getIisLogs == true)
                {
                    backgroundWorker1.ReportProgress(6, configurationsHelper.popup);
                    Program.CopyIISAccessLogs(configurationsHelper.FormConfigurations.iisLogsNrDays);
                }
            }

            // Database Troubleshoot
            if (!backgroundWorker1.CancellationPending)
            {
                if (configurationsHelper.FormConfigurations.cbConfs.TryGetValue(OSDiagToolForm.OsDiagForm._diDbTroubleshoot, out bool _doDbTroubleshoot) && _doDbTroubleshoot == true)
                {
                    backgroundWorker1.ReportProgress(10, configurationsHelper.popup);
                    Platform.PlatformConnectionStringDefiner ConnectionStringDefiner = new Platform.PlatformConnectionStringDefiner();
                    Platform.PlatformConnectionStringDefiner ConnStringHelper        = ConnectionStringDefiner.GetConnectionString(Program.dbEngine, false, true, ConnectionStringDefiner, configurationsHelper.FormConfigurations.saUser, configurationsHelper.FormConfigurations.saPwd);

                    if (Program.dbEngine.Equals("sqlserver"))
                    {
                        Program.DatabaseTroubleshootProgram(configurationsHelper.ConfigFileConfigurations, ConnStringHelper.SQLConnString);
                    }
                    else if (Program.dbEngine.Equals("oracle"))
                    {
                        Program.DatabaseTroubleshootProgram(configurationsHelper.ConfigFileConfigurations, null, ConnStringHelper.OracleConnString);
                    }
                }
            }

            // Export Platform Metamodel
            if (!backgroundWorker1.CancellationPending)
            {
                if (configurationsHelper.FormConfigurations.cbConfs.TryGetValue(OSDiagToolForm.OsDiagForm._diMetamodel, out bool _getPlatformMetamodel) && _getPlatformMetamodel == true)
                {
                    backgroundWorker1.ReportProgress(9, configurationsHelper.popup);
                    Platform.PlatformConnectionStringDefiner ConnectionStringDefiner = new Platform.PlatformConnectionStringDefiner();
                    Platform.PlatformConnectionStringDefiner ConnStringHelper        = ConnectionStringDefiner.GetConnectionString(Program.dbEngine, false, false, ConnectionStringDefiner);

                    if (Program.dbEngine.Equals("sqlserver"))
                    {
                        Program.ExportPlatformMetamodel(Program.dbEngine, configurationsHelper.ConfigFileConfigurations, configurationsHelper.FormConfigurations, ConnStringHelper.SQLConnString, null);
                    }
                    else if (Program.dbEngine.Equals("oracle"))
                    {
                        Program.ExportPlatformMetamodel(Program.dbEngine, configurationsHelper.ConfigFileConfigurations, configurationsHelper.FormConfigurations, null, ConnStringHelper.OracleConnString);
                    }
                }
            }

            // Export Platform Logs
            if (!backgroundWorker1.CancellationPending)
            {
                if (configurationsHelper.FormConfigurations.cbConfs.TryGetValue(OSDiagToolForm.OsDiagForm._plPlatformLogs, out bool _getPlatformLogs) && _getPlatformLogs == true)
                {
                    backgroundWorker1.ReportProgress(7, configurationsHelper.popup);
                    Platform.PlatformConnectionStringDefiner ConnectionStringDefiner = new Platform.PlatformConnectionStringDefiner();
                    Platform.PlatformConnectionStringDefiner ConnStringHelper        = ConnectionStringDefiner.GetConnectionString(Program.dbEngine, Program.separateLogCatalog, false, ConnectionStringDefiner);

                    if (Program.dbEngine.Equals("sqlserver"))
                    {
                        Program.ExportServiceCenterLogs(Program.dbEngine, configurationsHelper.ConfigFileConfigurations, configurationsHelper.FormConfigurations, ConnStringHelper.SQLConnString, null);
                    }
                    else if (Program.dbEngine.Equals("oracle"))
                    {
                        Program.ExportServiceCenterLogs(Program.dbEngine, configurationsHelper.ConfigFileConfigurations, configurationsHelper.FormConfigurations, null, ConnStringHelper.OracleConnString, ConnStringHelper.AdminSchema);
                    }
                }
            }

            // IIS Thread dumps
            if (!backgroundWorker1.CancellationPending)
            {
                if (configurationsHelper.FormConfigurations.cbConfs.TryGetValue(OSDiagToolForm.OsDiagForm._tdIis, out bool getIisThreadDumps) && getIisThreadDumps == true)
                {
                    backgroundWorker1.ReportProgress(1, configurationsHelper.popup);
                    Program.CollectThreadDumpsProgram(getIisThreadDumps, false);
                }
            }

            // OutSystems Services Thread dumps
            if (!backgroundWorker1.CancellationPending)
            {
                if (configurationsHelper.FormConfigurations.cbConfs.TryGetValue(OSDiagToolForm.OsDiagForm._tdOsServices, out bool _getOsThreadDumps) && _getOsThreadDumps == true)
                {
                    backgroundWorker1.ReportProgress(2, configurationsHelper.popup);
                    Program.CollectThreadDumpsProgram(false, _getOsThreadDumps);
                }
            }

            // IIS Memory Dumps
            if (!backgroundWorker1.CancellationPending)
            {
                if (configurationsHelper.FormConfigurations.cbConfs.TryGetValue(OSDiagToolForm.OsDiagForm._mdIis, out bool getIisMemDumps) && getIisMemDumps == true)
                {
                    backgroundWorker1.ReportProgress(3, configurationsHelper.popup);
                    Program.CollectMemoryDumpsProgram(getIisMemDumps, false);
                }
            }

            // OutSystems Services Memory Dumps
            if (!backgroundWorker1.CancellationPending)
            {
                if (configurationsHelper.FormConfigurations.cbConfs.TryGetValue(OSDiagToolForm.OsDiagForm._mdOsServices, out bool getOsMemDumps) && getOsMemDumps == true)
                {
                    backgroundWorker1.ReportProgress(4, configurationsHelper.popup);
                    Program.CollectMemoryDumpsProgram(false, getOsMemDumps);
                }
            }

            backgroundWorker1.ReportProgress(11, configurationsHelper.popup);
            Program.GenerateZipFile();
            backgroundWorker1.ReportProgress(12, configurationsHelper.popup); // Last step to close pop up

            /* REFACTOR */



            if (!backgroundWorker1.CancellationPending == true)
            {
                puf_popUpForm popup2 = new puf_popUpForm(puf_popUpForm._feedbackDoneType, _doneMessage + Environment.NewLine + Program._endFeedback);
                popup2.ShowDialog();
            }
            else
            {
                puf_popUpForm popup2 = new puf_popUpForm(puf_popUpForm._feedbackDoneType, _operationCancelled + Environment.NewLine + Program._endFeedback);
                popup2.ShowDialog();
            }
        }