Sha256: ed282e9704ee39ba408b5965ae6fe11ccc0511398b7d304124c17f159df9beeb

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

package org.rsos.openbill.command
{
	/* add to controller
	addCommand( LoginEvent.EVENT_LOGIN, LoginCommand );
	*/
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.adobe.cairngorm.commands.ICommand;

	import org.rsos.openbill.model.OpenbillModelLocator;
	import org.rsos.openbill.business.RailsDelegate;
	import org.rsos.openbill.event.LoginEvent;

	import mx.controls.Alert;
	import mx.rpc.IResponder;
	import mx.rpc.events.FaultEvent;
	
	import mx.core.Application;

	public class LoginCommand implements ICommand, IResponder
	{
		public function execute(event:CairngormEvent):void
		{
		    var delegate : RailsDelegate = new RailsDelegate( this )
		 
		    delegate.login(LoginEvent(event).userVO)

		}
		
		public function result(data:Object):void
		{
			var model : OpenbillModelLocator = OpenbillModelLocator.getInstance();
			model.userVO = model.GetUserVOFromXML(XML(data.result));
			if(model.userVO.id > 0)
			{
				model.dologin();
			}
			else
			{
				model.askforlogin(Application.application)
			}
		}
		
		public function fault(info:Object):void
		{
			var faultEvent :FaultEvent = FaultEvent( info );
			Alert.show( "fault at login" );
			var model : OpenbillModelLocator = OpenbillModelLocator.getInstance();
			model.askforlogin(Application.application)
		}
		
	}
}

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
smukherjee-openbill-0.1.5 src/org/rsos/openbill/command/LoginCommand.as
smukherjee-openbill-0.1.6 src/org/rsos/openbill/command/LoginCommand.as
smukherjee-openbill-0.1.7 src/org/rsos/openbill/command/LoginCommand.as
openbill-0.1.5 src/org/rsos/openbill/command/LoginCommand.as
openbill-0.1.6 src/org/rsos/openbill/command/LoginCommand.as