private void AddFeed() { BTBWeatherFeedInfo objBTBYahooWeather = new BTBWeatherFeedInfo(); BTBWeatherFeedController objCtlBTBYahooWeather = new BTBWeatherFeedController(); //load info object with relavent data objBTBYahooWeather.WeatherId = ItemId; objBTBYahooWeather.ModuleId = ModuleId; BTBWeatherFeedController.TemperatureScale tempScale; if (rbTempC.Checked) { tempScale = BTBWeatherFeedController.TemperatureScale.Celsius; } else { tempScale = BTBWeatherFeedController.TemperatureScale.Fahrenheit; } objBTBYahooWeather.Url = objCtlBTBYahooWeather.CreateFeedUrl(txtFeedCode.Text, tempScale); objBTBYahooWeather.WeatherId = DataProvider.AddBTBWeatherFeed(objBTBYahooWeather); objCtlBTBYahooWeather.UpdateWeatherFeed(objBTBYahooWeather, this.PortalSettings, this.ModuleConfiguration); }
private void ValidateFeedsHaveLocationName(IEnumerable <BTBWeatherFeedInfo> feeds) { //if we find a feeds without a name, this could becuase we //have just converted to 1.1 of the app or have imported //existing weather content, therefore the feed hasnt be parsed //to generate the location name BTBWeatherFeedController controller = new BTBWeatherFeedController(); foreach (BTBWeatherFeedInfo feed in feeds) { if (feed.LocationName == Null.NullString) { controller.UpdateWeatherFeed(feed, PortalSettings, ModuleConfiguration); } } }
protected void DisplayFeed(BTBWeatherFeedInfo info) { //check if we have a transformed feed or the item has expired from cache if (info != null) { if (string.IsNullOrEmpty(info.TransformedFeed) | info.CachedDate < DateTime.Now | string.IsNullOrEmpty(info.LocationName)) { BTBWeatherFeedController controller = new BTBWeatherFeedController(); controller.UpdateWeatherFeed(info, this.PortalSettings, this.ModuleConfiguration); } else if (ModuleSettings.RenderEngine == BTBYahooWeatherSettings.TemplateEngine.Razor) { //if we are usig razor always update the html since we may have logic in the //cshtml which is doing something and needs to render the html different and //not just display the cached version BTBWeatherFeedController controller = new BTBWeatherFeedController(); controller.RenderRssData(info, this.ModuleConfiguration); } litOutput.Text = info.TransformedFeed; } }