Exemple #1
0
        /// <summary>
        ///Returns entity schema query to get records srored in dynamic folder
        /// </summary>
        /// <param name="objectName">Entity schema name</param>
        /// <param name="searchData">Byte array which represent serialized search data for dynamic folder query</param>
        /// <param name="userConnection">Connection</param>
        /// <param name="recordIdColumn">Column with record identifier</param>
        public static EntitySchemaQuery GetDynamicFolderESQ(string objectName, byte[] searchData,
                                                            UserConnection userConnection, out EntitySchemaQueryColumn recordIdColumn)
        {
            var ESQ = new EntitySchemaQuery(userConnection.EntitySchemaManager, objectName);

            recordIdColumn = ESQ.AddColumn(ESQ.RootSchema.GetPrimaryColumnName());
            IEntitySchemaQueryFilterItem filters =
                CommonUtilities.ConvertClientFilterDataToEsqFilters(userConnection, searchData, ESQ.RootSchema.UId);

            CommonUtilities.DisableEmptyEntitySchemaQueryFilters(new [] { filters });
            if (filters != null)
            {
                ESQ.Filters.Add(filters);
            }
            return(ESQ);
        }
Exemple #2
0
        /// <summary>
        /// Returns true when search data has filters and filters aren't disabled.
        /// </summary>
        /// <param name="schemaName">Root schema name.</param>
        /// <param name="searchData">Folder search data.</param>
        /// <param name="userConnection">User connection.</param>
        /// <returns>True when search data has filter.</returns>
        public virtual bool CheckSearchDataHasFilter(string schemaName, byte[] searchData,
                                                     UserConnection userConnection)
        {
            if (searchData == null || searchData.Length == 0)
            {
                return(false);
            }
            var foldersQuery = new EntitySchemaQuery(userConnection.EntitySchemaManager, schemaName);
            IEntitySchemaQueryFilterItem filters = CommonUtilities.ConvertClientFilterDataToEsqFilters(userConnection,
                                                                                                       searchData, foldersQuery.RootSchema.UId);

            CommonUtilities.DisableEmptyEntitySchemaQueryFilters(new [] { filters });
            if (!filters.GetFilterInstances().Any())
            {
                return(false);
            }
            return(true);
        }
        private Select GetSelectByFilterData(UserConnection userConnection, byte[] filterEditData,
                                             string rootSchemaName, string customPrefix)
        {
            EntitySchema entitySchema            = userConnection.EntitySchemaManager.GetInstanceByName(rootSchemaName);
            IEntitySchemaQueryFilterItem filters = CommonUtilities.ConvertClientFilterDataToEsqFilters(userConnection,
                                                                                                       filterEditData, entitySchema.UId, customPrefix);
            var esq = GetEntitySchemaQuery(customPrefix, entitySchema);

            if (filters.GetFilterInstances().IsEmpty())
            {
                return(esq.GetSelectQuery(userConnection));
            }
            esq.Filters.Add(CommonUtilities.ConvertClientFilterDataToEsqFilters(userConnection,
                                                                                filterEditData, entitySchema.UId, customPrefix));
            Select esqSelect = esq.GetSelectQuery(userConnection);

            return(esqSelect);
        }