private void cmdRemoveOrchestrations_Click(object sender, EventArgs e)
        {
            BizTalkPortAndOrchsCollectorConfigEntry currentConfig;

            if (SelectedEntry != null)
            {
                currentConfig = (BizTalkPortAndOrchsCollectorConfigEntry)SelectedEntry;
            }
            else
            {
                if (SelectedConfig == null)
                {
                    SelectedConfig = new BizTalkPortAndOrchsCollectorConfig();
                }
                currentConfig = (BizTalkPortAndOrchsCollectorConfigEntry)((ICollectorConfig)SelectedConfig).Entries[0];
            }

            if (MessageBox.Show("Are you sure you want to remove the selected item(s)?", "Remove", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                foreach (int index in (from int i in lstOrchestrations.SelectedIndices
                                       orderby i descending
                                       select i))
                {
                    currentConfig.Orchestrations.Remove(lstOrchestrations.Items[index].ToString());
                    LoadOrchestrations();
                }
            }
        }
        private void cmdTestDB_Click(object sender, EventArgs e)
        {
            BizTalkPortAndOrchsCollectorConfigEntry currentConfig;

            if (SelectedEntry != null)
            {
                currentConfig = (BizTalkPortAndOrchsCollectorConfigEntry)SelectedEntry;
            }
            else
            {
                if (SelectedConfig == null)
                {
                    SelectedConfig = new BizTalkPortAndOrchsCollectorConfig();
                }
                currentConfig = (BizTalkPortAndOrchsCollectorConfigEntry)((ICollectorConfig)SelectedConfig).Entries[0];
            }

            currentConfig.SqlServer  = txtSQLServer.Text;
            currentConfig.MgmtDBName = txtDatabase.Text;
            if (!currentConfig.TestConnection())
            {
                MessageBox.Show(currentConfig.LastError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("Success", "Connection test", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private void BizTalkPortsAndOrchsEditConfig_Shown(object sender, EventArgs e)
        {
            BizTalkPortAndOrchsCollectorConfigEntry currentConfig;

            if (SelectedEntry != null)
            {
                currentConfig = (BizTalkPortAndOrchsCollectorConfigEntry)SelectedEntry;
            }
            else
            {
                if (SelectedConfig == null)
                {
                    SelectedConfig = new BizTalkPortAndOrchsCollectorConfig();
                }
                currentConfig = (BizTalkPortAndOrchsCollectorConfigEntry)((ICollectorConfig)SelectedConfig).Entries[0];
            }

            txtSQLServer.Text = currentConfig.SqlServer;
            txtDatabase.Text  = currentConfig.MgmtDBName;
            chkAllReceiveLocations.Checked = currentConfig.AllReceiveLocations;
            chkAllSendPorts.Checked        = currentConfig.AllSendPorts;
            chkAllOrchestrations.Checked   = currentConfig.AllOrchestrations;
            LoadReceiveLocations();
            LoadSendPorts();
            LoadOrchestrations();
        }
        private void cmdAddReceiveLocation_Click(object sender, EventArgs e)
        {
            try
            {
                BizTalkPortAndOrchsCollectorConfigEntry currentConfig;
                if (SelectedEntry != null)
                {
                    currentConfig = (BizTalkPortAndOrchsCollectorConfigEntry)SelectedEntry;
                }
                else
                {
                    if (SelectedConfig == null)
                    {
                        SelectedConfig = new BizTalkPortAndOrchsCollectorConfig();
                    }
                    currentConfig = (BizTalkPortAndOrchsCollectorConfigEntry)((ICollectorConfig)SelectedConfig).Entries[0];
                }

                if (!currentConfig.TestConnection())
                {
                    MessageBox.Show(currentConfig.LastError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    BizTalkEditList editList = new BizTalkEditList();
                    editList.Text        = "Receive Locations";
                    editList.ColumnNames = new List <string>();
                    editList.ColumnNames.Add("Receive Port");
                    editList.ColumnNames.Add("Receive Location");
                    editList.ColumnNames.Add("Host");
                    editList.ValueColumn  = 1;
                    editList.ExcludeItems = new List <string>();
                    editList.ExcludeItems.AddRange((from s in currentConfig.ReceiveLocations
                                                    orderby s
                                                    select s).ToArray());
                    editList.Items = new List <string[]>();
                    List <ReceiveLocationInfo> list = currentConfig.GetReceiveLocationList();
                    foreach (var rl in list)
                    {
                        editList.Items.Add(new string[] { rl.ReceivePortName, rl.ReceiveLocationName, rl.HostName });
                    }
                    if (editList.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        currentConfig.ReceiveLocations.AddRange(editList.SelectedItems.ToArray());
                        LoadReceiveLocations();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #5
0
        public override List <System.Data.DataTable> GetDetailDataTables()
        {
            List <System.Data.DataTable>       list          = new List <System.Data.DataTable>();
            BizTalkPortAndOrchsCollectorConfig currentConfig = (BizTalkPortAndOrchsCollectorConfig)AgentConfig;

            if (currentConfig.Entries.Count == 1)
            {
                BizTalkPortAndOrchsCollectorConfigEntry entry = (BizTalkPortAndOrchsCollectorConfigEntry)currentConfig.Entries[0];
                System.Data.DataTable receiveLocationsTable   = new System.Data.DataTable(entry.SqlServer + " - Receive locations");
                receiveLocationsTable.Columns.Add(new System.Data.DataColumn("Port", typeof(string)));
                receiveLocationsTable.Columns.Add(new System.Data.DataColumn("Name", typeof(string)));
                receiveLocationsTable.Columns.Add(new System.Data.DataColumn("State", typeof(string)));

                System.Data.DataTable sendPortsTable = new System.Data.DataTable(entry.SqlServer + " - Send ports");
                sendPortsTable.Columns.Add(new System.Data.DataColumn("Name", typeof(string)));
                sendPortsTable.Columns.Add(new System.Data.DataColumn("State", typeof(string)));

                System.Data.DataTable orchestrationsTable = new System.Data.DataTable(entry.SqlServer + " - Orchestrations");
                orchestrationsTable.Columns.Add(new System.Data.DataColumn("Name", typeof(string)));
                orchestrationsTable.Columns.Add(new System.Data.DataColumn("State", typeof(string)));

                foreach (ReceiveLocationInfo rl in entry.GetReceiveLocationList())
                {
                    receiveLocationsTable.Rows.Add(rl.ReceivePortName, rl.ReceiveLocationName, rl.Disabled ? "Disabled" : "Enabled");
                }
                foreach (SendPortInfo sp in entry.GetSendPortList())
                {
                    sendPortsTable.Rows.Add(sp.Name, sp.State);
                }
                foreach (SendPortInfo orch in entry.GetOrchestrationList())
                {
                    orchestrationsTable.Rows.Add(orch.Name, orch.State);
                }
                list.Add(receiveLocationsTable);
                list.Add(sendPortsTable);
                list.Add(orchestrationsTable);
            }
            else
            {
                System.Data.DataTable dt = new System.Data.DataTable(Name);
                dt.Columns.Add(new System.Data.DataColumn("Error", typeof(string)));
                dt.Rows.Add("Configuration error.");
                list.Add(dt);
            }

            return(list);
        }
        private void LoadReceiveLocations()
        {
            BizTalkPortAndOrchsCollectorConfigEntry currentConfig;

            if (SelectedEntry != null)
            {
                currentConfig = (BizTalkPortAndOrchsCollectorConfigEntry)SelectedEntry;
            }
            else
            {
                if (SelectedConfig == null)
                {
                    SelectedConfig = new BizTalkPortAndOrchsCollectorConfig();
                }
                currentConfig = (BizTalkPortAndOrchsCollectorConfigEntry)((ICollectorConfig)SelectedConfig).Entries[0];
            }

            StringBuilder sb = new StringBuilder();

            lstReceiveLocations.Items.Clear();
            txtDisplayReceiveLocations.Text = "";
            foreach (string r in (from s in currentConfig.ReceiveLocations
                                  orderby s
                                  select s))
            {
                lstReceiveLocations.Items.Add(r);
                sb.Append(r + ", ");
            }
            string output = sb.ToString().Trim(' ', ',');

            if (output.Length > 1000)
            {
                output = output.Substring(0, 1000) + "...";
            }
            if (chkAllReceiveLocations.Checked)
            {
                txtDisplayReceiveLocations.Text = "All";
            }
            else
            {
                txtDisplayReceiveLocations.Text = output;
            }
        }
        private void cmdOK_Click(object sender, EventArgs e)
        {
            BizTalkPortAndOrchsCollectorConfigEntry currentConfig;

            if (SelectedEntry != null)
            {
                currentConfig = (BizTalkPortAndOrchsCollectorConfigEntry)SelectedEntry;
            }
            else
            {
                if (SelectedConfig == null)
                {
                    SelectedConfig = new BizTalkPortAndOrchsCollectorConfig();
                }
                currentConfig = (BizTalkPortAndOrchsCollectorConfigEntry)((ICollectorConfig)SelectedConfig).Entries[0];
            }

            currentConfig.SqlServer           = txtSQLServer.Text;
            currentConfig.MgmtDBName          = txtDatabase.Text;
            currentConfig.AllReceiveLocations = chkAllReceiveLocations.Checked;
            currentConfig.AllSendPorts        = chkAllSendPorts.Checked;
            currentConfig.AllOrchestrations   = chkAllOrchestrations.Checked;
            currentConfig.ReceiveLocations.Clear();
            foreach (string s in lstReceiveLocations.Items)
            {
                currentConfig.ReceiveLocations.Add(s);
            }
            currentConfig.SendPorts.Clear();
            foreach (string s in lstSendPorts.Items)
            {
                currentConfig.SendPorts.Add(s);
            }
            currentConfig.Orchestrations.Clear();
            foreach (string s in lstOrchestrations.Items)
            {
                currentConfig.Orchestrations.Add(s);
            }
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }
예제 #8
0
        public override MonitorState RefreshState()
        {
            MonitorState returnState = new MonitorState();
            string       lastAction  = "";

            try
            {
                BizTalkPortAndOrchsCollectorConfig currentConfig = (BizTalkPortAndOrchsCollectorConfig)AgentConfig;

                if (currentConfig.Entries.Count == 1)
                {
                    BizTalkPortAndOrchsCollectorConfigEntry entry = (BizTalkPortAndOrchsCollectorConfigEntry)currentConfig.Entries[0];

                    returnState.RawDetails   = string.Format("BizTalk Management DB: {0}", entry.Description);
                    returnState.HtmlDetails  = string.Format("<b>BizTalk Management DB: {0}</b>", entry.Description);
                    returnState.CurrentValue = "All ok";

                    lastAction = "Getting Receive Location count";
                    int receiveLocationCount = entry.AllReceiveLocations ? entry.GetTotalReceiveLocationCount() : entry.ReceiveLocations.Count;
                    lastAction = "Getting Disabled Receive Location count";
                    int receiveLocationsDisabled = entry.AllReceiveLocations ? entry.GetDisabledReceiveLocationCount(new List <string>()) : entry.GetDisabledReceiveLocationCount(entry.ReceiveLocations);

                    //Now check send ports
                    lastAction = "Getting Send Port count";
                    int sendPortCount = entry.AllSendPorts ? entry.GetTotalSendPortCount() : entry.SendPorts.Count;
                    lastAction = "Getting Stopped Send Port count";
                    int sendPortStoppedCount = entry.AllSendPorts ? entry.GetStoppedSendPortCount(new List <string>()) : entry.GetStoppedSendPortCount(entry.SendPorts);
                    //Now check orchestrations
                    lastAction = "Getting Orchestration count";
                    int orchestrationCount = entry.AllOrchestrations ? entry.GetTotalOrchestrationCount() : entry.Orchestrations.Count;
                    lastAction = "Getting Stopped Orchestration count";
                    int orchestrationStoppedCount = entry.AllOrchestrations ? entry.GetStoppedOrchestrationCount(new List <string>()) : entry.GetStoppedOrchestrationCount(entry.Orchestrations);

                    if (receiveLocationsDisabled == -1 || sendPortStoppedCount == -1 || orchestrationStoppedCount == -1)
                    {
                        returnState.State        = CollectorState.Error;
                        returnState.ForAgent     = entry.Description;
                        returnState.CurrentValue = "BizTalk Management database error";
                        returnState.RawDetails   = "An error occured trying to query the BizTalk Management database!";
                        returnState.HtmlDetails  = "An error occured trying to query the BizTalk Management database!";
                    }
                    else
                    {
                        if ((receiveLocationsDisabled >= receiveLocationCount && (receiveLocationCount > 0)) ||
                            (sendPortStoppedCount >= sendPortCount && (sendPortCount > 0)) ||
                            (orchestrationStoppedCount >= orchestrationCount && (orchestrationCount > 0)))
                        {
                            returnState.State         = CollectorState.Error;
                            returnState.CurrentValue  = (sendPortStoppedCount > 0 ? string.Format("SP: {0},", sendPortStoppedCount) : "");
                            returnState.CurrentValue += (orchestrationStoppedCount > 0 ? string.Format("ORCH: {0},", orchestrationStoppedCount) : "");
                            returnState.CurrentValue += returnState.CurrentValue.ToString().Trim(',');
                        }
                        else if (receiveLocationsDisabled > 0 || sendPortStoppedCount > 0 || orchestrationStoppedCount > 0)
                        {
                            returnState.State         = CollectorState.Warning;
                            returnState.CurrentValue  = (sendPortStoppedCount > 0 ? string.Format("SP: {0},", sendPortStoppedCount) : "");
                            returnState.CurrentValue += (orchestrationStoppedCount > 0 ? string.Format("ORCH: {0},", orchestrationStoppedCount) : "");
                            returnState.CurrentValue += returnState.CurrentValue.ToString().Trim(',');
                        }
                        else
                        {
                            returnState.State = CollectorState.Good;
                        }

                        if (receiveLocationsDisabled > 0)
                        {
                            MonitorState disabledRL = new MonitorState()
                            {
                                RawDetails  = "Disabled receive locations",
                                HtmlDetails = "<b>Disabled receive locations</b>"
                            };
                            foreach (string rl in entry.GetDisabledReceiveLocationNames())
                            {
                                disabledRL.ChildStates.Add(
                                    new MonitorState()
                                {
                                    ForAgent     = rl,
                                    State        = CollectorState.Error,
                                    CurrentValue = "Disabled"
                                });
                            }
                            returnState.ChildStates.Add(disabledRL);
                        }
                        if (sendPortStoppedCount > 0)
                        {
                            MonitorState stoppedSP = new MonitorState()
                            {
                                RawDetails  = "Stopped send ports",
                                HtmlDetails = "<b>Stopped send ports</b>"
                            };
                            foreach (string sp in entry.GetStoppedSendPortNames())
                            {
                                stoppedSP.ChildStates.Add(
                                    new MonitorState()
                                {
                                    ForAgent     = sp,
                                    State        = CollectorState.Error,
                                    CurrentValue = "Stopped"
                                });
                            }
                            returnState.ChildStates.Add(stoppedSP);
                        }
                        if (orchestrationStoppedCount > 0)
                        {
                            MonitorState stoppedOrchs = new MonitorState()
                            {
                                RawDetails  = "Stopped orchestrations",
                                HtmlDetails = "<b>Stopped orchestrations</b>"
                            };
                            foreach (string orch in entry.GetStoppedOrchestrationNames())
                            {
                                stoppedOrchs.ChildStates.Add(
                                    new MonitorState()
                                {
                                    ForAgent     = orch,
                                    State        = CollectorState.Error,
                                    CurrentValue = "Stopped"
                                });
                            }
                            returnState.ChildStates.Add(stoppedOrchs);
                        }
                    }
                }
                else
                {
                    returnState.State       = CollectorState.Error;
                    returnState.RawDetails  = "Configuration not set";
                    returnState.HtmlDetails = "Configuration not set";
                }
            }
            catch (Exception ex)
            {
                returnState.RawDetails  = ex.Message;
                returnState.HtmlDetails = string.Format("<p><b>Last action:</b> {0}</p><blockquote>{1}</blockquote>", lastAction, ex.Message);
                returnState.State       = CollectorState.Error;
            }
            return(returnState);
        }
예제 #9
0
 public BizTalkPortAndOrchsCollector()
 {
     AgentConfig = new BizTalkPortAndOrchsCollectorConfig();
 }