public SiteInfoResponseType GetSites(string[] locationParameters, Boolean includeSeries)
            {
                locationParameters = WSUtils.removeEmptyStrings(locationParameters);

                List <locationParam> siteCodes = new List <locationParam>(locationParameters.Length);

                foreach (String s in locationParameters)
                {
                    locationParam lp = new locationParam(s);
                    siteCodes.Add(lp);
                }
                SiteInfoType[]       sites  = ODSiteInfo.GetSitesByLocationParameters(siteCodes.ToArray());
                SiteInfoResponseType result = CreateSitesResponse(sites, includeSeries);

                if (locationParameters.Length == 0)
                {
                    result.queryInfo = CuahsiBuilder.CreateQueryInfoType("GetSites");
                    NoteType note = CuahsiBuilder.createNote("ALL Sites(empty request)");
                    result.queryInfo.note = CuahsiBuilder.addNote(null, note);
                }
                else
                {
                    result.queryInfo = CuahsiBuilder.CreateQueryInfoType("GetSites", locationParameters, null, null, null, null);
                }
                return(result);
            }
Beispiel #2
0
            public SiteInfoResponseType GetSitesInBox(
                float west, float south, float east, float north,
                Boolean IncludeSeries
                )
            {
                Stopwatch timer = System.Diagnostics.Stopwatch.StartNew();

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

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

                SiteInfoResponseType resp = new SiteInfoResponseType();

                resp.site = WebServiceUtils.GetSitesByBox(queryBox, IncludeSeries);

                //set query info
                resp.queryInfo = CuahsiBuilder.CreateQueryInfoType("GetSitesInBox");
                NoteType note = CuahsiBuilder.createNote("box");

                resp.queryInfo.note = CuahsiBuilder.addNote(null, note);

                queryLog2.LogEnd(CustomLogging.Methods.GetSitesInBoxObject,
                                 queryBox.ToString(),
                                 timer.ElapsedMilliseconds.ToString(),
                                 resp.site.Length.ToString(),
                                 appContext.Request.UserHostName);
                return(resp);
            }
Beispiel #3
0
            public SiteInfoResponseType GetSites(string[] locationIDs)
            {
                Stopwatch timer = System.Diagnostics.Stopwatch.StartNew();

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

                SiteInfoResponseType result = new SiteInfoResponseType();

                result.site = WebServiceUtils.GetSitesFromDb();

                //set query info
                result.queryInfo = CuahsiBuilder.CreateQueryInfoType("GetSites");
                NoteType note = CuahsiBuilder.createNote("ALL Sites(empty request)");

                result.queryInfo.note = CuahsiBuilder.addNote(null, note);

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

                return(result);
            }
            public SiteInfoResponseType GetSiteInfoResponse(locationParam[] LocationParameters, Boolean IncludeSeries)
            {
                SiteInfoResponseType result = createSiteInfoResponse(LocationParameters, IncludeSeries);

                string[] lps = Array.ConvertAll <locationParam, string>(LocationParameters, Convert.ToString);
                //result.queryInfo = CreateQueryInfo(lps);
                result.queryInfo = CuahsiBuilder.CreateQueryInfoType("GetSiteInfo", lps, null, null, null, null);

                return(result);
            }
