public List <GeographicalRegion> GetRegions() { int iteratorId = 0; List <long> ids = new List <long>(); List <GeographicalRegion> regions = new List <GeographicalRegion>(); try { int numberOfResources = 500; int resourcesLeft = 0; List <ModelCode> properties = modelResourcesDesc.GetAllPropertyIds(ModelCode.REGION); iteratorId = GdaQueryProxy.GetExtentValues(ModelCode.REGION, properties); resourcesLeft = GdaQueryProxy.IteratorResourcesLeft(iteratorId); while (resourcesLeft > 0) { List <ResourceDescription> rds = GdaQueryProxy.IteratorNext(numberOfResources, iteratorId); for (int i = 0; i < rds.Count; i++) { var rg = GdaQueryProxy.GetValues(rds[i].Id, properties); GeographicalRegion geographicalRegion = new GeographicalRegion(rds[i].Id); regions.Add(geographicalRegion.ConvertFromRD(rg)); } resourcesLeft = GdaQueryProxy.IteratorResourcesLeft(iteratorId); } GdaQueryProxy.IteratorClose(iteratorId); CommonTrace.WriteTrace(CommonTrace.TraceError, "Getting extent values method successfully finished."); } catch (Exception e) { string message = string.Format("Getting extent values method failed for {0}.\n\t{1}", ModelCode.REGION, e.Message); Console.WriteLine(message); CommonTrace.WriteTrace(CommonTrace.TraceError, message); } return(regions); }
public GeographicalRegion GetRegionByGid(long gid) { GeographicalRegion syncMachine = null; try { List <ModelCode> properties = modelResourcesDesc.GetAllPropertyIds(ModelCode.REGION); ResourceDescription rd = GdaQueryProxy.GetValues(gid, properties); syncMachine = new GeographicalRegion(rd.Id); syncMachine.ConvertFromRD(rd); CommonTrace.WriteTrace(CommonTrace.TraceError, "Getting extent values method successfully finished."); } catch (Exception e) { string message = string.Format("Getting extent values method failed for {0}.\n\t{1}", ModelCode.REGION, e.Message); Console.WriteLine(message); CommonTrace.WriteTrace(CommonTrace.TraceError, message); } return(syncMachine); }