Пример #1
0
        private void createAccessionPopulation(AccessionViewModel accession)
        {
            Family family = accession.ToFamily();

            try
            {
                u_repo.SaveFamily(family);
            }
            catch (Exception e)
            {
                //TODO:write to logging
                throw new AccessionException("Unable to create population");
            }


            Genotype genotype = accession.ToGenotype();

            genotype.Family   = family;
            genotype.FamilyId = family.Id;

            if (accession.IsBase)
            {
                genotype.Year   = accession.FamilyBaseGenotypeYear;
                genotype.Note   = accession.FamilyBaseGenotypeNote;
                genotype.IsRoot = true;
            }

            try
            {
                u_repo.SaveGenotype(genotype);
            }
            catch (Exception e)
            {
                u_repo.DeleteFamily(family);
                //TODO:write to logging
                throw new AccessionException("Unable to create selection");
            }

            family.BaseGenotype   = genotype;
            family.BaseGenotypeId = genotype.Id;

            u_repo.SaveFamily(family);
            accession.Id = genotype.Id;
        }