private void SubmitButton_Click(object sender, EventArgs e) { WeatherData displayWD = new WeatherData(); displayWD.SetZip(this.userZipBox = zipBox.Text); ObtainUserInformation oui = new ObtainUserInformation((displayWD.GetZip()), (displayWD.GetDate()), sender); displayWD.SetDate(oui.DateFormatter(this.userDateBox = dateBox.Text)); if (oui.ValidateZipInput(displayWD.GetZip()) == false) { displayBox.AppendText("Sorry, that is an invalid zip code."); } else { string[] rawAirportData = oui.DivideAirportsByNewLine(oui.ObtainRawAirportData()); displayWD.SetIcao(oui.ParseForK(oui.ObtainICAOCode(rawAirportData))); ObtainWeatherData owd = new ObtainWeatherData(displayWD, sender); // displayBox.AppendText("Width: " + displayWD.GetWeatherDataWidth() + "\tLength: " + displayWD.GetWeatherDataLength()); for (int i = 0; i < displayWD.GetWeatherDataLength(); i++) { displayBox.AppendText(owd.GetWeatherRow(displayWD, i)); } } //displayBox.AppendText(owd.GetAllWeatherData(dd.SendWeatherData(), sender)); }
private string getWeatherURL(WeatherData wd) { return(@"http://api.wunderground.com/history/airport/" + wd.GetIcao() + "/" + wd.GetDate() + "/DailyHistory.html?reqdb.zip=" + wd.GetZip()); }
private string VerifyUserZip() { try { string splitJsonData = FormatRawWebDataFromURL(MainClass.DownloadWebData(GetZipCodeURL(wd.GetZip()))); OnlineZipStructure account = JsonConvert.DeserializeObject <OnlineZipStructure>(splitJsonData); return(account.placeName + ", " + account.stateAbbreviation); } catch (Exception e) { MainClass.Quitter("" + e, "Unable to deserialize zip code."); } return("Failure"); }