今天我就把上个月搭的MVC2+Spring.net+Nhibernate+Jquery开发框架介绍给大家,虽然本框架已经被老板“下架”,但是我还是想把这个实践经验介绍给大家。
首先先看看文件夹结构。
先看看Dao层。
其中Implement下放的是实现接口的Dao。Interface下放的是接口。我们再看看实现类BaseDao
public
class BaseDao<T, PK> : HibernateDaoSupport,IDao<T, PK>
{
Type type;
ISession iSession = null;
public BaseDao()
{ }
public BaseDao(Type type)
{
this.type = type;
}
public T Get(PK pk)
{
T test = (T)HibernateTemplate.Get(type, pk);
return test;
}
public IList GetAll()
{
return HibernateTemplate.ExecuteFind( new HibernateGetAll<T>(type));
}
public PK Save(T entity)
{
return (PK)HibernateTemplate.Execute( new HibernateSave<T, PK>(entity));
}
public void Update(T entity)
{
HibernateTemplate.Execute( new HibernateUpdate<T>(entity));
}
public void SaveOrUpdate(T entity)
{
HibernateTemplate.Execute( new HibernateSaveOrUpdate<T>(entity));
}
public void Delete(T entity)
{
HibernateTemplate.Execute( new HibernateDelete<T>(entity));
}
public IList FindByCriteria(ICriterion[] Criterions)
{
return HibernateTemplate.ExecuteFind( new HibernateFindByCriteria<T>(Criterions, type));
}
public IList FindByCriteria(Order order, ICriterion[] criterions)
{
return HibernateTemplate.ExecuteFind( new HibernateFindByCriterias<T>(order, criterions, type));
}
public IList GetListForPage(Type type, ICriterion[] criterions,
int offset, int length)
{
return HibernateTemplate.ExecuteFind( new HibernateGetListForPage<T>(criterions, type, offset, length));
}
public IList FindByCriteria( int firstResult, int rowCount, Order order, ICriterion[] criterions)
{
return HibernateTemplate.ExecuteFind( new HibernateFindByCriteriass<T>(firstResult, rowCount, order, type, criterions));
}
public IList GetAggValueByCriteria(ProjectionList projectionList, ICriterion[] criterions)
{
return HibernateTemplate.ExecuteFind( new HibernateGetAggValue<T>(projectionList, criterions, type));
}
public IList FindByNamedParam( string queryString, string[] paramNames, object[] values)
{
return HibernateTemplate.FindByNamedParam(queryString, paramNames, values);
}
}
}
{
Type type;
ISession iSession = null;
public BaseDao()
{ }
public BaseDao(Type type)
{
this.type = type;
}
public T Get(PK pk)
{
T test = (T)HibernateTemplate.Get(type, pk);
return test;
}
public IList GetAll()
{
return HibernateTemplate.ExecuteFind( new HibernateGetAll<T>(type));
}
public PK Save(T entity)
{
return (PK)HibernateTemplate.Execute( new HibernateSave<T, PK>(entity));
}
public void Update(T entity)
{
HibernateTemplate.Execute( new HibernateUpdate<T>(entity));
}
public void SaveOrUpdate(T entity)
{
HibernateTemplate.Execute( new HibernateSaveOrUpdate<T>(entity));
}
public void Delete(T entity)
{
HibernateTemplate.Execute( new HibernateDelete<T>(entity));
}
public IList FindByCriteria(ICriterion[] Criterions)
{
return HibernateTemplate.ExecuteFind( new HibernateFindByCriteria<T>(Criterions, type));
}
public IList FindByCriteria(Order order, ICriterion[] criterions)
{
return HibernateTemplate.ExecuteFind( new HibernateFindByCriterias<T>(order, criterions, type));
}
public IList GetListForPage(Type type, ICriterion[] criterions,
int offset, int length)
{
return HibernateTemplate.ExecuteFind( new HibernateGetListForPage<T>(criterions, type, offset, length));
}
public IList FindByCriteria( int firstResult, int rowCount, Order order, ICriterion[] criterions)
{
return HibernateTemplate.ExecuteFind( new HibernateFindByCriteriass<T>(firstResult, rowCount, order, type, criterions));
}
public IList GetAggValueByCriteria(ProjectionList projectionList, ICriterion[] criterions)
{
return HibernateTemplate.ExecuteFind( new HibernateGetAggValue<T>(projectionList, criterions, type));
}
public IList FindByNamedParam( string queryString, string[] paramNames, object[] values)
{
return HibernateTemplate.FindByNamedParam(queryString, paramNames, values);
}
}
}
BaseDao去实现IDao类。我们再看看每个Dao类去继承BaseDao实现对应的接口
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Dao.Implement.SysManager
{
using Dao.Interface.SysManager;
using Dao.Implement.Util;
using Model;
public class SysCodeDao : BaseDao<SS_CODE, SS_CODEID>,ISysCodeDao
{
public SysCodeDao()
: base( typeof(SS_CODE))
{ }
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Dao.Implement.SysManager
{
using Dao.Interface.SysManager;
using Dao.Implement.Util;
using Model;
public class SysCodeDao : BaseDao<SS_CODE, SS_CODEID>,ISysCodeDao
{
public SysCodeDao()
: base( typeof(SS_CODE))
{ }
}
}
我们再看看其对应的接口由于篇幅有限,我们接着看Model层
其中Models文件夹下放的是实体类,Mappings下放的是Nhibernate映射的xml文件。
Util下放的是要使用的关于加载Json解析的类。
接下来我们再看看我的程序集SpringConfig,其中的Controller_Dao.xml是对控制器中所使用用到的Dao注入到控制器。Dao.xml是对Dao的Spring配置。Spring_Hibernate.xml是对Spring+Nhibernate组合的一个配置。
我们大致来看看,Dao.xml
<?
xml
version
="1.0"
encoding
="utf-8"
?>
< objects xmlns ="http://www.springframework.net"
xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation ="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd" >
< object id ="CodeDao" type ="Dao.Implement.SysManager.SysCodeDao,Dao" autowire ="byName" >
< property name ="sessionFactory" ref ="sessionFactory" />
</ object >
< object id ="sysOrgDao" type ="Dao.Implement.SysManager.SysOrgDao,Dao" autowire ="byName" >
< property name ="sessionFactory" ref ="sessionFactory" />
</ object >
< object id ="sysCodeDao" type ="Dao.Implement.SysManager.SysCodeDao,Dao" autowire ="byName" >
< property name ="sessionFactory" ref ="sessionFactory" />
</ object >
< object id ="sysUserDao" type ="Dao.Implement.SysManager.SysUserDao,Dao" >
< property name ="sessionFactory" ref ="sessionFactory" />
</ object >
< object id ="sysLogInfoDao" type ="Dao.Implement.SysManager.SysLogInfoDao" >
< property name ="sessionFactory" ref ="sessionFactory" />
</ object >
< object id ="sysModuleDao" type ="Dao.Implement.SysManager.SysModulDao" >
< property name ="sessionFactory" ref ="sessionFactory" />
</ object >
</ objects >
< objects xmlns ="http://www.springframework.net"
xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation ="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd" >
< object id ="CodeDao" type ="Dao.Implement.SysManager.SysCodeDao,Dao" autowire ="byName" >
< property name ="sessionFactory" ref ="sessionFactory" />
</ object >
< object id ="sysOrgDao" type ="Dao.Implement.SysManager.SysOrgDao,Dao" autowire ="byName" >
< property name ="sessionFactory" ref ="sessionFactory" />
</ object >
< object id ="sysCodeDao" type ="Dao.Implement.SysManager.SysCodeDao,Dao" autowire ="byName" >
< property name ="sessionFactory" ref ="sessionFactory" />
</ object >
< object id ="sysUserDao" type ="Dao.Implement.SysManager.SysUserDao,Dao" >
< property name ="sessionFactory" ref ="sessionFactory" />
</ object >
< object id ="sysLogInfoDao" type ="Dao.Implement.SysManager.SysLogInfoDao" >
< property name ="sessionFactory" ref ="sessionFactory" />
</ object >
< object id ="sysModuleDao" type ="Dao.Implement.SysManager.SysModulDao" >
< property name ="sessionFactory" ref ="sessionFactory" />
</ object >
</ objects >
Spring_Dao.xml
<?
xml
version
="1.0"
encoding
="utf-8"
?>
< objects xmlns ="http://www.springframework.net"
xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation ="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd" >
<!-- 部门管理所需加载的对象 -->
< object id ="ssCodeId" type ="Model.SS_CODEID,Model" autowire ="byName" />
< object id ="ssOrga1" type ="Model.SS_ORGA,Model" autowire ="byName" > </ object >
< object id ="ssCode" type ="Model.SS_CODE,Model" autowire ="byName" > </ object >
< object id ="ListItem" type="Utility.Common.ListItem<Model.SS_CODE >,Utility" autowire="byName">
</ object >
< object id ="OrgaController" type ="EduCationManage.Controllers.SysManager.OrgaController,EduCationManage" singleton ="false" >
< property name ="ssOrga" ref ="ssOrga1" > </ property >
< property name ="ssCode" ref ="ssCode" > </ property >
< property name ="sysOrgDao" ref ="sysOrgDao" > </ property >
< property name ="sysCodeDao" ref ="sysCodeDao" > </ property >
< property name ="ssCodeId" ref ="ssCodeId" > </ property >
< property name ="myListItem" ref ="ListItem" > </ property >
</ object >
< object id ="ssUser1" type ="Model.SS_USER,Model" autowire ="byName" > </ object >
< object id ="ssLogInfos" type ="Model.SS_LOG_INFO,Model" autowire ="byName" > </ object >
< object id ="LoginController" type ="EduCationManage.Controllers.LoginController,EduCationManage" singleton ="false" >
< property name ="ssUser" ref ="ssUser1" />
< property name ="ssLogInfos" ref ="ssLogInfos" > </ property >
< property name ="sysUserDao" ref ="sysUserDao" > </ property >
< property name ="sysLogInfoDao" ref ="sysLogInfoDao" > </ property >
< property name ="sysModuleDao" ref ="sysModuleDao" > </ property >
</ object >
</ objects >
< objects xmlns ="http://www.springframework.net"
xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation ="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd" >
<!-- 部门管理所需加载的对象 -->
< object id ="ssCodeId" type ="Model.SS_CODEID,Model" autowire ="byName" />
< object id ="ssOrga1" type ="Model.SS_ORGA,Model" autowire ="byName" > </ object >
< object id ="ssCode" type ="Model.SS_CODE,Model" autowire ="byName" > </ object >
< object id ="ListItem" type="Utility.Common.ListItem<Model.SS_CODE >,Utility" autowire="byName">
</ object >
< object id ="OrgaController" type ="EduCationManage.Controllers.SysManager.OrgaController,EduCationManage" singleton ="false" >
< property name ="ssOrga" ref ="ssOrga1" > </ property >
< property name ="ssCode" ref ="ssCode" > </ property >
< property name ="sysOrgDao" ref ="sysOrgDao" > </ property >
< property name ="sysCodeDao" ref ="sysCodeDao" > </ property >
< property name ="ssCodeId" ref ="ssCodeId" > </ property >
< property name ="myListItem" ref ="ListItem" > </ property >
</ object >
< object id ="ssUser1" type ="Model.SS_USER,Model" autowire ="byName" > </ object >
< object id ="ssLogInfos" type ="Model.SS_LOG_INFO,Model" autowire ="byName" > </ object >
< object id ="LoginController" type ="EduCationManage.Controllers.LoginController,EduCationManage" singleton ="false" >
< property name ="ssUser" ref ="ssUser1" />
< property name ="ssLogInfos" ref ="ssLogInfos" > </ property >
< property name ="sysUserDao" ref ="sysUserDao" > </ property >
< property name ="sysLogInfoDao" ref ="sysLogInfoDao" > </ property >
< property name ="sysModuleDao" ref ="sysModuleDao" > </ property >
</ object >
</ objects >
Spring_Hibernate.xml
ok,上面的就是本项目比较关键的配置。紧接着我们赶紧看看控制器
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace EduCationManage.Controllers.SysManager
{
using Model;
using Dao.Interface.SysManager;
using EduCationManage.Controllers.Util;
using NHibernate.Criterion;
using Utility.Common;
using Utility.Json;
using Model.Util;
public class OrgaController : BaseController
{
private SS_ORGA ssOrga ; //部门类
private SS_CODE ssCode ; //系统参数类
private SS_CODEID ssCodeId ; //系统参数复合主键类
private ISysOrgDao sysOrgDao ; //部门dao
private ISysCodeDao sysCodeDao ; //系统参数dao
private ListItem<SS_CODE> myListItem;
private List<SS_CODE> orgaTypeList ; //部门类型的List
private List<SS_ORGA> orgaList = new List<SS_ORGA>(); //部门的List
private String strJson ; //返回页面值
private int total ; //总页数
private int page ; //当前页
private int records ; //总记录数
public ActionResult Execute()
{
ICriterion[] criterions = new ICriterion[1];
criterions[0] = Expression.Eq( "Id.C_ENAME", "ORGATYPE");
this.orgaTypeList = (List<SS_CODE>)sysCodeDao.FindByCriteria(criterions);
SelectList listItem = myListItem.GetListItem(orgaTypeList, "C_DISPLAY_CONTENT", "", "---选择---");
ViewData.Add( "listItem", listItem);
return View( "~/Views/SysManage/Orga/OrgaManager.aspx");
}
[HttpPost]
public JsonResult Show()
{
SS_USER user = Session[ "user"] as SS_USER;
String strOrgaId = "0010"; // user.C_ORGA_ID;//登录者的所在部门ID
try
{
ssOrga = sysOrgDao.Get(strOrgaId);
if (ssOrga.chkManageOrga())
{
ssOrga = sysOrgDao.Get(CONS_ROOT_ID);
}
JSTreeNode treeNode = this.CreateJSTreeforOrgTree(ssOrga);
nodeList.Add(treeNode);
strJson = "{suc:1,msg:'生成树成功'}";
log.Info( "生成树成功");
return Json(nodeList, JsonRequestBehavior.AllowGet);
}
catch (Exception)
{
strJson = "{suc:0,msg:'生成树失败'}";
log.Error( "生成树失败");
return Json( "{msg:'生成树失败'}");
}
}
}
}
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace EduCationManage.Controllers.SysManager
{
using Model;
using Dao.Interface.SysManager;
using EduCationManage.Controllers.Util;
using NHibernate.Criterion;
using Utility.Common;
using Utility.Json;
using Model.Util;
public class OrgaController : BaseController
{
private SS_ORGA ssOrga ; //部门类
private SS_CODE ssCode ; //系统参数类
private SS_CODEID ssCodeId ; //系统参数复合主键类
private ISysOrgDao sysOrgDao ; //部门dao
private ISysCodeDao sysCodeDao ; //系统参数dao
private ListItem<SS_CODE> myListItem;
private List<SS_CODE> orgaTypeList ; //部门类型的List
private List<SS_ORGA> orgaList = new List<SS_ORGA>(); //部门的List
private String strJson ; //返回页面值
private int total ; //总页数
private int page ; //当前页
private int records ; //总记录数
public ActionResult Execute()
{
ICriterion[] criterions = new ICriterion[1];
criterions[0] = Expression.Eq( "Id.C_ENAME", "ORGATYPE");
this.orgaTypeList = (List<SS_CODE>)sysCodeDao.FindByCriteria(criterions);
SelectList listItem = myListItem.GetListItem(orgaTypeList, "C_DISPLAY_CONTENT", "", "---选择---");
ViewData.Add( "listItem", listItem);
return View( "~/Views/SysManage/Orga/OrgaManager.aspx");
}
[HttpPost]
public JsonResult Show()
{
SS_USER user = Session[ "user"] as SS_USER;
String strOrgaId = "0010"; // user.C_ORGA_ID;//登录者的所在部门ID
try
{
ssOrga = sysOrgDao.Get(strOrgaId);
if (ssOrga.chkManageOrga())
{
ssOrga = sysOrgDao.Get(CONS_ROOT_ID);
}
JSTreeNode treeNode = this.CreateJSTreeforOrgTree(ssOrga);
nodeList.Add(treeNode);
strJson = "{suc:1,msg:'生成树成功'}";
log.Info( "生成树成功");
return Json(nodeList, JsonRequestBehavior.AllowGet);
}
catch (Exception)
{
strJson = "{suc:0,msg:'生成树失败'}";
log.Error( "生成树失败");
return Json( "{msg:'生成树失败'}");
}
}
}
}
我们在使用类的时候,只需要声明无需实例化,因为实例化这个过程由Spring容器管理。还要讲的是,有接口的类我们都是用接口声明,而在spring配置中只要配置成实现类即可,这样有利于代码的安全。
再看看页面
<
%@ Page
Language
="C#" Inherits="System.Web.Mvc.ViewPage<Model.Models.SystemManage.Orga.SS_ORGA
>" %>
< !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 >OrgaManage </title>
< link rel ="Stylesheet" href ="../../Content/form.css" />
< script type ="text/javascript" src ="../../Scripts/Project/SysManages/orgmanager.js" > </script>
</head>
< body >
< div id ="orgWapper" style ="overflow: hidden; margin: 0; padding-right: 0;" >
<div id="Basic_html" style="float: left; overflow: hidden; width: 16%; margin-left: 0px;
padding: 0;">
</div>
< div style ="overflow: auto; padding: 0; margin: 0;" >
< div id ="orgRightPane" style ="margin-left: 0px; padding: 0; float: right;" >
< table id ="dataGrid" >
</table>
< div id ="pager" style ="text-align: right; clear: both;" >
</div>
</div>
</div>
</div>
<div id="content" class="content ui-widjet window" style="text-align: center; width: 460px;
height: 260px; display: none">
< div class ="headbar" >
<img id="img_close" src="../../../Images/gbb.gif" style="float: right; cursor: pointer;"
alt="" />
<span style="float: left; height: 30px; line-height: 30px; color: #fff; font-size: 14px;
font-weight: bolder"> 部门信息 </span>
</div>
<% using (Html.BeginForm("", "Orga", FormMethod.Post, new { id = "orgaForm" }))
{ %>
< %: Html.HiddenFor(m = > m.C_FATHER_ID, new { id = "orgaFatherId", name = "CFatherId" })%>
< script language ="javascript" type ="text/javascript" >
var x = document.getElementById("orgaFatherId");
alert(x.value);
</script>
< %: Html.HiddenFor(m = > m.C_ORGA_ID, new { id = "orgaId", name = "COrgaId" })%>
< table border ="0" class ="tableStyle" >
< tr >
< td >
</td>
</tr>
< tr >
< td align ="right" >
部门名称
</td>
< td align ="left" >
< %: Html.TextBoxFor(m = > m.C_ORGA_NM, new { id = "orgaName", cssClass = "text required" })%>
< font color ="red" style ="font-size: 20" >* </font>
</td>
< td align ="right" >
部门类型
</td>
< td align ="left" >
< %: Html.DropDownListFor(m = > m.C_ORGA_TP, ViewData["listItem"] as SelectList, new { id = "orgaType", name = "COrgaTp" })%>
< font color ="red" style ="font-size: 20" >* </font>
</td>
</tr>
< tr >
< td align ="right" >
负责人
</td>
< td align ="left" >
< %:Html.TextBoxFor(m= >m.C_LEADER, new { id = "leader", cssClass = "text" })%>
< font color ="red" style ="font-size: 20" >* </font>
</td>
< td align ="right" >
电话
</td>
< td align ="left" >
< %:Html.TextBoxFor(m = > m.C_PHONE, new { id = "phone", cssClass = "text", Size = "20px" })%>
< font color ="red" style ="font-size: 20" >* </font>
</td>
</tr>
< tr >
< td align ="right" >
Email
</td>
< td colspan ="3" align ="left" >
< %:Html.TextBoxFor(m= >m.C_EMAIL, new { id = "email", cssClass = "text", Size = "60px" })%>
</td>
</tr>
< tr >
< td align ="right" valign ="top" >
部门描述
</td>
< td colspan ="3" align ="left" >
< %: Html.TextAreaFor(m= >m.C_ORGA_DESC, new { id = "orgaDesc", cssClass = "text", Columns = "58", Rows = "4" })%>
</td>
</tr>
< tr >
< td colspan ="4" align ="center" >
< button id ="orgModified" name ="modified" type ="button" class ="Pcip1" >
修 改
</button>
< button id ="orgSave" name ="orgSave" type ="submit" class ="Pcip1" >
保 存
</button>
< button id ="orgReset" type ="button" name ="orgReset" class ="Pcip1" >
重 置
</button>
< button id ="orgClose" name ="close" type ="button" class ="Pcip1" >
取 消
</button>
</td>
</tr>
</table>
< %} % >
</div>
< div id ="mask" class ="mask" >
</div>
</body>
</html>
< !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 >OrgaManage </title>
< link rel ="Stylesheet" href ="../../Content/form.css" />
< script type ="text/javascript" src ="../../Scripts/Project/SysManages/orgmanager.js" > </script>
</head>
< body >
< div id ="orgWapper" style ="overflow: hidden; margin: 0; padding-right: 0;" >
<div id="Basic_html" style="float: left; overflow: hidden; width: 16%; margin-left: 0px;
padding: 0;">
</div>
< div style ="overflow: auto; padding: 0; margin: 0;" >
< div id ="orgRightPane" style ="margin-left: 0px; padding: 0; float: right;" >
< table id ="dataGrid" >
</table>
< div id ="pager" style ="text-align: right; clear: both;" >
</div>
</div>
</div>
</div>
<div id="content" class="content ui-widjet window" style="text-align: center; width: 460px;
height: 260px; display: none">
< div class ="headbar" >
<img id="img_close" src="../../../Images/gbb.gif" style="float: right; cursor: pointer;"
alt="" />
<span style="float: left; height: 30px; line-height: 30px; color: #fff; font-size: 14px;
font-weight: bolder"> 部门信息 </span>
</div>
<% using (Html.BeginForm("", "Orga", FormMethod.Post, new { id = "orgaForm" }))
{ %>
< %: Html.HiddenFor(m = > m.C_FATHER_ID, new { id = "orgaFatherId", name = "CFatherId" })%>
< script language ="javascript" type ="text/javascript" >
var x = document.getElementById("orgaFatherId");
alert(x.value);
</script>
< %: Html.HiddenFor(m = > m.C_ORGA_ID, new { id = "orgaId", name = "COrgaId" })%>
< table border ="0" class ="tableStyle" >
< tr >
< td >
</td>
</tr>
< tr >
< td align ="right" >
部门名称
</td>
< td align ="left" >
< %: Html.TextBoxFor(m = > m.C_ORGA_NM, new { id = "orgaName", cssClass = "text required" })%>
< font color ="red" style ="font-size: 20" >* </font>
</td>
< td align ="right" >
部门类型
</td>
< td align ="left" >
< %: Html.DropDownListFor(m = > m.C_ORGA_TP, ViewData["listItem"] as SelectList, new { id = "orgaType", name = "COrgaTp" })%>
< font color ="red" style ="font-size: 20" >* </font>
</td>
</tr>
< tr >
< td align ="right" >
负责人
</td>
< td align ="left" >
< %:Html.TextBoxFor(m= >m.C_LEADER, new { id = "leader", cssClass = "text" })%>
< font color ="red" style ="font-size: 20" >* </font>
</td>
< td align ="right" >
电话
</td>
< td align ="left" >
< %:Html.TextBoxFor(m = > m.C_PHONE, new { id = "phone", cssClass = "text", Size = "20px" })%>
< font color ="red" style ="font-size: 20" >* </font>
</td>
</tr>
< tr >
< td align ="right" >
</td>
< td colspan ="3" align ="left" >
< %:Html.TextBoxFor(m= >m.C_EMAIL, new { id = "email", cssClass = "text", Size = "60px" })%>
</td>
</tr>
< tr >
< td align ="right" valign ="top" >
部门描述
</td>
< td colspan ="3" align ="left" >
< %: Html.TextAreaFor(m= >m.C_ORGA_DESC, new { id = "orgaDesc", cssClass = "text", Columns = "58", Rows = "4" })%>
</td>
</tr>
< tr >
< td colspan ="4" align ="center" >
< button id ="orgModified" name ="modified" type ="button" class ="Pcip1" >
修 改
</button>
< button id ="orgSave" name ="orgSave" type ="submit" class ="Pcip1" >
保 存
</button>
< button id ="orgReset" type ="button" name ="orgReset" class ="Pcip1" >
重 置
</button>
< button id ="orgClose" name ="close" type ="button" class ="Pcip1" >
取 消
</button>
</td>
</tr>
</table>
< %} % >
</div>
< div id ="mask" class ="mask" >
</div>
</body>
</html>
废话不多说,我们最后看看公共类。
一个是Json解析,另外的是一些加密,下拉绑定的公用类。
ok,大概就这么介绍下,如果那位仁兄想要我的源代码,请留言,在要之前,确保你的机子上装上了VS2010。
本文转自 BruceAndLee 51CTO博客,原文链接:http://blog.51cto.com/leelei/343101,如需转载请自行联系原作者