Пример #1
0
        public static long getDownloadsCountByFolder(ParaCredentials creds, long folderID)
        {
            var downloadQuery = new DownloadQuery();

            downloadQuery.TotalOnly = true;
            downloadQuery.AddStaticFieldFilter(DownloadQuery.DownloadStaticFields.Folder, ParaEnums.QueryCriteria.Equal, folderID.ToString());

            var downloads = Service.GetList <Download>(downloadQuery);

            if (downloads.ApiCallResponse.HasException)
            {
                throw new Exception(downloads.ApiCallResponse.ExceptionDetails);
            }

            return(downloads.TotalItems);
        }
Пример #2
0
        public static List <ParatureSDK.ParaObjects.Download> getDownloadsByFolder(ParaCredentials creds, long folderID)
        {
            var downloadQuery = new DownloadQuery();

            downloadQuery.RetrieveAllRecords = true;
            downloadQuery.AddStaticFieldFilter(DownloadQuery.DownloadStaticFields.Folder, ParaEnums.QueryCriteria.Equal, folderID.ToString());

            var downloads = Service.GetList <Download>(downloadQuery);

            if (downloads.ApiCallResponse.HasException)
            {
                throw new Exception(downloads.ApiCallResponse.ExceptionDetails);
            }

            return(downloads.ToList());
        }
Пример #3
0
        private static ParaEntityList <ParaObjects.Download> RetrieveAllDownloadEntities(ParaCredentials pc, DownloadQuery query)
        {
            ApiCallResponse ar;
            var             downloadList = new ParaEntityList <ParaObjects.Download>();

            ar = ApiCallFactory.ObjectGetList <ParaObjects.Download>(pc, query.BuildQueryArguments());
            if (ar.HasException == false)
            {
                downloadList = ParaEntityParser.FillListDownload(ar.XmlReceived);
            }
            downloadList.ApiCallResponse = ar;

            var continueCalling = true;

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

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

            return(downloadList);
        }
Пример #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);
        }