| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- package com.imt.intimamedia.commands.user
- {
- import com.adobe.cairngorm.control.CairngormEvent;
- import com.fnicollet.toaster.Toaster;
- import com.imt.flex.cairngormExtended.command.SuperCommand;
- import com.imt.intimamedia.business.UserDelegate;
- import com.imt.intimamedia.events.user.ValidateAccountEvent;
- import com.imt.intimamedia.model.ApplicationModelLocator;
- import com.imt.intimamedia.views.common.ImtToaster;
- import com.imt.intimamedia.views.general.register.RegisterView;
- import com.imt.intimamedia.vo.ReturnObjectVo;
- import com.imt.intimamedia.vo.UserVo;
-
- import flash.external.ExternalInterface;
-
- import mx.controls.Alert;
- import mx.resources.ResourceManager;
- import mx.rpc.events.FaultEvent;
- import mx.rpc.events.ResultEvent;
- import com.imt.intimamedia.views.IntimaMedia;
-
- /**
- * Commande d'enregistrement d'un utilisateur
- */
- public class ValidateAccountCommand extends SuperCommand
- {
- private var _dispatcher : IntimaMedia;
-
- /**
- * Excecution de la commande
- *
- * @param event Evénement de type CairngormEvent
- * @return void
- */
- override public function execute( event : CairngormEvent ) : void
- {
- super.execute( event );
-
- var delegate : UserDelegate = new UserDelegate( this );
-
- var validateEvent : ValidateAccountEvent = ValidateAccountEvent( event );
-
- delegate.validateAccount( validateEvent.userId, validateEvent.password );
-
- _dispatcher = this.getDispatcher(this);
- }
-
- /**
- * Résultat de la commande
- *
- * @param result Un objet
- * @return void
- */
- override public function result( result : Object ) : void
- {
- _dispatcher.displayValidateAccount();
- }
-
- /**
- * Résultat de la commande
- *
- * @param result Un objet
- * @return void
- */
- override public function fault( fault : Object ) : void
- {
- super.fault( fault );
-
- if (( fault as FaultEvent ).fault.faultString != ApplicationModelLocator.getInstance().ACCOUNT_ALREADY_CONFIRMED )
- {
- var toastMessage : ImtToaster = new ImtToaster();
-
- toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'error.title');
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'error.validate');
- toastMessage.level = ImtToaster.ERROR;
-
- ApplicationModelLocator.getInstance().toaster.toast( toastMessage );
- }
- }
- }
- }
|