public virtual TitleDescriptionObjectTranslation GetTranslation(Int32 idUserLanguage, Int32 idDefaultLanguage, Boolean firstIsMulti, Boolean useFirstOccurence) { TitleDescriptionObjectTranslation translation = null; if (Translations == null || Translations.Any()) { translation = Translations.Where(t => t.IdLanguage == idUserLanguage).FirstOrDefault().Translation; } if (translation == null && DefaultTranslation.IsValid() && firstIsMulti) { translation = DefaultTranslation; } if (translation == null && Translations.Any()) { translation = Translations.Where(t => t.IdLanguage == idDefaultLanguage).FirstOrDefault().Translation; } if (translation == null && Translations.Any() && useFirstOccurence) { translation = Translations.FirstOrDefault().Translation; } return((translation == null) ? new TitleDescriptionObjectTranslation() { Title = Id.ToString() } : translation); }
public virtual TitleDescriptionObjectTranslation GetTranslation(Int32 idUserLanguage, Int32 idDefaultLanguage) { TitleDescriptionObjectTranslation translation = (Translations == null || (Translations.Any() && !Translations.Where(t => t.Deleted == BaseStatusDeleted.None).Any())) ? DefaultTranslation : (Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idUserLanguage).Any()) ? Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idUserLanguage).Select(t => t.Translation).FirstOrDefault() : Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idDefaultLanguage).Select(t => t.Translation).FirstOrDefault(); if (translation == null || !translation.IsValid()) { translation = DefaultTranslation; } return(translation); }
public TagItem() { Type = TagType.Community; IsDefault = false; IsSystem = false; Organizations = new List <OrganizationAvailability>(); Status = lm.Comol.Core.Dashboard.Domain.AvailableStatus.Draft; CommunityAssignments = new List <CommunityTag>(); DefaultTranslation = new TitleDescriptionObjectTranslation(); Translations = new List <TagTranslation>(); CommunityTypes = new List <Int32>(); }
public dtoTileFullTranslation(lm.Comol.Core.DomainModel.Languages.dtoLanguageItem languageInfo, dtoEditTile tile) { LanguageInfo = languageInfo; lm.Comol.Core.DomainModel.Languages.TitleDescriptionObjectTranslation translation = null; if (languageInfo.IsMultiLanguage) { translation = tile.Translation; } else if (tile.Translations.Where(t => t.IdLanguage == languageInfo.IdLanguage).Any()) { translation = tile.Translations.Where(t => t.IdLanguage == languageInfo.IdLanguage).Select(i => i.Translation).FirstOrDefault(); } else { translation = new TitleDescriptionObjectTranslation(); } Title = translation.Title; ShortTitle = translation.ShortTitle; Description = translation.Description; ToolTips = (from TileItemType t in Enum.GetValues(typeof(TileItemType)).AsQueryable() select t).ToDictionary(t => t, t => ""); foreach (dtoEditTileItem item in tile.SubItems) { if (languageInfo.IsMultiLanguage) { ToolTips[item.Type] = item.ToolTip; } else if (item.Translations.Where(t => t.IdLanguage == languageInfo.IdLanguage).Any()) { ToolTips[item.Type] = item.Translations.Where(t => t.IdLanguage == languageInfo.IdLanguage).Select(i => i.ToolTip).FirstOrDefault(); } else { ToolTips[item.Type] = ""; } } }