Esempio n. 1
0
        /// <summary>
        /// Returns entity schema query to get records stored in dynamic folder.
        /// </summary>
        /// <param name="schemaName">Entity schema name.</param>
        /// <param name="searchData">Byte array which represent serialized search data for dynamic folder query.</param>
        /// <param name="userConnection">Connection.</param>
        /// <returns>Entity schema query instance with deserialized filters.</returns>
        public static EntitySchemaQuery GetDynamicFolderESQ(string schemaName, byte[] searchData,
                                                            UserConnection userConnection)
        {
            var selectQuery = new Nui.ServiceModel.DataContract.SelectQuery {
                RootSchemaName = schemaName,
                Filters        = Json.Deserialize <Nui.ServiceModel.DataContract.Filters>(Encoding.UTF8.GetString(searchData,
                                                                                                                  0, searchData.Length))
            };
            var esq = selectQuery.BuildEsq(userConnection);

            CommonUtilities.DisableEmptyEntitySchemaQueryFilters(new[] { esq.Filters });
            return(esq);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }