Exemple #1
0
        public void Create_instanceServ(ref string ticket, ref ONOid agentOid, XmlReader xmlReader, XmlWriter xmlWriter, double dtdVersion, string clientName)
        {
            // Process the service arguments
            ONServiceInfo lSInfo = new ONServiceInfo("Clas_1348178411520734Ser_1_Alias", AeronaveClassText.Create_instanceServiceAlias, "Clas_1348178411520734_Alias", AeronaveClassText.ClassAlias);

            lSInfo.AddOIDArgument("p_agrPasajeroAeronave", false, "PasajeroAeronave", "Clas_1348178411520734Ser_1Arg_6_Alias", AeronaveClassText.Create_instance_P_agrPasajeroAeronaveArgumentAlias);
            lSInfo.AddDataValuedArgument("p_atrid_Aeronave", false, DataTypeEnumerator.Autonumeric, 0, "Clas_1348178411520734Ser_1Arg_1_Alias", AeronaveClassText.Create_instance_P_atrid_AeronaveArgumentAlias);
            lSInfo.AddDataValuedArgument("p_atrNombre", false, DataTypeEnumerator.Text, 0, "Clas_1348178411520734Ser_1Arg_2_Alias", AeronaveClassText.Create_instance_P_atrNombreArgumentAlias);
            lSInfo.AddDataValuedArgument("p_atrMaximoPasajeros", false, DataTypeEnumerator.Int, 0, "Clas_1348178411520734Ser_1Arg_3_Alias", AeronaveClassText.Create_instance_P_atrMaximoPasajerosArgumentAlias);
            lSInfo.AddDataValuedArgument("p_atrOrigen", false, DataTypeEnumerator.Text, 0, "Clas_1348178411520734Ser_1Arg_4_Alias", AeronaveClassText.Create_instance_P_atrOrigenArgumentAlias);
            lSInfo.AddDataValuedArgument("p_atrDestino", false, DataTypeEnumerator.Text, 0, "Clas_1348178411520734Ser_1Arg_5_Alias", AeronaveClassText.Create_instance_P_atrDestinoArgumentAlias);

            try
            {
                lSInfo.XML2ON(xmlReader, dtdVersion, true);
            }
            catch (Exception e)
            {
                throw new ONServiceArgumentsException(e, "Clas_1348178411520734_Alias", AeronaveClassText.ClassAlias, "Clas_1348178411520734Ser_1_Alias", AeronaveClassText.Create_instanceServiceAlias);
            }

            PasajeroAeronaveOid lP_agrPasajeroAeronaveArg = (PasajeroAeronaveOid)((ONArgumentInfo)lSInfo.mArgumentList["p_agrPasajeroAeronave"]).Value;
            ONInt  lP_atrid_AeronaveArg     = (ONInt)((ONArgumentInfo)lSInfo.mArgumentList["p_atrid_Aeronave"]).Value;
            ONText lP_atrNombreArg          = (ONText)((ONArgumentInfo)lSInfo.mArgumentList["p_atrNombre"]).Value;
            ONInt  lP_atrMaximoPasajerosArg = (ONInt)((ONArgumentInfo)lSInfo.mArgumentList["p_atrMaximoPasajeros"]).Value;
            ONText lP_atrOrigenArg          = (ONText)((ONArgumentInfo)lSInfo.mArgumentList["p_atrOrigen"]).Value;
            ONText lP_atrDestinoArg         = (ONText)((ONArgumentInfo)lSInfo.mArgumentList["p_atrDestino"]).Value;

            // Create Context
            ONServiceContext lOnContext = new ONServiceContext();

            lOnContext.OidAgent = agentOid;

            // Execute Service
            AeronaveInstance lInstance = null;

            try
            {
                ONFilterList             lFilterList = new ONFilterList();
                PasajeroAeronaveInstance lp_agrPasajeroAeronaveInstance = new PasajeroAeronaveInstance(lOnContext);
                if (lP_agrPasajeroAeronaveArg != null)
                {
                    lFilterList = new ONFilterList();
                    lFilterList.Add("HorizontalVisibility", new PasajeroAeronaveHorizontalVisibility());
                    lp_agrPasajeroAeronaveInstance = lP_agrPasajeroAeronaveArg.GetInstance(lOnContext, lFilterList);
                    if (lp_agrPasajeroAeronaveInstance == null)
                    {
                        throw new ONInstanceNotExistException(null, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.ClassAlias);
                    }
                }

                using (AeronaveServer lServer = new AeronaveServer(lOnContext, null))
                {
                    lServer.Create_instanceServ(lP_agrPasajeroAeronaveArg, lP_atrid_AeronaveArg, lP_atrNombreArg, lP_atrMaximoPasajerosArg, lP_atrOrigenArg, lP_atrDestinoArg);
                    lInstance = lServer.Instance;
                }
                ticket = lOnContext.GetTicket(dtdVersion, clientName);
            }
            catch (SecurityException)
            {
                throw new ONAccessAgentValidationException(null);
            }
            catch
            {
                throw;
            }

            // Write Oid
            if (dtdVersion >= 3.1)
            {
                if (lInstance != null)
                {
                    ON2XML(xmlWriter, lInstance.Oid, dtdVersion, ONXml.XMLTAG_OIDFIELD);
                }
            }

            // Write Outbound Arguments
            xmlWriter.WriteStartElement("Arguments");
            // Write Outbound Arguments
            xmlWriter.WriteEndElement();             // Arguments
        }
