public Model Initial() { _currentCavity = 95; _currentPlate = null; _currentTube = 15; _currentTubeRunner = null; _platesCreated = 0; _tubeRunnersCreated = 0; _result = new JobCollection.JobCollection(); _locationRepository = new LocationRepository(); foreach (var sample in _jobRequest.Samples) { AddSample(sample); } foreach (var reagent in _jobRequest.Assay.Reagents) { AddReagent(reagent); } AddSteps(_jobRequest.Samples); _resultModel = new Model { RootElements = { _result }, ModelUri = new Uri("temp:result") }; return(_resultModel); }
private void AddSample(ISample sample) { _affectedJobsPerSample.Add(sample, new List <IJob>()); _currentCavity++; _currentTube++; if (_currentCavity == 96) { _currentCavity = 0; _platesCreated++; _currentPlate = new Microplate() { Name = $"Plate{_platesCreated:00}" }; _result.Labware.Add(_currentPlate); } if (_currentTube == 16) { _currentTube = 0; _tubeRunnersCreated++; _currentTubeRunner = new TubeRunner { Name = $"TubeRunner{_tubeRunnersCreated:00}" }; _result.Labware.Add(_currentTubeRunner); } _currentTubeRunner.Barcodes.Add(sample.SampleID); _locationRepository.SetProcessingLocation(sample, _currentPlate, _currentCavity); _locationRepository.SetOrigin(sample, _currentTubeRunner, _currentTube); }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { if ((this._parent.Microplate == null)) { IMicroplate microplateCasted = item.As <IMicroplate>(); if ((microplateCasted != null)) { this._parent.Microplate = microplateCasted; return; } } }