/// <summary> /// Changes a checkbox for a particular set of values /// </summary> public void SetValue(string XValue, string YValue, bool Checked) { XmlNode YValueNode = LogicalSetXmlDoc.ChildNodes[0].SelectSingleNode("YValue[@y='" + CswTools.XPathSafeParameter(YValue) + "']"); if (YValueNode == null) { YValueNode = LogicalSetXmlDoc.CreateElement("YValue"); XmlAttribute YAttribute = LogicalSetXmlDoc.CreateAttribute("y"); YAttribute.Value = CswTools.XPathSafeParameter(YValue); YValueNode.Attributes.Append(YAttribute); LogicalSetXmlDoc.ChildNodes[0].AppendChild(YValueNode); } XmlNode XValueNode = YValueNode.SelectSingleNode(XValue); if (XValueNode == null) { XValueNode = LogicalSetXmlDoc.CreateElement(XValue); YValueNode.AppendChild(XValueNode); } if (Checked) { XValueNode.InnerText = "1"; } else { XValueNode.InnerText = "0"; } }
/// <summary> /// Returns whether a checkbox is checked for a particular set of values /// </summary> public bool CheckValue(string XValue, string YValue) { bool ret = false; XmlNode YValueNode = LogicalSetXmlDoc.ChildNodes[0].SelectSingleNode("YValue[@y='" + CswTools.XPathSafeParameter(YValue) + "']"); if (YValueNode != null) { XmlNode XValueNode = YValueNode.SelectSingleNode(XValue); if (XValueNode != null) { ret = (XValueNode.InnerText == "1"); } } return(ret); }