public void Save(IEnumerable <AppConfigParameter> items)
        {
            if (items == null)
            {
                throw new ArgumentNullException("items");
            }
            int num = AppConfigSession.Inspect <AppConfigParameter>(items, AppConfigSession.AppConfigParameterEqualityComparer.Default);

            if (num == 0)
            {
                throw new ArgumentOutOfRangeException("items");
            }
            if (num < 0)
            {
                throw new ArgumentException("Duplicate parameters specified.", "items");
            }
            BatchPropertyTable batchPropertyTable = new BatchPropertyTable();

            foreach (AppConfigParameter appConfigParameter in items)
            {
                Guid identity = AppConfigSession.GenerateParameterIdentity();
                batchPropertyTable.AddPropertyValue(identity, AppConfigSchema.ParamVersionProp, appConfigParameter.Version.ToInt64());
                batchPropertyTable.AddPropertyValue(identity, AppConfigSchema.ParamNameProp, appConfigParameter.Name);
                batchPropertyTable.AddPropertyValue(identity, AppConfigSchema.ParamValueProp, appConfigParameter.Value);
                batchPropertyTable.AddPropertyValue(identity, AppConfigSchema.DescriptionProp, appConfigParameter.Description);
            }
            AppConfigSchema.AppConfigItems appConfigItems = new AppConfigSchema.AppConfigItems(batchPropertyTable);
            AuditHelper.ApplyAuditProperties(appConfigItems, default(Guid), null);
            this.DataProvider.Save(appConfigItems);
        }
示例#2
0
 private static void AddDataFilterRow(BatchPropertyTable table, ComparisonFilter filter)
 {
     if (filter != null)
     {
         Guid identity = CombGuidGenerator.NewGuid();
         table.AddPropertyValue(identity, TransportQueueSchema.FilterNameProperty, filter.Property.Name);
         table.AddPropertyValue(identity, TransportQueueSchema.OperatorProperty, filter.ComparisonOperator.ToString());
         table.AddPropertyValue(identity, TransportQueueSchema.FilterValueProperty, filter.PropertyValue.ToString());
     }
 }
        public SpamRuleProcessorBlobBatch(IEnumerable <SpamRuleProcessorBlob> items)
        {
            BatchPropertyTable batchPropertyTable = new BatchPropertyTable();

            foreach (SpamRuleProcessorBlob spamRuleProcessorBlob in items)
            {
                Guid identity = CombGuidGenerator.NewGuid();
                batchPropertyTable.AddPropertyValue(identity, SpamRuleProcessorBlobSchema.IdProperty, spamRuleProcessorBlob.Id);
                batchPropertyTable.AddPropertyValue(identity, SpamRuleProcessorBlobSchema.ProcessorIdProperty, spamRuleProcessorBlob.ProcessorId);
                batchPropertyTable.AddPropertyValue(identity, SpamRuleProcessorBlobSchema.DataProperty, spamRuleProcessorBlob.Data);
            }
            base.Batch = batchPropertyTable;
        }
示例#4
0
        public SyncWatermarkBatch(IEnumerable <SyncWatermark> items)
        {
            BatchPropertyTable batchPropertyTable = new BatchPropertyTable();

            foreach (SyncWatermark syncWatermark in items)
            {
                Guid identity = CombGuidGenerator.NewGuid();
                batchPropertyTable.AddPropertyValue(identity, SyncWatermark.IdProperty, syncWatermark.Id);
                batchPropertyTable.AddPropertyValue(identity, SyncWatermark.SyncContextProperty, syncWatermark.SyncContext);
                batchPropertyTable.AddPropertyValue(identity, SyncWatermark.DataProperty, syncWatermark.Data);
                batchPropertyTable.AddPropertyValue(identity, SyncWatermark.OwnerProperty, syncWatermark.Owner);
            }
            base.Batch = batchPropertyTable;
        }
        public RuleExtendedPropertyBatch(IEnumerable <RuleExtendedProperty> items)
        {
            BatchPropertyTable batchPropertyTable = new BatchPropertyTable();

            foreach (RuleExtendedProperty ruleExtendedProperty in items)
            {
                Guid identity = CombGuidGenerator.NewGuid();
                batchPropertyTable.AddPropertyValue(identity, RuleExtendedProperty.IDProperty, ruleExtendedProperty.ID);
                if (ruleExtendedProperty.PropertyName != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.NameProperty, ruleExtendedProperty.PropertyName);
                    if (ruleExtendedProperty.IntValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.IntValueProperty, ruleExtendedProperty.IntValue);
                    }
                    if (ruleExtendedProperty.LongValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.LongValueProperty, ruleExtendedProperty.LongValue);
                    }
                    if (ruleExtendedProperty.StringValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.StringValueProperty, ruleExtendedProperty.StringValue);
                    }
                    if (ruleExtendedProperty.BlobValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.BlobValueProperty, ruleExtendedProperty.BlobValue);
                    }
                    if (ruleExtendedProperty.DatetimeValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.DatetimeValueProperty, ruleExtendedProperty.DatetimeValue);
                    }
                    if (ruleExtendedProperty.DecimalValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.DecimalValueProperty, ruleExtendedProperty.DecimalValue);
                    }
                    if (ruleExtendedProperty.BoolValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.BoolValueProperty, ruleExtendedProperty.BoolValue);
                    }
                    if (ruleExtendedProperty.GuidValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.GuidValueProperty, ruleExtendedProperty.GuidValue);
                    }
                }
            }
            base.Batch = batchPropertyTable;
        }
