AIR版的通讯簿(九)

 CustomerManagePage.mxml页面内容(1)

?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" paddingTop="5" 
 paddingLeft="2" paddingRight="2" creationComplete="init()">
 <mx:Script>
  <![CDATA[
   import mx.events.CloseEvent;
   import mx.managers.PopUpManager;
   import mx.collections.ArrayCollection;
   import mx.controls.Alert;
   import mx.core.WindowedApplication;
   public  var conn:SQLConnection;
   private var stat:SQLStatement;
   private var file:File;
   [Bindable]private var fileFilter:Array=[new FileFilter("图片文件(*.jpg,*.bmp,*.gif,*,png)",("*.jpg;*.bmp;*.gif;*.png)"))];
   [Bindable]private var dataList:ArrayCollection=new ArrayCollection();
   [Bindable]private var editObj:Object;
   private function init():void{
    file=new File();
    file.addEventListener(Event.SELECT,selectFileHandler);
    queryList();
   }
   private function queryList():void{
    dataList.removeAll();
    stat=new SQLStatement();
    stat.sqlConnection=conn;
    var sql:String=" select * from ql_customer where 1=1";
    if(queryName.text!=null&&queryName.text!=""){
     sql+=" and customer_name like '%"+queryName.text+"%'";
    }
    if(queryPhone.text!=null&&queryPhone.text!=""){
     sql+="and customer_mobile like '%"+queryPhone.text+"%'";
    }
    stat.text=sql;
    stat.execute(-1,new Responder(getCusList,errorHandler));
   }
   private function getCusList(result:SQLResult):void{
    if(result.data!=null){
     var numResults:int =result.data.length;
     for (var i:int = 0; i < numResults; i++){
             var row:Object = result.data[i];
             dataList.addItem(row);
         }
    }
   }
   private function errorHandler(error:SQLError):void{
    Alert.show("查询客户列表出错");
    Alert.show(error.details);
   }

你可能感兴趣的:(AIR版的通讯簿(九))