資源簡介
Mvc+Easyui基本使用demo。easyui部分包括頁面布局,可伸縮面板,菜單,iframe選項卡,數據表格,linkbutton等的基本使用方法。mvc部分演示了視圖調用和json類型數據返回的方法。

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?DAL;
using?Model;
using?Models;
using?System.Data.Entity;//必須引用
using?System.Data;//EntityState.Modified;???這個準備??一定添加命名空間System.Data.Entity和ef4.1
namespace?BLL
{
????public?class?ProductBLL
????{
????????public?IList?GetProductList(int?pageIndex?int?pageSize?out?int?Total)
????????{
????????????using?(MyContext?db?=?new?MyContext())
????????????{
????????????????Total?=?(from?c?in?db.Product
?????????????????????????orderby?c.ID
?????????????????????????select?c).Count();
????????????????var?items?=?(from?c?in?db.Product
?????????????????????????????orderby?c.ID
?????????????????????????????select?c).Skip((pageIndex?-?1)?*?pageSize).Take(pageSize).ToList();
????????????????IList?ProductInfos?=?new?List();
????????????????foreach?(var?item?in?items)
????????????????{
????????????????????ProductInfo?info?=?new?ProductInfo();
????????????????????info.ID?=?item.ID;
????????????????????info.ProductTypeID?=?item.ProductTypeID;
????????????????????info.ProductTypeName?=?item.ProductType.ProductTypeName;//導航屬性的特點
????????????????????info.Image?=?item.Image;
????????????????????info.ProductName?=?item.ProductName;
????????????????????info.MarketPrice?=?item.MarketPrice;
????????????????????info.NewPrice?=?item.NewPrice;
????????????????????info.GetDate?=?item.GetDate.ToShortDateString();
????????????????????info.Enable?=?item.Enable;
????????????????????ProductInfos.Add(info);
????????????????}
????????????????return?ProductInfos;
????????????}
????????}
????????public?IList?GetProductsBySerach(int?pageIndex?int?pageSize?out?int?Total?int?typeId?int?id?string?name?int?NewPrice?bool??b)
????????{
????????????using?(MyContext?db?=?new?MyContext())
????????????{
????????????????Total?=?(from?c?in?db.Product
?????????????????????????where?((id?!=?0)???c.ID?==?id?:?true)?&&?((typeId?!=?0)???c.ProductTypeID?==?typeId?:?true)?&&
?????????????????????????????(!string.IsNullOrEmpty(name)???c.ProductName.Contains(name)?:?true)?&&
?????????????????????????????((NewPrice?!=?0)???c.NewPrice?==?NewPrice?:?true)?&&?????????????????????????????
?????????????????????????????((b?==?null)???true?:?c.Enable?==?b)//傳值為NULL就是全部
?????????????????????????orderby?c.ProductTypeID
?????????????????????????select?c).Count();
????????????????var?items?=?(from?c?in?db.Product
?????????????????????????????where?((id?!=?0)???c.ID?==?id?:?true)?&&?((typeId?!=?0)???c.ProductTypeID?==?typeId?:?true)?&&
????????????????????????????(!string.IsNullOrEmpty(name)???c.ProductName.Contains(name)?:?true)?&&???????????????????????????
????????????????????????????((NewPrice?!=?0)???c.NewPrice?==?NewPrice?:?true)?&&
????????????????????????????((b?==?null)???true?:?c.Enable?==?b)//傳值為NULL就是全部
?????????????????????????????orderby?c.ProductTypeID//必須在分頁前排序
?????????????????????????????sel
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????783648??2011-04-06?10:33??DLL\Entityfr
?????文件?????320512??2011-01-04?13:48??DLL\Newtonsoft.Json.Net35.dll
?????文件??????13312??2012-10-14?20:34??MyProject\BLL\bin\Debug\BLL.dll
?????文件??????24064??2012-10-14?20:34??MyProject\BLL\bin\Debug\BLL.pdb
?????文件???????5120??2012-10-14?18:13??MyProject\BLL\bin\Debug\DAL.dll
?????文件??????11776??2012-10-14?18:13??MyProject\BLL\bin\Debug\DAL.pdb
?????文件?????783648??2011-04-06?10:33??MyProject\BLL\bin\Debug\Entityfr
?????文件???????9728??2012-10-14?18:13??MyProject\BLL\bin\Debug\Model.dll
?????文件??????11776??2012-10-14?18:13??MyProject\BLL\bin\Debug\Model.pdb
?????文件???????3022??2012-10-09?00:29??MyProject\BLL\BLL.csproj
?????文件????????227??2012-10-14?14:51??MyProject\BLL\BLL.csproj.user
?????文件????????639??2012-10-14?14:51??MyProject\BLL\obj\Debug\BLL.csproj.FileListAbsolute.txt
?????文件??????13312??2012-10-14?20:34??MyProject\BLL\obj\Debug\BLL.dll
?????文件??????24064??2012-10-14?20:34??MyProject\BLL\obj\Debug\BLL.pdb
?????文件???????5966??2012-10-14?21:15??MyProject\BLL\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件??????13211??2012-10-14?18:13??MyProject\BLL\obj\Debug\ResolveAssemblyReference.cache
?????文件???????5876??2012-10-14?20:34??MyProject\BLL\ProductBLL.cs
?????文件???????5401??2012-10-14?20:14??MyProject\BLL\ProductTypeBLL.cs
?????文件???????1338??2012-09-19?22:51??MyProject\BLL\Properties\AssemblyInfo.cs
?????文件???????5120??2012-10-14?18:13??MyProject\DAL\bin\Debug\DAL.dll
?????文件??????11776??2012-10-14?18:13??MyProject\DAL\bin\Debug\DAL.pdb
?????文件?????783648??2011-04-06?10:33??MyProject\DAL\bin\Debug\Entityfr
?????文件???????9728??2012-10-14?18:13??MyProject\DAL\bin\Debug\Model.dll
?????文件??????11776??2012-10-14?18:13??MyProject\DAL\bin\Debug\Model.pdb
?????文件???????2817??2012-10-14?14:51??MyProject\DAL\DAL.csproj
?????文件???????1071??2012-10-08?00:14??MyProject\DAL\MyContext.cs
?????文件????????503??2012-10-08?00:29??MyProject\DAL\obj\Debug\DAL.csproj.FileListAbsolute.txt
?????文件???????5120??2012-10-14?18:13??MyProject\DAL\obj\Debug\DAL.dll
?????文件??????11776??2012-10-14?18:13??MyProject\DAL\obj\Debug\DAL.pdb
?????文件???????5894??2012-10-14?21:15??MyProject\DAL\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
............此處省略392個文件信息
評論
共有 條評論