Example #1
0
        public static bool operator==(ONInstance obj1, ONInstance obj2)
        {
            if ((((object)obj1 == null) || (obj1.Oid.Value == null)) && (((object)obj2 == null) || (obj2.Oid.Value == null)))
            {
                return(true);
            }

            if (((object)obj1 == null) || (obj1.Oid.Value == null) || ((object)obj2 == null) || (obj2.Oid.Value == null))
            {
                return(false);
            }

            ONBool lRes = (obj1.Oid == obj2.Oid);

            return(lRes.TypedValue);
        }
Example #2
0
        /// <summary>
        /// Creates XML elements from the data of the system.
        /// </summary>
        /// <param name="xmlWriter">Object with the XML message to add new information and return to client side</param>
        /// <param name="val">Value to be puted inside the XML message</param>
        /// <param name="dtdVersion">Version of the DTD that follows the XML message</param>
        /// <param name="xmlElement">Element of the XML that is checked</param>
        public static void ON2XML(XmlWriter xmlWriter, ONBool val, double dtdVersion, string xmlElement)
        {
            if (val == null)
            {
                if (xmlElement == ONXml.XMLTAG_V)
                {
                    xmlWriter.WriteElementString(xmlElement, "");
                }
                else
                {
                    xmlWriter.WriteElementString(ONXml.XMLTAG_NULL, null);
                }
            }
            else
            {
                if (dtdVersion < 2.0)                 // Apply the locale format
                {
                    if (val.TypedValue)
                    {
                        xmlWriter.WriteElementString(xmlElement, "Verdadero");
                    }
                    else
                    {
                        xmlWriter.WriteElementString(xmlElement, "Falso");
                    }
                }
                else
                {
                    xmlWriter.WriteStartElement(xmlElement);
                    if (xmlElement == ONXml.XMLTAG_OIDFIELD && dtdVersion > 2.0)
                    {
                        xmlWriter.WriteAttributeString("Type", "bool");
                    }

                    if (val.TypedValue)
                    {
                        xmlWriter.WriteString("true");
                    }
                    else
                    {
                        xmlWriter.WriteString("false");
                    }

                    xmlWriter.WriteEndElement();
                }
            }
        }