WD_DeviceInfoBusinessLogic.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using HNWD.Pregrant.Model;
  7. using HNWD.Pregrant.DataAccess;
  8. namespace HNWD.Pregrant.BusinessLogic
  9. {
  10. public class WD_DeviceInfoBusinessLogic : BusinessLogicBase2<WD_DeviceInfo>
  11. {
  12. private string deviceid = string.Empty;
  13. public WD_DeviceInfoBusinessLogic(string deviceid)
  14. : base(true, "led")
  15. {
  16. this.deviceid = deviceid;
  17. }
  18. public WD_DeviceInfoExt QueryAll()
  19. {
  20. this.wd_DeviceInfoDataAccess.QueryAll();
  21. return this.wd_DeviceInfoDataAccess.ext;
  22. }
  23. public override ModelExtBase<WD_DeviceInfo> Query()
  24. {
  25. this.wd_DeviceInfoDataAccess.QueryAll();
  26. this.wd_DeviceInfoDataAccess.ext.messageDataList = this.wd_DeviceInfoDataAccess.ext.messageDataList.FindAll(f => f.ID == this.deviceid).ToList();
  27. return this.wd_DeviceInfoDataAccess.ext;
  28. }
  29. public List<WD_DeviceInfo> QueryPartIDs()
  30. {
  31. List<WD_DeviceInfo> ldev = this.wd_DeviceInfoDataAccess.QueryPartIDs();
  32. return ldev;
  33. }
  34. public override ModelBase Business(string data)
  35. {
  36. base.Business(data);
  37. this.wd_DeviceInfoDataAccess.Business(this.insert_list, update_list, delete_list);
  38. return this.DefaultReturn();
  39. }
  40. protected override void Dispatch(string data)
  41. {
  42. if(data.Length == 0)
  43. {
  44. this.bSuccess = false;
  45. this.Message = "传入数据长度必须大于0";
  46. return;
  47. }
  48. string[] items = data.Split(new char[]{'$'});
  49. foreach(string item in items)
  50. {
  51. string[] subitems = item.Split(new char[]{'@'});
  52. WD_DeviceInfo wd_DeviceInfo = new WD_DeviceInfo()
  53. {
  54. ID = subitems[1],
  55. DEVICE_TYPE= subitems[2],
  56. DEVICE_SN = subitems[3],
  57. DEVICE_MODEL = subitems[4],
  58. DEVICE_SOFT_VER = subitems[5],
  59. DEVICE_HARD_VER = subitems[6],
  60. DEVICE_NAME = subitems[7],
  61. DEVICE_ETH_MAC = subitems[8],
  62. DEVICE_ETH_IP = subitems[9],
  63. DEVICE_WIFI_MAC = subitems[10],
  64. DEVICE_WIFI_IP = subitems[11],
  65. DEVICE_WIFI_HOSTNAME = subitems[12],
  66. DEVICE_STATUS = subitems[13],
  67. DEVICE_ROOM_NUM = subitems[14],
  68. DEVICE_ROOM_ID = subitems[15],
  69. DEVICE_BED_NUM = subitems[16],
  70. DEVICE_BED_NAME= subitems[17],
  71. DEVICE_HUMAN_TYPE= subitems[18],
  72. DEVICE_HUMAN_ID= subitems[19],
  73. DEVICE_SIP_IP= subitems[20],
  74. DEVICE_SIP_ID= subitems[21],
  75. DEVICE_SIP_PASSWORD= subitems[22],
  76. DEVICE_IR_CFG = subitems[26],
  77. DEVICE_ZONE0 = subitems[27],
  78. DEVICE_ZONE1 = subitems[28],
  79. DEVICE_ZONE2 = subitems[29],
  80. DEVICE_ZONE3 = subitems[30],
  81. DEVICE_ZONE4 = subitems[31],
  82. DEVICE_ZONE5 = subitems[32],
  83. DEVICE_DATETIME = subitems[33]
  84. };
  85. if(subitems[0].ToLower() == "i")
  86. {
  87. this.insert_list.Add(wd_DeviceInfo);
  88. }
  89. if (subitems[0].ToLower() == "u")
  90. {
  91. this.update_list.Add(wd_DeviceInfo);
  92. }
  93. if (subitems[0].ToLower() == "d")
  94. {
  95. this.delete_list.Add(wd_DeviceInfo);
  96. }
  97. }
  98. }
  99. }
  100. }