Ejemplo n.º 1
0
 protected ITranslationDefinitions <VmStringText, T> AddDefaultTransaltion(ITranslationDefinitions <VmStringText, T> definition)
 {
     definition
     .AddNavigation(i => i.Text, o => o.Description)
     .AddRequestLanguage(output => output);
     return(definition);
 }
Ejemplo n.º 2
0
 private void SetStep3Translation(ITranslationDefinitions <VmService, ServiceVersioned> definition)
 {
     definition.AddCollectionWithRemove(i =>
     {
         var number = 1;
         i.Step3Form.ServiceProducers.ForEach(p => p.Order = number++);
         return(i.Step3Form.ServiceProducers);
     }, o => o.ServiceProducers, r => true);
 }
 private void SetStep1Translation(ITranslationDefinitions <VmPrintableFormChannelStep1, ServiceChannelVersioned> definition, VmPrintableFormChannelStep1 model)
 {
     definition
     .AddNavigationOneMany(i => i, o => o.PrintableFormChannels)
     .AddSimple(i => typesCache.Get <ServiceChannelType>(ServiceChannelTypeEnum.PrintableForm.ToString()), o => o.TypeId);
     definitionHelper.AddChannelDescriptionsDefinition(definition);
     definitionHelper.AddAttachmentsDefinition(definition, model, model.Id);
     definitionHelper.AddAllAreasDefinition(definition, model.AreaInformationTypeId, model.Id);
 }
Ejemplo n.º 4
0
        public ITranslationDefinitions <TIn, TOut> AddTranslations <TIn, TOut>(ITranslationDefinitions <TIn, TOut> definition, string defaultName = null) where TIn : INameReferences where TOut : IVmTranslatedItem
        {
            var model = definition.AddPartial <INameReferences, IVmTranslatedItem>(i => i, o => o).GetFinal();

            if (string.IsNullOrEmpty(model?.DefaultTranslation) && !string.IsNullOrEmpty(defaultName))
            {
                model.DefaultTranslation = defaultName;
            }
            return(definition);
        }
        private void SetStep1Translation(ITranslationDefinitions <VmPrintableFormChannelStep1, PrintableFormChannel> definition, VmPrintableFormChannelStep1 model)
        {
            model.UrlAttachments?.ForEach(i => i.OwnerReferenceId = model.Id);
            model.DeliveryAddress.SafeCall(i => {
                i.OwnerReferenceId = model.Id;
            });

            definition
            //.AddLocalizable(i => new VmPrintableFormChannelIdentifier() { PrintableFormChannelId  = i.PrintableFormChannelChannelId, FormIdentifier = i.FormIdentifier}, o => o.FormIdentifiers)
            //.AddLocalizable(i => new VmPrintableFormChannelReceiver() { PrintableFormChannelId = i.PrintableFormChannelChannelId, FormReceiver = i.FormReceiver }, o => o.FormReceivers)
            .AddNavigation(i => (i.DeliveryAddress?.PostalCode != null) ? i.DeliveryAddress : null, o => o.DeliveryAddress)
//                .AddLocalizable(i => new VmPrintableFormChannelIdentifier() { PrintableFormChannelId  = i.PrintableFormChannelChannelId, FormIdentifier = i.FormIdentifier}, o => o.FormIdentifiers)
//                .AddLocalizable(i => new VmPrintableFormChannelReceiver() { PrintableFormChannelId = i.PrintableFormChannelChannelId, FormReceiver = i.FormReceiver }, o => o.FormReceivers)
            .AddNavigation(i => i.DeliveryAddress, o => o.DeliveryAddress)
            .AddCollection(i => i.WebPages, o => o.ChannelUrls);
        }
