public override void ExecuteCommand(AppSession session, StringRequestInfo requestInfo) { pre_arrangeList data = new pre_arrangeList(); List <Pre_arrangeList> pre_arrangeListList = null; switch (requestInfo[0]) { case "Add": //添加 { string str = requestInfo.Body.Substring(4); data = JsonConvert.DeserializeObject <pre_arrangeList>(str); Pre_DataManagement.AddData(data.Pre_arrangeList); } break; case "Del": //删除 { string str = requestInfo.Body.Substring(4); data = JsonConvert.DeserializeObject <pre_arrangeList>(str); Pre_DataManagement.DelData(data.tmp_Guid); } break; case "AllDel": //全删 { string str = requestInfo.Body.Substring(7); data = JsonConvert.DeserializeObject <pre_arrangeList>(str); } break; case "Revise": //修改 { string str = requestInfo.Body.Substring(7); data = JsonConvert.DeserializeObject <pre_arrangeList>(str); Pre_DataManagement.UpData(data.Pre_arrangeList); } break; case "Query": //查询 { pre_arrangeListList = Pre_DataManagement.GetAllData(); data.Pre_arrangeList = pre_arrangeListList; string strJsonData = JsonConvert.SerializeObject(data); session.Send(strJsonData); } break; case "TimeQuery": //根据时间查询 { string sql = requestInfo.Body.Substring(10); pre_arrangeListList = Pre_DataManagement.GetListWithCondition(sql); data.Pre_arrangeList = pre_arrangeListList; string strJsonData = JsonConvert.SerializeObject(data); session.Send(strJsonData); } break; } }
public void Pre_arrangeList_DelData(Guid[] _GuisList) { if (_GuisList != null && _GuisList.Length > 0) { pre_arrangeList data = new pre_arrangeList(); data.tmp_Guid = _GuisList; string str = JsonConvert.SerializeObject(data); string message = "GetPre_arrangeList/Del," + str + "\r\n"; byte[] b = Encoding.UTF8.GetBytes(message); CommunicationClass.stream2.Write(b, 0, b.Length); } }
public void Pre_arrangeList_ReviseData(List <Pre_arrangeList> _Pre_arrangeList) { if (_Pre_arrangeList != null && _Pre_arrangeList.Count > 0) { pre_arrangeList data = new pre_arrangeList(); data.Pre_arrangeList = _Pre_arrangeList; string str = JsonConvert.SerializeObject(data); string message = "GetPre_arrangeList/Revise," + str + "\r\n"; byte[] b = Encoding.UTF8.GetBytes(message); CommunicationClass.stream2.Write(b, 0, b.Length); } }
public List <Pre_arrangeList> Pre_arrangeList_GetListWithCondition(string sql) { List <Pre_arrangeList> tmpQueryData = new List <Pre_arrangeList>(); string message = "GetPre_arrangeList/TimeQuery," + sql + "\r\n"; byte[] b = Encoding.UTF8.GetBytes(message); CommunicationClass.stream2.Write(b, 0, b.Length); string responseData = String.Empty; b = new Byte[1024 * 100]; Int64 bytes = CommunicationClass.stream2.Read(b, 0, b.Length); responseData += Encoding.UTF8.GetString(b, 0, (int)bytes); pre_arrangeList AlarmData = new pre_arrangeList(); AlarmData = JsonConvert.DeserializeObject <pre_arrangeList>(responseData); tmpQueryData = AlarmData.Pre_arrangeList; return(tmpQueryData); }