public VersaCell() { try { _clsHRecord = new VersaCellHeaderRecord(); _clsPRecord = new VersaCellPatientRecord(); _clsORecord = new VersaCellOrderRecord(); _clsQRecord = new VersaCellQueryRecord(); _clsRRecord = new VersaCellResultRecord(); _clsTRecord = new VersaCellTerminationRecord(); PrvRequestArray = new Queue <List <string> >(); objService = new ExternalDataExchangeService(); InstanceId = Guid.NewGuid(); objWorkFlowRuntime.AddService(objService); objASTM = new clsASTM(); objService.AddService(objASTM); objASTM.SendACKEvent += objASTM_SendACKEvent; objASTM.SendNAKEvent += objASTM_SendNAKEvent; objASTM.SendENQEvent += objASTM_SendENQEvent; objASTM.SendEOTEvent += objASTM_SendEOTEvent; objWorkFlowInstance = objWorkFlowRuntime.CreateWorkflow(typeof(ASTMWorkflow), null, InstanceId); objWorkFlowInstance.Start(); Console.WriteLine(@"Work flow started"); objDataEventArgs = new ExternalDataEventArgs(InstanceId); objDataEventArgs.WaitForIdle = true; DumpStateMachine(objWorkFlowRuntime, InstanceId); } catch (Exception ex) { Log.FatalException("Fatal Error: ", ex); } }
private List <string> CreateOrderFrame(List <string> orderList) { var retList = new List <string>(); string sTemp = String.Concat(DeviceHelper.STX, "1", _clsHRecord.sHeaderRecord, DeviceHelper.ETX); string checksum = DeviceHelper.GetCheckSumValue(sTemp); retList.Add(String.Concat(sTemp, checksum, DeviceHelper.CRLF)); if ((orderList != null) && (orderList.Count != 0)) { _clsPRecord = new VersaCellPatientRecord(); sTemp = String.Concat(DeviceHelper.STX, "2", _clsPRecord.CreateData(), DeviceHelper.ETX); checksum = DeviceHelper.GetCheckSumValue(sTemp); retList.Add(String.Concat(sTemp, checksum, DeviceHelper.CRLF)); _clsORecord = new VersaCellOrderRecord(); sTemp = String.Concat(DeviceHelper.STX, "3", _clsORecord.CreateData(_sQBarcode, orderList), DeviceHelper.ETX); checksum = DeviceHelper.GetCheckSumValue(sTemp); retList.Add(String.Concat(sTemp, checksum, DeviceHelper.CRLF)); _clsTRecord = new VersaCellTerminationRecord(1, @"F"); sTemp = String.Concat(DeviceHelper.STX, "4", _clsTRecord.TerminationRecord); checksum = DeviceHelper.GetCheckSumValue(sTemp); retList.Add(String.Concat(sTemp, checksum, DeviceHelper.CRLF)); } else { _clsTRecord = new VersaCellTerminationRecord(1, @"I"); sTemp = String.Concat(DeviceHelper.STX, "2", _clsTRecord.TerminationRecord); checksum = DeviceHelper.GetCheckSumValue(sTemp); retList.Add(String.Concat(sTemp, checksum, DeviceHelper.CRLF)); } return(retList); }