public ActionResult GetExceptionTypeInfo(ExceptionTypeSeachModel model, int searchPage) { SearchDataWithPagedDatas <ExceptionTypeSeachModel, ExceptionTypeListModel> result = new SearchDataWithPagedDatas <ExceptionTypeSeachModel, ExceptionTypeListModel>(); result.SearchModel = model; result.PagedDatas = ExceptionTypeBLL.GetPagedExceptionType(model, searchPage, this.PageSize); return(PartialView("_ExceptionTypePagedGrid", result)); }
public static AsiatekPagedList <ExceptionTypeListModel> GetPagedExceptionType(ExceptionTypeSeachModel model, int searchPage, int pageSize) { List <SqlParameter> paras = new List <SqlParameter>() { new SqlParameter("@tableName", "ExceptionType"), new SqlParameter("@pageSize", pageSize), new SqlParameter("@currentPage", searchPage), new SqlParameter("@orderBy", "ID"), new SqlParameter("@showColumns", @"ID,ExName,Remark"), }; string conditionStr = " 1=1 "; if (!string.IsNullOrWhiteSpace(model.ExName)) { conditionStr += " AND ExName LIKE '%" + model.ExName + "%'"; } 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 <ExceptionTypeListModel> list = ConvertToList <ExceptionTypeListModel> .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)); }