コード例 #1
0
        public void DeleteSelection(int genotypeId)
        {
            var genotype = u_repo.GetGenotype(genotypeId);

            if (genotype == null)
            {
                throw new ArgumentNullException();
            }

            //Check if the genotype belongs to anything

            if (genotype.IsBase ||
                genotype.FemaleofFamilies.Any() ||
                genotype.MaleofFamilies.Any() ||
                genotype.MapComponents.HasAny(m => m.isSeedling == true) ||
                u_repo.GetCrossPlans(
                    c => c.MaleParentId == genotype.Id ||
                    c.FemaleParentId == genotype.Id).Any())
            {
                throw new AccessionException("Selection is referenced in the DB");
            }
            else
            {
                u_repo.DeleteGenotypeWithRelated(genotype);
            }
        }