示例#6
0
        public ProcessorBatch(IEnumerable <Processor> items)
        {
            BatchPropertyTable batchPropertyTable = new BatchPropertyTable();

            foreach (Processor processor in items)
            {
                Guid identity = CombGuidGenerator.NewGuid();
                batchPropertyTable.AddPropertyValue(identity, Processor.ProcessorIDProperty, processor.ProcessorID);
                if (processor.PropertyName != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.NameProperty, processor.PropertyName);
                    if (processor.IntValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.IntValueProperty, processor.IntValue);
                    }
                    if (processor.LongValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.LongValueProperty, processor.LongValue);
                    }
                    if (processor.StringValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.StringValueProperty, processor.StringValue);
                    }
                    if (processor.BlobValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.BlobValueProperty, processor.BlobValue);
                    }
                    if (processor.DatetimeValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.DatetimeValueProperty, processor.DatetimeValue);
                    }
                    if (processor.DecimalValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.DecimalValueProperty, processor.DecimalValue);
                    }
                    if (processor.BoolValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.BoolValueProperty, processor.BoolValue);
                    }
                    if (processor.GuidValue != null)
                    {
                        batchPropertyTable.AddPropertyValue(identity, ConfigurablePropertyTable.GuidValueProperty, processor.GuidValue);
                    }
                }
            }
            base.Batch = batchPropertyTable;
        }
示例#7
0
        public void PrepareForSerialization()
        {
            Guid scheduleId = this.ScheduleId;
            BatchPropertyTable batchPropertyTable = new BatchPropertyTable();

            foreach (long num in this.dataCenterIdCollection)
            {
                batchPropertyTable.AddPropertyValue(Guid.NewGuid(), DataCenterDefinition.DataCenterIdProperty, num);
            }
            this[ScheduleItem.SchedIdToDCIdMappingProperty] = batchPropertyTable;
        }
        public RulePredicateBatch(IEnumerable <RulePredicate> items)
        {
            BatchPropertyTable batchPropertyTable = new BatchPropertyTable();

            foreach (RulePredicate rulePredicate in items)
            {
                Guid identity = CombGuidGenerator.NewGuid();
                batchPropertyTable.AddPropertyValue(identity, RulePredicate.IDProperty, rulePredicate.ID);
                batchPropertyTable.AddPropertyValue(identity, RulePredicate.PredicateIDProperty, rulePredicate.PredicateID);
                batchPropertyTable.AddPropertyValue(identity, RulePredicate.PredicateTypeProperty, rulePredicate.PredicateType);
                if (rulePredicate.Sequence != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, RulePredicate.SequenceProperty, rulePredicate.Sequence);
                }
                if (rulePredicate.ParentID != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, RulePredicate.ParentIDProperty, rulePredicate.ParentID);
                }
                if (rulePredicate.ProcessorID != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, RulePredicate.ProcessorIdProperty, rulePredicate.ProcessorID);
                }
            }
            base.Batch = batchPropertyTable;
        }
