using EGFramework; using Newtonsoft.Json; namespace Emergency_platform{ public class ResponsePatrol : IResponse { public string action { set; get; } public string taskid { set; get; } public List cabinetid { set; get; } public bool TrySetData(string protocolData, byte[] protocolBytes) { try { ResponsePatrol data = JsonConvert.DeserializeObject(protocolData); if(data.action == "patrol"){ this.action = data.action; this.taskid = data.taskid; this.cabinetid = data.cabinetid; return true; } return false; } catch (System.Exception) { return false; throw; } } } public class RequestPatrol : IRequest { public string action = "identify"; public string date { set; get; } public string taskid { set; get; } public int cabinetid = 1; public List target { set; get; } public RequestPatrol(){ date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); target = new List(); } public RequestPatrol(List target){ this.target = target; date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } public byte[] ToProtocolByteData() { return null; } public string ToProtocolData() { return JsonConvert.SerializeObject(this); } } public struct PatrolTarget{ public string name { set; get; } public string result { set; get; } public PatrolTarget(string name_,string result_){ name = name_; result = result_; } } }