/// <summary> /// /// </summary> /// <param name="model"></param> /// <param name="formatForParentControl">Use full verbose description</param> /// <param name="htmlString"></param> /// <returns></returns> public virtual string GetFullSummary(object model, bool formatForParentControl, string htmlString) { using (StringWriter htmlWriter = new StringWriter()) { if (model.GetType().IsSubclassOf(typeof(CLEMModel))) { CLEMModel cm = model as CLEMModel; htmlWriter.Write(cm.ModelSummaryOpeningTags(formatForParentControl)); htmlWriter.Write(cm.ModelSummaryInnerOpeningTagsBeforeSummary()); htmlWriter.Write(cm.ModelSummary(formatForParentControl)); htmlWriter.Write(cm.ModelSummaryInnerOpeningTags(formatForParentControl)); foreach (var item in (model as IModel).Children) { htmlWriter.Write(GetFullSummary(item, true, htmlString)); } htmlWriter.Write(cm.ModelSummaryInnerClosingTags(formatForParentControl)); htmlWriter.Write(cm.ModelSummaryClosingTags(formatForParentControl)); } return(htmlWriter.ToString()); } }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <param name="formatForParentControl">Use full verbose description</param> /// <param name="htmlString"></param> /// <returns></returns> public virtual string GetFullSummary(object model, bool formatForParentControl, string htmlString) { string html = ""; if (model.GetType().IsSubclassOf(typeof(CLEMModel))) { CLEMModel cm = model as CLEMModel; html += cm.ModelSummaryOpeningTags(formatForParentControl); html += cm.ModelSummaryInnerOpeningTagsBeforeSummary(); html += cm.ModelSummary(formatForParentControl); html += cm.ModelSummaryInnerOpeningTags(formatForParentControl); foreach (var item in (model as IModel).Children) { html += GetFullSummary(item, true, htmlString); } html += cm.ModelSummaryInnerClosingTags(formatForParentControl); html += cm.ModelSummaryClosingTags(formatForParentControl); } return(html); }
/// <inheritdoc/> public virtual string GetFullSummary(IModel model, List <string> parentControls, string htmlString, Func <string, string> markdown2Html = null) { using (StringWriter htmlWriter = new StringWriter()) { if (model.GetType().IsSubclassOf(typeof(CLEMModel))) { CLEMModel cm = model as CLEMModel; cm.CurrentAncestorList = parentControls.ToList(); cm.CurrentAncestorList.Add(model.GetType().Name); htmlWriter.Write(cm.ModelSummaryOpeningTags()); htmlWriter.Write(cm.ModelSummaryInnerOpeningTagsBeforeSummary()); htmlWriter.Write(cm.ModelSummary()); htmlWriter.Write(cm.ModelSummaryInnerOpeningTags()); bool reportMemosInPlace = false; // think through the various model types that do not support memos being writen within children // for example all the filters in a filter group and timers and cohorts // basically anyting that does special actions with all the children // if if the current model supports memos in place set reportMemosInPlace to true. if (!reportMemosInPlace) { htmlWriter.Write(AddMemosToSummary(model, markdown2Html)); } foreach (var item in (model).Children) { if (item is Memo) { if (reportMemosInPlace) { string markdownMemo = (item as Memo).Text; if (markdown2Html != null) { markdownMemo = markdown2Html(markdownMemo); } htmlWriter.Write($"<div class='memo-container'><div class='memo-head'>Memo</div><div class='memo-text'>{markdownMemo}</div></div>"); } } else { htmlWriter.Write(GetFullSummary(item, cm.CurrentAncestorList.ToList(), htmlString)); } } htmlWriter.Write(cm.ModelSummaryInnerClosingTags()); htmlWriter.Write(cm.ModelSummaryClosingTags()); } return(htmlWriter.ToString()); } }