/**
 * @(#)file    TermsAgreeBiz.java
 * @(#)author  이성민
 * @(#)version 1.0
 *
 */
package kr.co.udapsoft.ebid.supplier.portal.own.biz;



import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;

import kr.co.hsnc.common.base.WAFLogger;
import kr.co.hsnc.common.sql.Row;
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 kr.co.udapsoft.ebid.buyer.common.file.FileManager;

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 ChargeDetailBiz extends Biz {

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

	/* (non-Javadoc)
	 * @see kr.co.hwenc.system.Biz#doBiz()
	 */
	public void doBiz() throws Exception 
	{

		
		//System.out.println("ChargeDetailBiz event==============>" + storage.getEvent());
		ValueObject SuppJoinRequestVo = new ValueObject();
		
		if(storage.compareEvent("GET_DETAIL"))
		{
		    if(params.get("p_user_id").equals(""))
		    {
		        params.set("p_user_id", params.get("user_id"));
		    }
		    
	        SuppJoinRequestVo = getSuppJoinRequestList(params);
            
            storage.addValueObject("SuppJoinRequest", SuppJoinRequestVo);
		}
		
	}
	
	public ValueObject getSuppJoinRequestList(ValueObject params){
        Search search = new SearchImpl();
        ValueObject vo = null;
        RowSet rowSet = new RowSetImpl();
        
        StringBuffer sqlstr = new StringBuffer();
        
        
        try{
            
            sqlstr.append("             SELECT                  \n")
                   .append("                   CORP_ID              \n") 
                   .append("                 , USER_ID              \n")
                   .append("                 , USER_NAME                \n")
                   .append("                 , '' PASSWD                       \n")
                   .append("                 , USER_NAME            \n")
                   .append("                 , DIVISION            \n")
                   .append("                 , POSITION         \n")
                   .append("                 , TEL_NUM         \n")
                   .append("                 , FAX_NUM         \n")
                   .append("                 , HP1                          \n")
                   .append("                 , HP2                          \n")
                   .append("                 , HP3                          \n")
                   .append("                 , EMAIL                                        \n")
                   .append("                 , DEFAULT_YN                                        \n")
                   .append("                 , USE_YN                                        \n")
                   .append("                  FROM SUPP_CHARGE                          \n")
                   .append("                 WHERE USER_ID= ?                                                                                                    \n");
            
                                    
                                    
                                    
            search.setStatement(sqlstr.toString());
            search.addParameter(params.get("p_user_id"));
            rowSet = search.execute();
            
            
            //System.out.println(sqlstr.toString());
            //System.out.println(search.getParameters());
            
            if(rowSet.size()>0){
                vo = RowSetUtility.getValueObject(rowSet.getRow(0));
            }
            
        }catch(Exception e){
            e.printStackTrace();
            throw e;
        }finally{
            if( vo == null) vo = new ValueObject();
            return vo;
        }
    } 
	
	
}