public void SetPrimitiveQuotation(PrimitiveQuotation quotation) { VmInstrument vmInstrument = this._Instruments.SingleOrDefault(i => i.Id == quotation.InstrumentId); if (vmInstrument != null) { VmInstrumentSourceRelation relation = vmInstrument.SourceRelations.SingleOrDefault(r => r.SourceId == quotation.SourceId); if (relation != null) { if (relation.SetSourceQuotation(new VmSourceQuotation(quotation))) { for (int i = 0; i < vmInstrument.SourceRelations.Count; i++) { VmInstrumentSourceRelation relation2 = vmInstrument.SourceRelations[i]; if (!object.ReferenceEquals(relation2, relation)) { relation2.SetSourceQuotation(new VmSourceQuotation(new PrimitiveQuotation() { Timestamp = quotation.Timestamp })); } } } } } }
private bool FindVmInstrumentSourceRelation(int relationId, out VmInstrumentSourceRelation relation, out VmInstrument instrument) { relation = null; instrument = null; foreach (VmInstrument vmInstrument in this._Instruments) { relation = vmInstrument.SourceRelations.SingleOrDefault(r => r.Id == relationId); if (relation != null) { instrument = vmInstrument; break; } } return(relation != null); }