// Token: 0x060006EF RID: 1775 RVA: 0x0002C2A4 File Offset: 0x0002A4A4
        public static string GetNetObjectPrefix(IInformationServiceProxyFactory swisFactory, string entityType)
        {
            if (swisFactory == null)
            {
                throw new ArgumentNullException("swisFactory");
            }
            if (string.IsNullOrEmpty(entityType))
            {
                throw new ArgumentException("entityType");
            }
            string result;

            using (IInformationServiceProxy2 informationServiceProxy = swisFactory.CreateConnection())
            {
                DataTable dataTable = informationServiceProxy.Query("SELECT TOP 1 Prefix FROM Orion.NetObjectTypes WHERE EntityType = @entityType", new Dictionary <string, object>
                {
                    {
                        "entityType",
                        entityType
                    }
                });
                if (dataTable == null || dataTable.Rows.Count == 0)
                {
                    result = null;
                }
                else
                {
                    result = dataTable.Rows[0]["Prefix"].ToString();
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
 public static string GetEntityName(
     IInformationServiceProxyFactory swisFactory,
     string entityType)
 {
     if (swisFactory == null)
     {
         throw new ArgumentNullException(nameof(swisFactory));
     }
     if (string.IsNullOrEmpty(entityType))
     {
         throw new ArgumentException(nameof(entityType));
     }
     using (IInformationServiceProxy2 connection = swisFactory.CreateConnection())
     {
         DataTable dataTable = ((IInformationServiceProxy)connection).Query("SELECT DisplayName, Name FROM Metadata.Entity WHERE Type = @entityType", (IDictionary <string, object>) new Dictionary <string, object>()
         {
             {
                 nameof(entityType),
                 (object)entityType
             }
         });
         if (dataTable == null || dataTable.Rows.Count == 0)
         {
             return((string)null);
         }
         string str = dataTable.Rows[0]["DisplayName"].ToString();
         if (string.IsNullOrEmpty(str))
         {
             str = dataTable.Rows[0]["Name"].ToString();
         }
         return(str);
     }
 }
 // Token: 0x060004EA RID: 1258 RVA: 0x0001EBA6 File Offset: 0x0001CDA6
 public ThresholdIndicator(IInformationServiceProxyFactory swisFactory, IndicationPublisher indicationReporter)
 {
     if (swisFactory == null)
     {
         throw new ArgumentNullException("swisFactory");
     }
     if (indicationReporter == null)
     {
         throw new ArgumentNullException("indicationReporter");
     }
     this._swisFactory         = swisFactory;
     this._indicationPublisher = indicationReporter;
 }
 // Token: 0x06000426 RID: 1062 RVA: 0x0001C3D6 File Offset: 0x0001A5D6
 public TechnologyPollingIndicator(IInformationServiceProxyFactory swisFactory, IndicationPublisher indicationReporter)
 {
     if (swisFactory == null)
     {
         throw new ArgumentNullException("swisFactory");
     }
     if (indicationReporter == null)
     {
         throw new ArgumentNullException("indicationReporter");
     }
     this.swisFactory        = swisFactory;
     this.indicationReporter = indicationReporter;
 }
 public TechnologyPollingIndicator(
     IInformationServiceProxyFactory swisFactory,
     IPublisherManager indicationReporter)
 {
     if (swisFactory == null)
     {
         throw new ArgumentNullException(nameof(swisFactory));
     }
     if (indicationReporter == null)
     {
         throw new ArgumentNullException(nameof(indicationReporter));
     }
     this.swisFactory    = swisFactory;
     this.publishManager = indicationReporter;
 }
Ejemplo n.º 6
0
        public ThresholdIndicator(
            IInformationServiceProxyFactory swisFactory,
            IPublisherManager publishManager)
        {
            IInformationServiceProxyFactory serviceProxyFactory = swisFactory;

            if (serviceProxyFactory == null)
            {
                throw new ArgumentNullException(nameof(swisFactory));
            }
            this._swisFactory = serviceProxyFactory;
            IPublisherManager ipublisherManager = publishManager;

            if (ipublisherManager == null)
            {
                throw new ArgumentNullException(nameof(publishManager));
            }
            this._publishManager = ipublisherManager;
        }
        // Token: 0x060006F0 RID: 1776 RVA: 0x0002C344 File Offset: 0x0002A544
        public static string GetEntityName(IInformationServiceProxyFactory swisFactory, string entityType)
        {
            if (swisFactory == null)
            {
                throw new ArgumentNullException("swisFactory");
            }
            if (string.IsNullOrEmpty(entityType))
            {
                throw new ArgumentException("entityType");
            }
            string result;

            using (IInformationServiceProxy2 informationServiceProxy = swisFactory.CreateConnection())
            {
                DataTable dataTable = informationServiceProxy.Query("SELECT DisplayName, Name FROM Metadata.Entity WHERE Type = @entityType", new Dictionary <string, object>
                {
                    {
                        "entityType",
                        entityType
                    }
                });
                if (dataTable == null || dataTable.Rows.Count == 0)
                {
                    result = null;
                }
                else
                {
                    string text = dataTable.Rows[0]["DisplayName"].ToString();
                    if (string.IsNullOrEmpty(text))
                    {
                        text = dataTable.Rows[0]["Name"].ToString();
                    }
                    result = text;
                }
            }
            return(result);
        }
Ejemplo n.º 8
0
 public static string GetNetObjectPrefix(
     IInformationServiceProxyFactory swisFactory,
     string entityType)
 {
     if (swisFactory == null)
     {
         throw new ArgumentNullException(nameof(swisFactory));
     }
     if (string.IsNullOrEmpty(entityType))
     {
         throw new ArgumentException(nameof(entityType));
     }
     using (IInformationServiceProxy2 connection = swisFactory.CreateConnection())
     {
         DataTable dataTable = ((IInformationServiceProxy)connection).Query("SELECT TOP 1 Prefix FROM Orion.NetObjectTypes WHERE EntityType = @entityType", (IDictionary <string, object>) new Dictionary <string, object>()
         {
             {
                 nameof(entityType),
                 (object)entityType
             }
         });
         return(dataTable == null || dataTable.Rows.Count == 0 ? (string)null : dataTable.Rows[0]["Prefix"].ToString());
     }
 }
Ejemplo n.º 9
0
        public static Dictionary <int, string> GetNetObjectsCaptions(
            IInformationServiceProxyFactory swisFactory,
            string entityType,
            int[] instanceIds)
        {
            if (swisFactory == null)
            {
                throw new ArgumentNullException(nameof(swisFactory));
            }
            if (string.IsNullOrEmpty(entityType))
            {
                throw new ArgumentException(nameof(entityType));
            }
            Dictionary <int, string> dictionary = new Dictionary <int, string>();
            string str1 = (string)null;

            using (IInformationServiceProxy2 connection = swisFactory.CreateConnection())
            {
                DataTable dataTable1 = ((IInformationServiceProxy)connection).Query("SELECT TOP 1 Prefix, KeyProperty, NameProperty FROM Orion.NetObjectTypes WHERE EntityType = @entityType", (IDictionary <string, object>) new Dictionary <string, object>()
                {
                    {
                        nameof(entityType),
                        (object)entityType
                    }
                });
                if (dataTable1 != null)
                {
                    if (dataTable1.Rows.Count > 0)
                    {
                        str1 = dataTable1.Rows[0]["Prefix"].ToString();
                        string index1 = dataTable1.Rows[0]["KeyProperty"].ToString();
                        string index2 = dataTable1.Rows[0]["NameProperty"].ToString();
                        if (!string.IsNullOrEmpty(index1))
                        {
                            if (!string.IsNullOrEmpty(index2))
                            {
                                DataTable dataTable2 = ((IInformationServiceProxy)connection).Query(string.Format("SELECT {2},{0} FROM {1} WHERE {2} in ({3})", (object)index2, (object)entityType, (object)index1, (object)string.Join <int>(",", (IEnumerable <int>)instanceIds)));
                                if (dataTable2 != null)
                                {
                                    int ordinal1 = dataTable2.Columns[index1].Ordinal;
                                    int ordinal2 = dataTable2.Columns[index2].Ordinal;
                                    foreach (DataRow dataRow in dataTable2.Rows.Cast <DataRow>())
                                    {
                                        string s = dataRow[ordinal1].ToString();
                                        int    result;
                                        if (!string.IsNullOrEmpty(s) && int.TryParse(s, out result))
                                        {
                                            dictionary[result] = dataRow[ordinal2].ToString();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (string.IsNullOrEmpty(str1))
            {
                str1 = entityType;
            }
            for (int index = 0; index < instanceIds.Length; ++index)
            {
                if (!dictionary.ContainsKey(instanceIds[index]))
                {
                    string str2 = string.Format("{0}:{1}", (object)str1, (object)instanceIds[index]);
                    dictionary.Add(instanceIds[index], str2);
                }
            }
            return(dictionary);
        }
        // Token: 0x060006EE RID: 1774 RVA: 0x0002C064 File Offset: 0x0002A264
        public static Dictionary <int, string> GetNetObjectsCaptions(IInformationServiceProxyFactory swisFactory, string entityType, int[] instanceIds)
        {
            if (swisFactory == null)
            {
                throw new ArgumentNullException("swisFactory");
            }
            if (string.IsNullOrEmpty(entityType))
            {
                throw new ArgumentException("entityType");
            }
            Dictionary <int, string> dictionary = new Dictionary <int, string>();
            string text = null;

            using (IInformationServiceProxy2 informationServiceProxy = swisFactory.CreateConnection())
            {
                DataTable dataTable = informationServiceProxy.Query("SELECT TOP 1 Prefix, KeyProperty, NameProperty FROM Orion.NetObjectTypes WHERE EntityType = @entityType", new Dictionary <string, object>
                {
                    {
                        "entityType",
                        entityType
                    }
                });
                if (dataTable != null && dataTable.Rows.Count > 0)
                {
                    text = dataTable.Rows[0]["Prefix"].ToString();
                    string text2 = dataTable.Rows[0]["KeyProperty"].ToString();
                    string text3 = dataTable.Rows[0]["NameProperty"].ToString();
                    if (!string.IsNullOrEmpty(text2) && !string.IsNullOrEmpty(text3))
                    {
                        DataTable dataTable2 = informationServiceProxy.Query(string.Format("SELECT {2},{0} FROM {1} WHERE {2} in ({3})", new object[]
                        {
                            text3,
                            entityType,
                            text2,
                            string.Join <int>(",", instanceIds)
                        }));
                        if (dataTable2 != null)
                        {
                            int ordinal  = dataTable2.Columns[text2].Ordinal;
                            int ordinal2 = dataTable2.Columns[text3].Ordinal;
                            foreach (DataRow dataRow in dataTable2.Rows.Cast <DataRow>())
                            {
                                string text4 = dataRow[ordinal].ToString();
                                int    key;
                                if (!string.IsNullOrEmpty(text4) && int.TryParse(text4, out key))
                                {
                                    dictionary[key] = dataRow[ordinal2].ToString();
                                }
                            }
                        }
                    }
                }
            }
            if (string.IsNullOrEmpty(text))
            {
                text = entityType;
            }
            for (int i = 0; i < instanceIds.Length; i++)
            {
                if (!dictionary.ContainsKey(instanceIds[i]))
                {
                    string value = string.Format("{0}:{1}", text, instanceIds[i]);
                    dictionary.Add(instanceIds[i], value);
                }
            }
            return(dictionary);
        }