Esempio n. 1
0
        private void btn_startExchangeGeneration_Click(object sender, EventArgs e)
        {
            if (!ExchangeGenWrapper.DoNotShowExchangePrerequisites)
            {
                var prerequisitesForm = new ExchangePrerequisites();
                prerequisitesForm.Show();
            }


            var messageSize = _mailSizeDictionary.FirstOrDefault(x => x.Value == cb_MailSize.SelectedItem.ToString()).Key;

            // Start Exchange Generation for selected servers with specific parameters

            if (cb_ExchangeUseCustomCreds.Checked)
            {
                ExchangeGenWrapper.StartExchangeGenerator(lv_ExchangeServers, ServerWrapper.ExchangeServersList, messageSize, tb_exchangeCustomUsername.Text, tb_exchangeCustomDomain.Text, tb_exchangeCustomPassword.Text);
            }
            else
            {
                ExchangeGenWrapper.StartExchangeGenerator(lv_ExchangeServers, ServerWrapper.ExchangeServersList, messageSize);
            }

            // Update ListView
            ServerWrapper.UpdateExchangeListView(lv_ExchangeServers, lbl_exchangeGenerationRunningValue);

            var exchangeParmsToSerialize = new ExchangeGeneratorParameters()
            {
                MessageSize = messageSize
            };

            exchangeParmsToSerialize.SerizalizeExchangeParamsToFile();
        }
 private void btn_Add_Click(object sender, EventArgs e)
 {
     ServerWrapper.AddServerManually(tb_IP.Text, tb_UserName.Text, tb_Password.Text);
     tb_IP.Clear();
     tb_UserName.Clear();
     tb_Password.Clear();
     tb_IP.Focus();
 }
Esempio n. 3
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);
        }
Esempio n. 4
0
        private void btn_StopDDT_Click(object sender, EventArgs e)
        {
            // Stop DDT for selected servers
            DdtWrapper.StopDdt(lv_AgentsList, ServerWrapper.ServersList);

            // Update ListView
            ServerWrapper.UpdateListView(lv_AgentsList, lbl_ChangeRateValue, lbl_totalAgentsRunningValue);
        }
Esempio n. 5
0
        private void btn_stopExchangeGeneration_Click(object sender, EventArgs e)
        {
            // Stop DDT for selected servers
            ExchangeGenWrapper.StopExchangeGenerator(lv_ExchangeServers, ServerWrapper.ExchangeServersList);


            // Update ListView
            ServerWrapper.UpdateExchangeListView(lv_ExchangeServers, lbl_exchangeGenerationRunningValue);
        }
Esempio n. 6
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     ServerWrapper.UpdateListView(lv_AgentsList, lbl_ChangeRateValue, lbl_totalAgentsRunningValue);
     ServerWrapper.UpdateExchangeListView(lv_ExchangeServers, lbl_exchangeGenerationRunningValue);
     ServerWrapper.UpdateSqlListView(lv_SQL, lbl_SQLGenerationRunningvalue);
     lbl_TotalAmountValue.Text         = lv_AgentsList.Items.Count.ToString();
     lbl_exchangeTotalAgentsValue.Text = lv_ExchangeServers.Items.Count.ToString();
     lbl_TotalSQLServersValue.Text     = lv_SQL.Items.Count.ToString();
 }