Ejemplo n.º 6
0
 private void SetStep2Translation(ITranslationDefinitions <VmService, ServiceVersioned> definition, VmService model)
 {
     model.Step2Form?.ServiceClasses?.ForEach(i => i.OwnerReferenceId    = model.Id);
     model.Step2Form?.OntologyTerms?.ForEach(i => i.OwnerReferenceId     = model.Id);
     model.Step2Form?.LifeEvents?.ForEach(i => i.OwnerReferenceId        = model.Id);
     model.Step2Form?.IndustrialClasses?.ForEach(i => i.OwnerReferenceId = model.Id);
     definition
     .AddCollection(i => i.Step2Form.TargetGroups.Select(x => new VmTargetGroupListItem {
         Id = x, OwnerReferenceId = model.Id
     }).Concat(
                        i.Step2Form.OverrideTargetGroups.Select(x => new VmTargetGroupListItem {
         Id = x, Override = true, OwnerReferenceId = model.Id
     })),
                    o => o.ServiceTargetGroups)
     .AddCollection(i => i.Step2Form.ServiceClasses, o => o.ServiceServiceClasses)
     .AddCollection(i => i.Step2Form.OntologyTerms, o => o.ServiceOntologyTerms)
     .AddCollection(i => i.Step2Form.LifeEvents, o => o.ServiceLifeEvents)
     .AddCollection(i => i.Step2Form.IndustrialClasses, o => o.ServiceIndustrialClasses)
     .AddCollection(i => i.Step2Form.KeyWords.Select(x => new VmKeywordItem()
     {
         Id = x, OwnerReferenceId = model.Id
     }).Concat(i.Step2Form.NewKeyWords.Where(j => !string.IsNullOrEmpty(j.Name))), o => o.ServiceKeywords);
 }
Ejemplo n.º 7
0
        public ServiceChannelTranslationDefinitionHelper AddLanguagesDefinition <TIn>(ITranslationDefinitions <TIn, ServiceChannelVersioned> definition) where TIn : ILanguages
        {
            var languageCounter = 0;

            definition.AddCollection(
                i => i.Languages?.Select(x => new VmListItem {
                Id               = x,
                OrderNumber      = languageCounter++,
                OwnerReferenceId = i.Id
            }),
                o => o.Languages, TranslationPolicy.FetchData
                );
            return(this);
        }
Ejemplo n.º 8
0
 public ServiceChannelTranslationDefinitionHelper AddOpeningHoursDefinition <TOut>(ITranslationDefinitions <ServiceChannelVersioned, TOut> definition) where TOut : IOpeningHours
 {
     definition.AddNavigation(input => input, output => output.OpeningHours);
     return(this);
 }
Ejemplo n.º 9
0
 public ServiceChannelTranslationDefinitionHelper AddOpeningHoursDefinition <TIn>(ITranslationDefinitions <TIn, ServiceChannelVersioned> definition) where TIn : IOpeningHours
 {
     definition.AddPartial(input => input.OpeningHours);
     return(this);
 }
Ejemplo n.º 10
0
 public ServiceChannelTranslationDefinitionHelper AddChannelBaseDefinition <TOut>(ITranslationDefinitions <ServiceChannelVersioned, TOut> definition) where TOut : VmServiceChannel
 {
     definition.AddPartial <ServiceChannelVersioned, VmServiceChannel>(input => input, output => output);
     return(this);
 }
 public ITranslationDefinitions <ServiceHours, TOut> AddOpeningHoursDefinition <TOut>(ITranslationDefinitions <ServiceHours, TOut> definition) where TOut : VmHours
 {
     return(definition.AddPartial(input => input, output => output as VmHours));
 }
