private HistoryItem defaultActivityDTOAssembler(ActEntry actEntry) { //When the display name is not set use the GBST list to get a localized if (actEntry.Template.DisplayName == null) { var actEntryNameElement = _listCache.GetGbstListElements("Activity Name", false).FirstOrDefault(e => e.Rank == actEntry.Template.Code); string displayName; if (actEntryNameElement == null) { _logger.LogWarn("No entry was found in GBST 'Activity Name' for code {0} (by rank). Using code value as a display name so there is something to show.", actEntry.Template.Code); displayName = Convert.ToString(actEntry.Template.Code); } else { displayName = actEntryNameElement.Title; } actEntry.Template.DisplayName = StringToken.FromKeyString("HISTORY_ACTIVITY_NAME_{0}".ToFormat(actEntry.Template.Code), displayName); } return(new HistoryItem { DatabaseIdentifier = actEntry.ActEntryRecord.DatabaseIdentifier(), Id = actEntry.Id, Type = actEntry.Type, Title = actEntry.Template.DisplayName, Who = actEntry.Who, ImpersonatedBy = actEntry.ImpersonatedBy, When = actEntry.When, Detail = actEntry.AdditionalInfo }); }
public static string GetLocalizedTitleByObjid(this IListCache listCache, string listName, int objid) { var globalStringElementCollection = listCache.GetGbstListElements(listName, true); if (globalStringElementCollection != null) { var globalStringElement = globalStringElementCollection.Find(t => t.ObjectID == objid); return((globalStringElement == null) ? "" : globalStringElement.GetLocalizedTitle(CultureInfo.CurrentCulture)); } var hierarchicalStringElement = listCache.GetHgbstList(listName, true).Find(t => t.ObjectID == objid); return((hierarchicalStringElement == null) ? "" : hierarchicalStringElement.GetLocalizedTitle(CultureInfo.CurrentCulture)); }
public static string GetLocalizedTitle(this IListCache listCache, string listName, string title) { var gbstListElements = listCache.GetGbstListElements(listName, true); if (gbstListElements != null) { var globalStringElement = gbstListElements.Find(t => t.Title == title); if (globalStringElement != null) { return(globalStringElement.GetLocalizedTitle(CultureInfo.CurrentCulture)); } return(title); } var hierarchicalStringElement = listCache.GetHgbstList(listName, true).Find(t => t.Title == title); if (hierarchicalStringElement != null) { return(hierarchicalStringElement.GetLocalizedTitle(CultureInfo.CurrentCulture)); } return(title); }