LOGIN 登錄窗口 簡單測試flex+EF(Asp.Net Entity Framework)+FluorineFx 的組合

 

如果不知道什麼是EF請看[EF(Asp.Net Entity Framework)做爲數據模型框架 與FLEX 的應用]

先看下界面

image

登錄窗口

 

image

密碼錯誤

image

驗證成功

 

LOGIN.mxml


    id="loginRO"
    source="PosServiceLibrary.login"
    destination="fluorine"
    showBusyCursor="true">
   


            import mx.rpc.events.ResultEvent;
        import mx.utils.ObjectUtil;
        import mx.controls.Alert;
        import mx.rpc.events.FaultEvent;
        /* Call the login service*/
        private function logIn():void{       
          //use remote object method setCredentials to
          //enable Flex to send the values required
           loginRO.logout();
            loginRO.loginin(username.text, password.text)
        }
        /*Call logout*/
        private function logOut():void
        {       
            loginRO.logout();
            appViews.selectedChild = loginView;
        }

          /* Display error messages returned */
        private function serverFault(event:FaultEvent):void{
               Alert.show( ObjectUtil.toString(event.fault.faultString), "Error", mx.controls.Alert.OK );
        }
        private function loginResult(event:ResultEvent):void {
            var result:Boolean = event.result as Boolean;
            if (result)         appViews.selectedChild = secureView;
            else
            Alert.show( "密碼錯誤", "Error", mx.controls.Alert.OK );
         }
        private function loginFault(event:FaultEvent):void{
            //Alert.show("Authentication failed", "Errors", mx.controls.Alert.OK);
            Alert.show( ObjectUtil.toString(event.fault), "Authentication failed" );
        }
        private function getSecureDataResult(event:ResultEvent):void {
            var result:String = event.result as String;
        Alert.show(result, "Secure data", mx.controls.Alert.OK);
      }
    ]]>
 

   
 
   
     
       
         
           
         
         
           
         
       
       
         
                        enabled="{(username.text.length == 0 || password.text.length == 0) ? false : true}"
              toolTip="{loginButton.enabled == true ? 'Click to submit' : 'Enter username and password'}"
              click="logIn()" />
       
     
   
 
 
   
     
       
       
       
       
       
     
   
 
 

 

-----------------------------------------------------------------

用了ado.net Entity Data Model

login.cs

using System;
using System.Text;

using System.Collections.Generic;
using System.Linq;
using System.Web;
using FluorineFx;
using System.Data.OleDb;
using System.Data;
using System.Data.Linq;
using PosServiceLibrary.model;

namespace PosServiceLibrary
{
    [RemotingService("Fluorine sample service")]
   public class login
    {
        private posEntities pe = new posEntities();
        public bool loginin(string name, string password)
        {
            var lo = from g in pe.Employees where g.E_NAME == name && g.E_PASSWORD == password select g;
            if (lo.Count()!=0){return true;}else{return false;}
        }

    }
}

相關鏈接 :[Flex與FluorineFx的通信]

 FLEX_riaedu.com 全國最大,資料最全的Ria富媒體 學習交流社區 Riaedu.com

轉載請保留出處: DDV=敵敵畏 www.dplayer.net


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章