Ejemplo n.º 12
0
        private void SetStep1Translation(ITranslationDefinitions <VmOrganizationModel, OrganizationVersioned> definition, VmOrganizationModel organization)
        {
            //var model = organization.Step1Form;
            //var names = new List<VmName>()
            //{
            //    new VmName {Name = model.OrganizationName, TypeId = typesCache.Get<NameType>(NameTypeEnum.Name.ToString()), OwnerReferenceId = organization.Id}
            //};

            //if (!string.IsNullOrEmpty(model.OrganizationAlternateName) || (model.DisplayNameId == typesCache.Get<NameType>(NameTypeEnum.AlternateName.ToString())))
            //{
            //    names.Add(new VmName { Name = model.OrganizationAlternateName, TypeId = typesCache.Get<NameType>(NameTypeEnum.AlternateName.ToString()), OwnerReferenceId = organization.Id });
            //}

            //var descriptions = new List<VmDescription>()
            //{
            //    new VmDescription { Description = model.Description, TypeId = typesCache.Get<DescriptionType>(DescriptionTypeEnum.Description.ToString()), OwnerReferenceId = organization.Id},
            //};

            //definition.AddNavigation(i => i.Step1Form.Business, o => o.Business);

            //if (model.OrganizationTypeId.IsAssigned() && typesCache.Compare<AreaInformationType>(model.AreaInformationTypeId, AreaInformationTypeEnum.AreaType.ToString()))
            //{
            //    if (typesCache.Compare<OrganizationType>(model.OrganizationTypeId, OrganizationTypeEnum.State.ToString()) ||
            //        typesCache.Compare<OrganizationType>(model.OrganizationTypeId, OrganizationTypeEnum.Organization.ToString()) ||
            //        typesCache.Compare<OrganizationType>(model.OrganizationTypeId, OrganizationTypeEnum.Company.ToString()) ||
            //        typesCache.Compare<OrganizationType>(model.OrganizationTypeId, OrganizationTypeEnum.RegionalOrganization.ToString()))
            //    {
            //        var areas = model.BusinessRegions.Union(model.HospitalRegions).Union(model.Provinces);
            //        definition.AddCollection(i => areas.Select(x => new VmListItem { Id = x, OwnerReferenceId = organization.Id }), o => o.OrganizationAreas);
            //        definition.AddCollection(i => i.Step1Form.Municipalities.Select(x => new VmListItem { Id = x, OwnerReferenceId = organization.Id }), o => o.OrganizationAreaMunicipalities);
            //    }
            //}
            //else
            //{   //Remove Areas
            //    definition.AddCollection(i => new List<VmListItem>() {}, o => o.OrganizationAreas);
            //    definition.AddCollection(i => new List<VmListItem>() {}, o => o.OrganizationAreaMunicipalities);
            //}

            //var nameType = new VmDispalyNameType { NameTypeId = model.DisplayNameId, OwnerReferenceId = organization.Id };

            //var order = 1;
            //model.Emails.ForEach(email => email.OrderNumber = order++);
            //order = 1;
            //model.PhoneNumbers.ForEach(phone => phone.OrderNumber = order++);
            //order = 1;
            //model.VisitingAddresses.ForEach(item => item.OrderNumber = order++);
            //order = 1;
            //model.PostalAddresses.ForEach(item => item.OrderNumber = order++);

            //var defaultAreaInformationTypeId = typesCache.Get<AreaInformationType>(AreaInformationTypeEnum.WholeCountry.ToString());
            //  definition
            // .AddSimple(i => i.Step1Form.OrganizationTypeId, o => o.TypeId)
            // .AddSimple(i => i.Step1Form.AreaInformationTypeId.IsAssigned() ? i.Step1Form.AreaInformationTypeId : defaultAreaInformationTypeId, output => output.AreaInformationTypeId)
            // .AddSimple(i => i.Step1Form.ParentId, o => o.ParentId)
            // .AddSimple(i => i.Step1Form.Municipality?.Id, o => o.MunicipalityId)
            //.AddSimple(i => i.Step1Form.DisplayNameId, o => o.DisplayNameTypeId)
            //.AddNavigation(i => i.Step1Form.OrganizationId, o => o.Oid)
            // .AddLocalizable(i => nameType, o => o.OrganizationDisplayNameTypes)
            //.AddCollectionWithKeep(i => names, o => o.OrganizationNames, TranslationPolicy.FetchData, x => x.LocalizationId != RequestLanguageId)
            //.AddCollectionWithKeep(i => descriptions, o => o.OrganizationDescriptions, TranslationPolicy.FetchData, x => x.LocalizationId != RequestLanguageId);

            //model.ShowContacts
            //definition
            // .AddCollection(i => i.Step1Form.Emails, o => o.OrganizationEmails)
            // .AddCollection(i => i.Step1Form.PhoneNumbers, o => o.OrganizationPhones)
            // .AddCollection(i => i.Step1Form.WebPages, o => o.OrganizationWebAddress);


            //TODO
            //model.ShowPostalAddress || model.ShowVisitingAddress)

            //var addresses = new List<VmAddressSimple>();
            //addresses = model.PostalAddresses.Any() ? addresses.Concat(model.PostalAddresses.Where(x =>
            //                                                          (x.PostalCode != null && x.StreetType != AddressTypeEnum.Foreign.ToString()) ||
            //                                                           x.StreetType == AddressTypeEnum.Foreign.ToString())).ToList() : addresses;
            //addresses = model.VisitingAddresses.Any() ? addresses.Concat(model.VisitingAddresses.Where(x =>
            //                                                          (x.PostalCode != null && x.StreetType != AddressTypeEnum.Foreign.ToString()) ||
            //                                                           x.StreetType == AddressTypeEnum.Foreign.ToString())).ToList() : addresses;
            //addresses.ForEach(x => x.OwnerReferenceId = organization.Id);
            //definition.AddCollection(i => addresses, o => o.OrganizationAddresses);
        }
 public ITranslationDefinitions <ServiceChannelVersioned, TOut> AddAttachmentsDefinition <TOut>(ITranslationDefinitions <ServiceChannelVersioned, TOut> definition, LanguageCode requestLanguageCode) where TOut : IAttachments
 {
     return(definition.AddCollection(input => languageCache.FilterCollection(input.Attachments.Select(i => i.Attachment).OrderBy(i => i.OrderNumber).ThenBy(i => i.Modified), requestLanguageCode), output => output.UrlAttachments));
 }
 public ITranslationDefinitions <ServiceChannelVersioned, TOut> AddWebPagesDefinition <TOut>(ITranslationDefinitions <ServiceChannelVersioned, TOut> definition, LanguageCode languageCode) where TOut : IWebPages
 {
     return(definition.AddCollection(i => i.WebPages.OrderBy(x => x.WebPage.OrderNumber).ThenBy(x => x.WebPage.Created).Where(x => languageCache.Get(languageCode.ToString()) == x.WebPage.LocalizationId), o => o.WebPages));
 }
