Ejemplo n.º 1
0
        public AeronaveInstance Create_instanceServ(PasajeroAeronaveOid p_agrPasajeroAeronaveArg, ONInt p_atrid_AeronaveArg, ONText p_atrNombreArg, ONInt p_atrMaximoPasajerosArg, ONText p_atrOrigenArg, ONText p_atrDestinoArg)
        {
            // Create new context
            using (ONServiceContext lOnContext = new ONServiceContext(OnContext))
            {

                // Call Executive
                AeronaveExecutive lExecutive = new AeronaveExecutive();
                lExecutive.OnContext = lOnContext;
                lExecutive.Instance = Instance;
                Instance = lExecutive.Create_instanceServ(p_agrPasajeroAeronaveArg, p_atrid_AeronaveArg, p_atrNombreArg, p_atrMaximoPasajerosArg, p_atrOrigenArg, p_atrDestinoArg);

            }

            return Instance;
        }
Ejemplo n.º 2
0
        internal AeronaveInstance Create_instanceServ(PasajeroAeronaveOid p_agrPasajeroAeronaveArg, ONInt p_atrid_AeronaveArg, ONText p_atrNombreArg, ONInt p_atrMaximoPasajerosArg, ONText p_atrOrigenArg, ONText p_atrDestinoArg)
        {
            if (Instance != null)
            {
                ONFilterList onfilt = new ONFilterList();
                onfilt.Add("QueryByOid", new QueryByOidFilter(Instance.Oid));
                Instance.Find(onfilt);
            }
            // Execute service
            AeronaveAction lAction = new AeronaveAction(OnContext);
            lAction.Instance = new AeronaveInstance(OnContext);
            Instance = lAction.Create_instanceServ(p_agrPasajeroAeronaveArg, p_atrid_AeronaveArg, p_atrNombreArg, p_atrMaximoPasajerosArg, p_atrOrigenArg, p_atrDestinoArg);

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

            return Instance;
        }
Ejemplo n.º 3
0
        public override void Copy(ONInstance instance)
        {
            AeronaveInstance linstance = instance as AeronaveInstance;

            Oid = new AeronaveOid(linstance.Oid);

            if ((object)linstance.NombreAttrTemp != null)
            {
                NombreAttrTemp = new ONText(linstance.NombreAttrTemp);
            }
            else
            {
                NombreAttrTemp = null;
            }
            MaximoPasajerosAttr = new ONInt(linstance.MaximoPasajerosAttr);
            if ((object)linstance.OrigenAttrTemp != null)
            {
                OrigenAttrTemp = new ONText(linstance.OrigenAttrTemp);
            }
            else
            {
                OrigenAttrTemp = null;
            }
            if ((object)linstance.DestinoAttrTemp != null)
            {
                DestinoAttrTemp = new ONText(linstance.DestinoAttrTemp);
            }
            else
            {
                DestinoAttrTemp = null;
            }
            PasajeroAeronaveRoleTemp = linstance.PasajeroAeronaveRoleTemp;
            StateObj = new ONString(linstance.StateObj);

            base.Copy(instance);
        }