示例#9
0
        public SpamRuleBlobBatch(IEnumerable <SpamRuleBlob> items)
        {
            BatchPropertyTable batchPropertyTable = new BatchPropertyTable();

            foreach (SpamRuleBlob spamRuleBlob in items)
            {
                Guid identity = CombGuidGenerator.NewGuid();
                batchPropertyTable.AddPropertyValue(identity, SpamRuleBlobSchema.IdProperty, spamRuleBlob.Id);
                batchPropertyTable.AddPropertyValue(identity, SpamRuleBlobSchema.RuleIdProperty, spamRuleBlob.RuleId);
                batchPropertyTable.AddPropertyValue(identity, SpamRuleBlobSchema.GroupIdProperty, spamRuleBlob.GroupId);
                batchPropertyTable.AddPropertyValue(identity, SpamRuleBlobSchema.ScopeIdProperty, spamRuleBlob.ScopeId);
                batchPropertyTable.AddPropertyValue(identity, SpamRuleBlobSchema.RuleDataProperty, spamRuleBlob.RuleData);
                batchPropertyTable.AddPropertyValue(identity, SpamRuleBlobSchema.RuleMetaDataProperty, spamRuleBlob.RuleMetaData);
                batchPropertyTable.AddPropertyValue(identity, SpamRuleBlobSchema.PriorityProperty, spamRuleBlob.Priority);
                batchPropertyTable.AddPropertyValue(identity, SpamRuleBlobSchema.PublishingStateProperty, spamRuleBlob.PublishingState);
                batchPropertyTable.AddPropertyValue(identity, SpamRuleBlobSchema.ProcessorDataProperty, spamRuleBlob.ProcessorData);
                if (spamRuleBlob.DeletedDatetime != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, SpamRuleBlobSchema.DeletedDatetimeProperty, spamRuleBlob.DeletedDatetime);
                }
            }
            base.Batch = batchPropertyTable;
        }
示例#10
0
        public RuleUpdateBatch(IEnumerable <RuleUpdate> items)
        {
            BatchPropertyTable batchPropertyTable = new BatchPropertyTable();

            foreach (RuleUpdate ruleUpdate in items)
            {
                Guid identity = CombGuidGenerator.NewGuid();
                if (ruleUpdate.ID != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, RuleUpdate.IDProperty, ruleUpdate.ID);
                }
                if (ruleUpdate.RuleID != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, RuleUpdate.RuleIDProperty, ruleUpdate.RuleID);
                }
                if (ruleUpdate.RuleType != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, RuleUpdate.RuleTypeProperty, ruleUpdate.RuleType);
                }
                if (ruleUpdate.IsPersistent != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, RuleUpdate.IsPersistentProperty, ruleUpdate.IsPersistent);
                }
                if (ruleUpdate.IsActive != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, RuleUpdate.IsActiveProperty, ruleUpdate.IsActive);
                }
                if (ruleUpdate.State != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, RuleUpdate.StateProperty, ruleUpdate.State);
                }
                if (ruleUpdate.AddedVersion != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, RuleUpdate.AddedVersionProperty, ruleUpdate.AddedVersion);
                }
                if (ruleUpdate.RemovedVersion != null)
                {
                    batchPropertyTable.AddPropertyValue(identity, RuleUpdate.RemovedVersionProperty, ruleUpdate.RemovedVersion);
                }
            }
            base.Batch = batchPropertyTable;
        }
示例#11
0
        private static DataTable GetQueueLogProperties(TransportQueueLogBatch batch)
        {
            BatchPropertyTable batchPropertyTable = new BatchPropertyTable();

            if (batch.QueueLogs != null)
            {
                foreach (TransportQueueLog transportQueueLog in batch.QueueLogs)
                {
                    foreach (PropertyDefinition propertyDefinition in DalHelper.GetPropertyDefinitions(transportQueueLog, true))
                    {
                        if (!propertyDefinition.Type.Equals(typeof(DataTable)))
                        {
                            batchPropertyTable.AddPropertyValue(transportQueueLog.QueueId, propertyDefinition, transportQueueLog[propertyDefinition]);
                        }
                    }
                }
            }
            return(batchPropertyTable);
        }
