/// <summary> /// 根据动作,计算出应该显示的页数 /// </summary> public static int GetPageNow(PageAction action, int pageNow, int pageTotal) { int pageNum = pageNow; if (action.Equals(PageAction.First)) { pageNum = 0; } else if (action.Equals(PageAction.Last)) { pageNum = pageTotal; } else if (action.Equals(PageAction.Next)) { pageNum++; } else if (action.Equals(PageAction.Previous)) { pageNum--; } else { pageNum = 1; } if (pageNum > pageTotal) { pageNum = pageTotal; } if (pageNum < 1) { pageNum = 1; } return(pageNum); }
/// <summary> /// 根据动作,计算出应该显示的页数 /// </summary> public static int GetPageNow(PageAction action, int pageNow, int pageTotal) { int pageNum = pageNow; if (action.Equals(PageAction.First)) { pageNum = 0; } else if (action.Equals(PageAction.Last)) { pageNum = pageTotal; } else if (action.Equals(PageAction.Next)) { pageNum++; } else if (action.Equals(PageAction.Previous)) { pageNum--; } else { pageNum = 1; } if (pageNum > pageTotal) { pageNum = pageTotal; } if (pageNum < 1) { pageNum = 1; } return pageNum; }