/// <summary> /// createSiteInfoResponse populates a SiteInfoResponseType. /// It is used the webmethod getSiteInfo. /// designed for multiple site codes /// This method will be slow if the information has never been cached. /// </summary> /// <param name="LocationParams"></param> private SiteInfoResponseType CreateSitesResponse(locationParam[] LocationParams) { /* for each site code, add a siteInfo type with a period of record * // for each site * createSitInfoType * add to response * createPeriodOfRecord * add to response * return response * */ SiteInfoResponseType response; SiteInfoType[] sites = ODSiteInfo.GetSitesByLocationParameters(LocationParams); if (sites.Length == 0) { throw new WaterOneFlowException("No Sites found"); } response = CuahsiBuilder.CreateASetOfSiteResponses(sites.Length, 1); for (int i = 0; i < sites.Length; i++) { response.site[i].siteInfo = sites[i]; String aSiteID = response.site[i].siteInfo.siteCode[0].siteID; // no period of record } return(response); }
private SiteInfoType getSiteInfoType(locationParam LocationParameter) { SiteInfoType sit; // look in memory // sit = (SiteInfoType)appCache[sitCache + siteCode]; // if (sit != null) return sit; //ok, try the database SiteInfoType[] sites = ODSiteInfo.GetSitesByLocationParameters(new locationParam[] { LocationParameter }); if (sites == null || sites.Length == 0) { return(null); } else if (sites != null && sites.Length == 1) { return(sites[0]); } else { // had better be only one String error = "More than one site with SiteCode '" + LocationParameter + "'"; log.Error(error); throw new WaterOneFlowException(error); } return(sit); }