/// <summary> 获取上传协议 /// </summary> /// <param name="dr">数据行</param> /// <param name="dbName">帐套</param> /// <returns></returns> private static FileProtocol GetProtocol(DataRow dr, string dbName) { if (!htTable.ContainsKey(dr.Table.TableName)) { return(null); } FileProtocol fp = new FileProtocol(); fp.StationId = GlobalStaticObj_Server.Instance.StationID; //根据表名得到子消息ID if (htTable[dr.Table.TableName] is ProtocolValue) { fp.SubMessageId = (htTable[dr.Table.TableName] as ProtocolValue).MessageId; } else { fp.SubMessageId = htTable[dr.Table.TableName].ToString(); } fp.TimeSpan = TimeHelper.GetTimeInMillis(); //Json对象 string json = JsonHelper.DataTableToJson(dr, fp.StationId, dbName, true); json = BaseCodeHelper.EnCode(json); fp.Json = json; return(fp); }
private static UploadDataProtocol GetProtocol(DataRow dr, String tbName, string dbName) { if (!htTable.ContainsKey(tbName)) { return(null); } UploadDataProtocol udp = new UploadDataProtocol(); udp.StationId = GlobalStaticObj_Server.Instance.StationID; //根据表名得到子消息ID if (htTable[tbName] is ProtocolValue) { udp.SubMessageId = (htTable[tbName] as ProtocolValue).MessageId; } else { udp.SubMessageId = htTable[tbName].ToString(); } udp.TimeSpan = TimeHelper.GetTimeInMillis(); //Json对象 string json = JsonHelper.DataTableToJson(dr, udp.StationId, dbName, true); json = BaseCodeHelper.EnCode(json); udp.Json = json; return(udp); }
/// <summary> 获取在线客户端 /// </summary> /// <param name="dr">数据行</param> /// <param name="dbName">帐套</param> /// <returns></returns> private static ClientProtocol GetProtocol(DataRow dr, string dbName) { if (!htTable.ContainsKey(dr.Table.TableName)) { return(null); } ClientProtocol cp = new ClientProtocol(); cp.StationId = GlobalStaticObj_Server.Instance.StationID; //根据表名得到子消息ID if (htTable[dr.Table.TableName] is ProtocolValue) { cp.SubMessageId = (htTable[dr.Table.TableName] as ProtocolValue).MessageId; } else { cp.SubMessageId = htTable[dr.Table.TableName].ToString(); } cp.TimeSpan = TimeHelper.GetTimeInMillis(); var sb = new StringBuilder(); foreach (var item in dr.ItemArray) { sb.Append(item); } LogAssistant.LogService.WriteLog(sb); //Json对象 string json = JsonHelper.DataTableToJson(dr, cp.StationId, dbName, false); json = BaseCodeHelper.EnCode(json); cp.Json = json; return(cp); }
/// <summary> 获取上传协议 /// </summary> /// <param name="dr">数据行</param> /// <param name="dbName">帐套</param> /// <returns></returns> private static AnnounceProtocol GetProtocol(DataRow dr, string dbName) { AnnounceProtocol protocol = new AnnounceProtocol(); protocol.StationId = GlobalStaticObj_Server.Instance.StationID; //根据表名得到子消息ID protocol.SubMessageId = SubMessageId; protocol.TimeSpan = TimeHelper.GetTimeInMillis(); //Json对象 string json = JsonHelper.DataTableToJson(dr, protocol.StationId, dbName, true); json = BaseCodeHelper.EnCode(json); protocol.Json = json; return(protocol); }
/// <summary> 获取在线客户端 /// </summary> /// <param name="dr">数据行</param> /// <param name="dbName">帐套</param> /// <returns></returns> private static ClientProtocol GetProtocol(DataRow dr, string dbName) { if (!htTable.ContainsValue(dr.Table.TableName)) { return(null); } ClientProtocol cp = new ClientProtocol(); cp.StationId = GlobalStaticObj_Server.Instance.StationID; //根据表名得到子消息ID cp.SubMessageId = htTable[dr.Table.TableName].ToString(); cp.TimeSpan = TimeHelper.GetTimeInMillis(); //Json对象 string json = JsonHelper.DataTableToJson(dr, cp.StationId, dbName, true); json = BaseCodeHelper.EnCode(json); cp.Json = json; return(cp); }