示例#1
0
        /// <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);
        }
示例#2
0
        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);
        }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <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);
        }
示例#5
0
        /// <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);
        }