Esempio n. 1
0
        public static int RemoveActivityType(string typeID, SqlConnection scoConnection, bool replaceWithUnknown, bool deletedOnly)
        {
            //TODO: Also need to remove QIKOBJECT instances
            int    numAffected = 0;
            string whereClause = string.Empty;

            if (deletedOnly)
            {
                whereClause = string.Format("WHERE obj.ObjectType = '{0}' AND obj.Deleted = 1)", typeID);
            }
            else
            {
                whereClause = string.Format("WHERE obj.ObjectType = '{0}')", typeID);
            }

            StringBuilder sb = new StringBuilder();

            typeID = GuidUtilities.RemoveBracesFromGuid(typeID);
            if (replaceWithUnknown)
            {
                sb.Append("UPDATE [Orchestrator].[dbo].[OBJECTS] obj");
                sb.Append("SET obj.ObjectType = 'DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD', set obj.Enabled = 0");
                sb.Append(whereClause);
            }
            else
            {
                sb.Append("DELETE FROM [Orchestrator].[dbo].[OBJECTS]");
                sb.Append(whereClause);
            }
            numAffected += SQLUtilities.RunDeleteQuery(sb.ToString(), scoConnection);
            return(numAffected);
        }
Esempio n. 2
0
        public static int RemoveConfigurationDataForIP(string packID, SqlConnection scoConnection)
        {
            packID = GuidUtilities.RemoveBracesFromGuid(packID);
            string queryString = string.Format("DELETE FROM [Orchestrator].[dbo].[CONFIGURATION] Where AND DataValue like '%{0}%' ", packID);

            return(SQLUtilities.RunDeleteQuery(queryString, scoConnection));
        }
Esempio n. 3
0
        public static int RemoveCapDataForIP(string packID, SqlConnection scoConnection)
        {
            packID = GuidUtilities.RemoveBracesFromGuid(packID);
            string queryString = string.Format("DELETE FROM [Orchestrator].[dbo].[CAPS] Where UniqueID = '{0}'", packID);

            return(SQLUtilities.RunDeleteQuery(queryString, scoConnection));
        }
Esempio n. 4
0
        public static int RemoveLinkTriggersForActivityType(string typeID, SqlConnection scoConnection, bool deletedOnly)
        {
            StringBuilder sb = new StringBuilder();

            typeID = GuidUtilities.RemoveBracesFromGuid(typeID);

            sb.Append("DELETE FROM [Orchestrator].[dbo].[TRIGGERS]");
            sb.Append("WHERE ParentID IN");
            sb.Append(GetSelectObjectTypeSubQueryString(typeID, deletedOnly));

            return(SQLUtilities.RunDeleteQuery(sb.ToString(), scoConnection));
        }
Esempio n. 5
0
        public static int RemoveJobDataForActivityType(string typeID, SqlConnection scoConnection, bool deletedOnly)
        {
            StringBuilder sb = new StringBuilder();

            typeID = GuidUtilities.RemoveBracesFromGuid(typeID);

            sb.Append(" DELETE FROM [Orchestrator].[dbo].[OBJECTINSTANCEDATA] ");
            sb.Append(" WHERE ObjectInstanceID IN ");
            sb.Append(" (SELECT UniqueID FROM [Orchestrator].[dbo].[OBJECTINSTANCES] ");
            sb.Append("  WHERE ObjectID IN ");
            sb.Append(GetSelectObjectTypeSubQueryString(typeID, deletedOnly));
            sb.Append(string.Format(")", typeID));
            return(SQLUtilities.RunDeleteQuery(sb.ToString(), scoConnection));
        }
Esempio n. 6
0
        public static int RemoveLinksForActivityType(string typeID, SqlConnection scoConnection, bool deletedOnly)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("DELETE FROM [Orchestrator].[dbo].[LINKS]");
            sb.Append("WHERE SourceObject IN");
            sb.Append(GetSelectObjectTypeSubQueryString(typeID, deletedOnly));
            sb.Append("OR TargetObject IN");
            sb.Append(GetSelectObjectTypeSubQueryString(typeID, deletedOnly));

            int numAffected = SQLUtilities.RunDeleteQuery(sb.ToString(), scoConnection);

            return(numAffected);
        }