Ejemplo n.º 1
0
        protected override string GetUrl()
        {
            List <string> lst = new List <string>();

            if (this.Keywords != null)
            {
                lst.AddRange(this.Keywords);
            }
            if (lst.Count > 0)
            {
                System.Text.StringBuilder idSearch = new System.Text.StringBuilder("query in (");
                for (int i = 0; i <= lst.Count - 1; i++)
                {
                    idSearch.Append('"');
                    idSearch.Append(lst[i]);
                    idSearch.Append('"');
                    if (i != lst.Count - 1)
                    {
                        idSearch.Append(',');
                    }
                }
                idSearch.Append(")");

                System.Text.StringBuilder feedSearch = new System.Text.StringBuilder("location in (");
                feedSearch.Append(MyHelper.YqlStatement("id", "weather.search", idSearch.ToString(), null));
                feedSearch.Append(") and ");
                WeatherFeedDownload.MetricOption(feedSearch, this.IsMetric);

                return(MyHelper.YqlUrl("*", "weather.forecast", feedSearch.ToString(), this, false));
            }
            else
            {
                throw new ArgumentException("There must be minimum one keyword.", "keywords");
            }
        }
Ejemplo n.º 2
0
        protected override string GetUrl()
        {
            List <LocationIDData> lst = new List <LocationIDData>();

            if (this.Locations != null)
            {
                lst.AddRange(this.Locations);
            }
            if (lst.Count > 0)
            {
                System.Text.StringBuilder whereClause = new System.Text.StringBuilder();
                whereClause.Append("location in (");
                for (int i = 0; i <= lst.Count - 1; i++)
                {
                    whereClause.Append('"');
                    whereClause.Append(lst[i].ID);
                    whereClause.Append('"');
                    if (i != lst.Count - 1)
                    {
                        whereClause.Append(',');
                    }
                }
                whereClause.Append(") and ");
                WeatherFeedDownload.MetricOption(whereClause, this.IsMetric);

                return(MyHelper.YqlUrl("*", "weather.forecast", whereClause.ToString(), null, false));
            }
            else
            {
                throw new ArgumentException("There must be minimum one location.", "locations");
            }
        }