コード例 #1
0
        private static void NotifySubscribers(ServiceEventMessage message, TSubscriptionType subscriptionType)
        {
            Guid clientID       = StringUtils.GuidDecode((string)message.Parameters["ClientID"]);
            int  organisationID = (int)((long)message.Parameters["OrganisationID"]);

            Model.Object changedObject = null;

            List <Subscription> subscriptions = null;

            if (subscriptionType == TSubscriptionType.Observation)
            {
                changedObject = (Model.Object)message.Parameters["Object"];
                subscriptions = DataAccessFactory.Subscriptions.GetSubscriptions(clientID);
            }
            else
            {
                subscriptions = DataAccessFactory.Subscriptions.GetSubscriptions(organisationID);
            }

            foreach (Subscription subscription in subscriptions)
            {
                if (subscription.SubscriptionType == subscriptionType)
                {
                    if (subscriptionType == TSubscriptionType.Observation)
                    {
                        if (subscription.ObjectDefinitionID == changedObject.ObjectDefinitionID)
                        {
                            if (subscription.ObjectID == null || subscription.ObjectID == changedObject.InstanceID)
                            {
                                if (subscription.PropertyDefinitionID == Guid.Empty || changedObject.ContainsPropertyWithDefinitionID(subscription.PropertyDefinitionID))
                                {
                                    NotifySubscriber(clientID, subscription, changedObject);
                                }
                            }
                        }
                    }
                    else
                    {
                        NotifySubscriber(clientID, subscription, changedObject);
                    }
                }
            }
        }
コード例 #2
0
        private static void NotifySubscribers(ServiceEventMessage message, TSubscriptionType subscriptionType)
        {
            Guid clientID = StringUtils.GuidDecode((string)message.Parameters["ClientID"]);
            int organisationID = (int)((long)message.Parameters["OrganisationID"]);
            Model.Object changedObject = null;

            List<Subscription> subscriptions = null;
            if (subscriptionType == TSubscriptionType.Observation)
            {
                changedObject = (Model.Object)message.Parameters["Object"];
                subscriptions = DataAccessFactory.Subscriptions.GetSubscriptions(clientID);
            }
            else
                subscriptions = DataAccessFactory.Subscriptions.GetSubscriptions(organisationID);

            foreach (Subscription subscription in subscriptions)
            {
                if (subscription.SubscriptionType == subscriptionType)
                {
                    if (subscriptionType == TSubscriptionType.Observation)
                    {
                        if (subscription.ObjectDefinitionID == changedObject.ObjectDefinitionID)
                        {
                            if (subscription.ObjectID == null || subscription.ObjectID == changedObject.InstanceID)
                            {
                                if (subscription.PropertyDefinitionID == Guid.Empty || changedObject.ContainsPropertyWithDefinitionID(subscription.PropertyDefinitionID))
                                {
                                    NotifySubscriber(clientID, subscription, changedObject);
                                }
                            }
                        }
                    }
                    else
                        NotifySubscriber(clientID, subscription, changedObject);
                }
            }
        }