Ejemplo n.º 1
0
        public IVmListItemsData <IVmListItem> GetMunicipalities(string searchedCode, bool onlyValid = true)//TODO ADD LANGUAGE PARAM, MUNICIPALITY NAME
        {
            IReadOnlyList <VmListItem> result = new List <VmListItem>();

            contextManager.ExecuteReader(unitOfWork =>
            {
                var searchCode      = searchedCode.ToLower();
                var municipalityRep = unitOfWork.CreateRepository <IMunicipalityRepository>();

                var qry = municipalityRep.All();
                if (onlyValid)
                {
                    qry = qry.Where(m => m.IsValid);
                }

                var resultTemp = unitOfWork.ApplyIncludes(qry, i => i.Include(j => j.MunicipalityNames));

                if (!string.IsNullOrEmpty(searchCode))
                {
                    resultTemp = resultTemp
                                 .Where(x => x.Code.ToLower().Contains(searchedCode) ||
                                        x.MunicipalityNames.Any(y => y.Name.ToLower().Contains(searchedCode)
//                                                && y.LocalizationId == languageCache.Get(LanguageCode.fi.ToString())
                                                                ))
                                 .OrderBy(x => x.Code)
                                 .Take(CoreConstants.MaximumNumberOfAllItems);

                    result = translationEntToVm.TranslateAll <Municipality, VmListItem>(resultTemp);
                }
            });

            return(new VmListItemsData <IVmListItem>(result));
        }
        public List<ImportStatutoryServiceGeneralDescription> DownloadGeneralDescriptions()
        {
            return contextManager.ExecuteWriter(unitOfWork =>
            {
                var gds = unitOfWork.CreateRepository<IStatutoryServiceGeneralDescriptionVersionedRepository>().All();
                gds = unitOfWork.ApplyIncludes(gds, i => i
                    .Include(j => j.Names)
                    .Include(x => x.ServiceClasses).ThenInclude(x => x.ServiceClass).ThenInclude(x => x.Names)
                    .Include(x => x.OntologyTerms).ThenInclude(x => x.OntologyTerm).ThenInclude(x => x.Names)
                    .Include(x => x.LifeEvents).ThenInclude(x => x.LifeEvent).ThenInclude(x => x.Names)
                    .Include(x => x.IndustrialClasses).ThenInclude(x => x.IndustrialClass).ThenInclude(x => x.Names)
                    .Include(x => x.TargetGroups).ThenInclude(x => x.TargetGroup)
                    .Include(j => j.Descriptions)
                    .Include(x => x.LanguageAvailabilities)
                    .Include(x => x.Versioning)
                    .Include(j => j.StatutoryServiceRequirements)
                    .Include(j => j.StatutoryServiceLaws).ThenInclude(j => j.Law).ThenInclude(j => j.Names)
                    .Include(j => j.StatutoryServiceLaws).ThenInclude(j => j.Law).ThenInclude(j => j.WebPages).ThenInclude(j => j.WebPage)
                    .Include(j => j.UnificRoot).ThenInclude(j => j.StatutoryServiceGeneralDescriptionServiceChannels).ThenInclude(j => j.ServiceChannel).ThenInclude(j => j.Versions).ThenInclude(j => j.ServiceChannelNames)
                    .Include(j => j.UnificRoot).ThenInclude(j => j.StatutoryServiceGeneralDescriptionServiceChannels).ThenInclude(j => j.ServiceChannel).ThenInclude(j => j.Versions).ThenInclude(j => j.LanguageAvailabilities)
                    .Include(j => j.UnificRoot).ThenInclude(j => j.StatutoryServiceGeneralDescriptionServiceChannels).ThenInclude(j => j.GeneralDescriptionServiceChannelDescriptions)
                    .Include(j => j.UnificRoot).ThenInclude(j => j.StatutoryServiceGeneralDescriptionServiceChannels).ThenInclude(j => j.GeneralDescriptionServiceChannelDigitalAuthorizations).ThenInclude(j => j.DigitalAuthorization)
                );

                return transaltionManager
                    .TranslateAll<StatutoryServiceGeneralDescriptionVersioned, ImportStatutoryServiceGeneralDescription
                    >(gds).ToList();
            });
        }
