コード例 #1
0
 protected ITranslationDefinitions <VmStringText, T> AddDefaultTransaltion(ITranslationDefinitions <VmStringText, T> definition)
 {
     definition
     .AddNavigation(i => i.Text, o => o.Description)
     .AddRequestLanguage(output => output);
     return(definition);
 }
コード例 #2
0
        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);
        }
コード例 #3
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);

            //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);
        }
コード例 #4
0
 public ServiceChannelTranslationDefinitionHelper AddOpeningHoursDefinition <TOut>(ITranslationDefinitions <ServiceChannelVersioned, TOut> definition) where TOut : IOpeningHours
 {
     definition.AddNavigation(input => input, output => output.OpeningHours);
     return(this);
 }