예제 #1
0
 /// <summary>
 /// Execute a query to retrieve an instance.
 /// </summary>
 /// <param name="context">Current context.</param>
 /// <returns>A DataTable with the instance searched.</returns>
 public static DataTable ExecuteQueryInstance(IUQueryContext context)
 {
     AdministradorOid lOid = null;
     if (context.ExchangeInformation != null && context.ExchangeInformation.SelectedOids.Count > 0)
     {
         lOid = new AdministradorOid(context.ExchangeInformation.SelectedOids[0]);
     }
     return ExecuteQueryInstance(context.Agent, lOid, context.DisplaySetAttributes);
 }
예제 #2
0
        /// <summary>
        /// Execute a query to retrieve a set of instances, without any condition.
        /// </summary>
        /// <param name="context">Current context.</param>
        /// <returns>A DataTable with the instances searched.</returns>
        public static DataTable ExecuteQueryPopulation(IUPopulationContext context)
        {
            // Last Oid
            AdministradorOid lLastOid = null;
            if (context.LastOids.Count > 0)
            {
                lLastOid = new AdministradorOid(context.LastOids.Peek());
            }

            // Last Block
            bool lLastBlock = true;
            NavigationalFiltering navigationalFiltering = NavigationalFiltering.GetNavigationalFiltering(context);
            DataTable lDataTable = ExecuteQueryRelated(context.Agent, new Dictionary<string, Oid>(), context.DisplaySetAttributes, context.OrderCriteriaNameSelected, navigationalFiltering, lLastOid, context.BlockSize, ref lLastBlock);
            context.LastBlock = lLastBlock;

            return lDataTable;
        }
예제 #3
0
 /// <summary>
 /// Execute a query to retrieve an instance.
 /// </summary>
 /// <param name="agent">Application agent.</param>
 /// <param name="oid">Specific 'AdministradorOid' Oid of the instance to be searched.</param>
 /// <param name="displaySet">Display set that will be retrieved.</param>
 /// <returns>A DataTable with the instance searched.</returns>
 public static DataTable ExecuteQueryInstance(Oid agent, AdministradorOid oid, string displaySet)
 {
     return Logic.Adaptor.ExecuteQueryInstance(agent, "Administrador", string.Empty, oid, displaySet);
 }
예제 #4
0
        /// <summary>
        /// Execute a query related with other instance.
        /// </summary>
        /// <param name="agent">Application agent.</param>
        /// <param name="linkItems">List of related instance oids (path - role).</param>
        /// <param name="displaySet">List of attributes to return.</param>
        /// <param name="orderCriteria">Order criteria name.</param>
        /// <param name="lastOid">Oid from which to search (not included).</param>
        /// <param name="blockSize">Number of instances to return (0 for all population).</param>
        /// <param name="lastBlock">Return it is last block.</param>
        /// <returns>A DataTable with the instances searched.</returns>
        public static DataTable ExecuteQueryRelated(Oid agent, Dictionary<string, Oid> linkItems, string displaySet, string orderCriteria, AdministradorOid lastOid, int blockSize, ref bool lastBlock)
        {
            DataTable lDataTable = Logic.Adaptor.ExecuteQueryRelated(agent, "Administrador", linkItems, displaySet, orderCriteria, lastOid, blockSize);

            // Last block.
            if (lDataTable.ExtendedProperties.Contains("LastBlock"))
                lastBlock = (bool) lDataTable.ExtendedProperties["LastBlock"];
            else
                lastBlock = false;

            return lDataTable;
        }
예제 #5
0
        /// <summary>
        /// Execute a query related with other instance.
        /// </summary>
        /// <param name="context">Current context.</param>
        /// <returns>A DataTable with the instances searched.</returns>
        public static DataTable ExecuteQueryRelated(IUQueryContext context)
        {
            try
            {
                ExchangeInfo lExchangeInfo = context.ExchangeInformation;

                if (lExchangeInfo.ExchangeType != ExchangeType.Navigation || lExchangeInfo.SelectedOids.Count == 0)
                {
                    return null;
                }

                IUPopulationContext lIUContext = context as IUPopulationContext;
                int blockSize=1;
                if (lIUContext != null)
                {
                    blockSize = lIUContext.BlockSize;
                }
                ExchangeInfoNavigation lNavInfo = lExchangeInfo as ExchangeInfoNavigation;
                // Specific case. No role name indicates Query by Instance.
                if (lNavInfo.RolePath == "")
                {
                    if (lIUContext != null)
                    {
                        lIUContext.LastBlock = true;
                    }

                    AdministradorOid lOidInstance = new AdministradorOid(lNavInfo.SelectedOids[0]);
                    return ExecuteQueryInstance(context.Agent, lOidInstance, context.DisplaySetAttributes);
                }

                // Get link items.
                Oid lOid = lNavInfo.SelectedOids[0];
                Dictionary<string, Oid> lLinkItems = new Dictionary<string, Oid>(StringComparer.CurrentCultureIgnoreCase);
                lLinkItems.Add(lNavInfo.RolePath, lOid);

                bool lLastBlock = true;
                AdministradorOid lLastOid = null;
                string lOrderCriteria = string.Empty;

                // Get population members.
                if (lIUContext != null)
                {
                    if (lIUContext.LastOid != null)
                    {
                        lLastOid = new AdministradorOid(lIUContext.LastOid);
                    }
                    lOrderCriteria = lIUContext.OrderCriteriaNameSelected;
                }
                NavigationalFiltering navigationalFiltering = NavigationalFiltering.GetNavigationalFiltering(context);
                DataTable lDataTable = ExecuteQueryRelated(context.Agent, lLinkItems, context.DisplaySetAttributes, lOrderCriteria, navigationalFiltering, lLastOid, blockSize, ref lLastBlock);

                if (lIUContext != null)
                {
                    lIUContext.LastBlock = lLastBlock;
                }

                return lDataTable;
            }
            catch (Exception e)
            {
                ScenarioManager.LaunchErrorScenario(e);
                return null;
            }
        }
예제 #6
0
 /// <summary>
 /// Execute a query to retrieve a set of instances, without any condition.
 /// </summary>
 /// <param name="agent">Application agent.</param>
 /// <param name="displaySet">List of attributes to return.</param>
 /// <param name="orderCriteria">Order criteria name.</param>
 /// <param name="lastOid">Oid from which to search (not included).</param>
 /// <param name="blockSize">Number of instances to return (0 for all population).</param>
 /// <returns>A DataTable with the instances searched.</returns>
 public static DataTable ExecuteQueryPopulation(Oid agent, string displaySet, string orderCriteria, AdministradorOid lastOid, int blockSize, ref bool lastBlock)
 {
     return ExecuteQueryRelated(agent, new Dictionary<string, Oid>(), displaySet, orderCriteria, lastOid, blockSize, ref lastBlock);
 }