public void Unmanage(MaintenancePlanAssignment assignment)
        {
            MaintenancePlan maintenancePlan = this.maintenancePlanDAL.Get(assignment.get_MaintenancePlanID());

            if (maintenancePlan == null)
            {
                throw new Exception(string.Format("No maintenance plan found for PlanID={0}.", (object)assignment.get_MaintenancePlanID()));
            }
            string netObjectPrefix = this.GetNetObjectPrefix(assignment.get_EntityType());

            if (netObjectPrefix == null)
            {
                throw new Exception(string.Format("Cannot find net object prefix for EntityType='{0}'.", (object)assignment.get_EntityType()));
            }
            object netObjectId = this.CreateNetObjectId(netObjectPrefix, assignment.get_EntityID());

            if (netObjectId == null)
            {
                throw new Exception(string.Format("Cannot create net object id from prefix '{0}' and id '{1}'.", (object)netObjectPrefix, (object)assignment.get_EntityID()));
            }
            using (IInformationServiceProxy2 iinformationServiceProxy2 = this.swisProxy.Create())
                iinformationServiceProxy2.Invoke <object>(assignment.get_EntityType(), nameof(Unmanage), new object[4]
                {
                    netObjectId,
                    (object)maintenancePlan.get_UnmanageDate(),
                    (object)maintenancePlan.get_RemanageDate(),
                    (object)false
                });
        }
Esempio n. 2
0
        // Token: 0x06000589 RID: 1417 RVA: 0x00021A04 File Offset: 0x0001FC04
        public void Unmanage(MaintenancePlanAssignment assignment)
        {
            MaintenancePlan maintenancePlan = this.maintenancePlanDAL.Get(assignment.MaintenancePlanID);

            if (maintenancePlan == null)
            {
                throw new Exception(string.Format("No maintenance plan found for PlanID={0}.", assignment.MaintenancePlanID));
            }
            string netObjectPrefix = this.GetNetObjectPrefix(assignment.EntityType);

            if (netObjectPrefix == null)
            {
                throw new Exception(string.Format("Cannot find net object prefix for EntityType='{0}'.", assignment.EntityType));
            }
            object obj = this.CreateNetObjectId(netObjectPrefix, assignment.EntityID);

            if (obj == null)
            {
                throw new Exception(string.Format("Cannot create net object id from prefix '{0}' and id '{1}'.", netObjectPrefix, assignment.EntityID));
            }
            using (IInformationServiceProxy2 informationServiceProxy = this.swisProxy.Create())
            {
                informationServiceProxy.Invoke <object>(assignment.EntityType, "Unmanage", new object[]
                {
                    obj,
                    maintenancePlan.UnmanageDate,
                    maintenancePlan.RemanageDate,
                    false
                });
            }
        }
Esempio n. 3
0
        private static bool ShowUpdateProductNotification(string productTag)
        {
            ModuleInfo moduleInfo = ModulesCollector.GetModuleInfo(productTag);

            if (string.IsNullOrEmpty(moduleInfo.get_ValidateUpdateNotification()))
            {
                return(true);
            }
            try
            {
                using (IInformationServiceProxy2 iinformationServiceProxy2 = ((IInformationServiceProxyCreator)SwisConnectionProxyPool.GetSystemCreator()).Create())
                {
                    CoreHelper._log.DebugFormat("Calling SWQL query: {0}", (object)moduleInfo.get_ValidateUpdateNotification());
                    DataTable dataTable = ((IInformationServiceProxy)iinformationServiceProxy2).Query(moduleInfo.get_ValidateUpdateNotification());
                    if (dataTable.Columns.Count == 1 || dataTable.Rows.Count == 1)
                    {
                        return(dataTable.Rows[0][0] == null || Convert.ToBoolean(dataTable.Rows[0][0]));
                    }
                    CoreHelper._log.WarnFormat("Invalid query: {0}", (object)moduleInfo.get_ValidateUpdateNotification());
                    return(true);
                }
            }
            catch (Exception ex)
            {
                CoreHelper._log.ErrorFormat("Execution of ValidateUpdateNotification '{0}' has failed. Exception: {1}", (object)moduleInfo.get_ValidateUpdateNotification(), (object)ex);
                return(true);
            }
        }
