Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Web.Services;
- using System.Xml;
- using System;
- [WebService(Namespace = "http://tempuri.org/")]
- [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
- // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
- // [System.Web.Script.Services.ScriptService]
- public class Service : WebService
- {
- webservicex.airport wsx;
- feetoToMeters.lengthUnit ftm;
- public Service()
- {
- //Uncomment the following line if using designed components
- //InitializeComponent();
- wsx = new webservicex.airport();
- ftm = new feetoToMeters.lengthUnit();
- }
- [WebMethod]
- public string PridobiLetalisca(string drzava)
- {
- return wsx.GetAirportInformationByCountry(drzava);
- }
- //Začasno string, kasneje verjetno objekt
- [WebMethod]
- public string PridobiInformacije(string koda)
- {
- string info = wsx.getAirportInformationByAirportCode(koda);
- string dolzinaSteze = "";
- string nadmVisina = "";
- XmlDocument xd = new XmlDocument();
- xd.LoadXml(info);
- XmlNodeList xnl = xd.SelectNodes("/NewDataSet/Table");
- foreach (XmlNode xn in xnl)
- {
- dolzinaSteze = PretvoriVMetre(xn["RunwayLengthFeet"].InnerText);
- nadmVisina = PretvoriVMetre(xn["RunwayElevationFeet"].InnerText);
- }
- return dolzinaSteze + ", " + nadmVisina;
- //return wsx.getAirportInformationByAirportCode(koda);
- }
- [WebMethod]
- string PretvoriVMetre(string feet)
- {
- //Poklče funkcijo ChangeLenghtUnit, ki jo nudi storitev webservicex.lengthUnit
- return Math.Round(ftm.ChangeLengthUnit(double.Parse(feet), feetoToMeters.Lengths.Feet, feetoToMeters.Lengths.Meters)).ToString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement