コード例 #1
0
        public List <License> GetAllEIALicensesThatRequireASnapshot()
        {
            var snapshottedLicenseIds    = _licenseRepository.GetAllEIALicenseIdsThatHAVESnapshot();
            var licenseIds               = _licenseRepository.GetAllEIALicenseIds();
            var errorCount               = _licenseRepository.GetLicenseErrorCount();
            var licenseThatNeedASnapshot = licenseIds.Except(snapshottedLicenseIds).ToList();

            if (errorCount > 0)
            {
                var licensesWithErrors = _licenseRepository.GetAllLicenseIdsWithErrors();

                licenseThatNeedASnapshot = licenseThatNeedASnapshot.Except(licensesWithErrors).ToList();
            }
            else
            {
                licenseThatNeedASnapshot = licenseIds.Except(snapshottedLicenseIds).ToList();
            }

            var licensesThatNeedSnapshot =
                _licenseRepository.GetAllLicensesForListOfLicenseIds(licenseThatNeedASnapshot)
                //.OrderByDescending(_ => _.CreatedDate)
                .Take(100).ToList();

            foreach (var license in licensesThatNeedSnapshot)
            {
                if (snapshottedLicenseIds.Contains(license.LicenseId))
                {
                    licensesThatNeedSnapshot.Remove(license);
                }
            }
            return(licensesThatNeedSnapshot);
        }