예제 #1
0
        /// <summary>
        /// Builds a pedigree tree for a Genotype.  A Pedigree tree is a BST-like structure of parents for that genotype.
        /// </summary>
        /// <param name="id">The ID of the Genotype to build a Pedigree from.</param>
        /// <returns>The root node of the Pedigree Tree, or null if the ID doesn't find a match.</returns>
        public static TreeNode <Genotype> BuildPedigreeTree(this Genotype target, IPlantBreedingRepo repo)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            Genotype root = repo.GetGenotype(target.Id);
            Tuple <Genotype, Genotype> parents = repo.GetGenotypeParents(target);

            var node = new TreeNode <Genotype> {
                Data = root
            };

            if (parents != null && parents.Item1 != null)
            {
                // Left side is always the male.
                node.Left = BuildPedigreeTree(parents.Item1, repo);
            }

            if (parents != null && parents.Item2 != null)
            {
                // Right side is always the female.
                node.Right = BuildPedigreeTree(parents.Item2, repo);
            }

            return(node);
        }
예제 #2
0
        private void GetDefaultValues(CrossPlan crossPlan, IPlantBreedingRepo repo)
        {
            if (crossPlan.Id > 0 && !crossPlan.GenotypeId.HasValue)
            {
                CrossPlan old = repo.GetCrossPlan(crossPlan.Id);
                if (!crossPlan.GenotypeId.HasValue)
                {
                    crossPlan.GenotypeId = old.GenotypeId;
                }
            }


            if (crossPlan.FemaleParentId.HasValue && crossPlan.FemaleParent == null)
            {
                crossPlan.FemaleParent = repo.GetGenotype(crossPlan.FemaleParentId.Value);
            }

            if (crossPlan.MaleParentId.HasValue && crossPlan.MaleParent == null)
            {
                crossPlan.MaleParent = repo.GetGenotype(crossPlan.MaleParentId.Value);
            }

            if (crossPlan.OriginId.HasValue && crossPlan.OriginId == null)
            {
                crossPlan.Origin = repo.GetOrigin(crossPlan.OriginId.Value);
            }

            if (crossPlan.CrossTypeId.HasValue && crossPlan.CrossType == null)
            {
                crossPlan.CrossType = repo.GetCrossType(crossPlan.CrossTypeId.Value);
            }

            crossPlan.Genus = repo.GetGenus(crossPlan.GenusId);
        }
예제 #3
0
 public PhenotypeEntryUOW(IPlantBreedingRepo repo)
 {
     u_repo = repo;
     a_repo = new AccessionUOW(repo);
 }
예제 #4
0
 public AccessionUOW(IPlantBreedingRepo repo)
 {
     u_repo = repo;
 }
 public MapUow(IPlantBreedingRepo repo)
 {
     u_repo = repo;
     a_repo = new AccessionUOW(repo);
 }
 public CrossPlanningController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
     c_repo = new CrossPlanUOW(repo);
 }
 public DefaultController(IPlantBreedingRepo repo)
 {
     m_repo   = repo;
     map_repo = new MapUow(repo);
 }
 public MapBuilderController(IPlantBreedingRepo repo)
 {
     m_repo   = repo;
     map_repo = new MapUow(repo);
 }
예제 #9
0
 public LocationsController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
 }
 public HomeController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
 }
 public SelectionSummaryUOW(IPlantBreedingRepo repo)
 {
     u_repo = repo;
     a_repo = new AccessionUOW(repo);
     p_repo = new PhenotypeEntryUOW(repo);
 }
 /// <summary>
 /// Overloaded constructor to facilitate dependency injection.
 /// </summary>
 public CrossTypesController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
 }
 public DefaultController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
     r_repo = new ReportingUOW(repo);
 }
 /// <summary>
 /// Overloaded constructor to facilitate dependency injection.
 /// </summary>
 public MaterialsController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
 }
 /// <summary>
 /// Overloaded constructor to facilitate dependency injection.
 /// </summary>
 public TraitsController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
 }
 public DefaultController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
     a_repo = new AccessionUOW(repo);
 }
 public PurposesController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
 }
예제 #18
0
 public ReportingUOW(IPlantBreedingRepo repo)
 {
     u_repo = repo;
 }
 /// <summary>
 /// Overloaded constructor to facilitate dependency injection.
 /// </summary>
 public GrowersController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
 }
예제 #20
0
 public FatesController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
 }
예제 #21
0
 public SelectionSummaryController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
     s_repo = new SelectionSummaryUOW(repo);
 }
예제 #22
0
 public OriginsController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
 }
 public PedigreeController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
 }
 public FlatTypesController(PlantBreedingRepo repo)
 {
     m_repo = repo;
 }
 public PloidiesController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
 }
 public OrdersUOW(IPlantBreedingRepo repo)
 {
     u_repo = repo;
 }
예제 #27
0
 public CrossPlanUOW(IPlantBreedingRepo repo)
 {
     u_repo = repo;
     a_repo = new AccessionUOW(repo);
 }
예제 #28
0
 public PhenotypeEntryController(IPlantBreedingRepo repo)
 {
     m_repo   = repo;
     map_repo = new MapUow(repo);
     p_repo   = new PhenotypeEntryUOW(repo);
 }
 public GeneraController(IPlantBreedingRepo repo)
 {
     m_repo = repo;
 }