示例#1
0
            /// <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="sites"></param>
            /// <param name="includeSeries"></param>
            private SiteInfoResponseType CreateSitesResponse(IEnumerable <SiteInfoType> sites, Boolean includeSeries)
            {
                /* 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;

                response = CuahsiBuilder.CreateASetOfSiteResponses(1, 1);
                List <SiteInfoResponseTypeSite> sitesList =
                    new List <SiteInfoResponseTypeSite>();

                foreach (SiteInfoType site in sites)
                {
                    sitesList.Add(GetSiteInfoOD.CreateSite(site, includeSeries));
                }
                if (sitesList.Count > 0)
                {
                    response.site = sitesList.ToArray();
                }
                else
                {
                    throw new WaterOneFlowException("No Sites found in specified region: ");
                }

                return(response);
            }
            public string GetSources()
            {
                GetSiteInfoOD obj = new GetSiteInfoOD();



                //SiteInfoResponseType resp = obj.GetSites();



                return("");
            }
示例#3
0
            public SiteInfoResponseType GetSites(string[] locationIDs)
            {
                Stopwatch     timer = System.Diagnostics.Stopwatch.StartNew();
                GetSiteInfoOD obj   = new GetSiteInfoOD();


                queryLog2.LogStart(Logging.Methods.GetSites, locationIDs.ToString(),
                                   appContext.Request.UserHostName);

                SiteInfoResponseType resp = obj.GetSites(locationIDs, false);

                queryLog2.LogEnd(Logging.Methods.GetSites,
                                 locationIDs.ToString(),
                                 timer.ElapsedMilliseconds.ToString(),
                                 resp.site.Length.ToString(),
                                 appContext.Request.UserHostName);

                return(resp);
            }
示例#4
0
            public SiteInfoResponseType GetSitesInBox(
                float west, float south, float east, float north,
                Boolean IncludeSeries
                )
            {
                Stopwatch     timer = System.Diagnostics.Stopwatch.StartNew();
                GetSiteInfoOD obj   = new GetSiteInfoOD();

                box queryBox = new box(west, south, east, north);

                queryLog2.LogStart(Logging.Methods.GetSitesInBoxObject, queryBox.ToString(),
                                   appContext.Request.UserHostName);

                SiteInfoResponseType resp = obj.GetSitesByBox(queryBox, IncludeSeries);

                queryLog2.LogEnd(Logging.Methods.GetSitesInBoxObject,
                                 queryBox.ToString(),
                                 timer.ElapsedMilliseconds.ToString(),
                                 resp.site.Length.ToString(),
                                 appContext.Request.UserHostName);
                return(resp);
            }
示例#5
0
            public SiteInfoResponseType GetSiteInfo(string[] locationParameter, Boolean IncludeSeries)
            {
                Stopwatch timer = System.Diagnostics.Stopwatch.StartNew();

                if (locationParameter != null)
                {
                    queryLog2.LogStart(Logging.Methods.GetSiteInfo, locationParameter.ToString(),
                                       appContext.Request.UserHostName);
                }
                else
                {
                    queryLog2.LogStart(Logging.Methods.GetSiteInfo, "NULL",
                                       appContext.Request.UserHostName);
                }
                List <locationParam> lpList = new List <locationParam>();

                try
                {
                    foreach (string s in locationParameter)
                    {
                        locationParam l = new locationParam(s);

                        if (l.isGeometry)
                        {
                            String error = "Location by Geometry not accepted: " + locationParameter;
                            log.Debug(error);
                            throw new WaterOneFlowException(error);
                        }
                        else
                        {
                            lpList.Add(l);
                        }
                    }
                }
                catch (WaterOneFlowException we)
                {
                    log.Error(we.Message);
                    throw;
                }
                catch (Exception e)
                {
                    String error =
                        "Sorry. Your submitted site ID for this getSiteInfo request caused an problem that we failed to catch programmatically: " +
                        e.Message;
                    log.Error(error);
                    throw new WaterOneFlowException(error);
                }
                GetSiteInfoOD        getSiteInfo = new GetSiteInfoOD();
                SiteInfoResponseType resp        = null;

                resp = getSiteInfo.GetSiteInfoResponse(lpList.ToArray(), true);
                foreach (SiteInfoResponseTypeSite site in resp.site)
                {
                    foreach (seriesCatalogType catalog in site.seriesCatalog)
                    {
                        catalog.menuGroupName = serviceName;
                        catalog.serviceWsdl   = serviceUrl;
                    }
                }

                if (locationParameter != null)
                {
                    queryLog2.LogEnd(Logging.Methods.GetSiteInfo,
                                     locationParameter.ToString(),
                                     timer.ElapsedMilliseconds.ToString(),
                                     resp.site.Length.ToString(),
                                     appContext.Request.UserHostName);
                }
                else
                {
                    queryLog2.LogEnd(Logging.Methods.GetSiteInfo,
                                     "NULL",
                                     timer.ElapsedMilliseconds.ToString(),
                                     resp.site.Length.ToString(),
                                     appContext.Request.UserHostName);
                }

                return(resp);
            }
            public SiteInfoResponseType GetSiteInfo(string[] locationParameter, Boolean IncludeSeries)
            {
                Stopwatch timer = System.Diagnostics.Stopwatch.StartNew();
                 if (locationParameter != null)
                {
                    queryLog2.LogStart(Logging.Methods.GetSiteInfo, locationParameter.ToString(),
                                       appContext.Request.UserHostName);
                }
                else
                {
                    queryLog2.LogStart(Logging.Methods.GetSiteInfo, "NULL",
                                       appContext.Request.UserHostName);

                }
                List<locationParam> lpList = new List<locationParam>();
                try
                {
                    foreach (string s in locationParameter)
                    {
                        locationParam l = new locationParam(s);

                        if (l.isGeometry)
                        {
                            String error = "Location by Geometry not accepted: " + locationParameter;
                            log.Debug(error);
                            throw new WaterOneFlowException(error);
                        }
                        else
                        {
                            lpList.Add(l);
                        }
                    }
                }
                catch (WaterOneFlowException we)
                {
                    log.Error(we.Message);
                    throw;
                }
                catch (Exception e)
                {
                    String error =
                        "Sorry. Your submitted site ID for this getSiteInfo request caused an problem that we failed to catch programmatically: " +
                        e.Message;
                    log.Error(error);
                    throw new WaterOneFlowException(error);
                }
                GetSiteInfoOD getSiteInfo = new GetSiteInfoOD();
                SiteInfoResponseType resp = null;
                resp = getSiteInfo.GetSiteInfoResponse(lpList.ToArray(), true);
                foreach (SiteInfoResponseTypeSite site in resp.site)
                {
                    foreach (seriesCatalogType catalog in site.seriesCatalog)
                    {
                        catalog.menuGroupName = serviceName;
                        catalog.serviceWsdl = serviceUrl;
                    }
                }

                if (locationParameter != null)
                {

                    queryLog2.LogEnd(Logging.Methods.GetSiteInfo,
                                     locationParameter.ToString(),
                                     timer.ElapsedMilliseconds.ToString(),
                                     resp.site.Length.ToString(),
                                     appContext.Request.UserHostName);
                }
                else
                {
                    queryLog2.LogEnd(Logging.Methods.GetSiteInfo,
                                   "NULL",
                                   timer.ElapsedMilliseconds.ToString(),
                                   resp.site.Length.ToString(),
                                   appContext.Request.UserHostName);
                }

                return resp;
            }
            public string GetSources()
            {
                GetSiteInfoOD obj = new GetSiteInfoOD();

                //SiteInfoResponseType resp = obj.GetSites();

                return "";
            }
            public SiteInfoResponseType GetSitesInBox(
                float west, float south, float east, float north,
                Boolean IncludeSeries
                )
            {
                Stopwatch timer = System.Diagnostics.Stopwatch.StartNew();
                GetSiteInfoOD obj = new GetSiteInfoOD();

                box queryBox = new box(west, south, east, north);

                queryLog2.LogStart(Logging.Methods.GetSitesInBoxObject, queryBox.ToString(),
                     appContext.Request.UserHostName);

                SiteInfoResponseType resp = obj.GetSitesByBox(queryBox, IncludeSeries);

                queryLog2.LogEnd(Logging.Methods.GetSitesInBoxObject,
                      queryBox.ToString(),
                     timer.ElapsedMilliseconds.ToString(),
                     resp.site.Length.ToString(),
                     appContext.Request.UserHostName);
                return resp;
            }
            public SiteInfoResponseType GetSites(string[] locationIDs)
            {
                Stopwatch timer = System.Diagnostics.Stopwatch.StartNew();
                GetSiteInfoOD obj = new GetSiteInfoOD();

                queryLog2.LogStart(Logging.Methods.GetSites, locationIDs.ToString(),
                    appContext.Request.UserHostName);

                SiteInfoResponseType resp = obj.GetSites(locationIDs, false);

                queryLog2.LogEnd(Logging.Methods.GetSites,
                    locationIDs.ToString(),
                    timer.ElapsedMilliseconds.ToString(),
                    resp.site.Length.ToString(),
                    appContext.Request.UserHostName);

                return resp;
            }