public dtoEditTile() { Translations = new List <dtoBaseObjectTranslation>(); IdTags = new List <long>(); SubItems = new List <dtoEditTileItem>(); Translation = new lm.Comol.Core.DomainModel.Languages.TitleDescriptionObjectTranslation(); }
public 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 object Clone() { TitleDescriptionObjectTranslation clone = new TitleDescriptionObjectTranslation(); clone.Title = Title; clone.ShortTitle = ShortTitle; clone.Description = Description; return(clone); }
public TitleDescriptionObjectTranslation GetTranslation(String userLanguageCode, 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.LanguageCode == userLanguageCode).Any()) ? Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.LanguageCode == userLanguageCode).Select(t => t.Translation).FirstOrDefault() : Translations.Where(t => t.Deleted == BaseStatusDeleted.None && t.IdLanguage == idDefaultLanguage).Select(t => t.Translation).FirstOrDefault(); if (translation == null) { translation = DefaultTranslation; } return(translation); }
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] = ""; } } }
public TitleDescriptionTranslation() { DefaultTranslation = new TitleDescriptionObjectTranslation(); Translations = new List <ItemBaseTranslation>(); }
public ItemBaseTranslation() { Translation = new TitleDescriptionObjectTranslation(); }
public virtual Boolean IsEqual(TitleDescriptionObjectTranslation item) { return(Title.Equals(item.Title) && Description.Equals(item.Description) && ShortTitle.Equals(item.ShortTitle)); }