public PageList<StudentsInfo> Page(string Name, string Start_Time, string End_Time, int Grade_TypeId, int id = 0)
{
ViewBag.Grade_Id = new SelectList(studentsbll.Grade_TypeList(), "Grade_Id", "Grade_Name");
StringBuilder strb = new StringBuilder();
strb.Append(" 1=1 ");
if (!string.IsNullOrEmpty(Name))
{
strb.Append(" and Name like '%" + Name + "%'");
}
if (!string.IsNullOrEmpty(Start_Time) && !string.IsNullOrEmpty(End_Time))
{
strb.Append(" and(Start_Time between'" + Start_Time + "'and'" + End_Time + "')");
}
if (Grade_TypeId != 0)
{
strb.Append(" and a.Grade_Id=" + Grade_TypeId);
}
ParamModel parammodel = new ParamModel()
{
TableName = "StudentsInfo a inner join Grade_Type b on a.Grade_Id=b.Grade_Id",
IndexCol = "Id",
PageSize = 3,
PageIndex = id,
OrderCol = "Id desc",
StrWhere = strb.ToString(),
Columns = "*"
};
var list = studentsbll.GetStudentInfos(parammodel);
ViewBag.PageIndex = id;
ViewBag.TotalPage = list.TotalCount % parammodel.PageSize != 0 ? list.TotalCount / parammodel.PageSize + 1 : parammodel.PageSize;
return list;
}