public Page<HoiVien> Search1(int page) { MyConnectionDB db = new MyConnectionDB(); string sql = "Select * from HoiVien"; Page<HoiVien> ds; HoiVien srch = (HoiVien)TempData["search"]; string temp = ""; if (srch.DivisionID != null) { temp = temp + string.Format(" and DivisionID like N'%{0}%'", srch.DivisionID); } if (srch.MemberID != null) { temp = temp + string.Format(" and MemberID like N'%{0}%'", srch.MemberID); } if (srch.MemberName != null) { temp = temp + string.Format(" and MemberName like N'%{0}%'", srch.MemberName); } if (srch.Address != null) { temp = temp + string.Format(" and Address like N'%{0}%'", srch.Address); } if (srch.Identify != null) { temp = temp + string.Format(" and Identify like N'%{0}%'", srch.Identify); } if (srch.Phone != null) { temp = temp + string.Format(" and Phone like N'%{0}%'", srch.Phone); } if (srch.Tel != null) { temp = temp + string.Format(" and Tel like N'%{0}%'", srch.Tel); } if (srch.Fax != null) { temp = temp + string.Format(" and Fax like N'%{0}%'", srch.Fax); } if (srch.Email != null) { temp = temp + string.Format(" and Email like N'%{0}%'", srch.Email); } if (temp != null) { sql = sql + " where 0=0" + temp; } ds = db.Page<HoiVien>(page, 10, sql); return ds; }
public Page<HoiVien> Search(int page) { MyConnectionDB db = new MyConnectionDB(); string sql = "Select * from HoiVien"; Page<HoiVien> ds; ds = db.Page<HoiVien>(page,10,sql); Session["page"] = ds.TotalPages; return ds; }