示例#1
0
        /// <summary>
        /// 保存数据到历史记录表
        /// </summary>
        /// <param name="tx300"></param>
        private void SaveTX300History(TX300 tx300, string mac_id)
        {
            var          DataInstance = new DataBLL();
            TB_HISTORIES obj          = DataInstance.GetObject();

            obj.command_id       = "0x" + CustomConvert.IntToDigit(tx300.CommandID, CustomConvert.HEX, 4);
            obj.mac_id           = mac_id;
            obj.message_content  = CustomConvert.GetHex(tx300.MsgContent);
            obj.message_type     = 1;
            obj.package_id       = tx300.PackageID;
            obj.protocol_type    = tx300.ProtocolType;
            obj.protocol_version = tx300.ProtocolVersion;
            obj.receive_time     = DateTime.Now;
            obj.sequence_id      = tx300.SequenceID.ToString();
            obj.server_port      = 31875;
            obj.terminal_id      = tx300.TerminalID;
            obj.terminal_type    = tx300.TerminalType;
            obj.total_length     = (short)tx300.TotalLength;
            obj.total_package    = tx300.TotalPackage;
            DataInstance.Add(obj);
        }
示例#2
0
 /// <summary>
 /// 保存数据到历史记录表
 /// </summary>
 /// <param name="tx300"></param>
 private void SaveTX300History(TX300 tx300, DateTime receiveTime, string mac_id)
 {
     using (var bll = new DataBLL())
     {
         TB_HISTORIES obj = bll.GetObject();
         obj.command_id       = "0x" + CustomConvert.IntToDigit(tx300.CommandID, CustomConvert.HEX, 4);
         obj.mac_id           = mac_id;
         obj.message_content  = CustomConvert.GetHex(tx300.MsgContent);
         obj.message_type     = 1;
         obj.package_id       = tx300.PackageID;
         obj.protocol_type    = tx300.ProtocolType;
         obj.protocol_version = tx300.ProtocolVersion;
         obj.receive_time     = receiveTime;
         obj.sequence_id      = tx300.SequenceID.ToString();
         obj.server_port      = (short)(tx300.ProtocolType == Protocol.ProtocolTypes.SATELLITE ? 10800 :
                                        tx300.ProtocolType == Protocol.ProtocolTypes.SMS ? 0 : 31875);
         obj.terminal_id   = tx300.TerminalID;
         obj.terminal_type = tx300.TerminalType;
         obj.total_length  = (short)tx300.TotalLength;
         obj.total_package = tx300.TotalPackage;
         bll.Add(obj);
     }
 }