Ejemplo n.º 15
0
 protected virtual void TranslateDescription(ITranslationDefinitions <VmServiceViewsJsonItem, TFintoItem> definition, Guid?id)
 {
 }
 public ITranslationDefinitions <TIn, ServiceChannelVersioned> AddEmailsDefinition <TIn>(ITranslationDefinitions <TIn, ServiceChannelVersioned> definition) where TIn : IEmails
 {
     return(definition.AddCollection(input =>
     {
         var number = 1;
         input.Emails.ForEach(email => email.OrderNumber = number++);
         return input.Emails;
     }, output => output.Emails));
 }
 public ITranslationDefinitions <TIn, ServiceChannelVersioned> AddPhonesDefinition <TIn>(ITranslationDefinitions <TIn, ServiceChannelVersioned> definition) where TIn : IPhoneNumbers
 {
     return(definition.AddCollection(input =>
     {
         var number = 1;
         input.PhoneNumbers.ForEach(phoneNumber => phoneNumber.OrderNumber = number++);
         return input.PhoneNumbers;
     }, output => output.Phones));
 }
 public ITranslationDefinitions <ServiceChannelVersioned, TOut> AddChannelDescriptionsDefinition <TOut>(ITranslationDefinitions <ServiceChannelVersioned, TOut> definition) where TOut : IVmChannelDescription
 {
     return(definition.AddPartial(input => input, output => output as IVmChannelDescription));
 }
 public ITranslationDefinitions <TIn, ServiceChannelVersioned> AddChannelDescriptionsDefinition <TIn>(ITranslationDefinitions <TIn, ServiceChannelVersioned> definition) where TIn : IVmChannelDescription
 {
     return(definition.AddPartial <IVmChannelDescription>(input => input));
 }
 public ITranslationDefinitions <TIn, ServiceChannelVersioned> AddWebPagesDefinition <TIn>(ITranslationDefinitions <TIn, ServiceChannelVersioned> definition, IWebPages model, Guid?referenceId) where TIn : IWebPages
 {
     model.WebPages?.ForEach(i => i.OwnerReferenceId = referenceId);
     return(definition.AddCollection(i => i.WebPages.Where(j => !string.IsNullOrEmpty(j.UrlAddress)), o => o.WebPages, true));
 }
