public override SelectResult ExecuteSelect(AdamDataSourceSelectingEventArgs arguments)
 {
     var selectResult = new SelectResult<FieldInheritanceDefinition>();
     var definitionCollection = new FieldDefinitionCollection(App);
     var isLastPage = LoadFieldsPage(definitionCollection, arguments);
     var inheritanceDefinitions = LoadDefinitionsFor(definitionCollection).ToList();
     selectResult.SetItems(arguments, inheritanceDefinitions, isLastPage);
     return selectResult;
 }
        public override SelectResult ExecuteSelect(AdamDataSourceSelectingEventArgs arguments)
        {
            var selectResult           = new SelectResult <FieldInheritanceDefinition>();
            var definitionCollection   = new FieldDefinitionCollection(App);
            var isLastPage             = LoadFieldsPage(definitionCollection, arguments);
            var inheritanceDefinitions = LoadDefinitionsFor(definitionCollection).ToList();

            selectResult.SetItems(arguments, inheritanceDefinitions, isLastPage);
            return(selectResult);
        }
 public override int QueryTotalRowCount(AdamDataSourceSelectingEventArgs arguments)
 {
     var amountOfFieldDefinitions = new FieldDefinitionHelper(App).GetMatches(arguments.SelectExpression, false);
     if (arguments.MaximumRows != -1)
     {
         if (amountOfFieldDefinitions > arguments.MaximumRows)
         {
             return arguments.MaximumRows;
         }
     }
     return amountOfFieldDefinitions;
 }
        public override int QueryTotalRowCount(AdamDataSourceSelectingEventArgs arguments)
        {
            var amountOfFieldDefinitions = new FieldDefinitionHelper(App).GetMatches(arguments.SelectExpression, false);

            if (arguments.MaximumRows != -1)
            {
                if (amountOfFieldDefinitions > arguments.MaximumRows)
                {
                    return(arguments.MaximumRows);
                }
            }
            return(amountOfFieldDefinitions);
        }
        private bool LoadFieldsPage(FieldDefinitionCollection definitionCollection, AdamDataSourceSelectingEventArgs arguments)
        {
            var  pageNumber       = arguments.PageNumber + 1;
            var  loadOptions      = arguments.LoadOptions as FieldDefinitionLoadOptions;
            var  maxRows          = arguments.MaximumRows;
            var  pageSize         = arguments.PageSize;
            var  sortExpression   = arguments.SortExpression;
            var  searchExpression = arguments.SelectExpression;
            bool isLastPage;

            do
            {
                definitionCollection.Load(searchExpression, sortExpression, pageNumber, pageSize, out isLastPage, maxRows, loadOptions);
                --pageNumber;
            }while (definitionCollection.Count == 0 && pageNumber > 0);
            arguments.PageNumber = pageNumber;
            return(isLastPage);
        }
 private bool LoadFieldsPage(FieldDefinitionCollection definitionCollection, AdamDataSourceSelectingEventArgs arguments)
 {
     var pageNumber = arguments.PageNumber + 1;
     var loadOptions = arguments.LoadOptions as FieldDefinitionLoadOptions;
     var maxRows = arguments.MaximumRows;
     var pageSize = arguments.PageSize;
     var sortExpression = arguments.SortExpression;
     var searchExpression = arguments.SelectExpression;
     bool isLastPage;
     do
     {
         definitionCollection.Load(searchExpression, sortExpression, pageNumber, pageSize, out isLastPage, maxRows, loadOptions);
         --pageNumber;
     }
     while (definitionCollection.Count == 0 && pageNumber > 0);
     arguments.PageNumber = pageNumber;
     return isLastPage;
 }