예제 #1
0
        protected override ICollection <ServiceIssue> RunFullIssueScan()
        {
            ICollection <ServiceIssue> collection = new List <ServiceIssue>();

            foreach (Guid mdbGuid in MapiUtils.GetDatabasesOnThisServer())
            {
                using (new DatabaseSettingsContext(mdbGuid, null).Activate())
                {
                    try
                    {
                        DatabaseInformation databaseInformation = MapiUtils.FindServerForMdb(mdbGuid, null, null, FindServerFlags.None);
                        string databaseName = databaseInformation.DatabaseName;
                        if (!databaseInformation.IsOnThisServer)
                        {
                            return(null);
                        }
                        using (MapiStore systemMailbox = MapiUtils.GetSystemMailbox(mdbGuid, false))
                        {
                            using (MapiFolder requestJobsFolder = RequestJobXML.GetRequestJobsFolder(systemMailbox))
                            {
                                using (MapiTable contentsTable = requestJobsFolder.GetContentsTable(ContentsTableFlags.DeferredErrors))
                                {
                                    if (contentsTable.GetRowCount() > 0)
                                    {
                                        RequestJobNamedPropertySet requestJobNamedPropertySet = RequestJobNamedPropertySet.Get(systemMailbox);
                                        contentsTable.SetColumns(requestJobNamedPropertySet.PropTags);
                                        Restriction    restriction = Restriction.GT(requestJobNamedPropertySet.PropTags[23], ConfigBase <MRSConfigSchema> .GetConfig <int>("PoisonLimit"));
                                        List <MoveJob> allMoveJobs = SystemMailboxJobs.GetAllMoveJobs(restriction, null, contentsTable, mdbGuid, null);
                                        if (allMoveJobs != null)
                                        {
                                            foreach (MoveJob job in allMoveJobs)
                                            {
                                                collection.Add(new MRSPoisonedJobIssue(job));
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch (LocalizedException lastScanError)
                    {
                        base.LastScanError = lastScanError;
                    }
                }
            }
            return(collection);
        }
        private static Restriction BuildComparisonRestriction(ComparisonFilter filter, PropTag ptagToSearch, object propValue)
        {
            Restriction.PropertyRestriction propertyRestriction;
            switch (filter.ComparisonOperator)
            {
            case ComparisonOperator.Equal:
                propertyRestriction = (Restriction.PropertyRestriction)Restriction.EQ(ptagToSearch, propValue);
                break;

            case ComparisonOperator.NotEqual:
                propertyRestriction = (Restriction.PropertyRestriction)Restriction.NE(ptagToSearch, propValue);
                break;

            case ComparisonOperator.LessThan:
                propertyRestriction = (Restriction.PropertyRestriction)Restriction.LT(ptagToSearch, propValue);
                break;

            case ComparisonOperator.LessThanOrEqual:
                propertyRestriction = (Restriction.PropertyRestriction)Restriction.LE(ptagToSearch, propValue);
                break;

            case ComparisonOperator.GreaterThan:
                propertyRestriction = (Restriction.PropertyRestriction)Restriction.GT(ptagToSearch, propValue);
                break;

            case ComparisonOperator.GreaterThanOrEqual:
                propertyRestriction = (Restriction.PropertyRestriction)Restriction.GE(ptagToSearch, propValue);
                break;

            default:
                throw ContentFilterBuilder.UnexpectedFilterType(filter);
            }
            if (ptagToSearch.IsMultiValued())
            {
                propertyRestriction.MultiValued = true;
            }
            return(propertyRestriction);
        }