Esempio n. 4
0
        // Token: 0x0600058C RID: 1420 RVA: 0x00021BD0 File Offset: 0x0001FDD0
        internal string GetNetObjectPrefix(string entityName)
        {
            if (string.IsNullOrEmpty(entityName))
            {
                return(null);
            }
            string result;

            using (IInformationServiceProxy2 informationServiceProxy = this.swisProxy.Create())
            {
                DataTable dataTable = informationServiceProxy.Query("SELECT Prefix FROM Orion.NetObjectTypes WHERE EntityType = @entityName", new Dictionary <string, object>
                {
                    {
                        "entityName",
                        entityName
                    }
                });
                if (dataTable != null && dataTable.Rows != null && dataTable.Rows.Count == 1 && dataTable.Rows[0][0] != null)
                {
                    result = dataTable.Rows[0][0].ToString();
                }
                else
                {
                    result = null;
                }
            }
            return(result);
        }
Esempio n. 5
0
        // Token: 0x06000318 RID: 792 RVA: 0x000139C8 File Offset: 0x00011BC8
        private static bool ShowUpdateProductNotification(string productTag)
        {
            ModuleInfo moduleInfo = ModulesCollector.GetModuleInfo(productTag);

            if (string.IsNullOrEmpty(moduleInfo.ValidateUpdateNotification))
            {
                return(true);
            }
            bool result;

            try
            {
                using (IInformationServiceProxy2 informationServiceProxy = SwisConnectionProxyPool.GetSystemCreator().Create())
                {
                    CoreHelper._log.DebugFormat("Calling SWQL query: {0}", moduleInfo.ValidateUpdateNotification);
                    DataTable dataTable = informationServiceProxy.Query(moduleInfo.ValidateUpdateNotification);
                    if (dataTable.Columns.Count != 1 && dataTable.Rows.Count != 1)
                    {
                        CoreHelper._log.WarnFormat("Invalid query: {0}", moduleInfo.ValidateUpdateNotification);
                        result = true;
                    }
                    else
                    {
                        result = (dataTable.Rows[0][0] == null || Convert.ToBoolean(dataTable.Rows[0][0]));
                    }
                }
            }
            catch (Exception ex)
            {
                CoreHelper._log.ErrorFormat("Execution of ValidateUpdateNotification '{0}' has failed. Exception: {1}", moduleInfo.ValidateUpdateNotification, ex);
                result = true;
            }
            return(result);
        }
        // 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);
        }
Esempio n. 7
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);
     }
 }
Esempio n. 8
0
 public void Update(string entityUri, MaintenancePlan plan)
 {
     using (IInformationServiceProxy2 iinformationServiceProxy2 = this.SwisFactory.Create())
     {
         Dictionary <string, object> dictionary = MaintenanceModePlanDAL.RemoveKeysFromDictionary(ObjectExtensions.ToDictionary <MaintenancePlan>((M0)plan), "ID");
         ((IInformationServiceProxy)iinformationServiceProxy2).Update(entityUri, (IDictionary <string, object>)dictionary);
     }
 }
Esempio n. 9
0
 public string Create(MaintenancePlan plan)
 {
     using (IInformationServiceProxy2 iinformationServiceProxy2 = this.SwisFactory.Create())
     {
         Dictionary <string, object> dictionary = MaintenanceModePlanDAL.RemoveKeysFromDictionary(ObjectExtensions.ToDictionary <MaintenancePlan>((M0)plan), "ID");
         return(((IInformationServiceProxy)iinformationServiceProxy2).Create("Orion.MaintenancePlan", (IDictionary <string, object>)dictionary));
     }
 }
Esempio n. 10
0
 public void UpdateAgentNodeId(int agentId, int nodeId)
 {
     using (SwisConnectionProxyFactory connectionProxyFactory = new SwisConnectionProxyFactory())
     {
         using (IInformationServiceProxy2 proxy = connectionProxyFactory.Create())
             this.UpdateAgentNodeId(agentId, nodeId, proxy);
     }
 }
