public object LoadModel(int?page) { // 说明:参数page表示分页数,方法名LoadModel其实可以【随便取】。 // 根据用户选择的界面风格,计算实现要呈现的页面路径。 string papeUrl = this.GetTargetPageUrl("Customers.aspx"); if (this.IsStyle2) { // 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); result.RequestUrlEncodeRawUrl = HttpUtility.UrlEncode(this.HttpContext.Request.RawUrl); return(new PageResult(papeUrl, result)); }
public object List(CustomerSearchInfo pagingInfo) { pagingInfo.CheckPagingInfoState(); List <Customer> List = BllFactory.GetCustomerBLL().GetList(pagingInfo); var result = new GridResult <Customer>(List, pagingInfo.TotalRecords); return(new JsonResult(result)); }
public object Show(int id) { Customer customer = BllFactory.GetCustomerBLL().GetById(id); if (customer == null) { throw new MyMessageException("指定的ID值无效。不能找到对应的记录。"); } return(new PageResult("/Pages/Style1/Controls/CustomerInfo.cshtml", customer)); }
public object GetById(int id) { Customer customer = BllFactory.GetCustomerBLL().GetById(id); if (customer == null) { throw new MyMessageException("指定的ID值无效。不能找到对应的记录。"); } return(new JsonResult(customer)); }
public object Delete(int id, string returnUrl) { BllFactory.GetCustomerBLL().Delete(id); if (string.IsNullOrEmpty(returnUrl)) { return(null); } else { return(new RedirectResult(returnUrl)); } }
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 PageResult("/Pages/Style1/Controls/CustomerPicker.cshtml", data)); }
public void Update(Customer customer) { customer.EnsureItemIsOK(); BllFactory.GetCustomerBLL().Update(customer); }
public void Insert(Customer customer) { customer.EnsureItemIsOK(); BllFactory.GetCustomerBLL().Insert(customer); }