<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#A2C6CE, #E8F1B7]">

<mx:Script>
	<![CDATA[
		import mx.controls.Text;
		import mx.controls.Alert;
		import mx.messaging.AbstractConsumer;
		import mx.rpc.events.FaultEvent;
		import mx.rpc.events.ResultEvent;
		[Bindable]
		private var result:String=new String;
		
		public function getdata(event:ResultEvent):void
		{
		if(result=="True")
		{
			Alert.show("Country Details Inserted..");
		}	
		else
		if(result=="False")
		{
			Alert.show("Insertion Failed...");
		}
		}
		public function fault(event:FaultEvent):void
		{}
		public function addcountry():void
		{
			result = HolidayTripWebService.InsertCountry(Cname.text,Desc.text);
		}
		
		public function Home():void
		{
			var url:URLRequest=new URLRequest("AdminHome.html");
			navigateToURL(url,"_self");
		}
		
		public function Logout():void
		{
			var url:URLRequest=new URLRequest("Login.html");
			navigateToURL(url,"_self");
		}
	]]>
</mx:Script>

<mx:WebService 
		id="HolidayTripWebService" 
		wsdl="http://localhost:50854/HTWS/Service.asmx?wsdl"
		showBusyCursor="true">
		<mx:operation name="AddCountry" resultFormat="object" result="getdata(event)">
        </mx:operation>
</mx:WebService>


	<mx:Label x="297" y="66" text="Add Country" fontFamily="Courier New" fontSize="25" fontWeight="bold" fontStyle="italic" color="#823824"/>
	<mx:Button x="323" y="347" label="Submit" fillAlphas="[1.0, 1.0]" fillColors="[#C54242, #CFB3B3]" width="67" height="28" cornerRadius="20" click="addcountry()"/>
	<mx:Text x="217" y="182" text="Country Name:" fontSize="13" fontWeight="bold"/>
	<mx:Text x="217" y="259" text="Description:&#xa;" fontSize="13" fontWeight="bold"/>
	<mx:TextInput x="357" y="183" id="Cname"/>
	<mx:TextArea x="357" y="237" id="Desc"/>
	<mx:Button x="768" y="50" label="Home" width="61" height="23" fillAlphas="[1.0, 1.0]" fillColors="[#C54242, #CFB3B3]" cornerRadius="20" click="Home()"/>
	<mx:Button x="898" y="50" label="Logout" width="75" height="23" fillAlphas="[1.0, 1.0]" fillColors="[#C54242, #CFB3B3]" cornerRadius="20" click="Logout()"/>
	
</mx:Application>
