123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using HNWD.Pregrant.Model;
- using HNWD.Pregrant.DataAccess;
- namespace HNWD.Pregrant.BusinessLogic
- {
- public class WD_DeviceInfoBusinessLogic : BusinessLogicBase2<WD_DeviceInfo>
- {
- private string deviceid = string.Empty;
- public WD_DeviceInfoBusinessLogic(string deviceid)
- : base(true, "led")
- {
- this.deviceid = deviceid;
- }
-
- public WD_DeviceInfoExt QueryAll()
- {
- this.wd_DeviceInfoDataAccess.QueryAll();
- return this.wd_DeviceInfoDataAccess.ext;
- }
- public override ModelExtBase<WD_DeviceInfo> Query()
- {
- this.wd_DeviceInfoDataAccess.QueryAll();
- this.wd_DeviceInfoDataAccess.ext.messageDataList = this.wd_DeviceInfoDataAccess.ext.messageDataList.FindAll(f => f.ID == this.deviceid).ToList();
- return this.wd_DeviceInfoDataAccess.ext;
- }
- public List<WD_DeviceInfo> QueryPartIDs()
- {
- List<WD_DeviceInfo> ldev = this.wd_DeviceInfoDataAccess.QueryPartIDs();
- return ldev;
- }
- public override ModelBase Business(string data)
- {
- base.Business(data);
- this.wd_DeviceInfoDataAccess.Business(this.insert_list, update_list, delete_list);
- return this.DefaultReturn();
- }
-
- protected override void Dispatch(string data)
- {
- if(data.Length == 0)
- {
- this.bSuccess = false;
- this.Message = "传入数据长度必须大于0";
- return;
- }
- string[] items = data.Split(new char[]{'$'});
- foreach(string item in items)
- {
- string[] subitems = item.Split(new char[]{'@'});
- WD_DeviceInfo wd_DeviceInfo = new WD_DeviceInfo()
- {
- ID = subitems[1],
- DEVICE_TYPE= subitems[2],
- DEVICE_SN = subitems[3],
- DEVICE_MODEL = subitems[4],
- DEVICE_SOFT_VER = subitems[5],
- DEVICE_HARD_VER = subitems[6],
- DEVICE_NAME = subitems[7],
- DEVICE_ETH_MAC = subitems[8],
- DEVICE_ETH_IP = subitems[9],
- DEVICE_WIFI_MAC = subitems[10],
- DEVICE_WIFI_IP = subitems[11],
- DEVICE_WIFI_HOSTNAME = subitems[12],
- DEVICE_STATUS = subitems[13],
- DEVICE_ROOM_NUM = subitems[14],
- DEVICE_ROOM_ID = subitems[15],
- DEVICE_BED_NUM = subitems[16],
- DEVICE_BED_NAME= subitems[17],
- DEVICE_HUMAN_TYPE= subitems[18],
- DEVICE_HUMAN_ID= subitems[19],
- DEVICE_SIP_IP= subitems[20],
- DEVICE_SIP_ID= subitems[21],
- DEVICE_SIP_PASSWORD= subitems[22],
- DEVICE_IR_CFG = subitems[26],
- DEVICE_ZONE0 = subitems[27],
- DEVICE_ZONE1 = subitems[28],
- DEVICE_ZONE2 = subitems[29],
- DEVICE_ZONE3 = subitems[30],
- DEVICE_ZONE4 = subitems[31],
- DEVICE_ZONE5 = subitems[32],
- DEVICE_DATETIME = subitems[33]
-
- };
-
- if(subitems[0].ToLower() == "i")
- {
- this.insert_list.Add(wd_DeviceInfo);
- }
- if (subitems[0].ToLower() == "u")
- {
- this.update_list.Add(wd_DeviceInfo);
- }
- if (subitems[0].ToLower() == "d")
- {
- this.delete_list.Add(wd_DeviceInfo);
- }
- }
- }
- }
- }
|