/// <summary> /// Fills a Role list object /// </summary> /// <param name="creds"></param> /// <param name="query"></param> /// <param name="module"></param> /// <param name="entity"></param> /// <returns></returns> internal static ParaEntityList <TEntity> ApiGetEntityList <TModule, TEntity>(ParaCredentials creds, ParaQuery query) where TModule : ParaEntity where TEntity : ParaEntityBaseProperties { var rolesList = new ParaEntityList <TEntity>(); var ar = ApiCallFactory.ObjectSecondLevelGetList <TModule, TEntity>(creds, query.BuildQueryArguments()); if (ar.HasException == false) { //...Customer/status is sending "entities" not "Entities", which breaks the parser. Unwind and fix the XML var xmlStr = ar.XmlReceived.OuterXml; if (xmlStr.Contains("<entities")) { xmlStr = xmlStr.Replace("<entities", "<Entities"); xmlStr = xmlStr.Replace("entities>", "Entities>"); ar.XmlReceived = ParseXmlDoc(xmlStr); } rolesList = ParaEntityParser.FillList <TEntity>(ar.XmlReceived); } rolesList.ApiCallResponse = ar; // Checking if the system needs to recursively call all of the data returned. if (query.RetrieveAllRecords) { var continueCalling = true; while (continueCalling) { if (rolesList.TotalItems > rolesList.Data.Count) { // We still need to pull data // Getting next page's data query.PageNumber = query.PageNumber + 1; ar = ApiCallFactory.ObjectSecondLevelGetList <TModule, TEntity>(creds, query.BuildQueryArguments()); var objectlist = ParaEntityParser.FillList <TEntity>(ar.XmlReceived); if (objectlist.Data.Count == 0) { continueCalling = false; } rolesList.Data.AddRange(objectlist.Data); rolesList.ResultsReturned = rolesList.Data.Count; rolesList.PageNumber = query.PageNumber; } else { // That is it, pulled all the items. continueCalling = false; rolesList.ApiCallResponse = ar; } } } return(rolesList); }
/// <summary> /// Get the List of views from within your Parature license /// </summary> /// <typeparam name="TParentEntity"></typeparam> /// <typeparam name="TEntity"></typeparam> /// <param name="query"></param> /// <returns></returns> public ParaEntityList <TEntity> GetList <TParentEntity, TEntity>(ParaQuery query) where TEntity : ParaEntityBaseProperties, new() where TParentEntity : ParaEntity { if (!(query.QueryTargetType == typeof(TEntity))) { throw new ArgumentException("Inavlid query type for the requested entity result type", "query"); } return(ApiUtils.ApiGetEntityList <TParentEntity, TEntity>(Credentials, query)); }
public OptimizationResult(OptimizationResult optResult) { Query = optResult.Query; objectList = optResult.objectList; apiResponse = new ApiCallResponse(optResult.apiResponse); }