Ejemplo n.º 21
0
        private void SetStep1Translation(ITranslationDefinitions <VmService, ServiceVersioned> definition, VmService service)
        {
            var model = service.Step1Form;
            var order = 1;

            model.Laws?.ForEach(i =>
            {
                i.OrderNumber      = order++;
                i.OwnerReferenceId = model.Id;
            });

            var serviceTypeId = model.GeneralDescription?.UnificRootId == null ? model.ServiceTypeId : model.GeneralDescription.TypeId;

            var names = new List <VmName>()
            {
                new VmName {
                    Name = model.ServiceName, TypeId = typesCache.Get <NameType>(NameTypeEnum.Name.ToString()), OwnerReferenceId = service.Id
                }
            };

            if (!string.IsNullOrEmpty(model.AlternateServiceName))
            {
                names.Add(new VmName {
                    Name = model.AlternateServiceName, TypeId = typesCache.Get <NameType>(NameTypeEnum.AlternateName.ToString()), OwnerReferenceId = service.Id
                });
            }

            var descriptions = new List <VmDescription>()
            {
                new VmDescription {
                    Description = model.ShortDescriptions, TypeId = typesCache.Get <DescriptionType>(DescriptionTypeEnum.ShortDescription.ToString()), OwnerReferenceId = service.Id
                },
                new VmDescription {
                    Description = model.Description, TypeId = typesCache.Get <DescriptionType>(DescriptionTypeEnum.Description.ToString()), OwnerReferenceId = service.Id
                },
                new VmDescription {
                    Description = model.UserInstruction, TypeId = typesCache.Get <DescriptionType>(DescriptionTypeEnum.ServiceUserInstruction.ToString()), OwnerReferenceId = service.Id
                },
                new VmDescription {
                    Description = model.AdditionalInformation, TypeId = typesCache.Get <DescriptionType>(DescriptionTypeEnum.ChargeTypeAdditionalInfo.ToString()), OwnerReferenceId = service.Id
                }
            };

            if (!typesCache.Compare <ServiceType>(serviceTypeId, ServiceTypeEnum.Service.ToString()))
            {
                descriptions.Add(new VmDescription {
                    Description = model.AdditionalInformationDeadLine, TypeId = typesCache.Get <DescriptionType>(DescriptionTypeEnum.DeadLineAdditionalInfo.ToString()), OwnerReferenceId = service.Id
                });
                descriptions.Add(new VmDescription {
                    Description = model.AdditionalInformationProcessingTime, TypeId = typesCache.Get <DescriptionType>(DescriptionTypeEnum.ProcessingTimeAdditionalInfo.ToString()), OwnerReferenceId = service.Id
                });
                //    descriptions.Add(new VmDescription { Description = model.AdditionalInformationTasks, TypeId = typesCache.Get<DescriptionType>(DescriptionTypeEnum.TasksAdditionalInfo.ToString()), OwnerReferenceId = service.Id });
                descriptions.Add(new VmDescription {
                    Description = model.AdditionalInformationValidityTime, TypeId = typesCache.Get <DescriptionType>(DescriptionTypeEnum.ValidityTimeAdditionalInfo.ToString()), OwnerReferenceId = service.Id
                });
            }
            else
            {
                if (service.Id.IsAssigned())
                {
                    descriptions.Add(new VmDescription {
                        TypeId = typesCache.Get <DescriptionType>(DescriptionTypeEnum.DeadLineAdditionalInfo.ToString()), OwnerReferenceId = service.Id
                    });
                    descriptions.Add(new VmDescription {
                        TypeId = typesCache.Get <DescriptionType>(DescriptionTypeEnum.ProcessingTimeAdditionalInfo.ToString()), OwnerReferenceId = service.Id
                    });
                    //descriptions.Add(new VmDescription { TypeId = typesCache.Get<DescriptionType>(DescriptionTypeEnum.TasksAdditionalInfo.ToString()), OwnerReferenceId = service.Id });
                    descriptions.Add(new VmDescription {
                        TypeId = typesCache.Get <DescriptionType>(DescriptionTypeEnum.ValidityTimeAdditionalInfo.ToString()), OwnerReferenceId = service.Id
                    });
                }
            }

            if (typesCache.Compare <AreaInformationType>(service.Step1Form.AreaInformationTypeId, AreaInformationTypeEnum.AreaType.ToString()))
            {
                var areas = service.Step1Form.BusinessRegions.Union(service.Step1Form.HospitalRegions).Union(service.Step1Form.Provinces);
                definition.AddCollectionWithRemove(i => areas.Select(x => new VmListItem {
                    Id = x, OwnerReferenceId = service.Id
                }), o => o.Areas, r => true);
                definition.AddCollectionWithRemove(i => i.Step1Form.Municipalities.Select(x => new VmListItem {
                    Id = x, OwnerReferenceId = service.Id
                }), o => o.AreaMunicipalities, r => true);
            }
            else
            {   //Remove Areas
                definition.AddCollectionWithRemove(i => new List <VmListItem>()
                {
                }, o => o.Areas, r => true);
                definition.AddCollectionWithRemove(i => new List <VmListItem>()
                {
                }, o => o.AreaMunicipalities, r => true);
            }

            var defaultAreaInformationTypeId             = typesCache.Get <AreaInformationType>(AreaInformationTypeEnum.WholeCountry.ToString());
            var generalDescriptionUnificRootIdIsAssigned = model.GeneralDescription != null?model.GeneralDescription.UnificRootId.IsAssigned() : false;

            var languageCount = 0;

            definition
            .AddSimple(i => generalDescriptionUnificRootIdIsAssigned ? model.GeneralDescription.UnificRootId : (Guid?)null, o => o.StatutoryServiceGeneralDescriptionId)
            .AddSimple(i => generalDescriptionUnificRootIdIsAssigned ? null : i.Step1Form.ServiceTypeId, o => o.TypeId)
            .AddSimple(i => i.Step1Form.ChargeType, o => o.ChargeTypeId)
            .AddSimple(i => i.Step1Form.AreaInformationTypeId.IsAssigned() ? i.Step1Form.AreaInformationTypeId : defaultAreaInformationTypeId, output => output.AreaInformationTypeId)
            .AddCollectionWithKeep(i => names, o => o.ServiceNames, TranslationPolicy.FetchData, x => x.LocalizationId != RequestLanguageId)
            .AddCollection(i => descriptions, o => o.ServiceDescriptions)
            .AddCollection(
                i => new List <VmServiceRequirement> {
                new VmServiceRequirement {
                    Requirement = model.ServiceUsage, Id = service.Id
                }
            },
                o => o.ServiceRequirements)
            .AddCollectionWithRemove(i => i.Step1Form.Languages.Select(x => new VmListItem {
                Id = x, OrderNumber = languageCount++, OwnerReferenceId = i.Id
            }), o => o.ServiceLanguages, r => true)
            //.AddCollection(i => i.Step1Form.Laws.Where(x => !string.IsNullOrEmpty(x.UrlAddress.TryGet(RequestLanguageCode.ToString()))), output => output.ServiceLaws, false)
            .AddCollectionWithKeep(i => i.Step1Form.Laws /*.Where(x => !string.IsNullOrEmpty(x.UrlAddress.TryGet(RequestLanguageCode.ToString())))*/, output => output.ServiceLaws, c =>
            {
                c.Check(h => h.Law).Check(h => h.Names).Any();
                c.Check(h => h.Law).Check(h => h.WebPages).Any();
                c.Check(h => h.Law).Check(h => h.WebPages).Check(h => h.WebPage).Check(h => h.LocalizationId).Not(RequestLanguageId);
            })
            .AddCollectionWithRemove(i => i.Step1Form.Organizers.Select(x => new VmTreeItem {
                Id = x, OwnerReferenceId = i.Id
            }), o => o.OrganizationServices, r => true)
            .AddSimple(i => i.Step1Form.FundingTypeId, o => o.FundingTypeId)
            .AddSimple(i => i.Step1Form.OrganizationId, o => o.OrganizationId)
            .AddCollectionWithKeep(i => i.Step1Form.ServiceVouchers, o => o.ServiceWebPages, c => c.Check(h => h.WebPage).Check(h => h.LocalizationId).Not(RequestLanguageId));

            // handle selfProduced serviceProducers
            if (service.Id.IsAssigned())
            {
                var selfProducedId            = typesCache.Get <ProvisionType>(ProvisionTypeEnum.SelfProduced.ToString());
                var selfProducedOrganizations = service.Step1Form.ServiceProducers.Where(p => p.ProvisionType == selfProducedId && p.SelfProducers != null).Select(x =>
                {
                    var organizers = service.Step1Form.Organizers;
                    if (service.Step1Form.OrganizationId.IsAssigned())
                    {
                        organizers.Add(service.Step1Form.OrganizationId);
                    }

                    x.SelfProducers = x.SelfProducers.Where(org => organizers.Contains(org)).ToList();
                    return(x);
                }).ToList();
                definition.AddCollectionWithKeep(i => selfProducedOrganizations, o => o.ServiceProducers, r => r.ProvisionTypeId != selfProducedId);
            }
        }
        public ITranslationDefinitions <TIn, ServiceChannelVersioned> AddAttachmentsDefinition <TIn>(ITranslationDefinitions <TIn, ServiceChannelVersioned> definition, IAttachments model, Guid?referenceId) where TIn : IAttachments
        {
            var order = 1;

            model.UrlAttachments?.ForEach(i =>
            {
                i.OrderNumber      = order++;
                i.OwnerReferenceId = referenceId;
            });

            return(definition.AddCollection(input => input.UrlAttachments, output => output.Attachments));
        }
