IpInfoService.cs 930 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data;
  6. using Models;
  7. using System.Data.SqlClient;
  8. namespace DAL
  9. {
  10. public class IpInfoService
  11. {
  12. /// <summary>
  13. /// 查询所有
  14. /// </summary>
  15. /// <param name="sql">sql语句</param>
  16. /// <param name="param">可变参数数组</param>
  17. /// <returns>返回集合</returns>
  18. List<IpInfo> excuteSql(string sql, params SqlParameter[] param)
  19. {
  20. return ServiceBase<IpInfo>.excuteSql(new IpInfo(), "IpInfo", sql, CommandType.Text, param);
  21. }
  22. /// <summary>
  23. /// 查询所有地址为中国的Ip段
  24. /// </summary>
  25. /// <returns></returns>
  26. public List<IpInfo> GetAllIpInfo()
  27. {
  28. string strSql = "select * from IpInfo where country like '%中国%'";
  29. return excuteSql(strSql);
  30. }
  31. }
  32. }