public List <LanguageValueObject> Resolve(ContactGroupPO source, ContactGroup destination, List <LanguageValueObject> destMember, ResolutionContext context)
        {
            List <LanguageValueObject> result = new List <LanguageValueObject>();

            if (source.Languages == null || source.Languages.Count == 0)
            {
                return(result);
            }

            foreach (var language in source.Languages)
            {
                LanguageValueObject nameLanguage = new LanguageValueObject()
                {
                    Field  = "Name",
                    LangId = language.MLocaleID,
                    Value  = language.MName
                };
                result.Add(nameLanguage);

                if (!string.IsNullOrWhiteSpace(language.MDesc))
                {
                    LanguageValueObject descLanguage = new LanguageValueObject()
                    {
                        Field  = "Desc",
                        LangId = language.MLocaleID,
                        Value  = language.MDesc
                    };

                    result.Add(descLanguage);
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public List <ContactGroupLanguagePO> Resolve(ContactGroup source, ContactGroupPO destination, List <ContactGroupLanguagePO> destMember, ResolutionContext context)
        {
            var result = new List <ContactGroupLanguagePO>();

            //名称以多语言为主
            if (source.Names != null && source.Names.Count > 0)
            {
                foreach (var nameLanguage in source.Names)
                {
                    ContactGroupLanguagePO contactGroupLanguage = new ContactGroupLanguagePO()
                    {
                        MLocaleID = nameLanguage.LangId,
                        MName     = nameLanguage.Value,
                        MParentID = source.Id,
                        MOrgID    = source.OrganizationId
                    };

                    result.Add(contactGroupLanguage);
                }
            }

            if (source.Descriptiones != null && source.Descriptiones.Count > 0)
            {
                foreach (var descLanguage in source.Descriptiones)
                {
                    var contactGroupLanguage = result.FirstOrDefault(x => x.MLocaleID == descLanguage.LangId);

                    contactGroupLanguage = contactGroupLanguage ?? new ContactGroupLanguagePO();

                    contactGroupLanguage.MLocaleID = descLanguage.LangId;
                    contactGroupLanguage.MParentID = source.Id;
                    contactGroupLanguage.MOrgID    = source.OrganizationId;
                    contactGroupLanguage.MDesc     = descLanguage.Value;
                }
            }

            return(result);
        }