/// <summary> /// Provides the closing html tags for object /// </summary> /// <returns></returns> public virtual string ModelSummaryOpeningTags(bool formatForParentControl) { string overall = "activity"; string extra = ""; if (this.ModelSummaryStyle == HTMLSummaryStyle.Default) { if (this is Relationship || this.GetType().IsSubclassOf(typeof(Relationship))) { this.ModelSummaryStyle = HTMLSummaryStyle.Default; } else if (this.GetType().IsSubclassOf(typeof(ResourceBaseWithTransactions))) { this.ModelSummaryStyle = HTMLSummaryStyle.Resource; } else if (typeof(IResourceType).IsAssignableFrom(this.GetType())) { this.ModelSummaryStyle = HTMLSummaryStyle.SubResource; } else if (this.GetType().IsSubclassOf(typeof(CLEMActivityBase))) { this.ModelSummaryStyle = HTMLSummaryStyle.Activity; } } switch (ModelSummaryStyle) { case HTMLSummaryStyle.Default: overall = "default"; break; case HTMLSummaryStyle.Resource: overall = "resource"; break; case HTMLSummaryStyle.SubResource: overall = "resource"; extra = "light"; break; case HTMLSummaryStyle.SubResourceLevel2: overall = "resource"; extra = "dark"; break; case HTMLSummaryStyle.Activity: break; case HTMLSummaryStyle.SubActivity: extra = "light"; break; case HTMLSummaryStyle.Helper: break; case HTMLSummaryStyle.SubActivityLevel2: extra = "dark"; break; case HTMLSummaryStyle.FileReader: overall = "file"; break; default: break; } string html = ""; html += "\n<div class=\"holder" + ((extra == "") ? "main" : "sub") + " " + overall + "\" style=\"opacity: " + SummaryOpacity(formatForParentControl).ToString() + ";\">"; html += "\n<div class=\"clearfix " + overall + "banner" + extra + "\">" + this.ModelSummaryNameTypeHeader() + "</div>"; html += "\n<div class=\"" + overall + "content" + ((extra != "")? extra: "") + "\">"; return(html); }
/// <summary> /// Constructor /// </summary> public ZoneCLEM() { ModelSummaryStyle = HTMLSummaryStyle.Helper; }
/// <summary> /// Provides the closing html tags for object /// </summary> /// <returns></returns> public virtual string ModelSummaryOpeningTags(bool formatForParentControl) { string overall = "activity"; string extra = ""; double opacity = 1; if (this.ModelSummaryStyle == HTMLSummaryStyle.Default) { if (this.GetType().IsSubclassOf(typeof(ResourceBaseWithTransactions))) { this.ModelSummaryStyle = HTMLSummaryStyle.Resource; } else if (typeof(IResourceType).IsAssignableFrom(this.GetType())) { this.ModelSummaryStyle = HTMLSummaryStyle.SubResource; } else if (this.GetType().IsSubclassOf(typeof(CLEMActivityBase))) { this.ModelSummaryStyle = HTMLSummaryStyle.Activity; } else if (this.GetType().IsSubclassOf(typeof(CLEMModel))) { this.ModelSummaryStyle = HTMLSummaryStyle.Activity; } } switch (ModelSummaryStyle) { case HTMLSummaryStyle.Default: break; case HTMLSummaryStyle.Resource: overall = "resource"; break; case HTMLSummaryStyle.SubResource: overall = "resource"; extra = "light"; break; case HTMLSummaryStyle.SubResourceLevel2: overall = "resource"; extra = "dark"; break; case HTMLSummaryStyle.Activity: break; case HTMLSummaryStyle.SubActivity: extra = "light"; break; case HTMLSummaryStyle.Helper: break; case HTMLSummaryStyle.SubActivityLevel2: extra = "dark"; break; case HTMLSummaryStyle.FileReader: overall = "file"; break; default: break; } if (!this.Enabled) { if (this.Parent.Enabled) { opacity = 0.4; } } string html = ""; html += "\n<div class=\"holder" + ((extra == "") ? "main" : "sub") + " " + overall + "\">"; html += "\n<div class=\"clearfix " + overall + "banner" + extra + "\">" + this.ModelSummaryNameTypeHeader() + "</div>"; html += "\n<div class=\"" + overall + "content" + ((extra != "")? extra: "") + "\" style=\"opacity: " + opacity.ToString() + ";\">"; //if(this.GetType().IsSubclassOf(typeof(CLEMResourceTypeBase))) //{ // // add units when completed // string units = (this as IResourceType).Units; // if (units != "NA") // { // html += "\n<div class=\"activityentry\">This resource is measured in "; // if (units == null || units == "") // { // html += "<span class=\"errorlink\">Not specified</span>"; // } // else // { // html += "<span class=\"setvalue\">" + units + "</span>"; // } // html += "</div>"; // } //} return(html); }
/// <summary> /// Create a html snippet /// </summary> /// <param name="value">The value to report</param> /// <param name="errorString">Error text when missing</param> /// <param name="entryStyle">Style of snippet</param> /// <param name="htmlTags">Include html tags</param> /// <returns>HTML span snippet</returns> public static string DisplaySummaryValueSnippet(string value, string errorString, HTMLSummaryStyle entryStyle = HTMLSummaryStyle.Default, bool htmlTags = true) { string spanClass = "setvalue"; string errorClass = "errorlink"; switch (entryStyle) { case HTMLSummaryStyle.Default: break; case HTMLSummaryStyle.Resource: spanClass = "resourcelink"; break; case HTMLSummaryStyle.SubResource: break; case HTMLSummaryStyle.SubResourceLevel2: break; case HTMLSummaryStyle.Activity: spanClass = "activitylink"; break; case HTMLSummaryStyle.SubActivity: break; case HTMLSummaryStyle.SubActivityLevel2: break; case HTMLSummaryStyle.Helper: break; case HTMLSummaryStyle.FileReader: spanClass = "filelink"; break; case HTMLSummaryStyle.Filter: spanClass = "filterset"; errorClass = "filtererror"; break; default: break; } if (htmlTags) { if (value != null && value != "") { return($"<span class=\"{spanClass}\">{value}</span>"); } else { return($"<span class=\"{errorClass}\">{errorString}</span>"); } } else if (value != null && value != "") { return(value.ToString()); } else { return(errorString); } }