<%@ page import="java.io.*, java.util.*"%>
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ page import="com.eactive.eai.common.b2bservice.B2BServiceManager"%>
<%@ page import="com.eactive.eai.common.b2bservice.B2BServiceVO"%>
<%@ page import="java.util.HashMap"%>

<%!
	/**
	* <pre>
	* 문자열을 받아서 널이면 제로스트링을, 아니면 트림된 문자열을 리턴.
	* </pre>
	* @param	String		변환 대상
	* @return	'String'
	*/
	public static String checkNull( String str ) {

		String sResult = new String();
		if ( str == null ) {
			sResult = "";
		}
		else {
			sResult = str.trim();
		}
		return sResult;
	}
%>
<%
    
	B2BServiceManager manager = B2BServiceManager.getInstance();  
    String            action  = request.getParameter("actionType");
    String []         alls    = manager.getAllKeys();
    
    String selectedKey = request.getParameter("selectedKey");
    if(selectedKey == null && alls.length>=1) {
        selectedKey  = alls[0];
    }
    if ("reload".equals(action)){
    	// 마지막 제거
    	manager.reload(selectedKey.substring(0,selectedKey.length()-1));
    }else if ("reloadAll".equals(action)){
    	manager.reload();
    }else {
    	;
    }
    B2BServiceVO vo   = null;
    if(selectedKey!=null) {
       vo = manager.getB2BServiceVO(selectedKey);
    }
    
%>


<html>
    <head>
    
        <title>
            B2BServiceManager
        </title>
         <script>
        function doAction() {
            document.frm.submit();
        }
        function managerReload(){ 
        	document.frm.actionType.value="reload";
        	document.frm.submit();
        	
        }
        function managerReloadAll(){
        	document.frm.actionType.value="reloadAll";
        	document.frm.submit();
        }
        function doSearch(){
        	var searchValue = document.frm.instiCd.value + document.frm.searchSvcPssSeq.value;
        	document.frm.selectedKey.value = searchValue;
        	document.frm.submit();
        }
        function enterEvent(){
        	if(window.event.keyCode==13){
        		doSearch();
        	}
        }
        </script>
    </head>
    <body>
        <p style="font-size:12pt;">
        <b>라우팅 B2B기관 정보 관리</b> <br><br>
        </p>
        <form name="frm" action="">
        <input type="hidden" name="actionType" value="">
        <input type="hidden" name="actionSeq" value="">
        
        <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
	        <tr bgcolor='white'>
	            <td align='right' width='350' bgcolor="#ccccff">기관코드 + 서비스처리순서 :&nbsp;</td>
	            <td align='left'>&nbsp;<select name="selectedKey" onchange="doAction();">
	            <%
	                for(int i=0;i<alls.length;i++) {
	            %>
	                <option value="<%=alls[i]%>" <%= (alls[i].equals(selectedKey)) ? "selected" : "" %> ><%=alls[i]%>
	            <%           
	                }
	            %></select>
	            </td>
	            <td width='50'><input type="button" name="reload" value="reload" onClick="managerReload()" /></td>
	            <td width='70'><input type="button" name="reloadAll" value="reloadAll" onClick="managerReloadAll()" /></td>
	        </tr>
	        <tr bgcolor='white'>
	        	<td align='right' bgcolor="#ccccff">기관코드 : &nbsp;&nbsp;</td>
	        	<td align='left' >&nbsp;<input type="edit" name="instiCd" onkeydown="enterEvent()" value="<%=vo.getB2bExtnlInstiCd()%>"  /></td> 
	            <td colspan=2 rowspan=2 align='center'><input type="button" name="search" value="search" onClick="doSearch()" /></td>
	        </tr>
	        <tr bgcolor='white'>
	        	<td align='right' bgcolor="#ccccff">서비스처리번호 : &nbsp;&nbsp;</td>
	        	<td align='left' >&nbsp;<input type="edit" name="searchSvcPssSeq" onkeydown="enterEvent()" value="<%=vo.getSvcPssSeq()%>"  /></td> 
	        </tr>
        </table>
        <br>
        <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td align='right' colspan='2' bgcolor="#003366">&nbsp; <font color="yellow"><b>내용</b> &nbsp;</font></td>
        </tr>