Esempio n. 7
0
        private void btn_Connect_Click(object sender, EventArgs e)
        {
            if (rb_Core.Checked)
            {
                _coreCreds = new CoreConnectionCredentials
                {
                    Hostname = tb_hostname.Text,
                    Port     = Convert.ToInt32(tb_Port.Text),
                    Username = tb_userName.Text,
                    Password = tb_password.Text
                };

                _coreCreds.SerizalizeCredsToFile();

                // Displays list of servers received from Core API to ListView
                try
                {
                    lbl_Loading.Visible = true;
                    ServerWrapper.ServersToListView(_coreCreds);
                    Logger.Log("Successfully connected to Core Server: " + tb_hostname.Text, Logger.LogLevel.Info, tb_hostname.Text);
                }
                catch (WCFClientBase.ClientServerErrorException exception)
                {
                    lbl_Loading.Visible = false;
                    Logger.LogError("Cannot connect to Core server " + _coreCreds.Hostname, _coreCreds.Hostname, exception);
                    MessageBox.Show("Cannot connect to Core server." + Environment.NewLine + exception.Message, "Connection Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }
                catch (WCFClientBase.HttpUnauthorizedRequestException exception)
                {
                    lbl_Loading.Visible = false;
                    Logger.LogError("Cannot connect to Core server " + _coreCreds.Hostname + " Wrong credentials.", _coreCreds.Hostname, exception);
                    MessageBox.Show("Cannot connect to Core server. Incorrect credentials." + Environment.NewLine + exception.Message, "Connection Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }
            }

            ServerWrapper.ServersListViewCreateColumns(lv_AgentsList);
            ServerWrapper.ExchangeListViewCreateColumns(lv_ExchangeServers);
            ServerWrapper.SqlListViewCreateColumns(lv_SQL);


            AddItemsToCbMailSize();
            GetGenParamsFromFileToGui();
            timer1.Interval = 3000; // Timer for UI update
            timer1.Start();
            lbl_Loading.Visible = false;

            // Hide Connection Page and displays ListView Page

            DisplayListViewPage();
        }
Esempio n. 8
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. 9
0
        private void btn_startDDT_Click(object sender, EventArgs e)
        {
            var failedValidation = false;
            var textBoxValidate  = new List <TextBox> {
                tb_Size, tb_Path, tb_Compression, tb_Interval
            };

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

            if (failedValidation)
            {
                return;
            }



            _ddtParameters = new DdtParameters()
            {
                Filesize          = Convert.ToInt32(tb_Size.Text),
                Compression       = Convert.ToInt32(tb_Compression.Text),
                Interval          = Convert.ToInt32(tb_Interval.Text),
                Filepath          = tb_Path.Text,
                FillingGeneration = cb_fillingGeneration.Checked
            };

            _ddtParameters.SerizalizeDdtParamsToFile();

            // Start DDT for selected servers with specific parameters
            if (cb_UseCustomCredentials.Checked)
            {
                DdtWrapper.StartDdt(lv_AgentsList, ServerWrapper.ServersList, _ddtParameters, tb_customUsername.Text, tb_customPassword.Text);
            }
            else
            {
                DdtWrapper.StartDdt(lv_AgentsList, ServerWrapper.ServersList, _ddtParameters);
            }

            // Update ListView
            ServerWrapper.UpdateListView(lv_AgentsList, lbl_ChangeRateValue, lbl_totalAgentsRunningValue);
        }
Esempio n. 10
0
        public static void CsVtoExchangeServersList(string filePath)
        {
            using (var sr = new StreamReader(filePath))
            {
                sr.ReadLine(); // to skip the line with headers
                try
                {
                    while (!sr.EndOfStream)
                    {
                        var line = sr.ReadLine();
                        if (line != null)
                        {
                            var values = line.Split(',');

                            ServerWrapper.AddExchangeServerManually(values[0], values[3], values[1], values[2]);
                        }
                    }
                }
                catch (IndexOutOfRangeException)
                {
                    MessageBox.Show("Incorrect format of CSV File.\nPlease make sure that it has following format:\n{Ip,Userame,Password,Domain}", "CSV Import Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 11
0
 private void btn_RemoveSQLManually_Click(object sender, EventArgs e)
 {
     ServerWrapper.DeleteSqlServerManually(lv_SQL);
 }
Esempio n. 12
0
 private void btn_deleteExchangeServer_Click(object sender, EventArgs e)
 {
     ServerWrapper.DeleteExchangeServerManually(lv_ExchangeServers);
 }
Esempio n. 13
0
 private void btn_deleteSelectedServers_Click(object sender, EventArgs e)
 {
     ServerWrapper.DeleteServerManually(lv_AgentsList);
 }