/**
 * @(#)file    FileListTechreqSaveBiz.java
 * @(#)author  chj
 * @(#)version 1.0
 * @(#)date    2014-06-24
 * @(#)since   JDK1.6
 *
 * Copyright (c) www.udapsoft.co.kr, Inc.
 */
package kr.co.udapsoft.ebid.buyer.common.file.biz;

import kr.co.hsnc.common.base.WAFLogger;
import kr.co.hsnc.common.sql.persistent.Persistent;
import kr.co.hsnc.common.sql.persistent.PersistentImpl;
import com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;

public class FileListTechreqChangeBiz extends Biz {

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

    /**
     */
    public void doBiz() throws Exception {
    	WAFLogger.debug("TechreqChangeBiz");
        String changeFileMapID     = params.get("change_file_map_id");
        String changeOpenCorpYN    = params.get("change_open_corp_yn");
        String changeUseConYN      = params.get("change_use_con_yn");
        String changeTechreqopenYN = params.get("change_techreq_open_yn");

        if( !changeOpenCorpYN.equals("") )
            updOpenCorpYN(changeFileMapID, changeOpenCorpYN);

        if( !changeUseConYN.equals("") )
            updUseConYN(changeFileMapID, changeUseConYN);
   
        if( !changeTechreqopenYN.equals("") )
            updTechreqOpenYN(changeFileMapID, changeTechreqopenYN);
    }

    public void updOpenCorpYN(String changeFileMapID, String changeOpenCorpYN) throws Exception {

        Persistent persistent = new PersistentImpl(conn.getConnection());
        String sqlstr = "";
        try {

            sqlstr = " UPDATE PUB0510T "
                   + " SET    OPEN_CORP_YN = ? "
                   + " WHERE  FILE_MAP_ID  = ? " ;

            persistent.setStatement(sqlstr);
            persistent.addParameter(changeOpenCorpYN);
            persistent.addParameter(changeFileMapID);
            persistent.execute();
        }
        catch(Exception e) {

            WAFLogger.error(this.getClass().getName() + " --> updOpenCorpYN() : " + e.getMessage());
            WAFLogger.error("SQL : " + sqlstr);
            WAFLogger.error(e);
            throw e;
        }
        finally {

            conn.close();
        }
    }

    public void updUseConYN(String changeFileMapID, String changeUseConYN) throws Exception {

        Persistent persistent = new PersistentImpl(conn.getConnection());
        String sqlstr = "";
        try {

            sqlstr = " UPDATE PUB0510T "
                   + " SET    USE_CON_YN   = ? "
                   + " WHERE  FILE_MAP_ID  = ? " ;

            persistent.setStatement(sqlstr);
            persistent.addParameter(changeUseConYN);
            persistent.addParameter(changeFileMapID);
            persistent.execute();
        }
        catch(Exception e) {

            WAFLogger.error(this.getClass().getName() + " --> updOpenCorpYN() : " + e.getMessage());
            WAFLogger.error("SQL : " + sqlstr);
            WAFLogger.error(e);
            throw e;
        }
        finally {

            conn.close();
        }
    }
    
  
    public void updTechreqOpenYN(String changeFileMapID, String changeTechreqopenYN) throws Exception {

        Persistent persistent = new PersistentImpl(conn.getConnection());
        String sqlstr = "";
        try {

            sqlstr = " UPDATE PUB0510T              "
                   + " SET    TECHREQ_OPEN_YN   = ? "
                   + " WHERE  FILE_MAP_ID       = ? " ;

            persistent.setStatement(sqlstr);
            persistent.addParameter(changeTechreqopenYN);
            persistent.addParameter(changeFileMapID);
            persistent.execute();
        }
        catch(Exception e) {

            WAFLogger.error(this.getClass().getName() + " --> updTechreqOpenYN() : " + e.getMessage());
            WAFLogger.error("SQL : " + sqlstr);
            WAFLogger.error(e);
            throw e;
        }
        finally {

            conn.close();
        }
    }
}
