private void loadAttributeSwitchOptionsForJS() { //should use stringbuilder instead for optimization MetadataNewDa MNDa = new MetadataNewDa(); dtAttributes = MNDa.GetAttributes(); string strOut = ""; for (int i = 0; i < dtAttributes.Rows.Count; i++) { DataTable attributeValueOptionsDT = MNDa.GetAttributeValueOptionsForAnAttribute(int.Parse(dtAttributes.Rows[i]["AttributeId"].ToString())); if (attributeValueOptionsDT.Rows.Count > 0) { string conc = ""; strOut = strOut + "case '" + dtAttributes.Rows[i]["AttributeId"].ToString() + "': valueOptions = new Array("; for (int j = 0; j < attributeValueOptionsDT.Rows.Count; j++) { strOut = strOut + conc + "'" + attributeValueOptionsDT.Rows[j]["AttributeOptionValue"].ToString() + "'"; conc = ","; } strOut = strOut + ");break;"; } } attTxtAttributeValueOptionsSwitch.Text = attTxtAttributeValueOptionsSwitch.Text + strOut; }
private void loadTableDefs() { MetadataNewDa MNDa = new MetadataNewDa(); DataTable tableDefsDt = MNDa.GetMetaTables(); ddlTableDefs.Items.Clear(); ddlEtTableName.Items.Clear(); for (int i = 0; i < tableDefsDt.Rows.Count; i++) { string id = tableDefsDt.Rows[i]["TableId"].ToString(); string tableName = tableDefsDt.Rows[i]["TableName"].ToString(); string tableLabel = tableDefsDt.Rows[i]["TableLabel"].ToString(); ListItem li = new ListItem(tableName + " (" + tableLabel + ")", id); ListItem li2 = new ListItem(li.Text, li.Value); ddlTableDefs.Items.Add(li); ddlEtTableName.Items.Add(li2); } ddlTableDefs.Items.Insert(0, " "); ddlTableDefs.SelectedIndex = 0; DataTable atts = MNDa.GetAttributes(); ddlEditAnAttribute.Items.Clear(); ddlEditAnAttribute.DataSource = atts; ddlEditAnAttribute.DataTextField = "AttributeName"; ddlEditAnAttribute.DataValueField = "AttributeId"; ddlEditAnAttribute.DataBind(); }
private void loadAttributeValueOptions() { if (hstAttributeValueOptions.Count == 0) { MetadataNewDa MNDa = new MetadataNewDa(); dtAttributes = MNDa.GetAttributes(); for (int i = 0; i < dtAttributes.Rows.Count; i++) { DataTable attributeValueOptionsDT = MNDa.GetAttributeValueOptionsForAnAttribute(int.Parse(dtAttributes.Rows[i]["AttributeId"].ToString())); try { hstAttributeValueOptions.Add(dtAttributes.Rows[i]["AttributeName"], attributeValueOptionsDT); } catch (Exception e) {} } } }