Extensions_ForSXTEx.cs 796 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data;
  6. namespace Bowin.Common.Linq
  7. {
  8. public static partial class Extensions_ForSXTEx
  9. {
  10. public static DataSet ToSXTEx_PagingDataSet<T>(this IEnumerable<T> source, int PageIndex, int PageSize) where T : class
  11. {
  12. DataSet ds = new DataSet("root");
  13. var dt1=source.Paging(PageIndex+1, PageSize).ToTable();
  14. DataTable dt2 = new DataTable("Tatol");
  15. dt2.Columns.Add("count", typeof(int));
  16. var dt2_con = dt2.NewRow();
  17. dt2_con[0] = source.Count();
  18. dt2.Rows.Add(dt2_con);
  19. ds.Tables.Add(dt1.Copy());
  20. ds.Tables.Add(dt2);
  21. return ds;
  22. }
  23. }
  24. }