Esempio n. 11
0
 public static DataTable GetAuditingTypesTable()
 {
     using (IInformationServiceProxy2 iinformationServiceProxy2 = AuditingDAL.creator.Create())
     {
         DataTable dataTable = InformationServiceProxyExtensions.QueryWithAppendedErrors((IInformationServiceProxy)iinformationServiceProxy2, "SELECT DISTINCT ActionTypeID, ActionType, ActionTypeDisplayName FROM [Orion].[AuditingActionTypes] (nolock=true)", SwisFederationInfo.get_IsFederationEnabled());
         dataTable.TableName = "AuditingTypesTable";
         return(dataTable);
     }
 }
 // Token: 0x0600067B RID: 1659 RVA: 0x00026B94 File Offset: 0x00024D94
 public void Update(string entityUri, MaintenancePlan plan)
 {
     using (IInformationServiceProxy2 informationServiceProxy = this.SwisFactory.Create())
     {
         Dictionary <string, object> dictionary = MaintenanceModePlanDAL.RemoveKeysFromDictionary(plan.ToDictionary <MaintenancePlan>(), new string[]
         {
             "ID"
         });
         informationServiceProxy.Update(entityUri, dictionary);
     }
 }
        // Token: 0x0600060C RID: 1548 RVA: 0x00024550 File Offset: 0x00022750
        private ILookup <string, NetObjectTypeEx> LoadNetObjectTypesExtSwisInfo()
        {
            ILookup <string, NetObjectTypeEx> result;

            using (IInformationServiceProxy2 informationServiceProxy = this._swisServiceProxyCreator.Create())
            {
                result = (from DataRow row in informationServiceProxy.Query("SELECT EntityType, Name, Prefix, KeyProperty, NameProperty, KeyPropertyIndex, CanConvert FROM Orion.NetObjectTypesExt").Rows
                          select new NetObjectTypeEx(row.Field("EntityType"), row.Field("Name"), row.Field("Prefix"), row.Field("KeyProperty"), row.Field("NameProperty"), (int)row.Field("CanConvert"), row.Field("KeyPropertyIndex"))).ToLookup((NetObjectTypeEx k) => k.EntityType);
            }
            return(result);
        }
Esempio n. 14
0
 public void ApproveUpdate(int agentId)
 {
     using (SwisConnectionProxyFactory connectionProxyFactory = new SwisConnectionProxyFactory())
     {
         using (IInformationServiceProxy2 iinformationServiceProxy2 = connectionProxyFactory.Create())
             iinformationServiceProxy2.Invoke <object>("Orion.AgentManagement.Agent", nameof(ApproveUpdate), new object[1]
             {
                 (object)agentId
             });
     }
 }
Esempio n. 15
0
        // Token: 0x060006BB RID: 1723 RVA: 0x0002AC40 File Offset: 0x00028E40
        public static DataTable GetAuditingTypesTable()
        {
            DataTable result;

            using (IInformationServiceProxy2 informationServiceProxy = AuditingDAL.creator.Create())
            {
                DataTable dataTable = informationServiceProxy.QueryWithAppendedErrors("SELECT DISTINCT ActionTypeID, ActionType, ActionTypeDisplayName FROM [Orion].[AuditingActionTypes] (nolock=true)", SwisFederationInfo.IsFederationEnabled);
                dataTable.TableName = "AuditingTypesTable";
                result = dataTable;
            }
            return(result);
        }
Esempio n. 16
0
 // Token: 0x06000920 RID: 2336 RVA: 0x00041E60 File Offset: 0x00040060
 public void ApproveUpdate(int agentId)
 {
     using (SwisConnectionProxyFactory swisConnectionProxyFactory = new SwisConnectionProxyFactory())
     {
         using (IInformationServiceProxy2 informationServiceProxy = swisConnectionProxyFactory.Create())
         {
             informationServiceProxy.Invoke <object>("Orion.AgentManagement.Agent", "ApproveUpdate", new object[]
             {
                 agentId
             });
         }
     }
 }
        // Token: 0x0600067A RID: 1658 RVA: 0x00026B34 File Offset: 0x00024D34
        public string Create(MaintenancePlan plan)
        {
            string result;

            using (IInformationServiceProxy2 informationServiceProxy = this.SwisFactory.Create())
            {
                Dictionary <string, object> dictionary = MaintenanceModePlanDAL.RemoveKeysFromDictionary(plan.ToDictionary <MaintenancePlan>(), new string[]
                {
                    "ID"
                });
                result = informationServiceProxy.Create("Orion.MaintenancePlan", dictionary);
            }
            return(result);
        }