Ejemplo n.º 4
0
        ///<summary> This method adds the order criteria to the SQL statement </summary>
        ///<param name = "onSql"> This parameter represents the SQL component </param>
        ///<param name = "comparer"> This parameter has all the information refering to the order criteria to add to SQL statement</param>
        /// <param name="startRowOid">This parameter has the OID necessary to start the search</param>
        /// <param name="blockSize">This parameter represents the number of instances to be returned</param>
        protected override void AddOrderCriteria(ONSqlSelect onSql, ONOrderCriteria comparer, ONOid startRowOid, int blockSize, ONPath initialPath)
        {
            //Initilizate StartRow
            AeronaveInstance lInstance = null;
            if (startRowOid != null)
            {
                lInstance = new AeronaveInstance(OnContext);
                lInstance.Oid = startRowOid as AeronaveOid;
            }

            //Default OrderCriteria
            if (comparer == null)
            {
                string lAlias = onSql.GetAlias("Aeronave", initialPath);
                if (lInstance != null)
                {
                    onSql.AddOrderBy(lAlias, CtesBD.FLD_AERONAVE_ID_AERONAVE, OrderByTypeEnumerator.Asc, lInstance.Oid.Id_AeronaveAttr);
                }
                else
                {
                    onSql.AddOrderBy(lAlias, CtesBD.FLD_AERONAVE_ID_AERONAVE, OrderByTypeEnumerator.Asc, null);
                }
                return;
            }

            //Add OrderCriteria
            bool lUseStartRow = (!comparer.InMemory);
            foreach (ONOrderCriteriaItem lOrderCriteriaItem in comparer.OrderCriteriaSqlItem)
            {
                ONPath lPath = new ONPath(lOrderCriteriaItem.OnPath);
                if((lInstance != null) && (lUseStartRow))
                {
                    ONSimpleType lAttrStartRow = null;

                    if (lPath.Path == "")
                        lAttrStartRow = lInstance[lOrderCriteriaItem.Attribute] as ONSimpleType;
                    else
                    {
                        ONCollection lCollection = (lInstance[lPath.Path] as ONCollection);
                        if((lCollection != null) && (lCollection.Count > 0))
                            lAttrStartRow = lCollection[0][lOrderCriteriaItem.Attribute] as ONSimpleType;
                    }
                    onSql.AddOrderBy(AeronaveData.AddPath(onSql, JoinType.LeftJoin, lOrderCriteriaItem.Facet, lPath, null, lOrderCriteriaItem.DomainArgument, false), lOrderCriteriaItem.Attribute, lOrderCriteriaItem.Type, lAttrStartRow);
                    lUseStartRow = (lAttrStartRow != null);
                }
                else
                    onSql.AddOrderBy(AeronaveData.AddPath(onSql, JoinType.LeftJoin, lOrderCriteriaItem.Facet, lPath, null, lOrderCriteriaItem.DomainArgument, false), lOrderCriteriaItem.Attribute, lOrderCriteriaItem.Type, null);
            }
            return;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Load the data retrieved from the Data Base to components of the application
        /// </summary>
        /// <param name="onContext">This parameter has the current context</param>
        /// <param name="columns">This parameter has the data collected from the database</param>
        /// <param name="index">This parameter has the position of the first data to fix in the application</param>
        public static AeronaveInstance LoadFacet(ONContext onContext, ONDisplaySet displaySet, object[] columns, ref int index)
        {
            AeronaveInstance lInstance = new AeronaveInstance(onContext);
            lInstance.Oid = new AeronaveOid();

            // Field 'id_Aeronave'
            lInstance.Oid.Id_AeronaveAttr = new ONInt(Convert.ToInt32(columns[index++]));
            lInstance.StateObj = new ONString(((string) columns[index++]).TrimEnd());
            lInstance.Lmd = new ONDateTime((DateTime) columns[index++]);
            // Field 'MaximoPasajeros'
            lInstance.MaximoPasajerosAttr = new ONInt(Convert.ToInt32(columns[index++]));
            if ((displaySet != null) && (displaySet.Contains("Nombre")))
            {
                lInstance.NombreAttr = new ONText((string) columns[index++]);
            }
            if ((displaySet != null) && (displaySet.Contains("Origen")))
            {
                lInstance.OrigenAttr = new ONText((string) columns[index++]);
            }
            if ((displaySet != null) && (displaySet.Contains("Destino")))
            {
                lInstance.DestinoAttr = new ONText((string) columns[index++]);
            }

            lInstance.Modified = false;
            return lInstance;
        }
Ejemplo n.º 6
0
        protected override ONInstance InhGetInstance(ONContext onContext, ONFilterList onFilterList)
        {
            // Add oid filter to the list
            ONFilterList lOnFilterList = new ONFilterList(onFilterList);
            lOnFilterList.Add("QueryByOid", new QueryByOidFilter(this));

            // Search Instance
            ONInstance lInstance = new AeronaveInstance(onContext);
            lInstance.Oid = this;
            lInstance = lInstance.Find(lOnFilterList);
            if (lInstance == null)
                lInstance = new AeronaveInstance(onContext);

            return lInstance;
        }
Ejemplo n.º 7
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_1348178542592177Ser_1_Alias", PasajeroAeronaveClassText.Create_instanceServiceAlias, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.ClassAlias);
            lSInfo.AddOIDArgument("p_agrAeronave", true, "Aeronave", "Clas_1348178542592177Ser_1Arg_5_Alias", PasajeroAeronaveClassText.Create_instance_P_agrAeronaveArgumentAlias);
            lSInfo.AddOIDArgument("p_agrPasajero", true, "Pasajero", "Clas_1348178542592177Ser_1Arg_6_Alias", PasajeroAeronaveClassText.Create_instance_P_agrPasajeroArgumentAlias);
            lSInfo.AddDataValuedArgument("p_atrid_PasajeroAeronave", false, DataTypeEnumerator.Autonumeric, 0, "Clas_1348178542592177Ser_1Arg_1_Alias", PasajeroAeronaveClassText.Create_instance_P_atrid_PasajeroAeronaveArgumentAlias);
            lSInfo.AddDataValuedArgument("p_atrNombreAeronave", false, DataTypeEnumerator.String, 100, "Clas_1348178542592177Ser_1Arg_8_Alias", PasajeroAeronaveClassText.Create_instance_P_atrNombreAeronaveArgumentAlias);
            lSInfo.AddDataValuedArgument("p_atrNombrePasajero", false, DataTypeEnumerator.String, 100, "Clas_1348178542592177Ser_1Arg_9_Alias", PasajeroAeronaveClassText.Create_instance_P_atrNombrePasajeroArgumentAlias);

            try
            {
                lSInfo.XML2ON(xmlReader, dtdVersion, true);
            }
            catch (Exception e)
            {
                throw new ONServiceArgumentsException(e, "Clas_1348178542592177_Alias", PasajeroAeronaveClassText.ClassAlias, "Clas_1348178542592177Ser_1_Alias", PasajeroAeronaveClassText.Create_instanceServiceAlias);
            }

            AeronaveOid lP_agrAeronaveArg = (AeronaveOid) ((ONArgumentInfo) lSInfo.mArgumentList["p_agrAeronave"]).Value;
            PasajeroOid lP_agrPasajeroArg = (PasajeroOid) ((ONArgumentInfo) lSInfo.mArgumentList["p_agrPasajero"]).Value;
            ONInt lP_atrid_PasajeroAeronaveArg = (ONInt) ((ONArgumentInfo) lSInfo.mArgumentList["p_atrid_PasajeroAeronave"]).Value;
            ONString lP_atrNombreAeronaveArg = (ONString) ((ONArgumentInfo) lSInfo.mArgumentList["p_atrNombreAeronave"]).Value;
            ONString lP_atrNombrePasajeroArg = (ONString) ((ONArgumentInfo) lSInfo.mArgumentList["p_atrNombrePasajero"]).Value;

            // Create Context
            ONServiceContext lOnContext = new ONServiceContext();
            lOnContext.OidAgent = agentOid;

            // Execute Service
            PasajeroAeronaveInstance lInstance = null;
            try
            {
                ONFilterList lFilterList = new ONFilterList();
                AeronaveInstance lp_agrAeronaveInstance = new AeronaveInstance(lOnContext);
                if (lP_agrAeronaveArg != null)
                {
                    lFilterList = new ONFilterList();
                    lFilterList.Add("HorizontalVisibility", new AeronaveHorizontalVisibility());
                    lp_agrAeronaveInstance = lP_agrAeronaveArg.GetInstance(lOnContext, lFilterList);
                    if (lp_agrAeronaveInstance == null)
                        throw new ONInstanceNotExistException(null, "Clas_1348178411520734_Alias", AeronaveClassText.ClassAlias);
                }

                PasajeroInstance lp_agrPasajeroInstance = new PasajeroInstance(lOnContext);
                if (lP_agrPasajeroArg != null)
                {
                    lFilterList = new ONFilterList();
                    lFilterList.Add("HorizontalVisibility", new PasajeroHorizontalVisibility());
                    lp_agrPasajeroInstance = lP_agrPasajeroArg.GetInstance(lOnContext, lFilterList);
                    if (lp_agrPasajeroInstance == null)
                        throw new ONInstanceNotExistException(null, "Clas_1348178542592658_Alias", PasajeroClassText.ClassAlias);
                }

                using (PasajeroAeronaveServer lServer = new PasajeroAeronaveServer(lOnContext, null))
                {
                    lServer.Create_instanceServ(lP_agrAeronaveArg,lP_agrPasajeroArg,lP_atrid_PasajeroAeronaveArg,lP_atrNombreAeronaveArg,lP_atrNombrePasajeroArg);
                    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
        }
Ejemplo n.º 8
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
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="onContext">This parameter has the current context</param>
 /// <param name="instance">This parameter has the instance that exectues the service</param>
 public AeronaveServer(ONServiceContext onContext, AeronaveInstance instance)
     : base(onContext, instance, "Aeronave")
 {
 }