public void HeaderTest() { try { const string rawHeader = @"H|\^&|||BS800^01.03.07.03^123456|||||||PR|1394-97|20090910102501"; var oldHeader = new Access2HeaderRecord(); oldHeader.Parse(rawHeader); //h.Parse(rawHeader); Debug.WriteLine(oldHeader.RecordType); var newHeader = (Access2HeaderRecord)oldHeader.Clone(); Debug.WriteLine(newHeader.Create()); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }
private List <string> CreateOrderFrame(List <string> orderList, string patientName) { var retList = new List <string>(); //Tạo Header mới var newHeaderRecord = (Access2HeaderRecord)_clsHRecord.Clone(); newHeaderRecord.SenderNameOrId.Data = _clsHRecord.ReceiverId.Data; newHeaderRecord.ReceiverId.Data = _clsHRecord.SenderNameOrId.Data; newHeaderRecord.DateAndTimeOfMessage.Data = DateTime.Now.ToString("yyyyMMddHHmmss"); var sTemp = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "1", newHeaderRecord.Create(), DeviceHelper.ETX); var checksum = DeviceHelper.GetCheckSumValue(sTemp); retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF)); //string sTemp = newHeaderRecord.Create(); _clsPRecord.SequenceNumber.Data = "1"; //Todo: TestOnly //_clsPRecord.PatientId.Data = "0003"; //_clsPRecord.PatientName.Data = "NGUYEN VAN A^^"; //_clsPRecord.PatientSex.Data = "U"; _clsPRecord.PracticeAssignedPatientId.Data = _sQBarcode; _clsPRecord.DateOfBirth.Data = "20000101"; _clsPRecord.PatientName.Data = string.Format("{0}^^^^", patientName); _clsPRecord.PatientSex.Data = "U"; sTemp = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "2", _clsPRecord.Create(), DeviceHelper.ETX); checksum = DeviceHelper.GetCheckSumValue(sTemp); retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF)); //Xử lý kết quả ) if ((orderList != null) && (orderList.Count != 0)) { //Add OrderRecord _clsORecord = new Access2TestOrderRecord(); _clsORecord.SequenceNumber.Data = "1"; _clsORecord.SpecimenId.Data = _sQBarcode; _clsORecord.UniversalTestId.Data = _clsORecord.CreateUniversalTestid(orderList); sTemp = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "3", _clsORecord.Create(), DeviceHelper.ETX); checksum = DeviceHelper.GetCheckSumValue(sTemp); retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF)); _clsTRecord = new Access2TerminationRecord { TerminationCode = { Data = "F" } }; sTemp = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "4", _clsTRecord.Create(), DeviceHelper.ETX); checksum = DeviceHelper.GetCheckSumValue(sTemp); retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF)); } else { _clsTRecord = new Access2TerminationRecord { TerminationCode = { Data = "F" } }; sTemp = string.Format("{0}{1}{2}{3}", DeviceHelper.STX, "3", _clsTRecord.Create(), DeviceHelper.ETX); checksum = DeviceHelper.GetCheckSumValue(sTemp); retList.Add(string.Format("{0}{1}{2}", sTemp, checksum, DeviceHelper.CRLF)); } return(retList); }