在当今的软件开发领域,快速开发和部署应用程序的需求日益增长。为了满足这一需求,开发了一种基于数据库的ASP.NETAJAXWeb应用程序生成器,它能够自动化地生成具有现代Web 2.0用户界面、多级菜单、安全系统、复杂页面布局、数据过滤、分页、排序、数据导出以及即时报告生成等功能的应用程序。
生成的应用程序具有以下特点:
应用程序代码基础依赖于Microsoft ASP.NET Ajax Extensions和Ajax Control Toolkit。报告生成则使用免费的Microsoft Report Viewer。生成的应用程序在包括Internet Explorer 7-8、Firefox、Safari、Chrome和Opera在内的主流浏览器中表现一致。
要安装ASP.NET代码生成器和代码生成项目,请按照以下步骤操作:
可以在查看生成的应用程序的实时演示。
以下是ASP.NET页面的代码示例:
<%@ Page Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeFile="Employees.aspx.cs" Inherits="Pages_Employees" Title="Employees" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PageHeaderContentPlaceHolder" runat="Server">
Employees
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageContentPlaceHolder" runat="Server">
<div factory:flow="NewRow" xmlns:factory="urn:codeontime:app-factory">
<div factory:activator="Tab|Employees">
<div id="view1" runat="server">
</div>
<aquarium:DataViewExtender id="view1Extender" runat="server" TargetControlID="view1" Controller="Employees" view="grid1" ShowInSummary="True" />
</div>
<div factory:activator="Tab|Employees">
<div id="view2" runat="server">
</div>
<aquarium:DataViewExtender id="view2Extender" runat="server" TargetControlID="view2" Controller="Employees" view="grid1" FilterSource="view1Extender" FilterFields="ReportsTo" />
</div>
<div factory:activator="Tab|Orders">
<div id="view3" runat="server">
</div>
<aquarium:DataViewExtender id="view3Extender" runat="server" TargetControlID="view3" Controller="Orders" view="grid1" FilterSource="view1Extender" FilterFields="EmployeeID" />
</div>
<div factory:activator="Tab|Employee Territories">
<div id="view4" runat="server">
</div>
<aquarium:DataViewExtender id="view4Extender" runat="server" TargetControlID="view4" Controller="EmployeeTerritories" view="grid1" FilterSource="view1Extender" FilterFields="EmployeeID" />
</div>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="SideBarPlaceHolder" runat="Server">
<div class="TaskBox">
<div class="Inner">
<div class="Header">
About
</div>
<div class="Value">
This page allows employees management.
</div>
</div>
</div>
</asp:Content>
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.codeontime.com/2008/codedom-compiler" xmlns:a="urn:schemas-codeontime-com:data-aquarium-project" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl a">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<compileUnit namespace="{a:project/a:namespace}.Data">
<imports>
<namespaceImport name="System" />
<namespaceImport name="System.Collections.Generic" />
<namespaceImport name="System.ComponentModel" />
<namespaceImport name="System.Data" />
<namespaceImport name="System.Data.Common" />
<namespaceImport name="System.Linq" />
<namespaceImport name="System.Text" />
<namespaceImport name="System.Text.RegularExpressions" />
<namespaceImport name="System.Xml" />
<namespaceImport name="System.Xml.XPath" />
<namespaceImport name="System.Web" />
<namespaceImport name="System.Web.Caching" />
<namespaceImport name="System.Web.Configuration" />
<namespaceImport name="System.Web.Security" />
</imports>
<types>
<typeDeclaration name="View">
<members>
<memberField type="System.String" name="id" />
<memberProperty type="System.String" name="Id">
<attributes public="true" final="true" />
<getStatements>
<methodReturnStatement>
<fieldReferenceExpression name="id" />
</methodReturnStatement>
</getStatements>
</memberProperty>
<memberField type="System.String" name="label" />
<memberProperty type="System.String" name="Label">
<attributes public="true" final="true" />
<getStatements>
<methodReturnStatement>
<fieldReferenceExpression name="label" />
</methodReturnStatement>
</getStatements>
</memberProperty>
<memberField type="System.String" name="headerText" />
<memberProperty type="System.String" name="HeaderText">
<attributes public="true" final="true" />
<getStatements>
<methodReturnStatement>
<fieldReferenceExpression name="headerText" />
</methodReturnStatement>
</getStatements>
</memberProperty>
<memberField type="System.String" name="type" />
<memberProperty type="System.String" name="Type">
<attributes public="true" final="true" />
<getStatements>
<methodReturnStatement>
<fieldReferenceExpression name="type" />
</methodReturnStatement>
</getStatements>
</memberProperty>
<constructor>
<attributes public="true" />
</constructor>
<constructor>
<attributes public="true" />
<parameters>
<parameter type="XPathNavigator" name="view" />
<parameter type="IXmlNamespaceResolver" name="resolver" />
</parameters>
<statements>
<assignStatement>
<fieldReferenceExpression name="id">
<thisReferenceExpression/>
</fieldReferenceExpression>
<castExpression targetType="System.String">
<methodInvokeExpression methodName="Evaluate">
<target>
<argumentReferenceExpression name="view" />
</target>
<parameters>
<primitiveExpression value="string(@id)" />
</parameters>
</methodInvokeExpression>
</castExpression>
</assignStatement>
<assignStatement>
<fieldReferenceExpression name="type">
<thisReferenceExpression/>
</fieldReferenceExpression>
<castExpression targetType="System.String">
<methodInvokeExpression methodName="Evaluate">
<target>
<argumentReferenceExpression name="view" />
</target>
<parameters>
<primitiveExpression value="string(@type)" />
</parameters>
</methodInvokeExpression>
</castExpression>
</assignStatement>
<assignStatement>
<fieldReferenceExpression name="label">
<thisReferenceExpression/>
</fieldReferenceExpression>
<castExpression targetType="System.String">
<methodInvokeExpression methodName="Evaluate">
<target>
<argumentReferenceExpression name="view" />
</target>
<parameters>
<primitiveExpression value="string(@label)" />
</parameters>
</methodInvokeExpression>
</castExpression>
</assignStatement>
<assignStatement>
<fieldReferenceExpression name="headerText">
<thisReferenceExpression/>
</fieldReferenceExpression>
<castExpression targetType="System.String">
<methodInvokeExpression methodName="Evaluate">
<target>
<argumentReferenceExpression name="view" />
</target>
<parameters>
<primitiveExpression value="string(c:headerText)" />
<argumentReferenceExpression name="resolver" />
</parameters>
</methodInvokeExpression>
</castExpression>
</assignStatement>
</statements>
</constructor>
</members>
</typeDeclaration>
</types>
</compileUnit>
</xsl:template>
</xsl:stylesheet>