private string ReplacePlaceholder(string source, DashboardRenderContext context) { while (source.Contains("###CATEGORYNAME_")) { string variableName = source.Split(new string[] { "###CATEGORYNAME_" }, StringSplitOptions.None)[1].Split('#')[0]; if (context.Categories.ContainsKey(variableName)) { source = source.Replace(string.Format( "###CATEGORYNAME_{0}###", variableName ), (string)this.Dashboard.Cache.CategoryLabels[context.Categories[variableName]][0][1]); } else { source = source.Replace(string.Format( "###CATEGORYNAME_{0}###", variableName ), "undefined"); } } return(source); }
public override void RenderDataUpdate( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight, string path ) { if (this.XmlNode.NodeType == XmlNodeType.Text) { base.RenderDataUpdate(result, context, filter, weight, path); return; } path += this.XmlNode.Name + string.Format( ":nth-child({0}) ", this.XmlNode.ParentNode.ChildNodes.IndexOf(this.XmlNode) ); foreach (DashboardNode node in this.Children) { node.RenderDataUpdate( result, context, filter, weight, path ); } }
public override void Render( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight ) { DateTime value; if (this.XmlNode.Attributes["Value"].Value == "Now") { value = DateTime.Now; } else { value = DateTime.Parse(this.XmlNode.Attributes["Value"].Value); } if (this.XmlNode.Attributes["Format"] != null) { result.Append(value.ToString(this.XmlNode.Attributes["Format"].Value)); } else { result.Append(value.ToString()); } }
public override void Render( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight ) { if (this.XmlNode.NodeType == XmlNodeType.Comment) { //result.Append(this.XmlNode.OuterXml); return; } if (this.XmlNode.NodeType == XmlNodeType.Text) { string text = ReplacePlaceholder(this.XmlNode.InnerText, context); result.Append(text); return; } // Render the opening tag of the html node. result.Append("<"); result.Append(this.XmlNode.Name); // Run through all attributes of the html node. foreach (XmlAttribute xmlAttribute in this.XmlNode.Attributes) { // Render the html attribute. result.Append(string.Format( " {0}=\"{1}\"", xmlAttribute.Name, ReplacePlaceholder(xmlAttribute.Value, context) )); } result.Append(">"); // Run through all child dashboard nodes. foreach (DashboardNode children in base.Children) { children.Render(result, context, filter, weight); } // Render the closing tag of the html node. result.Append(string.Format( "</{0}>", this.XmlNode.Name )); }
public override void RenderDataUpdate( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight, string path ) { result.Append("{ \"Path\": \""); //result.Append(path); result.Append(this.Dashboard.IdCounter++); result.Append("\", \"Value\": \""); result.Append(this.GetValue(filter, weight)); result.Append("\" },"); }
public override void Render( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight ) { string label = ""; if (context.Categories.ContainsKey(this.Variable)) { label = (string)this.Dashboard.Cache.CategoryLabels[context.Categories[this.Variable]][0][1]; } if (this.Repeat == false && context.LastRenderedLabel.ContainsKey(this.Identity)) { if (context.LastRenderedLabel[this.Identity] == label) { return; } } if (!context.LastRenderedLabel.ContainsKey(this.Identity)) { context.LastRenderedLabel.Add(this.Identity, ""); } context.LastRenderedLabel[this.Identity] = label; if (this.RenderContainer) { result.Append(string.Format( "<span id=\"r_{0}\">", this.Dashboard.IdCounter++ )); } result.Append(label); if (this.RenderContainer) { result.Append("</span>"); } }
public virtual void RenderDataUpdate( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight, string path ) { foreach (DashboardNode node in this.Children) { node.RenderDataUpdate( result, context, filter, weight, path ); } }
public override void Render( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight ) { Data data = filter; DataCore.Classes.StorageMethods.Database storageMethod = new DataCore.Classes.StorageMethods.Database( this.Dashboard.Core, null, this.Dashboard.Settings.ReportSettings.WeightMissingValue ); double highestValue = double.MinValue; Guid idCategory = new Guid(); foreach (string category in this.Dashboard.Cache.Categories[this.IdVariable.Value].Keys) { Data value = storageMethod.GetRespondents( (Guid)this.Dashboard.Cache.Categories[this.IdVariable.Value][category][0][2], this.IdVariable.Value, true, this.Dashboard.Core.CaseDataLocation, data, weight ); if (value.Value > highestValue) { highestValue = value.Value; idCategory = (Guid)this.Dashboard.Cache. Categories[this.IdVariable.Value][category][0][2]; } } if (this.Dashboard.Cache.CategoryLabels.ContainsKey(idCategory)) { result.Append((string)this.Dashboard.Cache.CategoryLabels[idCategory][0][1]); } }
public override void Render( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight ) { StringBuilder value = new StringBuilder(); // Run through all child dashboard nodes. foreach (DashboardNode children in base.Children) { children.Render( value, context, filter, weight ); } this.Dashboard.Properties[this.Type] = value.ToString().Trim(); }
public override void Render( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight ) { if (this.RenderContainer) { result.Append(string.Format( "<span id=\"r_{0}\">", this.Dashboard.IdCounter++ )); } result.Append(this.GetValue(filter, weight)); if (this.RenderContainer) { result.Append("</span>"); } }
public override void RenderDataUpdate( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight, string path ) { result.Append("{ \"Path\": \""); //result.Append(path); result.Append(this.Dashboard.IdCounter++); result.Append("\", \"Value\": \""); string label = ""; if (context.Categories.ContainsKey(this.Variable)) { label = (string)this.Dashboard.Cache.CategoryLabels[context.Categories[this.Variable]][0][1]; } result.Append(label); result.Append("\" },"); }
public override void RenderDataUpdate( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight, string path ) { if (!context.Categories.ContainsKey(this.Variable)) { context.Categories.Add(this.Variable, new Guid()); } DataCore.Classes.Data data = null; DataCore.Classes.StorageMethods.Database storageMethod = new DataCore.Classes.StorageMethods.Database( this.Dashboard.Core, null, this.Dashboard.Settings.ReportSettings.WeightMissingValue ); if (this.XmlNode.Attributes["DefaultWeighting"] != null) { if (this.Dashboard.Cache.Variables.ContainsKey(this.XmlNode.Attributes["DefaultWeighting"].Value)) { XmlNode xmlNode = this.XmlNode.Clone(); xmlNode.InnerXml = ""; xmlNode.Attributes["DefaultWeighting"].Value = ((Guid)this.Dashboard.Cache.Variables [this.XmlNode.Attributes["DefaultWeighting"].Value][0][1]).ToString(); weight = new WeightingFilterCollection( null, this.Dashboard.Core, xmlNode ); weight.LoadRespondents(filter); } } foreach (Guid idCategory in this.Categories.Keys) { data = storageMethod.GetRespondents( idCategory, this.IdVariable, true, this.Dashboard.Core.CaseDataLocation, filter, weight ); context.Categories[this.Variable] = idCategory; foreach (DashboardNode node in this.Children) { node.RenderDataUpdate( result, context, data, weight, path ); } } }
public override void Render( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight ) { if (!context.Categories.ContainsKey(this.Variable)) { context.Categories.Add(this.Variable, new Guid()); } DataCore.Classes.Data data = null; DataCore.Classes.Data datafilter = null; DataCore.Classes.StorageMethods.Database storageMethod = new DataCore.Classes.StorageMethods.Database( this.Dashboard.Core, null, this.Dashboard.Settings.ReportSettings.WeightMissingValue ); if (this.XmlNode.Attributes["DefaultWeighting"] != null) { if (this.Dashboard.Cache.Variables.ContainsKey(this.XmlNode.Attributes["DefaultWeighting"].Value)) { XmlNode xmlNode = this.XmlNode.Clone(); xmlNode.InnerXml = ""; xmlNode.Attributes["DefaultWeighting"].Value = ((Guid)this.Dashboard.Cache.Variables [this.XmlNode.Attributes["DefaultWeighting"].Value][0][1]).ToString(); weight = new WeightingFilterCollection( null, this.Dashboard.Core, xmlNode ); weight.LoadRespondents(filter); } } int count = 0; foreach (Guid idCategory in this.Categories.Keys) { //if (this.Aggregate) { data = storageMethod.GetRespondents( idCategory, this.IdVariable, true, this.Dashboard.Core.CaseDataLocation, filter, weight ); } if (this.HideEmpty) { /*bool exists = true; * Data hasValueFilter = null; * DashboardCacheHasValue hasValue = null; * * if (!this.Dashboard.Cache.HasValue.ContainsKey(idCategory)) * { * this.Dashboard.Cache.HasValue.Add(idCategory, new DashboardCacheHasValue()); * * if(this.Aggregate) * this.Dashboard.Cache.HasValue[idCategory].Filter = data; * else * { * this.Dashboard.Cache.HasValue[idCategory].Filter = storageMethod.GetRespondents( * idCategory, * this.IdVariable, * true, * this.Dashboard.Core.CaseDataLocation, * filter, * weight * ); * } * hasValueFilter = filter; * exists = false; * } * * hasValue = this.Dashboard.Cache.HasValue[idCategory]; * * foreach (string variable in context.Categories.Keys) * { * if (variable == this.Variable) * continue; * * if (!hasValue.Values.ContainsKey(context.Categories[variable])) * { * hasValue.Values.Add(context.Categories[variable], new DashboardCore.DashboardCacheHasValue()); * * exists = false; * break; * } * else * { * hasValueFilter = hasValue.Filter; * } * * hasValue = hasValue.Values[context.Categories[variable]]; * hasValue.Filter = hasValueFilter; * } * * if (!exists) * { * if (!this.Aggregate) * { * data = storageMethod.GetRespondents( * idCategory, * this.IdVariable, * true, * this.Dashboard.Core.CaseDataLocation, * hasValueFilter, * weight * ); * * hasValue.Filter = data; * } * * hasValue.HasValue = data.Base != 0; * } * * //if(data.Responses.Count == 0) * if (!hasValue.HasValue) * continue;*/ /*if (data.Base == 0) * continue;*/ if (data.Base == 0) { continue; } } context.Categories[this.Variable] = idCategory; // Run through all child dashboard nodes. foreach (DashboardNode children in base.Children) { children.Render( result, context, data, weight ); } count++; if (this.Count != -1 && count == this.Count) { break; } } context.Categories.Remove(this.Variable); }
public override void Render( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight ) { result.Append("<select"); if (this.XmlNode.Attributes["class"] != null) { this.XmlNode.Attributes["class"].Value += " DimensionSelector"; } else { this.XmlNode.AddAttribute("class", "DimensionSelector"); } DataCore.Classes.Data data = null; DataCore.Classes.StorageMethods.Database storageMethod = new DataCore.Classes.StorageMethods.Database( this.Dashboard.Core, null, this.Dashboard.Settings.ReportSettings.WeightMissingValue ); if (this.XmlNode.Attributes["DefaultWeighting"] != null) { if (this.Dashboard.Cache.Variables.ContainsKey(this.XmlNode.Attributes["DefaultWeighting"].Value)) { XmlNode xmlNode = this.XmlNode.Clone(); xmlNode.InnerXml = ""; xmlNode.Attributes["DefaultWeighting"].Value = ((Guid)this.Dashboard.Cache.Variables [this.XmlNode.Attributes["DefaultWeighting"].Value][0][1]).ToString(); weight = new WeightingFilterCollection( null, this.Dashboard.Core, xmlNode ); weight.LoadRespondents(filter); } } if (this.XmlNode.Attributes["selected"] == null) { // Render the html attribute. result.Append(string.Format( " {0}=\"{1}\"", "selected", string.Join(",", this.Selected) )); } // Run through all attributes of the html node. foreach (XmlAttribute xmlAttribute in this.XmlNode.Attributes) { // Render the html attribute. result.Append(string.Format( " {0}=\"{1}\"", xmlAttribute.Name, ReplacePlaceholder(xmlAttribute.Value, context) )); } result.Append(">"); foreach (Guid idCategory in this.Categories.Keys) { if (this.HideEmpty) { data = storageMethod.GetRespondents( idCategory, this.IdVariable, true, this.Dashboard.Core.CaseDataLocation, null,//filter, weight ); //if(data.Responses.Count == 0) if (data.Base == 0) { continue; } } result.Append(string.Format( "<option value=\"{0}\">{1}</option>", this.Dashboard.Cache.Categories2[idCategory][0][1], this.Dashboard.Cache.CategoryLabels[idCategory][0][1] )); } result.Append("</select>"); }
/// <summary> /// Renders the dashboard node to the result html string. /// </summary> /// <param name="result"> /// The string builder that holds the result html string. /// </param> public abstract void Render( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight );
public override void Render( StringBuilder result, DashboardRenderContext context, Data filter, WeightingFilterCollection weight ) { DataCore.Classes.Data data = filter; DataCore.Classes.StorageMethods.Database storageMethod = new DataCore.Classes.StorageMethods.Database( this.Dashboard.Core, null, this.Dashboard.Settings.ReportSettings.WeightMissingValue ); if (this.Categories.Count == 0) { data = storageMethod.GetRespondents( this.IdVariable, true, base.Dashboard.Core.CaseDataLocation, data, weight ); } else { if (this.Operator == DashboardFilterOperator.AND) { foreach (Guid idCategory in this.Categories.Keys) { data = storageMethod.GetRespondents( idCategory, this.IdVariable, true, base.Dashboard.Core.CaseDataLocation, data, weight ); } } else { if (data == null) { data = new Data(); } foreach (Guid idCategory in this.Categories.Keys) { Data d = storageMethod.GetRespondents( idCategory, this.IdVariable, true, base.Dashboard.Core.CaseDataLocation, data, weight ); foreach (Guid idRespondent in d.Responses.Keys) { if (!data.Responses.ContainsKey(idRespondent)) { data.Responses.Add(idRespondent, d.Responses[idRespondent]); } } } } } // Run through all child dashboard nodes. foreach (DashboardNode children in base.Children) { children.Render( result, context, data, weight ); } }