<%
    if(vo != null ){
        
%>
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp;기관코드  : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="svcPssSeq" style="width:98%" value="<%=vo.getB2bExtnlInstiCd()%>"></td>
        </tr>
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp;서비스처리순서 : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="svcPssSeq" style="width:98%" value="<%=vo.getSvcPssSeq()%>"></td>
        </tr>
         <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 수동인터페이스유형 : &nbsp;</td>                                                                           
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="psvItfTp" style="width:98%" value="<%=vo.getPsvItfTp()%>">                                                                                                                              
            </td>                                                                                                                                                
        </tr>
                <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 수동업무시스템명 : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="psvBwkSysNm" style="width:98%" value="<%=vo.getPsvBwkSysNm()%>"></td>
        </tr>
        
<%--
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 수동시스템ID : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="psvSysID" style="width:98%" value="<%=vo.getPsvSysID()%>"></td>
        </tr>
 --%>        
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 수동시스템서비스코드 : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="psvSysSvcCd" style="width:98%" value="<%=vo.getPsvSysSvcCd()%>"></td>
        </tr>
        
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 수동시스템인터페이스유형 : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="psvSysItfTp" style="width:98%" value="<%=vo.getPsvSysItfTp()%>"></td>
        </tr>
        

        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; FailOver여부 : &nbsp;</td>                                                                           
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="flOvrCls" style="width:98%" value="<%=vo.getFlOvrCls()%>">                                                          
            </td>                                                                                                                                                
        </tr>
        
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 변환유무 : &nbsp;</td>                                                                           
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="cnvEn" style="width:98%" value="<%=vo.getCnvEn()%>">                                                                                                                                          
            </td>                                                                                                                                                
        </tr>
        
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 변환메시지ID : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="cnvMsgID" style="width:98%" value="<%=vo.getCnvMsgID()%>"></td>
        </tr>
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 기본응답메시지비교값 : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="bsRspMsgCprVl" style="width:98%" value="<%=vo.getBsRspMsgCprVl()%>"></td>
        </tr>

        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 기본응답변환유무 : &nbsp;</td>                                                                           
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="bsRspCnvEn" style="width:98%" value="<%=vo.getBsRspCnvEn()%>"></td>                                          
        </tr>
        
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 기본응답변환메시지ID : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="bsRspCnvMsgID" style="width:98%" value="<%=vo.getBsRspCnvMsgID()%>"></td>
        </tr>

        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 오류응답메시지비교값 : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="errRspMsgCprVl" style="width:98%" value="<%=vo.getErrRspMsgCprVl()%>"></td>
        </tr>
        
        <tr bgcolor='white'>                                                                                                                                     
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 오류응답변환유무 : &nbsp;</td>                                                                           
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="errRspCnvEn" style="width:98%" value="<%=vo.getErrRspCnvEn()%>"></td>
                                                                                                                                                       
        </tr>
        
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 오류응답변환메시지ID : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="errRspCnvMsgID" style="width:98%" value="<%=vo.getErrRspCnvMsgID()%>"></td>
        </tr>
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 다음서비스처리순서 : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="nxtSvcPssSeq" style="width:98%" value="<%=vo.getNxtSvcPssSeq()%>"></td>
        </tr>

        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; Outbound라우팅명 : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="outbRtnNm" style="width:98%" value="<%=vo.getOutbRtnNm()%>"></td>
        </tr>
        
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 타임아웃값 : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="tmoVl" style="width:98%" value="<%=vo.getTmoVl()%>"></td>
        </tr>

        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 보상서비스처리코드 : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="cpnsSvcPssCd" style="width:98%" value="<%=vo.getCpnsSvcPssCd()%>"></td>
        </tr>
        
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 추가삭제여부 : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="supplDelYn" style="width:98%" value="<%=vo.getSupplDelYn()%>"></td>
        </tr>
        
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 헤더제어구분코드 : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="hdrCtrlDstcd" style="width:98%" value="<%=vo.getHdrCtrlDstcd()%>"></td>
        </tr>
        
        <tr bgcolor='white'>
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 참고클래스명 : &nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="hdrRefClsName" style="width:98%" value="<%=vo.getHdrRefClsName()%>"></td>
        </tr>
        
<%
}
%>    
        </table>
        </form>
    </body>
</html>