Esempio n. 18
0
 public void LoadPreviousThresholdData(int instanceId, string thresholdName)
 {
     using (IInformationServiceProxy2 connection = this._swisFactory.CreateConnection())
         this._previousThresholdValues = ((IInformationServiceProxy)connection).Query("SELECT OT.ThresholdOperator,\r\n                    OT.Level1Value,\r\n                    OT.Level1Formula,\r\n                    OT.Level2Value,\r\n                    OT.Level2Formula,\r\n                    OT.WarningPolls,\r\n                    OT.WarningPollsInterval,\r\n                    OT.CriticalPolls,\r\n                    OT.CriticalPollsInterval,\r\n                    OT.WarningEnabled,\r\n                    OT.CriticalEnabled\r\n                    FROM Orion.Thresholds OT\r\n                    WHERE OT.InstanceId = @InstanceId AND OT.Name = @Name", (IDictionary <string, object>) new Dictionary <string, object>()
         {
             {
                 "InstanceId",
                 (object)instanceId
             },
             {
                 "Name",
                 (object)thresholdName
             }
         });
 }
 // Token: 0x060004EB RID: 1259 RVA: 0x0001EBD8 File Offset: 0x0001CDD8
 private ThresholdIndicator.InstanceInformation GetInstanceInformation(string entityType, int instanceId)
 {
     if (string.IsNullOrEmpty(entityType) || instanceId == 0)
     {
         return(null);
     }
     ThresholdIndicator.InstanceInformation instanceInformation = new ThresholdIndicator.InstanceInformation();
     using (IInformationServiceProxy2 informationServiceProxy = this._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 == 1)
         {
             string arg  = dataTable.Rows[0]["Prefix"] as string;
             object obj  = dataTable.Rows[0]["KeyProperty"];
             object obj2 = dataTable.Rows[0]["NameProperty"];
             instanceInformation.NetObject = string.Format("{0}:{1}", arg, instanceId);
             if (obj != DBNull.Value && obj != DBNull.Value)
             {
                 DataTable dataTable2 = informationServiceProxy.Query(string.Format("SELECT {0} FROM {1} WHERE {2} = @InstanceId", obj2, entityType, obj), new Dictionary <string, object>
                 {
                     {
                         "InstanceId",
                         instanceId
                     }
                 });
                 if (dataTable2 != null && dataTable2.Rows.Count > 0)
                 {
                     instanceInformation.InstanceName = dataTable2.Rows[0][obj2.ToString()].ToString();
                 }
                 else
                 {
                     instanceInformation.InstanceName = instanceInformation.NetObject;
                 }
             }
             else
             {
                 instanceInformation.InstanceName = instanceInformation.NetObject;
             }
         }
     }
     return(instanceInformation);
 }
Esempio n. 20
0
 public void StartDeployingPlugin(int agentId, string pluginId)
 {
     if (string.IsNullOrEmpty(pluginId))
     {
         throw new ArgumentNullException(nameof(pluginId), "Plugin Id must be specified.");
     }
     using (SwisConnectionProxyFactory connectionProxyFactory = new SwisConnectionProxyFactory())
     {
         using (IInformationServiceProxy2 iinformationServiceProxy2 = connectionProxyFactory.Create())
             iinformationServiceProxy2.Invoke <object>("Orion.AgentManagement.Agent", "DeployPlugin", new object[2]
             {
                 (object)agentId,
                 (object)pluginId
             });
     }
 }
Esempio n. 21
0
        // Token: 0x06000921 RID: 2337 RVA: 0x00041ECC File Offset: 0x000400CC
        private void UpdateAgentNodeId(int agentId, int nodeId, IInformationServiceProxy2 proxy)
        {
            AgentInfo agentInfo = this._agentInfoDal.GetAgentInfo(agentId);

            if (agentInfo != null)
            {
                proxy.Update(agentInfo.Uri, new Dictionary <string, object>
                {
                    {
                        "NodeId",
                        nodeId
                    }
                });
                return;
            }
            AgentManager.log.WarnFormat("Agent Id={0} not found.", agentId);
        }
 // Token: 0x0600060D RID: 1549 RVA: 0x000245E4 File Offset: 0x000227E4
 private void DeleteOldSubscriptions()
 {
     using (IInformationServiceProxy2 informationServiceProxy = this._swisServiceProxyCreator.Create())
     {
         string text = "SELECT Uri FROM System.Subscription WHERE description = @description";
         foreach (DataRow dataRow in informationServiceProxy.Query(text, new Dictionary <string, object>
         {
             {
                 "description",
                 "NetObjectDowntimeIndication"
             }
         }).Rows.Cast <DataRow>())
         {
             informationServiceProxy.Delete(dataRow[0].ToString());
         }
     }
 }