Beispiel #5
0
            public SiteInfoResponseType GetSiteInfo(string locationParameter)
            {
                string siteId = locationParameter.Substring(locationParameter.LastIndexOf(":") + 1);

                SiteInfoResponseType resp = new SiteInfoResponseType();

                resp.site    = new SiteInfoResponseTypeSite[1];
                resp.site[0] = new SiteInfoResponseTypeSite();
                resp.site[0] = WebServiceUtils.GetSiteFromDb(siteId, true);

                resp.queryInfo = CuahsiBuilder.CreateQueryInfoType("GetSiteInfo", new string[] { locationParameter }, null, null, null, null);

                return(resp);
            }
            public TimeSeriesResponseType GetValuesForSiteVariable(string SiteNumber, string StartDate, string EndDate)
            {
                TimeSeriesResponseType response = new TimeSeriesResponseType();

                response.timeSeries = new List <TimeSeriesType>(
                    GetTimesSeriesTypeForSiteVariable(SiteNumber, StartDate, EndDate)).ToArray();


                response.queryInfo = CuahsiBuilder.CreateQueryInfoType("GetValuesForASite", new string[] { SiteNumber },
                                                                       null, null, StartDate, EndDate);
                CuahsiBuilder.addNote(response.queryInfo.note,
                                      CuahsiBuilder.createNote("AllValuesForASite"));

                return(response);
            }
            public SiteInfoResponseType GetSitesByBox(box queryBox, Boolean includeSeries)
            {
                IEnumerable <SiteInfoType> sites  = ODSiteInfo.GetSitesByBox(queryBox);
                SiteInfoResponseType       result = CreateSitesResponse(sites, includeSeries);

                // result.queryInfo = CreateQueryInfo(new string[] { queryBox.ToString() });
                result.queryInfo = CuahsiBuilder.CreateQueryInfoType("GetSitesByBox");
                CuahsiBuilder.AddQueryInfoParameter(result.queryInfo, "north", queryBox.North.ToString());
                CuahsiBuilder.AddQueryInfoParameter(result.queryInfo, "south", queryBox.South.ToString());
                CuahsiBuilder.AddQueryInfoParameter(result.queryInfo, "east", queryBox.East.ToString());
                CuahsiBuilder.AddQueryInfoParameter(result.queryInfo, "west", queryBox.West.ToString());
                CuahsiBuilder.AddQueryInfoParameter(result.queryInfo, "includeSeries", includeSeries.ToString());

                return(result);
            }
            public TimeSeriesResponseType getValues(string SiteNumber, string Variable, string StartDate, string EndDate)
            {
                // convert dates
                // get site info
                // get site ID
                // return value dataset

                TimeSeriesResponseType response;
                W3CDateTime?           BeginDateTime;
                W3CDateTime?           EndDateTime;
                int?variableId = null;
                int?siteID;

                VariableInfoType varInfoType = null;
                SiteInfoType     siteType    = null;

                BeginDateTime = GetBeginDateTime(StartDate);

                EndDateTime = GetEndDateTime(EndDate);

                VariableParam vp = GetVariableParameter(Variable, ref variableId, ref varInfoType);
                locationParam sq = GetLocationParameter(SiteNumber);

                siteInfoDataSet sitDs = ODSiteInfo.GetSiteInfoDataSet(sq);

                response = CuahsiBuilder.CreateTimeSeriesObjectSingleValue(1);

                if (sitDs != null && sitDs.sites.Count > 0)
                {
                    siteID = sitDs.sites[0].SiteID;
                    ValuesDataSet valuesDs = getValuesDataset(siteID, variableId, BeginDateTime, EndDateTime);

                    response.timeSeries[0].values = getValues(valuesDs, vp, variableId);

                    // above is the values, add the site, and variables
                    response.timeSeries[0].variable = varInfoType;

                    response.timeSeries[0].sourceInfo = ODSiteInfo.row2SiteInfoElement(sitDs.sites[0], sitDs);
                }

                // AddQueryInfo(StartDate, EndDate, Variable, SiteNumber, response);

                response.queryInfo = CuahsiBuilder.CreateQueryInfoType("GetValues",
                                                                       new string[] { SiteNumber }, null, new string[] { Variable }, StartDate, EndDate);

                return(response);
            }
            public VariablesResponseType GetVariableInfo(string Variable)
            {
                VariableInfoType[] variableList;
                if (String.IsNullOrEmpty(Variable))
                {
                    variableList = ODvariables.getVariables(new VariableParam[0], Variables);
                }
                else
                {
                    VariableParam vp;
                    vp           = new VariableParam(Variable);
                    variableList = ODvariables.getVariable(vp, Variables);
                }

                if (variableList == null)
                {
                    throw new WaterOneFlowException("Variable Not Found");
                }
                VariablesResponseType Response = new VariablesResponseType();

                Response.variables = variableList;

                Response.queryInfo = CuahsiBuilder.CreateQueryInfoType("GetVariableInfo", null, null,
                                                                       new string[] { Variable }, null, null);

                if (String.IsNullOrEmpty(Variable))
                {
                    CuahsiBuilder.addNote(Response.queryInfo.note,
                                          CuahsiBuilder.createNote("(Request for all variables"));
                }
                else
                {
                    Response.queryInfo.criteria.variableParam = Variable;
                }
                NoteType sourceNote = CuahsiBuilder.createNote("OD Web Service");

                Response.queryInfo.note = CuahsiBuilder.addNote(Response.queryInfo.note,
                                                                sourceNote);

                return(Response);
            }
Beispiel #10
0
            /// <summary>
            /// GetVariableInfo
            /// </summary>
            /// <param name="VariableParameter">full variable code in format vocabulary:VariableCode</param>
            /// <returns>the VariableInfo object</returns>
            public VariablesResponseType GetVariableInfo(String VariableParameter)
            {
                Stopwatch timer = System.Diagnostics.Stopwatch.StartNew();


                queryLog2.LogStart(CustomLogging.Methods.GetVariables, VariableParameter,
                                   appContext.Request.UserHostName);

                VariablesResponseType resp;

                if (string.IsNullOrEmpty(VariableParameter))
                {
                    resp           = new VariablesResponseType();
                    resp.variables = WebServiceUtils.GetVariablesFromDb();

                    //setup query info
                    resp.queryInfo = CuahsiBuilder.CreateQueryInfoType
                                         ("GetVariableInfo", null, null, new string[] { string.Empty }, null, null);
                    CuahsiBuilder.addNote(resp.queryInfo.note,
                                          CuahsiBuilder.createNote("(Request for all variables"));
                }
                else
                {
                    resp              = new VariablesResponseType();
                    resp.variables    = new VariableInfoType[1];
                    resp.variables[0] = WebServiceUtils.GetVariableInfoFromDb(VariableParameter);
                    //setup query info
                    resp.queryInfo = CuahsiBuilder.CreateQueryInfoType
                                         ("GetVariableInfo", null, null, new string[] { VariableParameter }, null, null);
                }

                queryLog2.LogEnd(CustomLogging.Methods.GetVariables,
                                 VariableParameter,
                                 timer.ElapsedMilliseconds.ToString(),
                                 resp.variables.Length.ToString(),
                                 appContext.Request.UserHostName);


                return(resp);
            }
            public SiteInfoResponseType GetSiteInfoResponse(locationParam locationParameter)
            {
                string Network;
                string SiteCode;

                SiteInfoResponseType result = createSiteInfoResponse(new locationParam[] { locationParameter }, true);

                // put a no result check here

                //result.queryInfo.criteria.locationParam = locationParameter.ToString(); // to string returns orignal string
                result.queryInfo = CuahsiBuilder.CreateQueryInfoType("GetSiteInfo", new string[] { locationParameter.ToString() }, null, null, null, null);
                if (result.site[0].siteInfo != null)
                {
                    result.site[0].siteInfo.siteCode[0].network =
                        System.Configuration.ConfigurationManager.AppSettings["network"];
                }
                else
                {
                    // we only have one site... so throw the exception
                    //  result.queryInfo.note = CuahsiBuilder.addNote(result.queryInfo.note,CuahsiBuilder.createNote("Site not found"));
                    throw new WaterOneFlowException("Site '" + locationParameter.ToString() + "' Not Found");
                }
                return(result);
            }