コード例 #1
0
		public object List(CustomerSearchInfo pagingInfo)
		{
			pagingInfo.CheckPagingInfoState();

			List<Customer> List = BllFactory.GetCustomerBLL().GetList(pagingInfo);
			var result = new GridResult<Customer>(List, pagingInfo.RecCount);
			return new JsonResult(result);
		}
コード例 #2
0
ファイル: CustomerBLL.cs プロジェクト: rockhe168/PracticeCode
		// 根据指定的查询关键词及分页参数,获取客户列表.
		public List<Customer> GetList(CustomerSearchInfo info)
		{
			var query = from customer in WebSiteDB.MyNorthwind.Customers.AsQueryable()
						select customer;

			if( string.IsNullOrEmpty(info.SearchWord) == false )
				query = query.Where(
					c => c.CustomerName.Contains(info.SearchWord) || c.Address.Contains(info.SearchWord));

			return query.OrderBy(x => x.CustomerName).GetPagingList<Customer>(info);
		}
コード例 #3
0
		public object ShowCustomerPicker(string searchWord, int? page)
		{
			CustomerSearchInfo info = new CustomerSearchInfo();
			info.SearchWord = searchWord ?? string.Empty;
			info.PageIndex = page.HasValue ? page.Value - 1 : 0;
			info.PageSize = AppHelper.DefaultPageSize;


			CustomerPickerModel data = new CustomerPickerModel();
			data.SearchInfo = info;
			data.List = BllFactory.GetCustomerBLL().GetList(info);

			return new UcResult("/Controls/Style1/CustomerPicker.ascx", data);
		}
コード例 #4
0
		public static object LoadModel(int? page)
		{
			// 说明:参数page表示分页数,方法名LoadModel其实可以【随便取】。

			// 根据用户选择的界面风格,计算实现要呈现的页面路径。
			string papeUrl = StyleHelper.GetTargetPageUrl("Customers.aspx");

			if( StyleHelper.PageStyle == StyleHelper.StyleArray[1] )
				// Style2 风格下,页面不需要绑定数据。数据由JS通过AJAX方式获取
				return new PageResult(papeUrl, null);


			// 为Style1 风格获取数据。
			CustomerSearchInfo info = new CustomerSearchInfo();
			info.SearchWord = string.Empty;
			info.PageIndex = page.HasValue ? page.Value - 1 : 0;
			info.PageSize = AppHelper.DefaultPageSize;

			CustomersPageModel result = new CustomersPageModel();
			result.PagingInfo = info;
			result.List = BllFactory.GetCustomerBLL().GetList(info);

			return new PageResult(papeUrl, result);
		}