Esempio n. 1
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);
        }
Esempio n. 2
0
 private void cmdAddReceiveLocation_Click(object sender, EventArgs e)
 {
     try
     {
         BizTalkPortAndOrchsCollectorConfigEntry tmpentry = new BizTalkPortAndOrchsCollectorConfigEntry();
         tmpentry.SqlServer  = txtSQLServer.Text;
         tmpentry.MgmtDBName = txtDatabase.Text;
         if (!tmpentry.TestConnection())
         {
             MessageBox.Show(tmpentry.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 string s in lstReceiveLocations.Items
                                             orderby s
                                             select s).ToArray());
             editList.Items = new List <string[]>();
             List <ReceiveLocationInfo> list = tmpentry.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)
             {
                 lstReceiveLocations.Items.AddRange(editList.SelectedItems.ToArray());
             }
             SetReceiveLocationTextBox();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public override void RefreshDisplayData()
        {
            try
            {
                if (Collector != null)
                {
                    BizTalkPortAndOrchsCollectorConfigEntry currentConfig = (BizTalkPortAndOrchsCollectorConfigEntry)((ICollectorConfig)Collector.AgentConfig).Entries[0];
                    lvwReceiveLocations.BeginUpdate();
                    lvwReceiveLocations.Items.Clear();

                    foreach (var item in currentConfig.GetReceiveLocationList())
                    {
                        if (currentConfig.AllReceiveLocations || currentConfig.ReceiveLocations.Contains(item.ReceiveLocationName))
                        {
                            ListViewItem lvi = new ListViewItem(item.ReceivePortName);
                            lvi.SubItems.Add(item.ReceiveLocationName);
                            lvi.SubItems.Add(item.Disabled ? "Disabled" : "Enabled");
                            if (item.Disabled)
                            {
                                lvi.BackColor = Color.LightCoral;
                            }
                            lvi.Tag = item;
                            lvwReceiveLocations.Items.Add(lvi);
                        }
                    }

                    lvwSendPorts.BeginUpdate();
                    lvwSendPorts.Items.Clear();
                    foreach (var item in currentConfig.GetSendPortList())
                    {
                        if (currentConfig.AllSendPorts || currentConfig.SendPorts.Contains(item.Name))
                        {
                            ListViewItem lvi = new ListViewItem(item.Name);
                            lvi.SubItems.Add(item.State);
                            if (item.State == "Stopped")
                            {
                                lvi.BackColor = Color.LightCoral;
                            }
                            else if (item.State == "Unenlisted")
                            {
                                lvi.BackColor = Color.Yellow;
                            }
                            lvi.Tag = item;
                            lvwSendPorts.Items.Add(lvi);
                        }
                    }

                    lvwOrchestrations.BeginUpdate();
                    lvwOrchestrations.Items.Clear();
                    foreach (var item in currentConfig.GetOrchestrationList())
                    {
                        if (currentConfig.AllOrchestrations || currentConfig.Orchestrations.Contains(item.Name))
                        {
                            ListViewItem lvi = new ListViewItem(item.Name);
                            lvi.SubItems.Add(item.State);
                            if (item.State == "Stopped")
                            {
                                lvi.BackColor = Color.LightCoral;
                            }
                            else if (item.State == "Unenlisted")
                            {
                                lvi.BackColor = Color.Yellow;
                            }
                            lvi.Tag = item;
                            lvwOrchestrations.Items.Add(lvi);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                lvwReceiveLocations.EndUpdate();
                lvwSendPorts.EndUpdate();
                lvwOrchestrations.EndUpdate();
            }
        }