public override void Copy(object oid)
        {
            RevisionOid lOid = oid as RevisionOid;

            if (lOid != null)
            {
                Id_RevisarAeronaveAttr = new ONInt(lOid.Id_RevisarAeronaveAttr);
            }
            base.Copy(oid);
        }
 /// <summary>Default Constructor</summary>
 public RevisionInstance(ONContext onContext)
     : base(onContext, "Revision", "Clas_1348178542592347_Alias")
 {
     Oid = new RevisionOid();
     NombreRevisorAttr = ONString.Null;
     FechaRevisionAttr = ONDate.Null;
     Id_AeronaveAttr = ONString.Null;
     RevisionPasajeroRoleTemp = null;
     StateObjAttrTemp = null;
 }
 public RevisionOid(RevisionOid oid) : base("Revision")
 {
     if (oid != null)
     {
         Id_RevisarAeronaveAttr = new ONInt(oid.Id_RevisarAeronaveAttr);
     }
     else
     {
         Id_RevisarAeronaveAttr = ONInt.Null;
     }
 }
 public RevisionOid(RevisionOid oid)
     : base("Revision")
 {
     if (oid != null)
     {
         Id_RevisarAeronaveAttr = new ONInt(oid.Id_RevisarAeronaveAttr);
     }
     else
     {
         Id_RevisarAeronaveAttr = ONInt.Null;
     }
 }
 internal void Delete_instanceServ(RevisionOid p_thisRevisarAeronaveArg)
 {
     if (Instance != null)
     {
         ONFilterList onfilt = new ONFilterList();
         onfilt.Add("QueryByOid", new QueryByOidFilter(Instance.Oid));
         Instance.Find(onfilt);
     }
     // Execute service
     RevisionAction lAction = new RevisionAction(OnContext);
     lAction.Instance = Instance;
     lAction.Delete_instanceServ(p_thisRevisarAeronaveArg);
 }
        /// <summary>
        /// Converts an OID into XML in order to put it in XML message response
        /// </summary>
        /// <param name="xmlWriter">XML with the response message</param>
        /// <param name="oid">OID that will be insert into XML message</param>
        /// <param name="dtdVersion">Version of DTD that follows the XML message</param>
        /// <param name="xmlElement">Element in the XML message in order to convert in the right form of the XML</param>
        public static void ON2XML(XmlWriter xmlWriter, RevisionOid oid, double dtdVersion, string xmlElement)
        {
            if (oid == null)
                xmlWriter.WriteElementString(ONXml.XMLTAG_NULL, null);
            else
            {
                xmlWriter.WriteStartElement(ONXml.XMLTAG_OID);
                xmlWriter.WriteAttributeString(ONXml.XMLATT_CLASS, "Revision");
                ONXmlAutonumeric.ON2XML(xmlWriter, oid.Id_RevisarAeronaveAttr, dtdVersion, xmlElement);

                xmlWriter.WriteEndElement(); // OID
            }
        }
        public RevisionPasajeroInstance Create_instanceServ(PasajeroAeronaveOid p_agrPasajeroAeronaveArg, RevisionOid p_agrRevisionArg, ONInt p_atrid_RevisionPasajeroArg)
        {
            // Create new context
            using (ONServiceContext lOnContext = new ONServiceContext(OnContext))
            {

                // Call Executive
                RevisionPasajeroExecutive lExecutive = new RevisionPasajeroExecutive();
                lExecutive.OnContext = lOnContext;
                lExecutive.Instance = Instance;
                Instance = lExecutive.Create_instanceServ(p_agrPasajeroAeronaveArg, p_agrRevisionArg, p_atrid_RevisionPasajeroArg);

            }

            return Instance;
        }
        internal RevisionPasajeroInstance Create_instanceServ(PasajeroAeronaveOid p_agrPasajeroAeronaveArg, RevisionOid p_agrRevisionArg, ONInt p_atrid_RevisionPasajeroArg)
        {
            if (Instance != null)
            {
                ONFilterList onfilt = new ONFilterList();
                onfilt.Add("QueryByOid", new QueryByOidFilter(Instance.Oid));
                Instance.Find(onfilt);
            }
            // Execute service
            RevisionPasajeroAction lAction = new RevisionPasajeroAction(OnContext);
            lAction.Instance = new RevisionPasajeroInstance(OnContext);
            Instance = lAction.Create_instanceServ(p_agrPasajeroAeronaveArg, p_agrRevisionArg, p_atrid_RevisionPasajeroArg);

            OnContext.OperationStack.Pop();
            OnContext.OperationStack.Push(Instance);

            return Instance;
        }
        public override bool Equals(object oid)
        {
            RevisionOid lOid = null;

            if (oid is RevisionOid)
            {
                lOid = oid as RevisionOid;
            }
            else if (oid is RevisionInstance)
            {
                lOid = (oid as RevisionInstance).Oid;
            }

            if ((object)lOid == null)
            {
                return(false);
            }

            return(lOid.Id_RevisarAeronaveAttr.Equals(Id_RevisarAeronaveAttr));
        }
 /// <summary>This method adds to the SQL statement the part that fixes the instance</summary>
 /// <param name="onSql">This parameter has the current SQL statement</param>
 /// <param name="onPath">Path to add to SQL statement</param>
 /// <param name="processedOnPath">Path pocessed until the call of this method</param>
 /// <param name="oid">OID to fix the instance in the SQL statement</param>
 public static void FixInstance(ONSqlSelect onSql, ONPath onPath, ONPath processedOnPath, RevisionOid oid)
 {
     FixInstance(onSql, onPath, processedOnPath, oid, false);
 }
        public override void Copy(ONInstance instance)
        {
            RevisionPasajeroInstance linstance = instance as RevisionPasajeroInstance;

            Oid = new RevisionPasajeroOid(linstance.Oid);

            RevisionRoleTemp = linstance.RevisionRoleTemp;
            if (linstance.RevisionRoleOidTemp != null)
                RevisionRoleOidTemp = new RevisionOid(linstance.RevisionRoleOidTemp);
            PasajeroAeronaveRoleTemp = linstance.PasajeroAeronaveRoleTemp;
            if (linstance.PasajeroAeronaveRoleOidTemp != null)
                PasajeroAeronaveRoleOidTemp = new PasajeroAeronaveOid(linstance.PasajeroAeronaveRoleOidTemp);
            StateObj = new ONString(linstance.StateObj);

            base.Copy(instance);
        }
        public void RevisionPasajeroRoleDelete(RevisionOid oid)
        {
            ONSqlUpdate lOnSql = new ONSqlUpdate();
            lOnSql.AddUpdate(CtesBD.TBL_REVISIONPASAJERO);
            lOnSql.AddSet(CtesBD.FLD_REVISIONPASAJERO_FK_REVISION_1, ONInt.Null);
            lOnSql.AddWhere(CtesBD.FLD_REVISIONPASAJERO_FK_REVISION_1, oid.Id_RevisarAeronaveAttr);

            Execute(lOnSql);
        }
        public ONCollection RevisionRole(RevisionOid oid)
        {
            ONSqlSelect lOnSql = new ONSqlSelect();

            //Create select
            RevisionData.AddPath(lOnSql, "RevisionPasajero", new ONPath("RevisionPasajero"), null, "");
            RetrieveInstances(lOnSql, null, new ONPath("RevisionPasajero"), OnContext);

            //Fix related instance
            RevisionData.FixInstance(lOnSql, null, null, oid);

            //Execute
            return ExecuteQuery(lOnSql);
        }
 public void RevisionRoleInsert(RevisionPasajeroOid localOid, RevisionOid relatedOid)
 {
     ONSqlUpdate lOnSql = new ONSqlUpdate();
     lOnSql.AddUpdate(CtesBD.TBL_REVISIONPASAJERO);
     lOnSql.AddSet(CtesBD.FLD_REVISIONPASAJERO_FK_REVISION_1, relatedOid.Id_RevisarAeronaveAttr);
     lOnSql.AddWhere(CtesBD.FLD_REVISIONPASAJERO_ID_REVISIONPASAJERO, localOid.Id_RevisionPasajeroAttr);
     Execute(lOnSql);
 }
        /// <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 RevisionOid XML2ON(XmlReader xmlReader, double dtdVersion)
        {
            try
            {
                if (xmlReader.IsStartElement(ONXml.XMLTAG_NULL))
                {
                    xmlReader.Skip();
                    return RevisionXml.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, "Revision", true) != 0)
                throw new ONXMLOIDWrongClassException(null, "Clas_1348178542592347_Alias", "Revision", lClass);

            RevisionOid lOid = new RevisionOid();
            xmlReader.ReadStartElement(ONXml.XMLTAG_OID);

            try
            {
                lOid.Id_RevisarAeronaveAttr = ONXmlAutonumeric.XML2ON(xmlReader, dtdVersion, ONXml.XMLTAG_OIDFIELD);
            }
            catch(Exception e)
            {
                throw new ONXMLOIDFieldException(e,"Clas_1348178542592347_Alias", "Revision", "Clas_1348178542592347Atr_1_Alias", "id_RevisarAeronave");
            }

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

            return lOid;
        }
 /// <summary>This method adds to the SQL statement the part that fixes the instance</summary>
 /// <param name="onSql">This parameter has the current SQL statement</param>
 /// <param name="onPath">Path to add to SQL statement</param>
 /// <param name="processedOnPath">Path pocessed until the call of this method</param>
 /// <param name="oid">OID to fix the instance in the SQL statement</param>
 /// <param name="isLinkedTo">The alias belongs to a role in a linked To element</param>
 public static void FixInstance(ONSqlSelect onSql, ONPath onPath, ONPath processedOnPath, RevisionOid oid, bool isLinkedTo)
 {
     if ((onPath != null) && (string.Compare(onPath.Path, "agent", true) == 0))
     {
         if (onSql.GetParameter("agent") == null)
         {
             string lAlias = AddPath(onSql, JoinType.InnerJoin, "Revision", onPath, processedOnPath, "Revision", false, isLinkedTo);
             onSql.AddWhere(lAlias + "." + CtesBD.FLD_REVISION_ID_REVISARAERONAVE + " = ?");
             onSql.AddWhereParameter("agent", oid.Id_RevisarAeronaveAttr);
         }
     }
     else
     {
         string lAlias = AddPath(onSql, JoinType.InnerJoin, "Revision", onPath, processedOnPath, "", false, isLinkedTo);
         onSql.AddWhere(lAlias + "." + CtesBD.FLD_REVISION_ID_REVISARAERONAVE + " = ?");
         onSql.AddWhereParameter("", oid.Id_RevisarAeronaveAttr);
     }
 }
        public override void Copy(ONInstance instance)
        {
            RevisionInstance linstance = instance as RevisionInstance;

            Oid = new RevisionOid(linstance.Oid);

            NombreRevisorAttr = new ONString(linstance.NombreRevisorAttr);
            FechaRevisionAttr = new ONDate(linstance.FechaRevisionAttr);
            Id_AeronaveAttr = new ONString(linstance.Id_AeronaveAttr);
            RevisionPasajeroRoleTemp = linstance.RevisionPasajeroRoleTemp;
            StateObj = new ONString(linstance.StateObj);

            base.Copy(instance);
        }
        public void Delete_instanceServ(RevisionOid p_thisRevisarAeronaveArg)
        {
            // Create new context
            using (ONServiceContext lOnContext = new ONServiceContext(OnContext))
            {
                // Change to Transactional OnContext
                Instance.OnContext = lOnContext;

                // Call Executive
                RevisionExecutive lExecutive = new RevisionExecutive();
                lExecutive.OnContext = lOnContext;
                lExecutive.Instance = Instance;
                lExecutive.Delete_instanceServ(p_thisRevisarAeronaveArg);

                // Change to Non-Transactional OnContext
                Instance.OnContext = OnContext;
            }
        }