/// <summary>
        /// Extracts the OID from the XML message and converts it in structures of the application
        /// </summary>
        /// <param name="xmlReader">XML with the request message</param>
        /// <param name="dtdVersion">Version of DTD that follows the XML message</param>
        public static PasajeroOid XML2ON(XmlReader xmlReader, double dtdVersion)
        {
            try
            {
                if (xmlReader.IsStartElement(ONXml.XMLTAG_NULL))
                {
                    xmlReader.Skip();
                    return(PasajeroXml.Null);
                }

                if (!xmlReader.IsStartElement(ONXml.XMLTAG_OID))
                {
                    throw new ONXMLStructureException(null, ONXml.XMLTAG_OID);
                }
            }
            catch (Exception e)
            {
                throw new ONXMLStructureException(e, ONXml.XMLTAG_OID);
            }

            string lClass = xmlReader.GetAttribute("Class");

            if (string.Compare(lClass, "Pasajero", true) != 0)
            {
                throw new ONXMLOIDWrongClassException(null, "Clas_1348178542592658_Alias", "Pasajero", lClass);
            }

            PasajeroOid lOid = new PasajeroOid();

            xmlReader.ReadStartElement(ONXml.XMLTAG_OID);

            try
            {
                lOid.Id_PasajeroAttr = ONXmlAutonumeric.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_OIDFIELD);
            }
            catch (Exception e)
            {
                throw new ONXMLOIDFieldException(e, "Clas_1348178542592658_Alias", "Pasajero", "Clas_1348178542592658Atr_1_Alias", "id_Pasajero");
            }

            try
            {
                xmlReader.ReadEndElement();
            }
            catch
            {
                throw new ONXMLStructureException(null, ONXml.XMLTAG_OID);
            }

            return(lOid);
        }
        /// <summary>
        /// Extracts the OID from the XML message and converts it in structures of the application
        /// </summary>
        /// <param name="xmlReader">XML with the request message</param>
        /// <param name="dtdVersion">Version of DTD that follows the XML message</param>
        public static NaveNodrizaOid XML2ON(XmlReader xmlReader, double dtdVersion)
        {
            try
            {
                if (xmlReader.IsStartElement(ONXml.XMLTAG_NULL))
                {
                    xmlReader.Skip();
                    return(NaveNodrizaXml.Null);
                }

                if (!xmlReader.IsStartElement(ONXml.XMLTAG_OID))
                {
                    throw new ONXMLStructureException(null, ONXml.XMLTAG_OID);
                }
            }
            catch (Exception e)
            {
                throw new ONXMLStructureException(e, ONXml.XMLTAG_OID);
            }

            string lClass = xmlReader.GetAttribute("Class");

            if (string.Compare(lClass, "NaveNodriza", true) != 0)
            {
                throw new ONXMLOIDWrongClassException(null, "Clas_1347649273856884_Alias", "NaveNodriza", lClass);
            }

            NaveNodrizaOid lOid = new NaveNodrizaOid();

            xmlReader.ReadStartElement(ONXml.XMLTAG_OID);

            try
            {
                lOid.Id_NaveNodrizaAttr = ONXmlAutonumeric.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_OIDFIELD);
            }
            catch (Exception e)
            {
                throw new ONXMLOIDFieldException(e, "Clas_1347649273856884_Alias", "NaveNodriza", "Clas_1347649273856884Atr_1_Alias", "id_NaveNodriza");
            }

            try
            {
                xmlReader.ReadEndElement();
            }
            catch
            {
                throw new ONXMLStructureException(null, ONXml.XMLTAG_OID);
            }

            return(lOid);
        }
Exemple #3
0
        private void ReadChangeDetectionItem(XmlReader xmlReader, double dtdVersion, string Name)
        {
            // Read the change detection items
            ONChangeDetectionInfo lCD;

            try
            {
                lCD = (ONChangeDetectionInfo)mChangesDetectionList[Name.ToLower()];
                if (lCD == null)
                {
                    xmlReader.Skip();
                    return;
                }
            }
            catch
            {
                return;
            }

            switch (lCD.Type)
            {
            case DataTypeEnumerator.Autonumeric:
            {
                lCD.OldValue = ONXmlAutonumeric.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Bool:
            {
                lCD.OldValue = ONXmlBool.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Blob:
            {
                lCD.OldValue = ONXmlBlob.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Date:
            {
                lCD.OldValue = ONXmlDate.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.DateTime:
            {
                lCD.OldValue = ONXmlDateTime.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Int:
            {
                lCD.OldValue = ONXmlInt.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Nat:
            {
                lCD.OldValue = ONXmlNat.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Password:
            {
                lCD.OldValue = ONXmlPassword.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Real:
            {
                lCD.OldValue = ONXmlReal.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.String:
            {
                lCD.OldValue = ONXmlString.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Text:
            {
                lCD.OldValue = ONXmlText.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Time:
            {
                lCD.OldValue = ONXmlTime.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.OID:
            {
                object[] lArgs = new object[2];
                lArgs[0]     = xmlReader;
                lArgs[1]     = dtdVersion;
                lCD.OldValue = ONContext.InvoqueMethod(ONContext.GetType_XML(lCD.ClassName), "XML2ON", lArgs) as IONType;
                break;
            }
            }
        }
Exemple #4
0
        private void ReadArgument(XmlReader xmlReader, double dtdVersion, string Name)
        {
            // Read the arguments and process
            ONArgumentInfo lArg;

            try
            {
                lArg = (ONArgumentInfo)mArgumentList[Name.ToLower()];
            }
            catch
            {
                return;
            }

            switch (lArg.Type)
            {
            case DataTypeEnumerator.Autonumeric:
            {
                lArg.Value = ONXmlAutonumeric.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Bool:
            {
                lArg.Value = ONXmlBool.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Blob:
            {
                lArg.Value = ONXmlBlob.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Date:
            {
                lArg.Value = ONXmlDate.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.DateTime:
            {
                lArg.Value = ONXmlDateTime.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Int:
            {
                lArg.Value = ONXmlInt.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Nat:
            {
                lArg.Value = ONXmlNat.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Password:
            {
                lArg.Value = ONXmlPassword.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Real:
            {
                lArg.Value = ONXmlReal.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.String:
            {
                lArg.Value = ONXmlString.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Text:
            {
                lArg.Value = ONXmlText.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.Time:
            {
                lArg.Value = ONXmlTime.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_LITERAL);
                break;
            }

            case DataTypeEnumerator.OID:
            {
                object[] lArgs = new object[2];
                lArgs[0]   = xmlReader;
                lArgs[1]   = dtdVersion;
                lArg.Value = ONContext.InvoqueMethod(ONContext.GetType_XML(lArg.ClassName), "XML2ON", lArgs) as IONType;
                break;
            }
            }
        }