protected void PopulateTableAttributes() { dirtyTableAttributes.Clear(); // special cases if (tableId.HasValue && !Page.IsPostBack) { MetadataTable biz = new MetadataTable(); biz.Get(tableId.Value); string tableName = biz[MetadataTable.TableName_Field].ToString(); // display with children //var childTableNames = BOL.BusinessObject.GetChildTableNames(tableName); var childTableNames = _dataEntryController.GetDataEntryForms(); // only show picker if there are child tables if (childTableNames.Count() > 0) { DisplayWithChild.DataSource = childTableNames; DisplayWithChild.DataBind(); } else { DisplayWithChild.Visible = false; DisplayWithChild_Label.Visible = false; } // plugins Caisis.Controller.PluginsController pc = new Caisis.Controller.PluginsController(); var pluginNames = pc.GetPluginNames(); Plugins.DataSource = pluginNames; Plugins.DataBind(); } // special case: relevant tables if (tableId.HasValue && !Page.IsPostBack) { var allTableNames = _dataEntryController.GetDataEntryForms();// BOL.BusinessObject.GetAllTableNames(); MostRelevantTables.DataSource = allTableNames; MostRelevantTables.DataBind(); } // get list of table attribute names/description var namesAndDescriptions = BOL.BusinessObject.GetAll <MetadataTableAttribute>().ToDictionary(a => a[MetadataTableAttribute.TableAttributeName].ToString(), a => a[MetadataTableAttribute.TableAttributeDescription].ToString(), StringComparer.OrdinalIgnoreCase); // get all table metadata MetadataDa da = new MetadataDa(); var tableSpecificMetadata = da.GetAllTableMetadata(tableId, QueryDiseaseId).AsEnumerable(); var tableDataSource = from record in tableSpecificMetadata let dAttributeName = record[MetadataTableAttribute.TableAttributeName].ToString() let dAttributeValue = record[MetadataTableAttributeValue.TableAttributeValue].ToString() let dTableAttributeValueId = record[MetadataTableAttributeValue.TableAttributeValueId].ToString() let dAttributeValueId = record[DiseaseAttributeValue.DiseaseAttributeValueId].ToString() orderby(!record.IsNull(DiseaseAttributeValue.DiseaseAttributeValueId) ? 0 : 1) ascending let a = new { TableAttributeName = dAttributeName, TableAttributeValue = dAttributeValue, TableAttributeValueId = dTableAttributeValueId, DiseaseAttributeValueId = dAttributeValueId } group a by a.TableAttributeName into g select g.First(); var inputs = CICHelper.GetCaisisInputControls(TablePanel); // get a list of attributes var attributeFields = GetAttributeToHiddenFields(TableAttributesPanel); // populate attributes (i.e., "PageTitle", "MenuTile",...) PopulateAttributes(new MetadataTableAttribute().TableName, MetadataTableAttribute.TableAttributeName, attributeFields); // populate table attribute values foreach (var entry in attributeFields) { string attributeName = entry.Key; // i.e., "PageTitle" var attributeIdField = entry.Value; // i.e., "Encounter" > "PageTitle" var tableAttributeValueId = GetTableAttributeValueIdControl(TablePanel, attributeName); // i.e. "Prostate Encounter Form" var attributeValue = GetTableAttributeValueControl(TablePanel, attributeName); // i.e., "Prostate" > "Encounter" > "PageTitle" = "Prostate Encounter Form" var diseaseAttributeValueId = GetDiseaseAttributeValueId(TablePanel, attributeName); // locate table attribute values var found = tableDataSource.Where(a => a.TableAttributeName.Equals(attributeName, StringComparison.CurrentCultureIgnoreCase)); if (found.Count() > 0) { var dataSource = found.First(); // set field value SetInputControlValue(tableAttributeValueId, dataSource.TableAttributeValueId.ToString(), null); SetInputControlValue(attributeValue, dataSource.TableAttributeValue, null); SetInputControlValue(diseaseAttributeValueId, dataSource.DiseaseAttributeValueId.ToString(), null); } // set friendly tooltip for attribute if (namesAndDescriptions.ContainsKey(attributeName)) { string attributeDescription = namesAndDescriptions[attributeName]; var attributeLabel = TablePanel.FindControl(attributeName + "_Label") as Label; if (attributeLabel != null) { // set friendly tooltip attributeLabel.Attributes["onmouseover"] = "showToolTipMessage('" + PageUtil.EscapeSingleQuotes(attributeDescription) + "');"; attributeLabel.Attributes["onmouseout"] = "hideToolTip();"; attributeLabel.ToolTip = attributeDescription; } } } // SPECIAL CASE: handle columns and grid if (GridView.Checked) { NumDisplayColumns.SelectedIndex = 2; } }