示例#1
0
        protected override PerTenantPolicyNudgeRulesCollection.PolicyNudgeRules Read(IConfigurationSession session)
        {
            ADPagedReader <PolicyTipMessageConfig> adpagedReader           = session.FindPaged <PolicyTipMessageConfig>(PerTenantPolicyNudgeRulesCollection.GetPolicyTipMessageConfigsContainerId(session), QueryScope.SubTree, null, null, 0);
            IEnumerable <PolicyTipMessageConfig>   tenantPolicyTipMessages = adpagedReader.ReadAllPages();
            ADPagedReader <TransportRule>          adpagedReader2          = session.FindPaged <TransportRule>(PerTenantPolicyNudgeRulesCollection.GetPolicyNudgeRuleContainerId(session), QueryScope.SubTree, null, PerTenantPolicyNudgeRulesCollection.PriorityOrder, 0);
            PolicyNudgeRuleParser         parser = PolicyNudgeRuleParser.Instance;
            IEnumerable <PolicyNudgeRule> tenantPolicyNudgeRules = (from rule in adpagedReader2.ReadAllPages()
                                                                    select parser.GetRule(rule.Xml, rule.Name, rule.WhenChangedUTC ?? (rule.WhenCreatedUTC ?? DateTime.MinValue)) into rule
                                                                    where rule != null
                                                                    select rule).ToList <PolicyNudgeRule>();

            return(new PerTenantPolicyNudgeRulesCollection.PolicyNudgeRules(tenantPolicyNudgeRules, new PerTenantPolicyNudgeRulesCollection.PolicyTipMessages(tenantPolicyTipMessages)));
        }
示例#2
0
        protected override ADNotificationRequestCookie Register(IConfigurationSession session)
        {
            ADNotificationRequestCookie request = ADNotificationAdapter.RegisterChangeNotification <PolicyTipMessageConfig>(PerTenantPolicyNudgeRulesCollection.GetPolicyTipMessageConfigsContainerId(session), new ADNotificationCallback(base.ChangeCallback), session);
            ADNotificationRequestCookie result;

            try
            {
                result = ADNotificationAdapter.RegisterChangeNotification <TransportRule>(PerTenantPolicyNudgeRulesCollection.GetPolicyNudgeRuleContainerId(session), new ADNotificationCallback(base.ChangeCallback), session);
            }
            catch (Exception ex)
            {
                ADNotificationAdapter.UnregisterChangeNotification(request);
                throw ex;
            }
            return(result);
        }