Beispiel #1
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_1348178542592347Ser_3_Alias", RevisionClassText.Edit_instanceServiceAlias, "Clas_1348178542592347_Alias", RevisionClassText.ClassAlias);

            lSInfo.AddOIDArgument("p_thisRevisarAeronave", false, "Revision", "Clas_1348178542592347Ser_3Arg_1_Alias", RevisionClassText.Edit_instance_P_thisRevisarAeronaveArgumentAlias);

            try
            {
                lSInfo.XML2ON(xmlReader, dtdVersion, true);
            }
            catch (Exception e)
            {
                throw new ONServiceArgumentsException(e, "Clas_1348178542592347_Alias", RevisionClassText.ClassAlias, "Clas_1348178542592347Ser_3_Alias", RevisionClassText.Edit_instanceServiceAlias);
            }

            RevisionOid lP_thisRevisarAeronaveArg = (RevisionOid)((ONArgumentInfo)lSInfo.mArgumentList["p_thisRevisarAeronave"]).Value;

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

            lOnContext.OidAgent = agentOid;

            // Execute Service
            RevisionInstance lInstance = null;

            try
            {
                ONFilterList     lFilterList   = new ONFilterList();
                RevisionInstance lThisInstance = new RevisionInstance(lOnContext);
                if (lP_thisRevisarAeronaveArg != null)
                {
                    lFilterList = new ONFilterList();
                    lFilterList.Add("HorizontalVisibility", new RevisionHorizontalVisibility());
                    lThisInstance = lP_thisRevisarAeronaveArg.GetInstance(lOnContext, lFilterList);
                    if (lThisInstance == null)
                    {
                        throw new ONInstanceNotExistException(null, "Clas_1348178542592347_Alias", RevisionClassText.ClassAlias);
                    }
                }

                using (RevisionServer lServer = new RevisionServer(lOnContext, lThisInstance))
                {
                    lServer.Edit_instanceServ(lP_thisRevisarAeronaveArg);
                    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
        }
        public RevisionPasajeroInstance Create_instanceServ(
            [ONInboundArgument("Clas_1348178673664478Ser_1Arg_3_Alias", RevisionPasajeroClassText.Create_instance_P_agrPasajeroAeronaveArgumentAlias, "", "Clas_1348178673664478Ser_1_Alias", RevisionPasajeroClassText.Create_instanceServiceAlias, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.ClassAlias, AllowsNull = false)] PasajeroAeronaveOid p_agrPasajeroAeronaveArg,
            [ONInboundArgument("Clas_1348178673664478Ser_1Arg_4_Alias", RevisionPasajeroClassText.Create_instance_P_agrRevisionArgumentAlias, "", "Clas_1348178673664478Ser_1_Alias", RevisionPasajeroClassText.Create_instanceServiceAlias, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.ClassAlias, AllowsNull = false)] RevisionOid p_agrRevisionArg,
            [ONInboundArgument("Clas_1348178673664478Ser_1Arg_1_Alias", RevisionPasajeroClassText.Create_instance_P_atrid_RevisionPasajeroArgumentAlias, "autonumeric", "Clas_1348178673664478Ser_1_Alias", RevisionPasajeroClassText.Create_instanceServiceAlias, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.ClassAlias, AllowsNull = false)] ONInt p_atrid_RevisionPasajeroArg)
        {
            try
            {
                RevisionPasajeroData lData = new RevisionPasajeroData(OnContext);

                #region Construct OID
                Instance.Oid = new RevisionPasajeroOid();
                Instance.Oid.Id_RevisionPasajeroAttr = new ONInt(p_atrid_RevisionPasajeroArg);
                #endregion Construct OID

                #region Argument initialization 'p_agrPasajeroAeronave' (PasajeroAeronave)
                if (p_agrPasajeroAeronaveArg != null)
                {
                    PasajeroAeronaveData lPasajeroAeronaveData = new PasajeroAeronaveData(OnContext);
                    if (!lPasajeroAeronaveData.Exist(p_agrPasajeroAeronaveArg, null))
                    {
                        throw new ONInstanceNotExistException(null, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.ClassAlias);
                    }

                    Instance.PasajeroAeronaveRole        = null;
                    Instance.PasajeroAeronaveRoleOidTemp = p_agrPasajeroAeronaveArg;

                    // Maximum cardinality check (inverse role)
                    if (p_agrPasajeroAeronaveArg.GetInstance(OnContext).RevisionPasajeroRole.Count >= 1)
                    {
                        throw new ONMaxCardinalityException(null, PasajeroAeronaveClassText.ClassAlias, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.RevisionPasajeroRoleAlias, "Agr_1348602167296649Rol_1_Alias", 1);
                    }
                }
                #endregion Argument Initialization 'p_agrPasajeroAeronave' (PasajeroAeronave)

                #region Argument initialization 'p_agrRevision' (Revision)
                if (p_agrRevisionArg != null)
                {
                    RevisionData lRevisionData = new RevisionData(OnContext);
                    if (!lRevisionData.Exist(p_agrRevisionArg, null))
                    {
                        throw new ONInstanceNotExistException(null, "Clas_1348178542592347_Alias", RevisionClassText.ClassAlias);
                    }

                    Instance.RevisionRole        = null;
                    Instance.RevisionRoleOidTemp = p_agrRevisionArg;

                    // Maximum cardinality check (inverse role)
                    if (p_agrRevisionArg.GetInstance(OnContext).RevisionPasajeroRole.Count >= 1)
                    {
                        throw new ONMaxCardinalityException(null, RevisionClassText.ClassAlias, "Clas_1348178542592347_Alias", RevisionClassText.RevisionPasajeroRoleAlias, "Agr_1348602167296276Rol_1_Alias", 1);
                    }
                }
                #endregion Argument Initialization 'p_agrRevision' (Revision)

                #region Autonumeric attribute 'id_RevisionPasajero'
                if (Instance.Id_RevisionPasajeroAttr < new ONInt(0))
                {
                    RevisionPasajeroData lAutonumericData = new RevisionPasajeroData(OnContext);
                    lAutonumericData.ClassName = "RevisionPasajero";
                    //Get Autonumeric
                    Instance.Oid.Id_RevisionPasajeroAttr = lAutonumericData.GetAutonumericid_RevisionPasajero();
                }
                #endregion Autonumeric attribute 'id_RevisionPasajero'

                //Search if instance exists
                if (lData.Exist(Instance.Oid, null))
                {
                    throw new ONInstanceExistException(null, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.ClassAlias);
                }

                //Update the new instance
                lData.UpdateAdded(Instance);

                #region Cardinality check for role 'PasajeroAeronave'
                // Minimum cardinality check
                if (Instance.PasajeroAeronaveRole == null)
                {
                    throw new ONMinCardinalityException(null, RevisionPasajeroClassText.ClassAlias, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.PasajeroAeronaveRoleAlias, "Agr_1348602167296649Rol_2_Alias", 1);
                }
                #endregion Cardinality check for role 'PasajeroAeronave'

                #region Cardinality check for role 'PasajeroAeronave'
                // Maximum cardinality check (inverse)
                foreach (PasajeroAeronaveInstance lRelatedInstance in Instance.PasajeroAeronaveRole)
                {
                    if (lRelatedInstance.RevisionPasajeroRole.Count > 1)
                    {
                        throw new ONMaxCardinalityException(null, PasajeroAeronaveClassText.ClassAlias, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.RevisionPasajeroRoleAlias, "Agr_1348602167296649Rol_1_Alias", 1);
                    }
                }
                #endregion Cardinality check for role 'PasajeroAeronave'

                #region Cardinality check for role 'Revision'
                // Minimum cardinality check
                if (Instance.RevisionRole == null)
                {
                    throw new ONMinCardinalityException(null, RevisionPasajeroClassText.ClassAlias, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.RevisionRoleAlias, "Agr_1348602167296276Rol_2_Alias", 1);
                }
                #endregion Cardinality check for role 'Revision'

                #region Cardinality check for role 'Revision'
                // Maximum cardinality check (inverse)
                foreach (RevisionInstance lRelatedInstance in Instance.RevisionRole)
                {
                    if (lRelatedInstance.RevisionPasajeroRole.Count > 1)
                    {
                        throw new ONMaxCardinalityException(null, RevisionClassText.ClassAlias, "Clas_1348178542592347_Alias", RevisionClassText.RevisionPasajeroRoleAlias, "Agr_1348602167296276Rol_1_Alias", 1);
                    }
                }
                #endregion Cardinality check for role 'Revision'
            }
            catch (Exception e)
            {
                if (e is ONException)
                {
                    throw e;
                }
                else
                {
                    string ltraceItem = "Definition class: RevisionPasajero, Service: create_instance, Component: RevisionPasajeroAction, Method: Create_instanceServ";
                    if (e is ONSystemException)
                    {
                        ONSystemException lException = e as ONSystemException;
                        lException.addTraceInformation(ltraceItem);
                        throw lException;
                    }
                    throw new ONSystemException(e, ltraceItem);
                }
            }

            return(Instance);
        }
        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_1348178673664478Ser_1_Alias", RevisionPasajeroClassText.Create_instanceServiceAlias, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.ClassAlias);

            lSInfo.AddOIDArgument("p_agrPasajeroAeronave", false, "PasajeroAeronave", "Clas_1348178673664478Ser_1Arg_3_Alias", RevisionPasajeroClassText.Create_instance_P_agrPasajeroAeronaveArgumentAlias);
            lSInfo.AddOIDArgument("p_agrRevision", false, "Revision", "Clas_1348178673664478Ser_1Arg_4_Alias", RevisionPasajeroClassText.Create_instance_P_agrRevisionArgumentAlias);
            lSInfo.AddDataValuedArgument("p_atrid_RevisionPasajero", false, DataTypeEnumerator.Autonumeric, 0, "Clas_1348178673664478Ser_1Arg_1_Alias", RevisionPasajeroClassText.Create_instance_P_atrid_RevisionPasajeroArgumentAlias);

            try
            {
                lSInfo.XML2ON(xmlReader, dtdVersion, true);
            }
            catch (Exception e)
            {
                throw new ONServiceArgumentsException(e, "Clas_1348178673664478_Alias", RevisionPasajeroClassText.ClassAlias, "Clas_1348178673664478Ser_1_Alias", RevisionPasajeroClassText.Create_instanceServiceAlias);
            }

            PasajeroAeronaveOid lP_agrPasajeroAeronaveArg = (PasajeroAeronaveOid)((ONArgumentInfo)lSInfo.mArgumentList["p_agrPasajeroAeronave"]).Value;
            RevisionOid         lP_agrRevisionArg         = (RevisionOid)((ONArgumentInfo)lSInfo.mArgumentList["p_agrRevision"]).Value;
            ONInt lP_atrid_RevisionPasajeroArg            = (ONInt)((ONArgumentInfo)lSInfo.mArgumentList["p_atrid_RevisionPasajero"]).Value;

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

            lOnContext.OidAgent = agentOid;

            // Execute Service
            RevisionPasajeroInstance 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);
                    }
                }

                RevisionInstance lp_agrRevisionInstance = new RevisionInstance(lOnContext);
                if (lP_agrRevisionArg != null)
                {
                    lFilterList = new ONFilterList();
                    lFilterList.Add("HorizontalVisibility", new RevisionHorizontalVisibility());
                    lp_agrRevisionInstance = lP_agrRevisionArg.GetInstance(lOnContext, lFilterList);
                    if (lp_agrRevisionInstance == null)
                    {
                        throw new ONInstanceNotExistException(null, "Clas_1348178542592347_Alias", RevisionClassText.ClassAlias);
                    }
                }

                using (RevisionPasajeroServer lServer = new RevisionPasajeroServer(lOnContext, null))
                {
                    lServer.Create_instanceServ(lP_agrPasajeroAeronaveArg, lP_agrRevisionArg, lP_atrid_RevisionPasajeroArg);
                    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
        }