Esempio n. 23
0
 private ThresholdIndicator.InstanceInformation GetInstanceInformation(
     string entityType,
     int instanceId)
 {
     if (string.IsNullOrEmpty(entityType) || instanceId == 0)
     {
         return((ThresholdIndicator.InstanceInformation)null);
     }
     ThresholdIndicator.InstanceInformation instanceInformation = new ThresholdIndicator.InstanceInformation();
     using (IInformationServiceProxy2 connection = this._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 == 1)
             {
                 string str  = dataTable1.Rows[0]["Prefix"] as string;
                 object obj1 = dataTable1.Rows[0]["KeyProperty"];
                 object obj2 = dataTable1.Rows[0]["NameProperty"];
                 instanceInformation.NetObject = string.Format("{0}:{1}", (object)str, (object)instanceId);
                 if (obj1 != DBNull.Value && obj1 != DBNull.Value)
                 {
                     DataTable dataTable2 = ((IInformationServiceProxy)connection).Query(string.Format("SELECT {0} FROM {1} WHERE {2} = @InstanceId", obj2, (object)entityType, obj1), (IDictionary <string, object>) new Dictionary <string, object>()
                     {
                         {
                             "InstanceId",
                             (object)instanceId
                         }
                     });
                     instanceInformation.InstanceName = dataTable2 == null || dataTable2.Rows.Count <= 0 ? instanceInformation.NetObject : dataTable2.Rows[0][obj2.ToString()].ToString();
                 }
                 else
                 {
                     instanceInformation.InstanceName = instanceInformation.NetObject;
                 }
             }
         }
     }
     return(instanceInformation);
 }
 // Token: 0x06000371 RID: 881 RVA: 0x00015878 File Offset: 0x00013A78
 private static void DeleteOldSubscriptions()
 {
     using (IInformationServiceProxy2 informationServiceProxy = SwisConnectionProxyPool.GetSystemCreator().Create())
     {
         string text = "SELECT Uri FROM System.Subscription WHERE description = @description";
         foreach (DataRow dataRow in informationServiceProxy.Query(text, new Dictionary <string, object>
         {
             {
                 "description",
                 "OrionCoreIndications"
             }
         }).Rows.Cast <DataRow>())
         {
             informationServiceProxy.Delete(dataRow[0].ToString());
         }
     }
 }
 // Token: 0x060004ED RID: 1261 RVA: 0x0001EDC0 File Offset: 0x0001CFC0
 private string GetThresholdEntityType(string thresholdName)
 {
     using (IInformationServiceProxy2 informationServiceProxy = this._swisFactory.CreateConnection())
     {
         DataTable dataTable = informationServiceProxy.Query("SELECT EntityType FROM Orion.Thresholds WHERE Name = @Name", new Dictionary <string, object>
         {
             {
                 "Name",
                 thresholdName
             }
         });
         if (dataTable != null && dataTable.Rows.Count > 0)
         {
             return(dataTable.Rows[0]["EntityType"].ToString());
         }
     }
     return(null);
 }
 // Token: 0x0600067D RID: 1661 RVA: 0x00026C6C File Offset: 0x00024E6C
 public MaintenancePlan Get(int planID)
 {
     using (IInformationServiceProxy2 informationServiceProxy = this.SwisFactory.Create())
     {
         DataTable dataTable = informationServiceProxy.Query("\r\n                SELECT TOP 1 ID, AccountID, Name, Reason, KeepPolling, Favorite, Enabled, UnmanageDate, RemanageDate\r\n                FROM Orion.MaintenancePlan\r\n                WHERE ID = @PlanID", new Dictionary <string, object>
         {
             {
                 "PlanID",
                 planID
             }
         });
         if (dataTable != null && dataTable.Rows.Count == 1)
         {
             return(MaintenanceModePlanDAL.DataRowToPlan(dataTable.Rows.Cast <DataRow>().FirstOrDefault <DataRow>()));
         }
     }
     return(null);
 }
