private IList <IGEN_SAMPLE> MakeGenomicsSamples(GenomicsOrder genOrder, IGEN_CUSTOMER genomicsCustomer) { IList <IGEN_SAMPLE> samples = new List <IGEN_SAMPLE>(); foreach (var genOrderProduct in genOrder.Products) { foreach (var genSample in genOrderProduct.Samples) { var sample = new IGEN_SAMPLE { ISVALID = true }; var sire = new IGEN_POTENTIALSIRE(); var dam = new IGEN_POTENTIALDAM(); var animal = new IGEN_ANIMAL(); sample.BARCODEID = genSample.BarcodeId; sample.REFBARCODEID = genSample.BarcodeId; sample.SUBSTRATE = genSample.Substrate; sample.CASENUM = genSample.CaseNumber; sample.COMMENTS = genSample.Comments; sample.BATCHNUMBER = genSample.BatchNumber.SafeInt(); sire.BREED1 = genSample.SireId; sire.BREEDASSOCIATIONID = genSample.SireRegistrationNumber; dam.BREED1 = genSample.DamId; dam.BREEDASSOCIATIONID = genSample.DamRegistrationNumber; animal.ANIMAL_ID = genSample.AnimalId; animal.BREEDASSOCIATIONID = genSample.BreedingAssociationCodeId; animal.IGEN_CUSTOMER = genomicsCustomer; //gak For Trinia seems to be only used on Customer //var custBreedAssoc = customerBreedAssocs.FirstOrDefault(f => // f.BREEDASSOCIATIONCODE == genSample.BreedingAssociationCode); //if (custBreedAssoc != null) //{ // custBreedAssoc.MEMBERNUMBER = custBreedAssoc.MEMBERNUMBER; //} animal.ELECTRONICID = genSample.ElectronicId; animal.SEX = genSample.SexofAnimal.FixSexValue(); animal.BREED1 = genSample.Breed1; animal.BREED2 = genSample.Breed2; animal.SIREGROUP = genSample.SireGroup; animal.BIRTHDATE = genSample.BirthDate; animal.ANIMALID2 = genSample.AnimalId2; animal.BIRTHSTATUS = GetBirthStatus(genSample); sample.IGEN_POTENTIALDAM.Add(dam); sample.IGEN_POTENTIALSIRE.Add(sire); sample.IGEN_ANIMAL = animal; samples.Add(sample); } } return(samples.ToList()); }
private void ValidationObjects(GenomicsOrder order, IGEN_CUSTOMER genomicsCustomer, IGEN_USER genomicsUser, IGEN_LAB genomicsLab) { if (genomicsCustomer == null) { var msg = $"CustomerId ({order.CustId}) does not exists."; _logger.Info(msg); throw new Exception(msg); } if (genomicsUser == null) { var msg = $"User ({order.UserId}) does not exist."; _logger.Info(msg); throw new Exception(msg); } if (genomicsLab == null) { var msg = $"Lab Id ({_labId} does not exist.)"; _logger.Info(msg); throw new Exception(msg); } }