private void BindVariables(Guid idHierarchy, string variableName, string existingVariables) { // Get all taxonomy chapters of the client. List <object[]> studies = Global.Core.Studies.GetValues( new string[] { "Id", "Name" }, new string[] { }, new object[] { } ); WebUtilities.Controls.Panel pnlContainer = new WebUtilities.Controls.Panel(); List <object[]> Variables; // Run through all taxonomy chapters. foreach (object[] study in studies) { WebUtilities.Controls.Panel pnlTaxonomyChapter = new WebUtilities.Controls.Panel(); pnlTaxonomyChapter.CssClass = "TaxonomyChapterTitle"; HtmlGenericControl lblTaxonomyChapterTitle = new HtmlGenericControl("div"); lblTaxonomyChapterTitle.Attributes.Add("class", "TaxonomyChapterTitleLabel"); lblTaxonomyChapterTitle.InnerText = study[1].ToString(); lblTaxonomyChapterTitle.Attributes.Add("onclick", string.Format( "HideTaxonomyChapter(this, '{0}');", study[0] )); pnlTaxonomyChapter.Controls.Add(lblTaxonomyChapterTitle); WebUtilities.Controls.Panel pnlTaxonomyChapterVariables = new WebUtilities.Controls.Panel(); pnlTaxonomyChapterVariables.CssClass = "TaxonomyChapterVariables PnlVariableSelectors"; pnlTaxonomyChapterVariables.Attributes.Add("id", "TaxonomyChapterVariables" + study[0]); string SQLQuery = "SELECT Id FROM Variables WHERE IdStudy='" + study[0] + "' AND Name LIKE '%" + variableName.Trim() + "%' "; if (!string.IsNullOrEmpty(existingVariables)) { SQLQuery = SQLQuery + " AND Id NOT IN ('" + existingVariables + "') "; } Variables = Global.Core.TaxonomyVariables.ExecuteReader(SQLQuery); if (Variables.Count == 0) { continue; } // Run through all taxonomy variables. foreach (object[] taxonomyVariable in Variables) { VariableSelector1.Classes.VariableSelector variableSelector = new VariableSelector1.Classes.VariableSelector( 2057, "Variables", "Id=" + taxonomyVariable[0].ToString() ); //variableSelector.EnableCombine = false; variableSelector.Render(); pnlTaxonomyChapterVariables.Controls.Add(variableSelector); } pnlTaxonomyChapter.Controls.Add(pnlTaxonomyChapterVariables); pnlContainer.Controls.Add(pnlTaxonomyChapter); } // Get all taxonomy variables without a chapter. Variables = Global.Core.Variables.GetValues( new string[] { "Id" }, new string[] { "IdStudy" }, new object[] { DBNull.Value } ); // Run through all taxonomy variables. foreach (object[] taxonomyVariable in Variables) { VariableSelector1.Classes.VariableSelector variableSelector = new VariableSelector1.Classes.VariableSelector( 2057, "Variables", "Id=" + taxonomyVariable[0].ToString() ); //variableSelector.EnableCombine = false; variableSelector.Variable.Values.Add("Id", taxonomyVariable[0]); variableSelector.Render(); pnlContainer.Controls.Add(variableSelector); } Response.Write(pnlContainer.ToHtml()); }
private void BindTaxonomyVariables(Guid idHierarchy, string variableName) { // Get all taxonomy chapters of the client. List <object[]> taxonomyChapters = Global.Core.TaxonomyChapters.GetValues( new string[] { "Id" }, new string[] { }, new object[] { } ); WebUtilities.Controls.Panel pnlContainer = new WebUtilities.Controls.Panel(); List <object[]> taxonomyVariables; // Run through all taxonomy chapters. foreach (object[] taxonomyChapter in taxonomyChapters) { WebUtilities.Controls.Panel pnlTaxonomyChapter = new WebUtilities.Controls.Panel(); pnlTaxonomyChapter.CssClass = "TaxonomyChapterTitle"; HtmlGenericControl lblTaxonomyChapterTitle = new HtmlGenericControl("div"); lblTaxonomyChapterTitle.Attributes.Add("class", "TaxonomyChapterTitleLabel"); lblTaxonomyChapterTitle.InnerText = (string)Global.Core.TaxonomyChapterLabels.GetValue( "Label", new string[] { "IdTaxonomyChapter", "IdLanguage" }, new object[] { taxonomyChapter[0], 2057 } ); lblTaxonomyChapterTitle.Attributes.Add("onclick", string.Format( "HideTaxonomyChapter(this, '{0}');", taxonomyChapter[0] )); pnlTaxonomyChapter.Controls.Add(lblTaxonomyChapterTitle); WebUtilities.Controls.Panel pnlTaxonomyChapterVariables = new WebUtilities.Controls.Panel(); pnlTaxonomyChapterVariables.CssClass = "TaxonomyChapterVariables PnlVariableSelectors"; pnlTaxonomyChapterVariables.Attributes.Add("id", "TaxonomyChapterVariables" + taxonomyChapter[0]); taxonomyVariables = Global.Core.TaxonomyVariables.ExecuteReader( "SELECT Id FROM TaxonomyVariables WHERE IdTaxonomyChapter='" + taxonomyChapter[0] + "' AND Name LIKE '%" + variableName.Trim() + "%' AND Id IN " + "(SELECT IdTaxonomyVariable FROM TaxonomyVariableHierarchies WHERE IdHierarchy='" + idHierarchy + "') " ); if (taxonomyVariables.Count == 0) { continue; } // Run through all taxonomy variables. foreach (object[] taxonomyVariable in taxonomyVariables) { VariableSelector1.Classes.VariableSelector variableSelector = new VariableSelector1.Classes.VariableSelector( 2057, "TaxonomyVariables", "Id=" + taxonomyVariable[0].ToString() ); //variableSelector.EnableCombine = false; variableSelector.Render(); pnlTaxonomyChapterVariables.Controls.Add(variableSelector); } pnlTaxonomyChapter.Controls.Add(pnlTaxonomyChapterVariables); pnlContainer.Controls.Add(pnlTaxonomyChapter); } // Get all taxonomy variables without a chapter. taxonomyVariables = Global.Core.TaxonomyVariables.GetValues( new string[] { "Id" }, new string[] { "IdTaxonomyChapter" }, new object[] { DBNull.Value } ); // Run through all taxonomy variables. foreach (object[] taxonomyVariable in taxonomyVariables) { VariableSelector1.Classes.VariableSelector variableSelector = new VariableSelector1.Classes.VariableSelector( 2057, "TaxonomyVariables", "Id=" + taxonomyVariable[0].ToString() ); //variableSelector.EnableCombine = false; variableSelector.Variable.Values.Add("Id", taxonomyVariable[0]); variableSelector.Render(); pnlContainer.Controls.Add(variableSelector); } Response.Write(pnlContainer.ToHtml()); }