Esempio n. 27
0
 // Token: 0x0600091F RID: 2335 RVA: 0x00041DD8 File Offset: 0x0003FFD8
 public void StartRedeployingPlugin(int agentId, string pluginId)
 {
     if (string.IsNullOrEmpty(pluginId))
     {
         throw new ArgumentNullException("pluginId", "Plugin Id must be specified.");
     }
     using (SwisConnectionProxyFactory swisConnectionProxyFactory = new SwisConnectionProxyFactory())
     {
         using (IInformationServiceProxy2 informationServiceProxy = swisConnectionProxyFactory.Create())
         {
             informationServiceProxy.Invoke <object>("Orion.AgentManagement.Agent", "RedeployPlugin", new object[]
             {
                 agentId,
                 pluginId
             });
         }
     }
 }
 internal string GetNetObjectPrefix(string entityName)
 {
     if (string.IsNullOrEmpty(entityName))
     {
         return((string)null);
     }
     using (IInformationServiceProxy2 iinformationServiceProxy2 = this.swisProxy.Create())
     {
         DataTable dataTable = ((IInformationServiceProxy)iinformationServiceProxy2).Query("SELECT Prefix FROM Orion.NetObjectTypes WHERE EntityType = @entityName", (IDictionary <string, object>) new Dictionary <string, object>()
         {
             {
                 nameof(entityName),
                 (object)entityName
             }
         });
         return(dataTable != null && dataTable.Rows != null && (dataTable.Rows.Count == 1 && dataTable.Rows[0][0] != null) ? dataTable.Rows[0][0].ToString() : (string)null);
     }
 }
Esempio n. 29
0
        // Token: 0x0600091D RID: 2333 RVA: 0x00041B94 File Offset: 0x0003FD94
        public int StartDeployingAgent(AgentDeploymentSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (string.IsNullOrWhiteSpace(settings.IpAddress) && string.IsNullOrWhiteSpace(settings.Hostname))
            {
                throw new ArgumentException("ipAddress or hostname must be specified");
            }
            int result;

            using (SwisConnectionProxyFactory swisConnectionProxyFactory = new SwisConnectionProxyFactory())
            {
                using (IInformationServiceProxy2 informationServiceProxy = swisConnectionProxyFactory.Create())
                {
                    string text  = (!string.IsNullOrEmpty(settings.Hostname)) ? settings.Hostname : settings.IpAddress;
                    string text2 = text;
                    int    num   = 1;
                    while (!this._agentInfoDal.IsUniqueAgentName(text2))
                    {
                        text2 = string.Format("{0}-{1}", text, ++num);
                    }
                    int num2 = informationServiceProxy.Invoke <int>("Orion.AgentManagement.Agent", "Deploy", new object[]
                    {
                        settings.EngineId,
                        text2,
                        text,
                        settings.IpAddress,
                        settings.Credentials.Username,
                        settings.Credentials.Password,
                        settings.Credentials.AdditionalUsername ?? "",
                        settings.Credentials.AdditionalPassword ?? "",
                        settings.Credentials.PasswordIsPrivateKey,
                        settings.Credentials.PrivateKeyPassword ?? "",
                        0,
                        settings.InstallPackageId ?? ""
                    });
                    this.UpdateAgentNodeId(num2, 0);
                    result = num2;
                }
            }
            return(result);
        }
Esempio n. 30
0
 private static void DeleteOldSubscriptions()
 {
     using (IInformationServiceProxy2 iinformationServiceProxy2_1 = ((IInformationServiceProxyCreator)SwisConnectionProxyPool.GetSystemCreator()).Create())
     {
         string str1 = "SELECT Uri FROM System.Subscription WHERE description = @description";
         IInformationServiceProxy2 iinformationServiceProxy2_2 = iinformationServiceProxy2_1;
         string str2 = str1;
         foreach (DataRow dataRow in ((IInformationServiceProxy)iinformationServiceProxy2_2).Query(str2, (IDictionary <string, object>) new Dictionary <string, object>()
         {
             {
                 "description",
                 (object)"AuditingIndications"
             }
         }).Rows.Cast <DataRow>())
         {
             ((IInformationServiceProxy)iinformationServiceProxy2_1).Delete(dataRow[0].ToString());
         }
     }
 }