public virtual SiteInfoResponseType GetSiteInfoObject(string SiteNumber, String authToken) { Stopwatch timer = System.Diagnostics.Stopwatch.StartNew(); queryLog2.LogStart(Logging.Methods.GetSiteInfo, SiteNumber, Context.Request.UserHostName); try { if (String.IsNullOrEmpty(SiteNumber)) { throw new WaterOneFlowException("Bad Location parameter submitted:'" + SiteNumber + "'"); } List <locationParam> lParams = new List <locationParam>(); //foreach (String site in SiteNumbers) //{ try { locationParam lp = new locationParam(SiteNumber); lParams.Add(lp); } catch { // only one here log.Info("Bad Location parameter submitted:'" + SiteNumber + "'"); throw new WaterOneFlowException("Bad Location parameter submitted:'" + SiteNumber + "'"); } //} if (lParams.Count > 0) { SiteInfoType[] siteList = ODws.GetSites(lParams.ToArray()); SiteInfoResponseType sit = new SiteInfoResponseType(); site[] sites = new site[siteList.Length]; // only one site sites[0] = new site(); sites[0].siteInfo = siteList[0]; // now add series sites[0].seriesCatalog = ODws.GetSeries(lParams[0]); sit.site = sites; queryLog2.LogEnd(Logging.Methods.GetSiteInfo, SiteNumber, timer.ElapsedMilliseconds.ToString(), sit.site.Length.ToString(), Context.Request.UserHostName); return(sit); } else { queryLog2.LogEnd(Logging.Methods.GetSiteInfo, SiteNumber, timer.ElapsedMilliseconds.ToString(), "-9999", Context.Request.UserHostName); throw new WaterOneFlowException("No Valid Site Code submitted"); } } catch (Exception we) { log.Warn(we.Message); queryLog2.LogEnd(Logging.Methods.GetSiteInfo, SiteNumber, timer.ElapsedMilliseconds.ToString(), "-9999", Context.Request.UserHostName); throw SoapExceptionGenerator.WOFExceptionToSoapException(we); } }
//public string GetSitesXml(string[] SiteNumbers, String authToken) //{ // SiteInfoResponseType aSite = GetSites(SiteNumbers, null); // string xml = WSUtils.ConvertToXml(aSite, typeof(SiteInfoResponseType)); // return xml; //} //public virtual string GetSiteInfo(string SiteNumber, String authToken) //{ // SiteInfoResponseType aSite = GetSiteInfoObject(SiteNumber, null); // string xml = WSUtils.ConvertToXml(aSite, typeof(SiteInfoResponseType)); // return xml; //} //public string GetVariableInfo(string Variable, String authToken) //{ // VariablesResponseType aVType = GetVariableInfoObject(Variable, null); // string xml = WSUtils.ConvertToXml(aVType, typeof(VariablesResponseType)); // return xml; //} public SiteInfoResponseType GetSites(string[] SiteNumbers, String authToken) { Stopwatch timer = System.Diagnostics.Stopwatch.StartNew(); queryLog2.LogStart(Logging.Methods.GetSites, SiteNumbers.ToString(), Context.Request.UserHostName); try { List <locationParam> lParams = new List <locationParam>(); foreach (String site in SiteNumbers) { try { if (!String.IsNullOrEmpty(site)) { locationParam lp = new locationParam(site); lParams.Add(lp); } } catch { log.Info("Bad Location parameter submitted"); } } SiteInfoType[] siteList; if (lParams.Count > 0) { siteList = ODws.GetSites(lParams.ToArray()); } else { siteList = ODws.GetSites(null); } SiteInfoResponseType sit = new SiteInfoResponseType(); site[] sites = new site[siteList.Length]; for (int i = 0; i < siteList.Length; i++) { sites[i] = new site(); sites[i].siteInfo = siteList[i]; } sit.site = sites; queryLog2.LogEnd(Logging.Methods.GetSites, SiteNumbers.ToString(), timer.ElapsedMilliseconds.ToString(), sit.site.Length.ToString(), Context.Request.UserHostName); return(sit); } catch (Exception we) { log.Warn(we.Message); queryLog2.LogEnd(Logging.Methods.GetSites, SiteNumbers.ToString(), timer.ElapsedMilliseconds.ToString(), "-9999", Context.Request.UserHostName ); throw SoapExceptionGenerator.WOFExceptionToSoapException(we); } }