private function insertErrorResult(event:SQLErrorEvent):void{
Alert.show("数据插入失败!","提示");
Alert.show(event.error.message);
Alert.show(event.error.details);
}
private function addNewCus():void{
mainBox.selectedChild=addBox;
}
private function returnMain():void{
editObj=null;
MyLoveContact(this.parentApplication).gotoMain();
}
private function returnList():void{
editObj=null;
mainBox.selectedChild=listBox;
}
private function chooseFiles():void{
file.browseForOpen("选择文件",fileFilter);
}
public function editCus():void{//编辑客户信息
editObj=myDg.selectedItem;
mainBox.selectedChild=addBox;
}
public function deleteCus():void{//删除客户信息
Alert.show("您确定要删除该客户信息吗?","提示",Alert.OK|Alert.CANCEL,this,deleteHandler);
}
private function deleteHandler(event:CloseEvent):void{
var cusId:String=myDg.selectedItem.customer_id;
if(event.detail==Alert.OK){
stat=new SQLStatement();
stat.sqlConnection=conn;
stat.text="delete from ql_customer where customer_id=? ";
stat.parameters[0]=cusId;
stat.addEventListener(SQLEvent.RESULT,deleteResult);
stat.execute();
}
}
private function deleteResult(event:SQLEvent):void{
queryList();
Alert.show("删除成功!","提示");
}
public function viewImg():void{
var imgUrl:String=myDg.selectedItem.img_url;
if(imgUrl!=null&&imgUrl!=""){
var window:PriviewImageWindow=PopUpManager.createPopUp(MyLoveContact(this.parentApplication),PriviewImageWindow,true) as PriviewImageWindow;
window.imgUrl=imgUrl;
PopUpManager.centerPopUp(window);
}
}
]]>
</mx:Script>
Alert.show("数据插入失败!","提示");
Alert.show(event.error.message);
Alert.show(event.error.details);
}
private function addNewCus():void{
mainBox.selectedChild=addBox;
}
private function returnMain():void{
editObj=null;
MyLoveContact(this.parentApplication).gotoMain();
}
private function returnList():void{
editObj=null;
mainBox.selectedChild=listBox;
}
private function chooseFiles():void{
file.browseForOpen("选择文件",fileFilter);
}
public function editCus():void{//编辑客户信息
editObj=myDg.selectedItem;
mainBox.selectedChild=addBox;
}
public function deleteCus():void{//删除客户信息
Alert.show("您确定要删除该客户信息吗?","提示",Alert.OK|Alert.CANCEL,this,deleteHandler);
}
private function deleteHandler(event:CloseEvent):void{
var cusId:String=myDg.selectedItem.customer_id;
if(event.detail==Alert.OK){
stat=new SQLStatement();
stat.sqlConnection=conn;
stat.text="delete from ql_customer where customer_id=? ";
stat.parameters[0]=cusId;
stat.addEventListener(SQLEvent.RESULT,deleteResult);
stat.execute();
}
}
private function deleteResult(event:SQLEvent):void{
queryList();
Alert.show("删除成功!","提示");
}
public function viewImg():void{
var imgUrl:String=myDg.selectedItem.img_url;
if(imgUrl!=null&&imgUrl!=""){
var window:PriviewImageWindow=PopUpManager.createPopUp(MyLoveContact(this.parentApplication),PriviewImageWindow,true) as PriviewImageWindow;
window.imgUrl=imgUrl;
PopUpManager.centerPopUp(window);
}
}
]]>
</mx:Script>