Esempio n. 1
0
        internal static ParaEntityList <ParaObjects.Download> ApiGetDownloadEntityList(ParaCredentials pc)
        {
            var entityList = new ParaEntityList <ParaObjects.Download>();
            var ar         = ApiCallFactory.ObjectGetList <ParaObjects.Download>(pc, new ArrayList());

            if (ar.HasException == false)
            {
                entityList = ParaEntityParser.FillListDownload(ar.XmlReceived);
            }
            entityList.ApiCallResponse = ar;

            return(entityList);
        }
Esempio n. 2
0
        public ParaEntityList <TFolder> GetList <TFolder>(FolderQuery query)
            where TFolder : Folder, new()
        {
            var folderList = new ParaEntityList <TFolder>();
            var ar         = ApiCallFactory.ObjectGetList <TFolder>(Credentials, query.BuildQueryArguments());

            if (ar.HasException == false)
            {
                folderList = ParaEntityParser.FillList <TFolder>(ar.XmlReceived);
            }
            folderList.ApiCallResponse = ar;

            // Checking if the system needs to recursively call all of the data returned.
            if (query.RetrieveAllRecords)
            {
                bool continueCalling = true;
                while (continueCalling)
                {
                    if (folderList.TotalItems > folderList.Data.Count)
                    {
                        // We still need to pull data

                        // Getting next page's data
                        query.PageNumber = query.PageNumber + 1;

                        ar = ApiCallFactory.ObjectGetList <TFolder>(Credentials, query.BuildQueryArguments());

                        var objectlist = ParaEntityParser.FillList <TFolder>(ar.XmlReceived);

                        if (objectlist.Data.Count == 0)
                        {
                            continueCalling = false;
                        }

                        folderList.Data.AddRange(objectlist.Data);
                        folderList.ResultsReturned = folderList.Data.Count;
                        folderList.PageNumber      = query.PageNumber;
                    }
                    else
                    {
                        // That is it, pulled all the items.
                        continueCalling            = false;
                        folderList.ApiCallResponse = ar;
                    }
                }
            }

            return(folderList);
        }
Esempio n. 3
0
        private static ParaEntityList <T> RetrieveAllEntities <T>(ParaCredentials pc, ParaEntityQuery query)
            where T : ParaEntity, new()
        {
            ApiCallResponse ar;
            var             entityList = new ParaEntityList <T>();

            ar = ApiCallFactory.ObjectGetList <T>(pc, query.BuildQueryArguments());
            if (ar.HasException == false)
            {
                entityList = ParaEntityParser.FillList <T>(ar.XmlReceived);
            }
            entityList.ApiCallResponse = ar;

            var continueCalling = true;

            while (continueCalling)
            {
                if (entityList.TotalItems > entityList.Data.Count)
                {
                    // We still need to pull data
                    // Getting next page's data
                    query.PageNumber = query.PageNumber + 1;

                    ar = ApiCallFactory.ObjectGetList <T>(pc, query.BuildQueryArguments());
                    if (ar.HasException == false)
                    {
                        var objectlist = ParaEntityParser.FillList <T>(ar.XmlReceived);
                        entityList.Data.AddRange(objectlist.Data);
                        entityList.ResultsReturned = entityList.Data.Count;
                        entityList.PageNumber      = query.PageNumber;
                    }
                    else
                    {
                        // There is an error processing request
                        entityList.ApiCallResponse = ar;
                        continueCalling            = false;
                    }
                }
                else
                {
                    // That is it, pulled all the items.
                    continueCalling            = false;
                    entityList.ApiCallResponse = ar;
                }
            }

            return(entityList);
        }
Esempio n. 4
0
        internal static ParaEntityList <ParaObjects.Download> ApiGetDownloadEntityList(ParaCredentials pc, DownloadQuery query)
        {
            var entityList = new ParaEntityList <ParaObjects.Download>();

            // Checking if the system needs to recursively call all of the data returned.
            if (query.RetrieveAllRecords)
            {
                entityList = RetrieveAllDownloadEntities(pc, query);
            }
            else
            {
                var ar = ApiCallFactory.ObjectGetList <ParaObjects.Download>(pc, query.BuildQueryArguments());
                if (ar.HasException == false)
                {
                    entityList = ParaEntityParser.FillListDownload(ar.XmlReceived);
                }
                entityList.ApiCallResponse = ar;
            }

            return(entityList);
        }