Ejemplo n.º 23
0
 public ServiceChannelTranslationDefinitionHelper AddLanguagesDefinition <TOut>(ITranslationDefinitions <ServiceChannelVersioned, TOut> definition) where TOut : ILanguages
 {
     definition.AddSimpleList(
         input => input.Languages
         .OrderBy(x => x.Order)
         .Select(x => x.LanguageId),
         output => output.Languages
         );
     return(this);
 }
Ejemplo n.º 24
0
//
//        public ITranslationDefinitions<TIn, ServiceChannelVersioned> AddWebPagesDefinition<TIn>(ITranslationDefinitions<TIn, ServiceChannelVersioned> definition, IWebPages model, Guid? referenceId) where TIn : IWebPages
//        {
//            model.WebPages?.ForEach(i => i.OwnerReferenceId = referenceId);
//            return definition.AddCollection(i => i.WebPages, o => o.WebPages, true);
//        }
//
//        public ITranslationDefinitions<ServiceChannelVersioned, TOut> AddWebPagesDefinition<TOut>(ITranslationDefinitions<ServiceChannelVersioned, TOut> definition, LanguageCode languageCode) where TOut : IWebPages
//        {
//            return definition.AddCollection(i => i.WebPages.Where(x => languageCache.Get(languageCode.ToString()) == x.WebPage.LocalizationId), o => o.WebPages);
//        }
//
        public ServiceChannelTranslationDefinitionHelper AddAttachmentsDefinition <TIn>(ITranslationDefinitions <TIn, ServiceChannelVersioned> definition, IAttachments model, Guid?referenceId) where TIn : IAttachments
        {
            definition
            .AddCollectionWithRemove(input => input.Attachments.SelectMany(pair =>
            {
                var localizationId = languageCache.Get(pair.Key);
                var orderNumber    = 0;
                return(pair.Value.Select(at =>
                {
                    at.OwnerReferenceId = referenceId;
                    at.LocalizationId = localizationId;
                    at.OrderNumber = orderNumber++;
                    return at;
                }));
            }), output => output.Attachments, x => true);
            return(this);
        }
