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.
232 lines
8.2 KiB
232 lines
8.2 KiB
<%@ CodeTemplate Language="C#" ClassName="PageAspx" 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+"\\WebSite\\"+tb.ModuleName+"\\"+tb.PropertyName+".aspx");
|
|
Field pkField = null;
|
|
foreach(Field fd in tb.Fields)
|
|
{
|
|
if( fd.IsPK )
|
|
pkField = fd;
|
|
}
|
|
%><%%@ Page Language="C#" AutoEventWireup="true" CodeFile="<%=tb.PropertyName%>.aspx.cs" Inherits="<%=moduleName%>_<%=folderName%>_<%=tb.PropertyName%>" %%>
|
|
<%%@ 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">
|
|
<!--navigation -->
|
|
<div class="location">
|
|
<a href="javascript:history.back(-1);" class="back"><i></i><span>·µ»ØÉÏÒ»Ò³</span></a>
|
|
<a href="../center.aspx" class="home"><i></i><span>Ê×Ò³</span></a>
|
|
<i class="arrow"></i>
|
|
<span class="nav_name"><%=tb.CnName%></span>
|
|
</div>
|
|
<!--navigation -->
|
|
|
|
<div class="tablebase">
|
|
|
|
<asp:Panel ID="findPanel" runat="server" Width="100%">
|
|
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="midTable1" >
|
|
<%
|
|
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>");
|
|
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)
|
|
{
|
|
continue;
|
|
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+"\" />");
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
|
|
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.MemberName+"\" runat=\"server\"></asp:Label>");
|
|
Response.WriteLine("\t\t\t\t\t\t\t<asp:HiddenField ID=\"hf"+fd.MemberName+"\" 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:ButtonField CommandName="Delete" Text="Delete" />
|
|
</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="midTable1">
|
|
<%
|
|
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.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();
|
|
}
|
|
%>
|
|
|