public override void toControl(Hashtable values) { object o = values[name]; if (o != null) { bool found = false; List <WFSelectValue> list = vl.getValues(Binding.DBConn, filter, null); foreach (WFSelectValue sv in list) { if (sv.key.Equals(o)) { o = sv.name; found = true; break; } } if (found || showInvalid) { c.Text = HTMLUtils.toHTMLText(o.ToString()); } else { c.Text = ""; } } else { c.Text = ""; } }
public void initValues(string name, DBFilter filter, WFValueList vl, CultureInfo ci) { Hashtable map = new Hashtable(); List <WFSelectValue> list = vl.getValues(DBConn, filter, ci); foreach (WFSelectValue v in list) { map[v.key] = v.name; } values[name] = map; }
public override void toControl(Hashtable values) { object o = values[fieldName]; if (o != null) { string xmlString = o.ToString(); System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); if (!string.IsNullOrEmpty(xmlString)) { xmlDoc.LoadXml(xmlString); System.Xml.XmlNodeList xmlNodeList = xmlDoc.DocumentElement.GetElementsByTagName(xmlNodeName); if (xmlNodeList.Count > 0) { o = xmlNodeList[0].InnerXml; bool found = false; System.Collections.Generic.List <WFSelectValue> list = valueList.getValues(Binding.DBConn, filter, null); foreach (WFSelectValue sv in list) { if (sv.key.Equals(o)) { o = sv.name; found = true; break; } } if (o.ToString().Equals("0")) { label.Text = string.Empty; } else if (found || showInvalid) { label.Text = HTMLUtils.toHTMLText(o.ToString()); } else { label.Text = string.Empty; } return; } } } label.Text = string.Empty; }
public static void loadValues(DatabaseConnection DBConn, ListControl c, WFValueList vl, DBFilter filter, CultureInfo ci, string selected, string notSelected) { //if (selected != null && selected.Equals(string.Empty)) // selected = Common.EMPTY_STRING; List <WFSelectValue> list = vl.getValues(DBConn, filter, ci); c.Items.Clear(); if (notSelected != null) { ResourceManager rm = DBUtils.getResourceManager(); string s = rm.GetString(notSelected, ci); if (s == null) { s = notSelected; } c.Items.Add(new ListItem(s, string.Empty)); } foreach (WFSelectValue sv in list) { string key = sv.key; //if (key.Equals("")) // key = Common.EMPTY_STRING; ListItem i = new ListItem(sv.name, key); if (selected != null && sv.key != null && sv.key.Equals(selected)) { i.Selected = true; } c.Items.Add(i); } if (selected != null) { ListItem item = c.Items.FindByValue(selected); if (item != null) { c.SelectedValue = item.Value; } } }