示例#12
0
        public IPagedReader <TaskItem> FindTasks(Guid roleId, Guid?ownerId, IEnumerable <TaskExecutionStateType> taskExecutionStates, IEnumerable <TaskExecutionStateType> taskExecutionExclusionStates, SchedulingType?schedulingType, int?regionSelectionSet, Guid?scheduleId, Guid?taskId, TaskCompletionStatusType?taskCompletionStatus, IEnumerable <long> dataCenterIdCollection, int pageSize, Guid?jobId = null, Guid?activeJobId = null)
        {
            int num = 5;

            if (jobId != null)
            {
                num++;
            }
            if (activeJobId != null)
            {
                num++;
            }
            if (ownerId != null)
            {
                num++;
            }
            if (schedulingType != null)
            {
                num++;
            }
            if (regionSelectionSet != null)
            {
                num++;
            }
            if (scheduleId != null)
            {
                num++;
            }
            if (taskId != null)
            {
                num++;
            }
            if (taskCompletionStatus != null)
            {
                num++;
            }
            QueryFilter[] array = new QueryFilter[num];
            num          = 0;
            array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.RoleIdQueryProperty, roleId);
            if (jobId != null)
            {
                array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.JobIdQueryProperty, jobId);
            }
            if (activeJobId != null)
            {
                array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.ActiveJobIdQueryProperty, activeJobId);
            }
            if (ownerId != null)
            {
                array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.OwnerIdQueryProperty, ownerId);
            }
            if (schedulingType != null)
            {
                array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.SchedulingTypeQueryProperty, (byte)schedulingType.Value);
            }
            if (regionSelectionSet != null)
            {
                array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.RegionSelectionSetQueryProperty, regionSelectionSet);
            }
            if (scheduleId != null)
            {
                array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.ScheduleIdQueryProperty, scheduleId);
            }
            if (taskId != null)
            {
                array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.TaskIdQueryProperty, taskId);
            }
            if (taskCompletionStatus != null)
            {
                array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.TaskCompletionStatusQueryProperty, taskCompletionStatus);
            }
            BatchPropertyTable batchPropertyTable = new BatchPropertyTable();

            if (dataCenterIdCollection != null)
            {
                foreach (long num2 in dataCenterIdCollection)
                {
                    batchPropertyTable.AddPropertyValue(Guid.NewGuid(), BackgroundJobBackendSession.DCSelectionSetProperty2, num2);
                }
            }
            array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.TvpDCIdList, batchPropertyTable);
            PropertyTable             propertyTable       = new PropertyTable();
            MultiValuedProperty <int> multiValuedProperty = new MultiValuedProperty <int>();

            if (taskExecutionStates != null)
            {
                foreach (TaskExecutionStateType item in taskExecutionStates)
                {
                    multiValuedProperty.Add((int)item);
                }
                propertyTable.AddPropertyValue(BackgroundJobBackendSession.TaskExecutionStateQueryMvpProperty, multiValuedProperty);
            }
            array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.TvpTaskExecutionStates, propertyTable);
            PropertyTable             propertyTable2       = new PropertyTable();
            MultiValuedProperty <int> multiValuedProperty2 = new MultiValuedProperty <int>();

            if (taskExecutionExclusionStates != null)
            {
                foreach (TaskExecutionStateType item2 in taskExecutionExclusionStates)
                {
                    multiValuedProperty2.Add((int)item2);
                }
                propertyTable2.AddPropertyValue(BackgroundJobBackendSession.TaskExecutionStateQueryMvpProperty, multiValuedProperty2);
            }
            array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.TvpTaskExecutionExclusionStates, propertyTable2);
            array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.PageSizeQueryProperty, pageSize);
            QueryFilter queryFilter = new OrFilter(array);

            return(this.GetPagedReader <TaskItem>(queryFilter, pageSize, jobId == null));
        }
示例#13
0
        public ScheduleItem[] FindScheduleItems(Guid roleId, Guid?scheduleId = null, bool?active = null, int?regionSelectionSet = null, IEnumerable <long> dataCenterIdCollection = null, Guid?jobId = null)
        {
            int num = 2;

            if (scheduleId != null)
            {
                num++;
            }
            if (active != null)
            {
                num++;
            }
            if (regionSelectionSet != null)
            {
                num++;
            }
            if (jobId != null)
            {
                num++;
            }
            QueryFilter[] array = new QueryFilter[num];
            num          = 0;
            array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.RoleIdQueryProperty, roleId);
            if (scheduleId != null)
            {
                array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.ScheduleIdQueryProperty, scheduleId);
            }
            if (active != null)
            {
                array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.ActiveQueryProperty, active);
            }
            if (regionSelectionSet != null)
            {
                array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.RegionSelectionSetQueryProperty, regionSelectionSet);
            }
            BatchPropertyTable batchPropertyTable = new BatchPropertyTable();

            if (dataCenterIdCollection != null)
            {
                foreach (long num2 in dataCenterIdCollection)
                {
                    batchPropertyTable.AddPropertyValue(Guid.NewGuid(), BackgroundJobBackendSession.DCSelectionSetProperty2, num2);
                }
            }
            array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.TvpDCIdList, batchPropertyTable);
            if (jobId != null)
            {
                array[num++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.JobIdQueryProperty, jobId);
            }
            QueryFilter filter;

            if (num > 1)
            {
                filter = new OrFilter(array);
            }
            else
            {
                filter = array[0];
            }
            IConfigurable[] array2 = this.dataProvider.Find <ScheduleItem>(filter, null, false, null);
            if (array2 == null)
            {
                return(null);
            }
            return(BackgroundJobBackendSession.IConfigurableArrayTo <ScheduleItem>(array2));
        }