protected void Button2_Click(object sender, EventArgs e) { string tot = Request.QueryString["total"]; decimal total = Convert.ToDecimal(tot); Random orderNo = new Random(); if ((TextBox1.Text.Equals("")) || (TextBox2.Text.Equals("")) || (TextBox3.Text.Equals("")) || (TextBox4.Text.Equals("")) || (TextBox5.Text.Equals("")) || (TextBox6.Text.Equals(""))) { Label3.Text = "Please fill in all the fields!"; } else { NewsSvcRef.Service1Client obj = new NewsSvcRef.Service1Client(); string result = obj.cardVerify(TextBox4.Text, DropDownList1.Text); if (result.Equals("Valid Card!")) { int orderNum = orderNo.Next(100000, 999999); string date = System.DateTime.Now.ToString(); LoginRegisterSvcRef.Service1Client obj1 = new LoginRegisterSvcRef.Service1Client(); string r = obj1.addOrder(orderNum, TextBox1.Text, TextBox2.Text, date, total); if (r.Equals("Success")) { Label4.Text = ""; Label5.Text = ""; Label6.Text = ""; Label7.Text = ""; Label8.Text = ""; Label9.Text = ""; Label10.Text = ""; Label11.Text = ""; TextBox1.Visible = false; TextBox2.Visible = false; TextBox3.Visible = false; TextBox4.Visible = false; TextBox5.Visible = false; TextBox6.Visible = false; DropDownList1.Visible = false; Button2.Visible = false; Label2.Text = "Order placed succesfully! Your Order Number is: " + orderNum.ToString() + ". Thank you!"; } else { Label4.Text = ""; Label5.Text = ""; Label6.Text = ""; Label7.Text = ""; Label8.Text = ""; Label9.Text = ""; Label10.Text = ""; Label11.Text = ""; TextBox1.Visible = false; TextBox2.Visible = false; TextBox3.Visible = false; TextBox4.Visible = false; TextBox5.Visible = false; TextBox6.Visible = false; DropDownList1.Visible = false; Button2.Visible = false; Label2.Text = r; } } else { Label3.Text = result; } } }
protected void Button5_Click(object sender, EventArgs e) { if (TextBox1.Text == string.Empty) { Label5.Text = "Please enter a place name!"; Label2.Text = ""; Label3.Text = ""; Label4.Text = ""; Label6.Text = ""; Label7.Text = ""; Label8.Text = ""; Label9.Text = ""; Label10.Text = ""; ListBox1.Visible = false; ListBox2.Visible = false; } else { string city = TextBox1.Text; CityToZipSvcRef.Service1Client obj = new CityToZipSvcRef.Service1Client(); string zip = obj.CityToZip(city); // Label1.Text = zip; WeatherSvcRef.WeatherServ1Client obj1 = new WeatherSvcRef.WeatherServ1Client(); Label5.Text = "Weather For next 5 days: "; string[] days = obj1.Weather5day(zip); ListBox2.Visible = true; ListBox2.Items.Clear(); foreach (string day in days) { ListBox2.Items.Add(day); } NewsSvcRef.Service1Client obj2 = new NewsSvcRef.Service1Client(); Label6.Text = "Latest News URLs: "; string[] urls = obj2.NewsFocus(city); ListBox1.Visible = true; ListBox1.Items.Clear(); foreach (string url in urls) { ListBox1.Items.Add(url); } Uri baseUri = new Uri("http://webstrar13.fulton.asu.edu/page5/ConvService.svc/"); UriTemplate myTemplate = new UriTemplate("zip2lat?zipcode={zipcode}"); Uri completeUri = myTemplate.BindByPosition(baseUri, zip); WebClient proxy = new WebClient(); byte[] abc = proxy.DownloadData(completeUri); Stream strm = new MemoryStream(abc); DataContractSerializer obje = new DataContractSerializer(typeof(string)); string result = obje.ReadObject(strm).ToString(); string[] latlong = result.Split(','); decimal lat = Convert.ToDecimal(latlong[0]); decimal lng = Convert.ToDecimal(latlong[1]); NatHazSvcRef.NatHazService1Client obj3 = new NatHazSvcRef.NatHazService1Client(); Label7.Text = "Number of Natural Hazards in the past: "; Label2.Text = obj3.NaturalHazards(lat, lng).ToString(); SolarWindSvcRef.Service1Client obj4 = new SolarWindSvcRef.Service1Client(); Label8.Text = "Solar and Wind Intensity: "; Label3.Text = obj4.getSolarEnergy(lat, lng).ToString(); Label9.Text = "kWh/m2/day"; Label4.Text = obj4.getWindEnergy(lat, lng).ToString(); Label10.Text = "m/s"; HttpCookie myCookies = Request.Cookies["details"]; if (myCookies == null) { Label11.Text = "Login or register to find latest travel packages available for this place!"; } } }