37 lines
1.2 KiB
Java
37 lines
1.2 KiB
Java
package com.tenwa.customer.handler.comm;
|
|
|
|
|
|
import jbo.app.tenwa.customer.CUSTOMER_ATTRIBUTION;
|
|
|
|
import com.amarsoft.are.jbo.BizObject;
|
|
import com.amarsoft.are.jbo.BizObjectManager;
|
|
import com.amarsoft.are.jbo.JBOFactory;
|
|
import com.amarsoft.awe.dw.handler.impl.CommonHandler;
|
|
|
|
public class CustomerAttributionHandler extends CommonHandler{
|
|
|
|
@Override
|
|
protected void initDisplayForAdd(BizObject bo) throws Exception {
|
|
String customerId=this.asPage.getAttribute("customerId").toString();
|
|
bo.setAttributeValue("customerid",customerId);
|
|
}
|
|
|
|
@Override
|
|
protected boolean validityCheck(BizObject bo, boolean isInsert) {
|
|
try {
|
|
String customerid=bo.getAttribute("customerid").toString();
|
|
String userid=bo.getAttribute("userid").toString();
|
|
BizObjectManager bm=JBOFactory.getFactory().getManager(CUSTOMER_ATTRIBUTION.CLASS_NAME);
|
|
BizObject attr=bm.createQuery("customerid=:customerid and userid=:userid").setParameter("customerid", customerid).setParameter("userid", userid).getSingleResult(false);
|
|
if(attr!=null){
|
|
this.errors="²»ÄÜÖØ¸´Ìí¼Ó¹éÊôÈË£¡";
|
|
return false;
|
|
}
|
|
} catch (Exception e) {
|
|
|
|
}
|
|
return super.validityCheck(bo, isInsert);
|
|
}
|
|
|
|
}
|