Ejemplo n.º 3
0
        public IReadOnlyList <VmListItem> GetOrganizationNamesForIds(IUnitOfWork unitOfWork, IList <Guid> organizationIds)
        {
            var organizationRepository = unitOfWork.CreateRepository <IOrganizationVersionedRepository>();
            var psPublished            = typesCache.Get <PublishingStatusType>(PublishingStatus.Published.ToString());
            var resultTemp             = organizationRepository.All().Where(x => x.PublishingStatusId == psPublished && organizationIds.Contains(x.UnificRootId));

            resultTemp = unitOfWork.ApplyIncludes(resultTemp, q => q.Include(i => i.OrganizationNames).ThenInclude(i => i.Localization).Include(i => i.OrganizationDisplayNameTypes).Include(i => i.LanguageAvailabilities));
            return(translationManagerToVm.TranslateAll <OrganizationVersioned, VmListItem>(resultTemp));
        }
Ejemplo n.º 4
0
        public IVmListItemsData <IVmCountry> GetCountries(string searchedCode)
        {
            IReadOnlyList <IVmCountry> result = new List <IVmCountry>();

            contextManager.ExecuteReader(unitOfWork =>
            {
                var searchCode = searchedCode.ToLower();
                var countryRep = unitOfWork.CreateRepository <ICountryRepository>();
                var resultTemp = unitOfWork.ApplyIncludes(countryRep.All(), i => i.Include(j => j.CountryNames));

                if (!string.IsNullOrEmpty(searchCode))
                {
                    resultTemp = resultTemp
                                 .Where(x => x.Code.ToLower().Contains(searchedCode) ||
                                        x.CountryNames.Any(y => y.Name.ToLower().Contains(searchCode)))
                                 .OrderBy(x => x.Code)
                                 .Take(CoreConstants.MaximumNumberOfAllItems);

                    result = translationEntToVm.TranslateAll <Country, VmCountry>(resultTemp);
                }
            });

            return(new VmListItemsData <IVmCountry> (result));
        }
Ejemplo n.º 5
0
        public IList <VmOpenApiCodeListItem> GetLanguageCodeList()
        {
            IReadOnlyList <VmOpenApiCodeListItem> result = new List <VmOpenApiCodeListItem>();

            contextManager.ExecuteReader(unitOfWork =>
            {
                var languageRep = unitOfWork.CreateRepository <ILanguageRepository>();
                var resultTemp  = unitOfWork.ApplyIncludes(languageRep.All(), i => i.Include(j => j.Names));

                resultTemp = resultTemp.OrderBy(x => x.Code);

                result = translationEntToVm.TranslateAll <Language, VmOpenApiCodeListItem>(resultTemp);
            });

            return(new List <VmOpenApiCodeListItem>(result));
        }
Ejemplo n.º 6
0
        public List <VmBugReport> GetAllBugReports()
        {
            var result = new List <VmBugReport>();

            contextManager.ExecuteWriter(unitOfWork =>
            {
                var bugReportRepository = unitOfWork.CreateRepository <IBugReportRepository>();
                var resultTemp          = bugReportRepository.All()
                                          .Select(x => new BugReport()
                {
                    Id          = x.Id,
                    Created     = x.Created,
                    Description = x.Description,
                    CreatedBy   = x.CreatedBy,
                    Modified    = x.Modified,
                    ModifiedBy  = x.ModifiedBy,
                    Name        = x.Name,
                    Version     = x.Version
                });
                result = translationManager.TranslateAll <BugReport, VmBugReport>(resultTemp).ToList();
            });
            return(result);
        }