/**
 * @(#)file    ChgItemBiz.java
 * @(#)author  Kim Myung Ho
 * @(#)version 1.0
 * @(#)date    2014-08-11
 * @(#)since   JDK 1.4.2
 */
package kr.co.udapsoft.ebid.buyer.cont.purchase.biz;


import java.sql.Connection;

import kr.co.hsnc.common.base.WAFLogger;
import kr.co.hsnc.common.sql.RowSet;
import kr.co.hsnc.common.sql.RowSetImpl;
import kr.co.hsnc.common.sql.WAFSQLException;
import kr.co.hsnc.common.sql.persistent.Persistent;
import kr.co.hsnc.common.sql.persistent.PersistentImpl;
import kr.co.hsnc.common.sql.search.Search;
import kr.co.hsnc.common.sql.search.SearchImpl;
import kr.co.hsnc.common.sql.util.RowSetUtility;
import kr.co.hsnc.common.util.ValueObject;
import oracle.toplink.internal.ox.StrBuffer;

import com.udapsoft.modular.web.ibsheet7.IBSheet7Factory;
import com.udapsoft.modular.web.ibsheet7.util.IBSheet7Utils;
import com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;

   
public class ChgItemPopBiz extends Biz {

	public ChgItemPopBiz(HandlerStorage storage) {
		super(storage);
	}

	public void doBiz() throws Exception {
		if(storage.compareEvent("")){
			ValueObject vo = new ValueObject();
			vo = getPointCount(params.get("pur_cont_mod_id"));	//입찰 정보 조회
			storage.addValueObject("cont", vo);
		}
	}

	 public ValueObject getPointCount(String purContModId) {
	        Search search = new SearchImpl();
	        RowSet listRowSet = null;
	        StrBuffer sqlstr = new StrBuffer();
	        ValueObject rowObject = null;
	        
	        try {
	        	
	        	
	        	sqlstr.append("			SELECT F_GET_CURRENCY_DIGIT(CURRENCY_GB) AS POINTCOUNT                                                                                          \n");
	        	sqlstr.append("			FROM PUR2000T																																	\n");
	        	sqlstr.append("			WHERE PUR_CONT_MOD_ID = '"+purContModId+"'																										\n");
	        	
	        	search.setStatement(sqlstr.toString());
	            listRowSet = search.execute();
	            rowObject = RowSetUtility.getValueObject(listRowSet.getRow(0));
	        }
	        catch(Exception e) {
	            WAFLogger.error(this.getClass().getName() + " --> getDivCont() : " + e.getMessage());
	            WAFLogger.error("SQL : " + search.getStatement());
	            WAFLogger.error(e);
	            return null;
	        }
	        finally {
	            if( rowObject == null ) rowObject = new ValueObject();
	            return rowObject;
	        }
	    }
	
}


