WdtLogService.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using cuidian.Sql;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using YiLvRunFrom.Model;
  9. namespace YiLvRunFrom.Dal
  10. {
  11. public class WdtLogService
  12. {
  13. public List<WdtLogs> GetLogsTable()
  14. {
  15. List<WdtLogs> list = new List<WdtLogs>();
  16. DataTable dt= DbUtils.Fill("select SysId,OperType,Args,ReturnCode,Msg from WdtLogs where ReturnCode<>0", ConnectionUtils.Instance.GetConnection("TempDB") );
  17. foreach (DataRow row in dt.Rows)
  18. {
  19. list.Add(new WdtLogs() {
  20. SysId = Convert.ToInt32(row["SysId"].ToString()),
  21. OperType = row["OperType"].ToString(),
  22. Args = row["Args"].ToString(),
  23. ReturnCode = Convert.ToInt32(row["ReturnCode"].ToString()),
  24. Msg=row["Msg"].ToString()
  25. });
  26. }
  27. return list;
  28. }
  29. public List<WdtLogs> GetSingletonTable(string typeStr)
  30. {
  31. List<WdtLogs> list = new List<WdtLogs>();
  32. DataTable dt = DbUtils.Fill(string.Format("select SysId,OperType,Args,ReturnCode,Msg from WdtLogs where ReturnCode<>0 and OperType like '%{0}%'",typeStr), ConnectionUtils.Instance.GetConnection("TempDB"));
  33. foreach (DataRow row in dt.Rows)
  34. {
  35. list.Add(new WdtLogs()
  36. {
  37. SysId = Convert.ToInt32(row["SysId"].ToString()),
  38. OperType = row["OperType"].ToString(),
  39. Args = row["Args"].ToString(),
  40. ReturnCode = Convert.ToInt32(row["ReturnCode"].ToString()),
  41. Msg = row["Msg"].ToString()
  42. });
  43. }
  44. return list;
  45. }
  46. }
  47. }