package com.steering.pss.qcm;

import java.util.ArrayList;

import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;

import com.steering.comm.db.DBCommon;
import com.steering.comm.tools.StringTool;

public class CoreMscCastRForg extends DBCommon {

    public CoreReturnObject getSpec(String specCode) {
    	String sql = CoreXmlSqlParsersFactory.getSql("CoreMscCastRForg.GetSpec");
    	sql = StringTool.ReplaceAll(sql, "#SPEC_CODE#", specCode);
    	
        return this.getData(sql);
    }

    public CoreReturnObject getSpecB(String speccode) {
       Object []obj=new Object[]{speccode,speccode};
        return this.getDataBySqlID("CoreMscCastRForg.GetSpecB",obj);
    }

    public CoreReturnObject getSpecD(String speccode) {
        Object []obj=new Object[]{speccode,speccode};
        return this.getDataBySqlID("CoreMscCastRForg.GetSpecD",obj);
    }

    @SuppressWarnings("unchecked")
    public CoreReturnObject doSave(String speccode,ArrayList<Object> parm) {
      
        CoreReturnObject cro = new CoreReturnObject();
        ArrayList<Object> sqlIDList = new ArrayList<Object>();
        ArrayList<Object[]> parmlist = new ArrayList<Object[]>();
        sqlIDList.add(CoreXmlSqlParsersFactory.getSql("CoreMscCastRForg.DELETE"));
        parmlist.add(new Object[] { speccode });
        if (parm.size() > 0) {
            for (int i = 0; i < parm.size(); i++) {
                ArrayList<Object> list = (ArrayList<Object>) parm.get(i);
                parmlist.add(list.toArray());
                sqlIDList.add(CoreXmlSqlParsersFactory.getSql("CoreMscCastRForg.ADD"));
            }
        }
        cro = this.getDao("TgDao").ExcuteTransction(sqlIDList, parmlist);
        return cro;
    }

}