Exemple #2
0
        public void Edit_instanceServ(ref string ticket, ref ONOid agentOid, XmlReader xmlReader, XmlWriter xmlWriter, double dtdVersion, string clientName)
        {
            // Process the service arguments
            ONServiceInfo lSInfo = new ONServiceInfo("Clas_1348178411520734Ser_3_Alias", AeronaveClassText.Edit_instanceServiceAlias, "Clas_1348178411520734_Alias", AeronaveClassText.ClassAlias);

            lSInfo.AddOIDArgument("p_thisAeronave", false, "Aeronave", "Clas_1348178411520734Ser_3Arg_1_Alias", AeronaveClassText.Edit_instance_P_thisAeronaveArgumentAlias);

            try
            {
                lSInfo.XML2ON(xmlReader, dtdVersion, true);
            }
            catch (Exception e)
            {
                throw new ONServiceArgumentsException(e, "Clas_1348178411520734_Alias", AeronaveClassText.ClassAlias, "Clas_1348178411520734Ser_3_Alias", AeronaveClassText.Edit_instanceServiceAlias);
            }

            AeronaveOid lP_thisAeronaveArg = (AeronaveOid)((ONArgumentInfo)lSInfo.mArgumentList["p_thisAeronave"]).Value;

            // Create Context
            ONServiceContext lOnContext = new ONServiceContext();

            lOnContext.OidAgent = agentOid;

            // Execute Service
            AeronaveInstance lInstance = null;

            try
            {
                ONFilterList     lFilterList   = new ONFilterList();
                AeronaveInstance lThisInstance = new AeronaveInstance(lOnContext);
                if (lP_thisAeronaveArg != null)
                {
                    lFilterList = new ONFilterList();
                    lFilterList.Add("HorizontalVisibility", new AeronaveHorizontalVisibility());
                    lThisInstance = lP_thisAeronaveArg.GetInstance(lOnContext, lFilterList);
                    if (lThisInstance == null)
                    {
                        throw new ONInstanceNotExistException(null, "Clas_1348178411520734_Alias", AeronaveClassText.ClassAlias);
                    }
                }

                using (AeronaveServer lServer = new AeronaveServer(lOnContext, lThisInstance))
                {
                    lServer.Edit_instanceServ(lP_thisAeronaveArg);
                    lInstance = lServer.Instance;
                }
                ticket = lOnContext.GetTicket(dtdVersion, clientName);
            }
            catch (SecurityException)
            {
                throw new ONAccessAgentValidationException(null);
            }
            catch
            {
                throw;
            }

            // Write Oid
            if (dtdVersion >= 3.1)
            {
                if (lInstance != null)
                {
                    ON2XML(xmlWriter, lInstance.Oid, dtdVersion, ONXml.XMLTAG_OIDFIELD);
                }
            }

            // Write Outbound Arguments
            xmlWriter.WriteStartElement("Arguments");
            // Write Outbound Arguments
            xmlWriter.WriteEndElement();             // Arguments
        }