public ActionResult GetServiceProviderInfo(ServiceProviderSeachModel model, int searchPage) { var result = new SearchDataWithPagedDatas <ServiceProviderSeachModel, ServiceProviderListModel>(); result.SearchModel = model; result.PagedDatas = ServiceProviderTypeBLL.GetPagedServiceProviderType(model, searchPage, this.PageSize); return(PartialView("_ServiceProviderGrid", result)); }
public static AsiatekPagedList <ServiceProviderListModel> GetPagedServiceProviderType(ServiceProviderSeachModel model, int searchPage, int pageSize) { List <SqlParameter> paras = new List <SqlParameter>() { new SqlParameter("@tableName", "ServiceProvider s"), new SqlParameter("@pageSize", pageSize), new SqlParameter("@currentPage", searchPage), new SqlParameter("@orderBy", "s.ID"), new SqlParameter("@showColumns", @"s.ID , s.Name, s.Remark, s.Status"), }; string conditionStr = " Status<>9 ";//不查询删除和报废的 if (!string.IsNullOrWhiteSpace(model.Name)) { conditionStr += " AND s.Name LIKE '%" + model.Name + "%'"; } if (!string.IsNullOrWhiteSpace(conditionStr)) { paras.Add(new SqlParameter("@conditionStr", conditionStr)); } paras.Add(new SqlParameter() { ParameterName = "@totalItemCount", Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int }); paras.Add(new SqlParameter() { ParameterName = "@newCurrentPage", Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int }); List <ServiceProviderListModel> list = ConvertToList <ServiceProviderListModel> .Convert(MSSQLHelper.ExecuteDataTable(CommandType.StoredProcedure, "Proc_GetPagedDatas", paras.ToArray())); int totalItemCount = Convert.ToInt32(paras[paras.Count - 2].Value); int newCurrentPage = Convert.ToInt32(paras[paras.Count - 1].Value); return(list.ToPagedList(newCurrentPage, pageSize, totalItemCount)); }