示例#1
0
        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;
        }
示例#2
0
 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) {}
         }
     }
 }