<%@ page contentType="text/html; charset=GBK"%>
<%@ page import = "zr.zrpower.common.util.SysPreperty"%>
<%@ page import = "zr.zrpower.entity.sys.SessionUser"%>
<%@ page import = "zr.zrpower.ejb.sys.UIService"%>
<%@ page import = "zr.zrpower.dbmanage.service.TableService"%>

<%@ page import = "java.lang.Object"%>
<%@ page import = "java.util.*"%>
<%@ page import = "java.text.*"%>
<%@ page import = "java.io.*"%>

<HTML>
<%
request.setCharacterEncoding("GBK");
response.setContentType("text/html; charset=GBK");

SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
TableService Table = new TableService();
String TABLEID=request.getParameter("ID");
String type=request.getParameter("type");//为1时生成实体
if (type==null){type="";}
//得到上次生成的路径
String getPath = "";
if (!type.equals("1"))
{
      getPath = Table.GetEntityPath();
}
//生成实体
if (type.equals("1"))
{
    String path=request.getParameter("path");
    if (path==null){path="";}
    getPath = path;

    Table.CreateEntity(TABLEID,path);//生成实体
}

%>
<HEAD>
<TITLE><%=SysPreperty.getProperty().SystemName%><%=SysPreperty.getProperty().Versoin%></TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META http-equiv="Content-Type" content="text/html; charset=GBK">
<LINK type="text/css" rel="stylesheet" href="../../zrsysmanage/css/<%=user.getUserCSS()%>">
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/script/Public.js"></SCRIPT>
 <!-- 弹出窗口 -->
<script src="../../zrsysmanage/html5/script/jquery-2.0.3.min.js"></script>
<script src="../../zrsysmanage/html5/layer/layer.js"></script>


<script language="JavaScript" type="text/javascript">
function CreateEntity(){
     var path = document.RegForm.PATH.value;
     var id = document.RegForm.TABLEID.value;
     location.href="CreateEntity.jsp?ID="+id+"&type=1&path="+path;
}

</script>
</HEAD>
<BODY class="BodyMain">
<FORM action="" method="post" name="RegForm" onsubmit="return Check(this);">
<input type="hidden" name="TABLEID" value='<%=TABLEID%>' >

           <DIV id="divMessage" style='padding-left:0;padding-top:0;width:96%;height:320;overflow:auto'>
           <table border="0" class="inputTable" cellspacing="0" cellpadding="0" align="center">
            <tr>
               <td class="inputTdtitle"></td>
               <td class="inputTd"><Font class="WriteSign">说明：生成的实体名称与表名相同，生成的实体文件存放在<br>c:/CreateEntity下，请手动拷贝到项目中。</Font><br><br></td>
            </tr>
            <tr>
               <td class="inputTdtitle">生成路径：</td>
               <td class="inputTd"><input class="text" type="text" name="PATH" size="58" value="<%=getPath%>" maxlength="150"><Font class="WriteSign">*</Font></td>
           </tr>

          </table>
          <br>
                 <center><br>
                 <table cellspacing="0" cellpadding="0" border='0'><tr>
                 <%=userUI.ClickButton1("生成实体","JavaScript:CreateEntity();","buttonSave.gif",user.getUserImage())%>

                 <%if("6".equals(user.getUserWINDOWTYPE())){%>
                 <%=userUI.ClickButton("关闭","JavaScript:parent.layer.closeAll();","buttonClose.gif",user.getUserImage())%>

                <%}else{ %>
                <%=userUI.ClickButton1("关闭","window.close();","buttonClose.gif",user.getUserImage())%>
                <%} %>
                 </tr></table>
                 </center>
         </DIV>

</FORM>

<script language="JavaScript" type="text/javascript">
<%if("6".equals(user.getUserWINDOWTYPE())){%>
         //layer.alert('已经生成实体，存放在c:/CreateEntity下！', {icon: 7});
         <%if (type.equals("1")){%>
         //alert("已经生成实体，存放在c:/CreateEntity下。");
         layer.msg('已经生成实体，存放在c:/CreateEntity下');
       <%}%>

    <%}else{%>
        <%if (type.equals("1")){%>
         alert("已经生成实体，存放在c:/CreateEntity下。");
       <%}%>
    <%}%>

</script>
</BODY>
</HTML>
<%
//清空相关对象
user = null;
userUI = null;
Table = null;
%>
