You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.4 KiB
84 lines
2.4 KiB
|
|
<%@ CodeTemplate Language="C#" ClassName="M_Luaguagesql" TargetLanguage="C#" Debug="False" Description="" encoding="GB2312" %>
|
|
<%@ Property Name="databaseProjectName" Type="System.String" Default="SpSampleDb" Optional="True" Category="Context" Description="" %>
|
|
<%@ Property Name="nameSpace" Type="System.String" Default="sql" Optional="True" Category="Context" Description="" %>
|
|
|
|
/*******************************************************/
|
|
/*Create table */
|
|
/*******************************************************/
|
|
<%
|
|
DbEntity db = Template.GetDataBase(databaseProjectName);
|
|
foreach(Table tb in db.Tables)
|
|
{
|
|
OpenResponse(databaseProjectName+"\\sql\\"+tb.ModuleName+"\\"+tb.Name+".sql");
|
|
string pkParmList = "";
|
|
foreach(Field fd in tb.Fields)
|
|
{
|
|
if(fd.IsPK == true)
|
|
pkParmList += fd.DataType.DotNetType+" "+fd.MemberName+",";
|
|
}
|
|
pkParmList = pkParmList.Trim(',');
|
|
|
|
|
|
|
|
Response.WriteLine("CREATE TABLE " + tb.Name+" (" );
|
|
Response.WriteLine(" [Id] int IDENTITY (1,1) NOT NULL,");
|
|
|
|
foreach(Field fd in tb.Fields)
|
|
{
|
|
if( fd.IsPK ==false )
|
|
{
|
|
|
|
Response.WriteLine(" "+ fd.MemberName+" "+ fd.DataType.FullName +" ," );
|
|
}
|
|
}
|
|
Response.WriteLine(")");
|
|
%>
|
|
go
|
|
/* View*/
|
|
Create view V_<%=tb.Name%>
|
|
as
|
|
select * from <%=tb.Name%>;
|
|
|
|
go
|
|
|
|
/*******************************************************/
|
|
/* Lanage */
|
|
/*******************************************************/
|
|
<%
|
|
|
|
string sql1 ="INSERT INTO TabLanguages(PageNo,LabNo,zh_cn ,En ,Remark ,PageName)VALUES(\'pc000"+ tb.MemberName+"\',";
|
|
Response.WriteLine(sql1);
|
|
Response.WriteLine("\'pagename\',");
|
|
Response.WriteLine("\'" +tb.CnName+ "\',");
|
|
Response.WriteLine("\'" + tb.MemberName+ "\',");
|
|
Response.WriteLine("\'±êÌâ\',");
|
|
Response.WriteLine("\'" + tb.CnName+ "/"+tb.MemberName+"\')");
|
|
|
|
|
|
%>
|
|
<%
|
|
|
|
foreach(Field fd in tb.Fields)
|
|
{
|
|
if( fd.IsPK ==false )
|
|
{
|
|
|
|
string sql ="INSERT INTO TabLanguages(PageNo,LabNo,zh_cn ,En ,Remark ,PageName)VALUES(\'pc000"+ tb.MemberName+"\',";
|
|
Response.WriteLine(sql);
|
|
Response.WriteLine("\'" + fd.MemberName+ "\',");
|
|
Response.WriteLine("\'" + fd.CnName+ "\',");
|
|
Response.WriteLine("\'" + fd.MemberName+ "\',");
|
|
Response.WriteLine("\'" + fd.CnName+ "\',");
|
|
Response.WriteLine("\'" + tb.CnName+ "/"+tb.MemberName+"\')");
|
|
}
|
|
}
|
|
%>
|
|
|
|
|
|
|
|
|
|
<%
|
|
CloseResponse();
|
|
}
|
|
%>
|
|
|