Ejemplo n.º 25
0
        private void SetStep4Translation(ITranslationDefinitions <VmService, ServiceVersioned> definition)
        {
//            definition
//                .AddCollection(i => i.Step4Form.Select( x => new VmChannelListItem() { Id = x }), o => o.ServiceServiceChannels);
        }
Ejemplo n.º 26
0
 public ServiceChannelTranslationDefinitionHelper AddAttachmentsDefinition <TOut>(ITranslationDefinitions <ServiceChannelVersioned, TOut> definition, ServiceChannelVersioned entity) where TOut : IAttachments
 {
     definition.AddDictionaryList(i => i.Attachments.Select(x => x.Attachment).OrderBy(x => x.OrderNumber).ThenBy(x => x.Created), o => o.Attachments,
                                  x => languageCache.GetByValue(x.LocalizationId));
     return(this);
 }
Ejemplo n.º 27
0
 public ITranslationDefinitions <TIn, TOut> AddLanguageAvailabilitiesDefinition <TIn, TOut, TLanguagesAvailability>(ITranslationDefinitions <TIn, TOut> definition, ILanguageOrderCache orderCache) where TIn : IMultilanguagedEntity <TLanguagesAvailability> where TOut : ILanguagesAvailabilities where TLanguagesAvailability : LanguageAvailability
 {
     return(definition.AddCollection <ILanguageAvailability, VmLanguageAvailabilityInfo>(
                i => i.LanguageAvailabilities.OrderBy(x => orderCache.Get(x.LanguageId)),
                o => o.LanguagesAvailabilities));
 }
Ejemplo n.º 28
0
 public ServiceChannelTranslationDefinitionHelper AddChannelBaseDefinition <TIn>(ITranslationDefinitions <TIn, ServiceChannelVersioned> definition) where TIn : VmServiceChannel
 {
     definition.AddPartial <VmServiceChannel>(input => input);
     return(this);
 }
 protected override void TranslateDescription(ITranslationDefinitions <VmServiceViewsJsonItem, ServiceClass> definition, Guid?id)
 {
     definition.AddCollectionWithRemove(i => i.Notes?.Select(x => GetLanguageText(string.Join(" ", x.Value), x.Key, id)) ?? new List <JsonLanguageLabel>(), o => o.Descriptions, x => true);
 }
 public ITranslationDefinitions <TIn, ServiceHours> AddOpeningHoursDefinition <TIn>(ITranslationDefinitions <TIn, ServiceHours> definition) where TIn : VmHours
 {
     return(definition.AddPartial <VmHours>(input => input));
 }