using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Aspose.Cells;
using System.Web;
namespace Quiz.WebsiteAnalysis
{
public class Tool
{
#region 同一页面分页
///
/// 分页
///
///
///
///
///
///
public static string PageBar(int PageCount, int CurrentIndex, string page, string param = "", string pagename = "page")
{
string _PageBar = "";
if (PageCount > 1)
{
_PageBar += "
";
if (CurrentIndex == 1)
{
_PageBar += "
<上一页";
}
else
{
_PageBar += "
<上一页";
}
int i = 1;
if (PageCount <= 10)
{
for (int time = 0; i + time <= PageCount; time++)
{
if ((i + time) == CurrentIndex)
{
_PageBar += "
" + (i + time) + "";
}
else
{
_PageBar += "
" + (i + time) + "";
}
}
}
else
{
if (CurrentIndex <= 5)
{
for (int time = 1; time <= (CurrentIndex == 5 ? 7 : 5); time++)
{
if ((time) == CurrentIndex)
{
_PageBar += "
" + (time) + "";
}
else
{
_PageBar += "
" + (time) + "";
}
}
_PageBar += "
..." + PageCount + "";
}
if (CurrentIndex > 5)
{
_PageBar += "
1...";
if (CurrentIndex >= PageCount - 5)
{
for (int time = PageCount - 5; time <= PageCount; time++)
{
if ((time) == CurrentIndex)
{
_PageBar += "
" + (time) + "";
}
else
{
_PageBar += "
" + (time) + "";
}
}
}
else
{
for (int time = CurrentIndex; time < CurrentIndex + 5; time++)
{
if ((time) == CurrentIndex)
{
_PageBar += "
" + (time) + "";
}
else
{
_PageBar += "
" + (time) + "";
}
}
_PageBar += "
..." + PageCount + "";
}
}
}
if (CurrentIndex == PageCount)
{
_PageBar += "
下一页>";
}
else
{
_PageBar += "
下一页>";
}
_PageBar += "
";
}
return _PageBar;
}
#endregion
#region 导出excel
///