private void ChangeTemperatureScale() { //remove the cached transformation and set the url to //the correct one for the new unit of temperature BTBWeatherFeedController.TemperatureScale tempScale; var controller = new BTBWeatherFeedController(); if (rbTempC.Checked) { tempScale = BTBWeatherFeedController.TemperatureScale.Celsius; } else { tempScale = BTBWeatherFeedController.TemperatureScale.Fahrenheit; } var feeds = DataProvider.GetBTBWeatherFeedByModule(ModuleId); foreach (BTBWeatherFeedInfo info in feeds) { info.TransformedFeed = null; info.Url = controller.CreateFeedUrl(controller.ExtractWeatherCodeFromUrl(info.Url), tempScale); DataProvider.UpdateBTBWeatherFeed(info); } }
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); }