Example #1
0
        public JobDefinition[] FindJobDefinitions(Guid?roleId = null, Guid?jobId = null, string jobName = null)
        {
            QueryFilter filter = null;

            if (roleId != null || jobId != null || jobName != null)
            {
                List <QueryFilter> list = new List <QueryFilter>(3);
                if (roleId != null)
                {
                    list.Add(new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.RoleIdQueryProperty, roleId));
                }
                if (jobId != null)
                {
                    list.Add(new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.JobIdQueryProperty, jobId));
                }
                if (jobName != null)
                {
                    list.Add(new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.JobNameQueryProperty, jobName));
                }
                if (list.Count == 1)
                {
                    filter = list[0];
                }
                else
                {
                    filter = new OrFilter(list.ToArray());
                }
            }
            IConfigurable[] array = this.dataProvider.Find <JobDefinition>(filter, null, false, null);
            if (array == null)
            {
                return(null);
            }
            return(BackgroundJobBackendSession.IConfigurableArrayTo <JobDefinition>(array));
        }
Example #2
0
        public BackgroundJobMgrInstance[] FindBackgroundJobMgrInstances(Guid roleId, DateTime lastCheckedDatetime, bool active)
        {
            OrFilter filter = new OrFilter(new QueryFilter[]
            {
                new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.RoleIdQueryProperty, roleId),
                new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.LastCheckedDatetimeQueryProperty, lastCheckedDatetime),
                new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.ActiveQueryProperty, active)
            });

            IConfigurable[] array = this.dataProvider.Find <BackgroundJobMgrInstance>(filter, null, false, null);
            if (array == null)
            {
                return(null);
            }
            return(BackgroundJobBackendSession.IConfigurableArrayTo <BackgroundJobMgrInstance>(array));
        }
Example #3
0
        public RoleDefinition[] FindRoleByNameVersion(string roleName, string roleVersion)
        {
            QueryFilter filter = null;
            int         num    = 0;

            if (roleName != null)
            {
                num++;
            }
            if (roleVersion != null)
            {
                num++;
            }
            if (num > 0)
            {
                QueryFilter[] array = new QueryFilter[num];
                int           num2  = 0;
                if (roleName != null)
                {
                    array[num2++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.RoleNameQueryProperty, roleName);
                }
                if (roleVersion != null)
                {
                    array[num2++] = new ComparisonFilter(ComparisonOperator.Equal, BackgroundJobBackendSession.RoleVersionQueryProperty, roleVersion);
                }
                if (num > 1)
                {
                    filter = new OrFilter(array);
                }
                else
                {
                    filter = array[0];
                }
            }
            IConfigurable[] array2 = this.dataProvider.Find <RoleDefinition>(filter, null, false, null);
            if (array2 == null)
            {
                return(null);
            }
            return(BackgroundJobBackendSession.IConfigurableArrayTo <RoleDefinition>(array2));
        }
Example #4
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));
        }