DT 的数据字典
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.
 
 
 
 
 

266 lines
9.5 KiB

<%@ CodeTemplate Language="C#" ClassName="MPageAspx" TargetLanguage="C#" Debug="False" Description="" %>
<%@ Property Name="databaseProjectName" Type="System.String" Default="SpSampleDb" Optional="True" Category="Context" Description="" %>
<%@ Property Name="moduleName" Type="System.String" Default="Manager" Optional="True" Category="Context" Description="" %>
<%@ Property Name="folderName" Type="System.String" Default="System" Optional="True" Category="Context" Description="" %>
<%@ Property Name="Theme" Type="System.String" Default="Default" Optional="True" Category="Context" Description="" %>
<%@ Property Name="title" Type="System.String" Default="" Optional="True" Category="Context" Description="" %>
<%
DbEntity db = Template.GetDataBase(databaseProjectName);
foreach(Table tb in db.Tables)
{
OpenResponse(databaseProjectName+"\\MWebSite\\"+tb.ModuleName+"\\"+tb.Name.ToLower()+".aspx");
Field pkField = null;
foreach(Field fd in tb.Fields)
{
if( fd.IsPK )
pkField = fd;
}
%><%%@ Page Language="C#" AutoEventWireup="true" CodeFile="<%=tb.Name.ToLower()%>.aspx.cs" Inherits="<%=moduleName%>_<%=folderName%>_<%=tb.Name%>" %%>
<%%@ Register Assembly="WebBase" Namespace="WebBase" TagPrefix="cc1" %%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>"<%=tb.CnName%>" </title>
</head>
<body>
<form id="form1" runat="server">
<!--µ¼º½À¸-->
<div class="location">
<a href="javascript:history.back(-1);" class="back"><i></i><span> <% Response.Write(@"<%=getLabtext(");
Response.Write("\"backpri\"");
Response.Write(@") % >");
%></span></a>
<a href="../center.aspx" class="home"><i></i><span> <% Response.Write(@"<%=getLabtext(");
Response.Write("\"homepage\"");
Response.Write(@") % >");
%></span></a>
<i class="arrow"></i>
<span class="nav_name">
<% Response.Write(@"<%=getLabtext(");
Response.Write("\"PageName\"");
Response.Write(@") % >");
%>
</span>
</div>
<div class="tablebase">
<asp:Panel ID="findPanel" runat="server" Width="100%">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="midTable" >
<%
int i = 0;
foreach(Field fd in tb.Fields)
{
if(fd.Identity.Enable == true || fd.LoadCodeProperty("Find") == "0")
continue;
string control = "";
i++;
if(i%3==1)
Response.WriteLine("\t\t\t\t<tr>");
//Response.WriteLine("\t\t\t\t\t<td align=\"right\" class=\"td1\">"+fd.CnName+": </td>");
//Response.WriteLine("\t\t\t\t\t<td align=\"right\" class=\"td1\"> <#=getLabtext(\""+fd.PropertyName+"\")#>: </td>");
Response.Write("\t\t\t\t\t<td align=\"right\" class=\"td1\">");
Response.Write(@"<%=getLabtext(");
Response.Write("\""+fd.MemberName+"\"");
Response.Write(@") % >");
Response.WriteLine(": </td>");
if( fd.IsFK == false)
{
if( fd.NoteIsEnum == true)
{
control = "\r\n\t\t\t\t\t<asp:DropDownList ID=\"ddlF"+fd.PropertyName+"\" runat=\"server\" class='ddl1'>\r\n";
control+="\t\t\t\t\t\t<asp:ListItem Value=\"\">ALL</asp:ListItem>\r\n";
foreach(string key in fd.NoteEnums.AllKeys)
control+="\t\t\t\t\t\t<asp:ListItem Value=\""+fd.NoteEnums[key]+"\">"+key+"</asp:ListItem>\r\n";
control+="\t\t\t\t\t</asp:DropDownList>\r\n";
}
else
{
switch(fd.DataType.GroupName.ToUpper())
{
case "NUMBER":
case "STRING":
control = "<asp:TextBox ID=\"txtF"+fd.PropertyName+"\" runat=\"server\" class='txt1'></asp:TextBox>";
break;
case "DATETIME":
control = "<cc1:Calendar ID=\"cbF"+fd.PropertyName+"\" runat=\"server\" class='txt1'></cc1:Calendar>";
break;
case "BLOB":
control = "<asp:TextBox ID=\"txtF"+fd.PropertyName+"\" TextMode=\"MultiLine\" runat=\"server\" class='txt1'></asp:TextBox>";
break;
}
}
}
else
{
control = "<asp:DropDownList ID=\"ddlF"+fd.PropertyName+"\" runat=\"server\" class='ddl1'></asp:DropDownList>";
}
Response.WriteLine("\t\t\t\t\t<td class='td2'>"+control+"</td>");
if(i%3==0)
Response.WriteLine("\t\t\t\t</tr>");
}
%>
<tr>
<td colspan="6" align="right">
<asp:Button ID="btnNew" runat="server" OnClick="btnNew_Click" CssClass="btnCancel" Text="New" />
<asp:Button ID="btnFind" runat="server" OnClick="btnFind_Click" CssClass='btnCancel' Text="Find" />
</td>
</tr>
</table>
<asp:GridView ID="gv<%=tb.PropertyName%>" CssClass="MainTable" runat="server" AutoGenerateColumns="False" Width="100%" OnRowEditing="gv<%=tb.PropertyName%>_RowEditing" DataKeyNames="<%=pkField.PropertyName%>" OnRowDeleting="gv<%=tb.PropertyName%>_RowDeleting" OnRowDataBound="gv<%=tb.PropertyName%>_RowDataBound">
<Columns>
<asp:TemplateField ItemStyle-Width="35px">
<headertemplate>
NO
</headertemplate>
<itemtemplate>
< %# Container.DataItemIndex + 1 %>
</itemtemplate>
</asp:TemplateField>
<%
foreach(Field fd in tb.Fields)
{
if( fd.LoadCodeProperty("List") == "0")
continue;
if( fd.IsFK == true)
{
Table parentT = tb.ParentTable(fd.Name);
if( parentT != null)
{
if( parentT.Fields.Count >= 2)
{
Response.WriteLine("\t\t\t\t\t<asp:BoundField DataField=\""+parentT.Fields[1].PropertyName+"\" HeaderText=\""+parentT.Fields[1].CnName+"\" Visible=\"False\" />");
continue;
}
}
}
if( fd.IsPK)
{
Response.WriteLine("\t\t\t\t\t<asp:BoundField DataField=\""+fd.MemberName+"\" HeaderText=\""+fd.CnName+"\" Visible=\"False\" />");
}
else
{
if( fd.DataType.FullName=="Date")
{
Response.WriteLine("\t\t\t\t\t<asp:TemplateField>");
Response.WriteLine("\t\t\t\t\t\t<HeaderTemplate>"+fd.CnName+"</HeaderTemplate>");
Response.WriteLine("\t\t\t\t\t\t<ItemTemplate>");
Response.WriteLine("\t\t\t\t\t\t\t<asp:Label ID=\"lab"+fd.PropertyName+"\" runat=\"server\"></asp:Label>");
Response.WriteLine("\t\t\t\t\t\t\t<asp:HiddenField ID=\"hf"+fd.PropertyName+"\" runat=\"server\" Value='<%#Eval(\""+fd.PropertyName+"\") % >' />");
Response.WriteLine("\t\t\t\t\t\t</ItemTemplate>");
Response.WriteLine("\t\t\t\t\t</asp:TemplateField>");
}
else
Response.WriteLine("\t\t\t\t\t<asp:BoundField DataField=\""+fd.MemberName+"\" HeaderText=\""+fd.CnName+"\" />");
}
}
%>
<asp:ButtonField CommandName="Edit" Text="Edit" />
<asp:CommandField DeleteImageUrl="~/Images/NDELETE.gif" ShowDeleteButton="True" CausesValidation="False"
DeleteText="&lt;div id=&quot;de&quot; onclick=&quot;return parent.ExeNoCheckPostBack(this)&quot;&gt;delete&lt;/div&gt; " />
</Columns>
</asp:GridView>
<cc1:DataPager ID="dp" runat="server" AlwaysShow="False" OnPageChanged="dp_PageChanged" PageSize="20"></cc1:DataPager>
</asp:Panel>
<%-- Edit --%>
<asp:Panel ID="editPanel" runat="server" Visible="False">
<table cellpadding="0" cellspacing="0" class="midTable">
<%
int iLable = 0;
i = 0;
foreach(Field fd in tb.Fields)
{
if( fd.LoadCodeProperty("Edit") == "0")
continue;
if( fd.Identity.Enable == false)
{
iLable++;
i++;
string control = "";
if( fd.IsFK == false)
{
if( fd.NoteIsEnum == true)
{
control = "\r\n\t\t\t\t\t<asp:DropDownList ID=\"ddl"+fd.PropertyName+"\" runat=\"server\" class='ddl1'>\r\n";
foreach(string key in fd.NoteEnums.AllKeys)
{
control+="\t\t\t\t\t\t<asp:ListItem Value=\""+fd.NoteEnums[key]+"\">"+key+"</asp:ListItem>\r\n";
}
control+="\t\t\t\t\t</asp:DropDownList>\r\n";
}
else
{
switch(fd.DataType.GroupName.ToUpper())
{
case "NUMBER":
control = "<asp:TextBox ID=\"txt"+fd.PropertyName+"\" runat=\"server\" class='txt1'></asp:TextBox>";
break;
case "STRING":
if( fd.DataType.Precision>=500 || fd.DataType.Scale>=500)
control = "<asp:TextBox ID=\"txt"+fd.PropertyName+"\" width=\"500px\" Height=\"60px\" TextMode=\"MultiLine\" runat=\"server\" class='txt1'></asp:TextBox>";
else
control = "<asp:TextBox ID=\"txt"+fd.PropertyName+"\" runat=\"server\" class='txt1'></asp:TextBox>";
break;
case "DATETIME":
control = "<cc1:Calendar ID=\"cb"+fd.PropertyName+"\" runat=\"server\" class='txt1'></cc1:Calendar>";
break;
case "BLOB":
control = "<asp:TextBox ID=\"txt"+fd.PropertyName+"\" TextMode=\"MultiLine\" runat=\"server\" class='txt1'></asp:TextBox>";
break;
}
}
}
else
{
control = "<asp:DropDownList ID=\"ddl"+fd.PropertyName+"\" runat=\"server\" class='ddl1'></asp:DropDownList>";
}
if(i%2==1)
Response.WriteLine("\t\t<tr>");
//Response.WriteLine("\t\t\t<td class='td1'>"+fd.CnName+": </td>");
Response.Write("\t\t\t\t\t<td align=\"right\" class=\"td1\">");
Response.Write(@"<%=getLabtext(");
Response.Write("\""+fd.MemberName+"\"");
Response.Write(@") % >");
Response.WriteLine(": </td>");
Response.WriteLine("\t\t\t<td class='td2'>"+control+"</td>");
if(i%2==0)
Response.WriteLine("\t\t</tr>");
}
}
%>
<tr>
<td class="tdbtn" colspan="4" >
<asp:Button ID="btnOK" runat="server" OnClick="btnOK_Click" CssClass="btnCancel" Text="OK" />
<asp:Button ID="btnCancel" runat="server" OnClick="btnCancel_Click" CssClass="btnCancel" Text="Cancel" />
</td>
</tr>
</table>
</asp:Panel>
</div>
</form>
</body>
</html>
<%
CloseResponse();
}
%>