public static string FormatDocumentLinks (IEnumerable<IDocument> documents, ViewModelContext context, string itemTemplate, string listTemplateOne, string listTemplateMany, string microdata, DocumentGroupPlacement groupPlacement, GetDocumentTitle getDocumentTitle = null) { var markupBuilder = new StringBuilder (); var count = 0; foreach (var document in documents) { var linkMarkup = document.FormatDocumentLink_WithMicrodata ( (getDocumentTitle == null)? document.Title : getDocumentTitle (document), Localization.GetString ("LinkOpen.Text", context.LocalResourceFile), true, groupPlacement, context.Module.TabId, context.Module.ModuleId, microdata, HttpContext.Current.Timestamp ); if (!string.IsNullOrEmpty (linkMarkup)) { markupBuilder.Append (string.Format (itemTemplate, linkMarkup)); count++; } } var markup = markupBuilder.ToString (); if (!string.IsNullOrEmpty (markup)) { return string.Format ((count == 1)? listTemplateOne : listTemplateMany, markup); } return string.Empty; }
public static string FormatDocumentLinks(IEnumerable <IDocument> documents, ViewModelContext context, string itemTemplate, string listTemplateOne, string listTemplateMany, string microdata, DocumentGroupPlacement groupPlacement, GetDocumentTitle getDocumentTitle = null) { var markupBuilder = new StringBuilder(); var count = 0; foreach (var document in documents) { var linkMarkup = document.FormatDocumentLink_WithMicrodata( (getDocumentTitle == null)? document.Title : getDocumentTitle(document), Localization.GetString("LinkOpen.Text", context.LocalResourceFile), true, groupPlacement, context.Module.TabId, context.Module.ModuleId, microdata, HttpContext.Current.Timestamp ); if (!string.IsNullOrEmpty(linkMarkup)) { markupBuilder.Append(string.Format(itemTemplate, linkMarkup)); count++; } } var markup = markupBuilder.ToString(); if (!string.IsNullOrEmpty(markup)) { return(string.Format((count == 1)? listTemplateOne : listTemplateMany, markup)); } return(string.Empty); }