internal void FindSpamRuleUpdates(RuleScopeType scopeIDs, ref DateTime changedDate, out SpamRulePackageData newRules, out SpamRulePackageData deletedRules, bool activeOnly = false) { newRules = null; deletedRules = null; QueryFilter queryFilter = QueryFilter.AndTogether(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, RuleBase.RuleTypeProperty, 0), new ComparisonFilter(ComparisonOperator.Equal, RuleBase.ScopeIDProperty, (byte)scopeIDs), new ComparisonFilter(ComparisonOperator.Equal, KesSpamSchema.ActiveOnlyProperty, activeOnly), base.BuildVersionParam }); if (changedDate != DateTime.MinValue) { DateTime dateTime = changedDate.Subtract(TimeSpan.FromSeconds(30.0)); queryFilter = QueryFilter.AndTogether(new QueryFilter[] { queryFilter, new ComparisonFilter(ComparisonOperator.Equal, RuleBase.ChangedDatetimeProperty, dateTime) }); } List <SpamRule> list = base.DataProvider.Find <SpamRule>(queryFilter, null, true, null).Cast <SpamRule>().ToList <SpamRule>(); if (list != null && list.Count > 0) { List <SpamRule> list2 = (from item in list where item.IsActive.Value select item).ToList <SpamRule>(); if (list2 != null && list2.Any <SpamRule>()) { newRules = base.GenerateSpamRulePackageData(list2); } List <SpamRule> list3 = (from item in list where !item.IsActive.Value select item).ToList <SpamRule>(); if (list3 != null && list3.Count > 0) { deletedRules = base.GenerateSpamRulePackageData(list3); } changedDate = (from item in list where item.ChangeDatetime != null select item.ChangeDatetime.Value).Max <DateTime>(); } }
internal void FindSpamRuleUpdates(RuleScopeType scopeIDs, ref string pageCookie, out SpamRulePackageData newRules, out SpamRulePackageData deletedRules, bool activeOnly = false) { newRules = null; deletedRules = null; QueryFilter queryFilter = QueryFilter.AndTogether(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, RuleBase.RuleTypeProperty, 0), new ComparisonFilter(ComparisonOperator.Equal, RuleBase.ScopeIDProperty, (byte)scopeIDs), new ComparisonFilter(ComparisonOperator.Equal, KesSpamSchema.ActiveOnlyProperty, activeOnly), base.BuildVersionParam }); List <SpamRule> list = base.FindPagedRules <SpamRule>(queryFilter, ref pageCookie, 1000); if (list != null && list.Count > 0) { List <SpamRule> list2 = (from item in list where item.IsActive.Value select item).ToList <SpamRule>(); if (list2 != null && list2.Any <SpamRule>()) { newRules = base.GenerateSpamRulePackageData(list2); } List <SpamRule> list3 = (from item in list where !item.IsActive.Value select item).ToList <SpamRule>(); if (list3 != null && list3.Count > 0) { deletedRules = base.GenerateSpamRulePackageData(list3); } } }