CAESGenome.Services.BarcodeService.DeclineQualityControl C# (CSharp) Method

DeclineQualityControl() public method

public DeclineQualityControl ( IRepositoryFactory repositoryFactory, Barcode barcode ) : void
repositoryFactory IRepositoryFactory
barcode Barcode
return void
        public void DeclineQualityControl(IRepositoryFactory repositoryFactory, Barcode barcode)
        {
            barcode.Done = true;
            repositoryFactory.BarcodeRepository.EnsurePersistent(barcode);

            var plate = barcode.UserJobPlate;
            // 2013-05-29 by kjt: Revised to set to false because even though a new barcode will be created (below),
            // the job will appear in "ongoing jobs" otherwise.
            //plate.Completed = true;
            plate.Completed = false;
            plate.DateTimeCompleted = DateTime.Now;
            repositoryFactory.UserJobPlateRepository.EnsurePersistent(plate);

            // duplicate the barcode for a new one
            var newBarcode = new Barcode() { UserJobPlate = barcode.UserJobPlate, SubPlateId = barcode.SubPlateId
                , Primer = barcode.Primer, Stage = barcode.Stage, SourceBarcode = barcode.SourceBarcode
            };
            repositoryFactory.BarcodeRepository.EnsurePersistent(newBarcode);
        }