package com.tenwa.reckon.help; import jbo.app.tenwa.calc.LC_CALC_CONDITION; import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.BizObjectManager; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.tenwa.comm.util.jboutil.DataOperatorUtil; import com.tenwa.reckon.bean.ConditionBean; import com.tenwa.reckon.bean.TabCalBean; public class AdjustInterestDaoUtil { public JBOTransaction tx; public AdjustInterestDaoUtil(JBOTransaction tx){ this.tx=tx; } public void delete(TabCalBean tcb,String tableName) throws Exception{ BizObjectManager bm=JBOFactory.getBizObjectManager(tableName, this.tx); bm.createQuery("delete from O where "+tcb.getPlanCName()+"='"+tcb.getPlanCValue()+"' and flowunid='"+tcb.getDocId()+"'").executeUpdate(); } public void addCondition(ConditionBean cb,TabCalBean tcb) throws Exception{ BizObjectManager bm=JBOFactory.getBizObjectManager(tcb.getCondition_tb(),tx); BizObject condition=JBOFactory.createBizObjectQuery(LC_CALC_CONDITION.CLASS_NAME,"payment_number=:paymentnumber").setParameter("paymentnumber",tcb.getPlanCValue()).getSingleResult(false); BizObject cond=bm.newObject(); DataOperatorUtil.coptyJBOPropertyNoKey(condition, cond); cond.setAttributeValue("YEAR_RATE",cb.getYearRate()); cond.setAttributeValue("IRR", cb.getIrr()); cond.setAttributeValue("flowunid",tcb.getDocId()); bm.saveObject(cond); } public JBOTransaction getTx() { return tx; } public void setTx(JBOTransaction tx) { this.tx = tx; } }