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
                });
        }
 public Task OnNotificationAsync(Notification notification)
 {
     if (!this._subscriptionId.get_Id().Equals((object)notification.get_SubscriptionId()))
     {
         return(Task.CompletedTask);
     }
     MaintenanceIndicationSubscriber.log.DebugFormat("Received maintenance mode indication '{0}'.", (object)notification.get_IndicationType());
     MaintenanceIndicationSubscriber.log.DebugFormat("Indication Properties: {0}", (object)notification.get_IndicationProperties());
     MaintenanceIndicationSubscriber.log.DebugFormat("Source Instance Properties: {0}", (object)notification.get_SourceInstanceProperties());
     try
     {
         MaintenancePlanAssignment assignment = this.CreateAssignment(notification.get_SourceInstanceProperties());
         if (IndicationHelper.GetIndicationType((IndicationType)0).Equals(notification.get_IndicationType()))
         {
             this.manager.Unmanage(assignment);
         }
         else if (IndicationHelper.GetIndicationType((IndicationType)1).Equals(notification.get_IndicationType()))
         {
             this.manager.Remanage(assignment);
         }
         else
         {
             IndicationHelper.GetIndicationType((IndicationType)2).Equals(notification.get_IndicationType());
         }
     }
     catch (Exception ex)
     {
         MaintenanceIndicationSubscriber.log.ErrorFormat("Unable to process maintenance mode indication. {0}", (object)ex);
         throw;
     }
     return(Task.CompletedTask);
 }
 // Token: 0x06000590 RID: 1424 RVA: 0x00021CEC File Offset: 0x0001FEEC
 public void OnIndication(string subscriptionId, string indicationType, PropertyBag indicationProperties, PropertyBag sourceInstanceProperties)
 {
     if (this.subscriptionId != subscriptionId)
     {
         return;
     }
     MaintenanceIndicationSubscriber.log.DebugFormat("Received maintenance mode indication '{0}'.", indicationType);
     MaintenanceIndicationSubscriber.log.DebugFormat("Indication Properties: {0}", indicationProperties);
     MaintenanceIndicationSubscriber.log.DebugFormat("Source Instance Properties: {0}", sourceInstanceProperties);
     try
     {
         MaintenancePlanAssignment assignment = this.CreateAssignment(sourceInstanceProperties);
         if (IndicationHelper.GetIndicationType(0).Equals(indicationType))
         {
             this.manager.Unmanage(assignment);
         }
         else if (IndicationHelper.GetIndicationType(1).Equals(indicationType))
         {
             this.manager.Remanage(assignment);
         }
         else
         {
             IndicationHelper.GetIndicationType(2).Equals(indicationType);
         }
     }
     catch (Exception ex)
     {
         MaintenanceIndicationSubscriber.log.ErrorFormat("Unable to process maintenance mode indication. {0}", ex);
         throw;
     }
 }
Exemple #4
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
                });
            }
        }
        internal MaintenancePlanAssignment CreateAssignment(
            IDictionary <string, object> sourceInstanceProperties)
        {
            if (sourceInstanceProperties == null)
            {
                throw new ArgumentNullException(nameof(sourceInstanceProperties));
            }
            if (!sourceInstanceProperties.Keys.Any <string>())
            {
                throw new ArgumentException(nameof(sourceInstanceProperties));
            }
            MaintenancePlanAssignment maintenancePlanAssignment = new MaintenancePlanAssignment();

            maintenancePlanAssignment.set_ID(Convert.ToInt32(sourceInstanceProperties["ID"]));
            maintenancePlanAssignment.set_EntityType(Convert.ToString(sourceInstanceProperties["EntityType"]));
            maintenancePlanAssignment.set_EntityID(Convert.ToInt32(sourceInstanceProperties["EntityID"]));
            maintenancePlanAssignment.set_MaintenancePlanID(Convert.ToInt32(sourceInstanceProperties["MaintenancePlanID"]));
            return(maintenancePlanAssignment);
        }
        public void Remanage(MaintenancePlanAssignment assignment)
        {
            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(Remanage), new object[1]
                {
                    netObjectId
                });
        }
Exemple #7
0
        // Token: 0x0600058A RID: 1418 RVA: 0x00021B00 File Offset: 0x0001FD00
        public void Remanage(MaintenancePlanAssignment assignment)
        {
            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, "Remanage", new object[]
                {
                    obj
                });
            }
        }