public void ProcessSignal(SignalRequirementsSignalRequirement signalRequirement) { InstrumentDAO dao = new InstrumentDAO(); List <Tuple <string, object, string> > attributes = new List <Tuple <string, object, string> >(); foreach (SignalRequirementsSignalRequirementTsfClassAttribute attribute in signalRequirement.TsfClassAttribute) { TsfClassAttributeName name = attribute.Name; if (attribute.Value != null) { if (attribute.Value.Item is DatumType) { DatumType datum = attribute.Value.Item as DatumType; Object value = Datum.GetNominalDatumValue(datum); if (value != null) { attributes.Add(new Tuple <string, object, string>(name.Value, value, datum.unitQualifier)); } } } } lvInstruments.BeginUpdate(); try { foreach (ListViewItem lvi in lvInstruments.Items) { lvi.BackColor = Color.White; } ICollection <object> ids = dao.FindCapableEquipment(attributes); foreach (ListViewItem lvi in lvInstruments.Items) { var testStationInstrumentData = lvi.Tag as TestStationInstrumentData; if (testStationInstrumentData != null) { var instrument = testStationInstrumentData.InstrumentDescription; if (instrument != null) { foreach (var id in ids) { if (id.Equals(instrument.uuid)) { lvi.BackColor = Color.PaleGreen; } } } } } } catch (Exception e2) { LogManager.Debug("Error In TSF Class: {0}", signalRequirement.TsfClass.tsfClassName); foreach (Tuple <string, object, string> tuple in attributes) { LogManager.Debug(" {0} = {1} {2}", tuple.Item1, tuple.Item2, tuple.Item3); } } lvInstruments.EndUpdate(); }
public Dictionary <SignalRequirementsSignalRequirement, ICollection <object> > Build(TestDescription testDescription) { var requiredSignals = new Dictionary <SignalRequirementsSignalRequirement, ICollection <object> >(); foreach (SignalRequirementsSignalRequirement signalRequirement in testDescription.SignalRequirements) { var attributes = new List <Tuple <string, object, string> >(); var dao = new InstrumentDAO(); TsfClass tsfClass = signalRequirement.TsfClass; if (tsfClass.tsfClassName.Equals("SHORT")) { continue; } if (string.IsNullOrWhiteSpace(tsfClass.tsfClassName)) { continue; } foreach (SignalRequirementsSignalRequirementTsfClassAttribute attribute in signalRequirement.TsfClassAttribute) { TsfClassAttributeName name = attribute.Name; if (attribute.Value != null) { if (attribute.Value.Item is DatumType) { DatumType datum = attribute.Value.Item as DatumType; Object value = Datum.GetNominalDatumValue(datum); if (value != null) { attributes.Add(new Tuple <string, object, string>(name.Value, value, datum.unitQualifier)); } } } } try { ICollection <object> capableEquipment = dao.FindCapableEquipment(attributes); requiredSignals.Add(signalRequirement, capableEquipment); } catch (Exception e2) { LogManager.SourceError(ATMLAllocator.SOURCE, "Error In TSF Class: {0} - ERROR: {1}", tsfClass.tsfClassName, e2.Message); LogManager.Debug(e2); foreach (var tuple in attributes) { LogManager.SourceError(ATMLAllocator.SOURCE, " {0} = {1}", tuple.Item1, tuple.Item2); } } } return(requiredSignals); }
public void ProcessSignal(SignalRequirementsSignalRequirement signalRequirement) { var dao = new InstrumentDAO(); var attributes = (from attribute in signalRequirement.TsfClassAttribute let name = attribute.Name where attribute.Value != null where attribute.Value.Item is DatumType let value = Datum.GetNominalDatumValue((DatumType)attribute.Value.Item) let qualifier = ((DatumType)attribute.Value.Item).unitQualifier where value != null select new Tuple <string, object, string>(name.Value, value, qualifier)).ToList(); lvTestStations.BeginUpdate(); try { foreach (ListViewItem lvi in lvTestStations.Items) { lvi.BackColor = Color.White; } ICollection <object> ids = dao.FindCapableEquipment(attributes); foreach (ListViewItem lvi in lvTestStations.Items) { var instrument = lvi.Tag as TestStationDescription11; if (instrument != null) { foreach (var id in ids) { if (id.Equals(instrument.uuid)) { lvi.BackColor = Color.PaleGreen; } } } } } catch (Exception e2) { LogManager.Debug("Error In TSF Class: {0}", signalRequirement.TsfClass.tsfClassName); foreach (Tuple <string, object, string> tuple in attributes) { LogManager.Debug(" {0} = {1} {2}", tuple.Item1, tuple.Item2, tuple.Item3); } } lvTestStations.EndUpdate(); }