private void ConstructorInit(PurgeType purgeType, InstrumentController instrumentController, List <GasEndPoint> gasEndPoints, InstrumentGasResponseEvent gasResponseEvent) { Log.Assert(instrumentController != null, "instrumentController cannot be null"); _instrumentController = instrumentController; _purgeType = purgeType; _returnGasResponseEvent = gasResponseEvent; // clone the supplied GasEndPoints foreach (GasEndPoint currentGasEndPoint in gasEndPoints) { GasEndPoint purgeGasEndPoint = (GasEndPoint)currentGasEndPoint.Clone(); GasEndPoints.Add(purgeGasEndPoint); } }
/// <summary> /// Creates a new instance of an InstrumentPurgeOperation class. /// </summary> public InstrumentPurgeOperation(PurgeType purgeType, InstrumentController instrumentController, List <GasEndPoint> gasEndPoints, InstrumentGasResponseEvent gasResponseEvent) { ConstructorInit(purgeType, instrumentController, gasEndPoints, gasResponseEvent); }
/// <summary> /// Creates a new instance of an InstrumentPurgeOperation class. /// </summary> public InstrumentPurgeOperation(PurgeType purgeType, InstrumentController instrumentController, List <GasEndPoint> gasEndPoints, InstrumentGasResponseEvent gasResponseEvent, List <SensorGasResponse> currentPassSGRList) { _currentPassSGRList = currentPassSGRList; ConstructorInit(purgeType, instrumentController, gasEndPoints, gasResponseEvent); }
private bool SaveEventJournals(DockingStationEvent dsEvent, DateTime lastDockedTime, DataAccessTransaction trx) { if (dsEvent.EventCode == null) { return(true); } EventJournalDataAccess ejDataAccess = new EventJournalDataAccess(); EventJournal eventJournal = null; // If the event implements IPassed, then use the result of its // Passed property. Otherwise, just default to true. bool passed = ((dsEvent is IPassed)) ? ((IPassed)dsEvent).Passed : true; if (dsEvent is InstrumentEvent) { // special case for // bump & cals... need to save a separate // event journal for every sensor involved in gas operation. // Note that in this situation, we also do NOT save an entry for the instrument itself. if (dsEvent is InstrumentGasResponseEvent && !(dsEvent is InstrumentManualOperationsDownloadEvent)) { InstrumentGasResponseEvent gasResponseTestEvent = (InstrumentGasResponseEvent)dsEvent; if (gasResponseTestEvent.GasResponses.Count <= 0) { return(true); } bool allSaved = true; foreach (SensorGasResponse sgr in gasResponseTestEvent.GasResponses) { eventJournal = new EventJournal(gasResponseTestEvent.EventCode.Code, sgr.Uid, gasResponseTestEvent.DockedInstrument.SerialNumber, sgr.Time, dsEvent.Time, sgr.Passed, sgr.Position, gasResponseTestEvent.DockedInstrument.SoftwareVersion); allSaved &= ejDataAccess.Save(eventJournal, trx); } // If gasResponseEvent is a InstrumentBumpTestEvent, it might have calibration gas responses due to O2 high bump test failure. // If there are any gas responses in HighBumpFailCalGasResponses, store them to the event journals. foreach (SensorGasResponse sgr in gasResponseTestEvent.HighBumpFailCalGasResponses) { eventJournal = new EventJournal(EventCode.Calibration, sgr.Uid, gasResponseTestEvent.DockedInstrument.SerialNumber, sgr.Time, dsEvent.Time, sgr.Passed, sgr.Position, gasResponseTestEvent.DockedInstrument.SoftwareVersion); allSaved &= ejDataAccess.Save(eventJournal, trx); } return(allSaved); } else { eventJournal = new EventJournal(dsEvent.EventCode, ((InstrumentEvent)dsEvent).DockedInstrument.SerialNumber, dsEvent.Time, dsEvent.Time, passed, ((InstrumentEvent)dsEvent).DockedInstrument.SoftwareVersion); } } else // DockingStationEvent { eventJournal = new EventJournal(dsEvent.EventCode, dsEvent.DockingStation.SerialNumber, dsEvent.Time, dsEvent.Time, passed, dsEvent.DockingStation.SoftwareVersion); } return(ejDataAccess.Save(eventJournal, trx)); // Update/insert EventJournal record for the event. }