public ActionResult GetCommunicationTypeInfo(CommunicationTypeSeachModel model, int searchPage) { SearchDataWithPagedDatas <CommunicationTypeSeachModel, CommunicationTypeListModel> result = new SearchDataWithPagedDatas <CommunicationTypeSeachModel, CommunicationTypeListModel>(); result.SearchModel = model; result.PagedDatas = CommunicationTypeBLL.GetPagedCommunicationType(model, searchPage, this.PageSize); return(PartialView("_CommunicationTypeGrid", result)); }
public static AsiatekPagedList <CommunicationTypeListModel> GetPagedCommunicationType(CommunicationTypeSeachModel model, int searchPage, int pageSize) { List <SqlParameter> paras = new List <SqlParameter>() { new SqlParameter("@tableName", "CommunicationType"), new SqlParameter("@pageSize", pageSize), new SqlParameter("@currentPage", searchPage), new SqlParameter("@orderBy", "ID"), new SqlParameter("@showColumns", @"ID , Name, Remark, Status"), }; string conditionStr = " Status<>9 ";//不查询删除 if (!string.IsNullOrWhiteSpace(model.Name)) { conditionStr += " AND 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 <CommunicationTypeListModel> list = ConvertToList <CommunicationTypeListModel> .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)); }