コード例 #1
0
        public void Test_Dog_Model()
        {
            Dog dogcorrect = new Dog { Name = "Rakki", Reg = "IS1", Sex = "M" };
            Dog dogincorrect = new Dog { Name = "Rakki", Reg = "IS1" }; //missing Gender

            Assert.AreEqual(dogcorrect.Name, "Rakki");
        }
コード例 #2
0
        List<Dog> CreateFakeDogs()
        {
            List<Dog> fakeDogs = new List<Dog>();
            Dog dog  = new Dog { Id=1, Name = "Rakki1", Reg = "IS1", Sex = "M", LitterId=1 };
            Dog dog2 = new Dog { Id=2, Name = "Rakki2", Reg = "IS2", Sex = "M", LitterId=2 };
            fakeDogs.Add(dog);
            fakeDogs.Add(dog2);

            return fakeDogs;
        }
コード例 #3
0
        // Fáum inn foreldra sem á prófa í Testmate og skilum ættbókarlista.  (eins og ættbók tilvonandi hvolps).
        public List<Dog> FetchPedigreeForTestMate(Dog A, Dog B)
        {
            List<Dog> parentList = new List<Dog>();
            List<Dog> pTemp = new List<Dog>();
            List<Dog> pTemp2 = new List<Dog>();

            parentList.Add(A);
            parentList.Add(B);

            foreach (Dog d in parentList)
            {
                if (pTemp == null)
                    pTemp = parents(d);
                else
                    pTemp.AddRange(parents(d));        // 4 hundar.
            }

            parentList.AddRange(pTemp);  // 6 hundar komnir.

            foreach (Dog d in pTemp) // finnur foreldra fyrir þessa 4 hunda.
            {
                if (pTemp2 == null)
                    pTemp2 = parents(d);
                else
                    pTemp2.AddRange(parents(d));        // 8 hundar.
            }
            parentList.AddRange(pTemp2);    // 6 + 8 = 14 stk
            pTemp = null;

            foreach (Dog d in pTemp2) // finnur foreldra fyrir þessa 8 hunda.
            {
                if (pTemp == null)
                    pTemp = parents(d);
                else
                    pTemp.AddRange(parents(d));        // 8 hundar.
            }
            parentList.AddRange(pTemp);  // 14 + 16 = 30 stk

            pTemp2 = null;

            foreach (Dog d in pTemp) // finnur þetta foreldra fyrir 16 hundana ?
            {
                if (pTemp2 == null)
                    pTemp2 = parents(d);
                else
                    pTemp2.AddRange(parents(d));        // skila 32 hundar.
            }

            parentList.AddRange(pTemp2);  // 30 + 32 = 62 stk

            return parentList;
        }
コード例 #4
0
ファイル: DogController.cs プロジェクト: gudni12345/isic-data
        public ActionResult Create(Dog dog)
        {
            if (ModelState.IsValid)
            {
                db.InsertOrUpdateDog(dog);
               // db.Dog.Add(dog);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.LitterId = new SelectList(db.allLitters, "Id", "Id", dog.LitterId);
            ViewBag.ColorId = new SelectList(db.allColors, "Id", "ColorText", dog.ColorId);
            ViewBag.PersonId = new SelectList(db.allPersons, "Id", "Name", dog.PersonId);
            ViewBag.BornInCountryId = new SelectList(db.allCountries, "Id", "Name", dog.BornInCountryId);
            ViewBag.LivesInCountryId = new SelectList(db.allCountries, "Id", "Name", dog.LivesInCountryId);
            return View(dog);
        }
コード例 #5
0
ファイル: FakePedigree.cs プロジェクト: gudni12345/isic-data
        public static List<Dog> CreateTestDogs()
        {
            List<Dog> dogs = new List<Dog>();

            Person person = new Person() { Id = 1, Name = "Jón Jónsson" };
            Dog rakki = new Dog() { Id = 1, Name = "Rakki_Founder", Reg = "IS1", Sex = "M", LitterId = 1 };
            Dog tik = new Dog() { Id = 2, Name = "Tík_Founder", Reg = "IS2", Sex = "M", LitterId = 1 };
            dogs.Add(rakki);
            dogs.Add(tik);

            Litter litter1 = new Litter() { Id = 1, FatherId = 1, MotherId = 2, PersonId = 1 };
            Litter litter2 = new Litter() { Id = 2, FatherId = 1, MotherId = 2, PersonId = 1 };
            Dog hvolpur1 = new Dog() { Id = 3, Name = "Hvolpur1", Reg = "IS3", Sex = "M", LitterId = 2 };
            Dog hvolpur2 = new Dog() { Id = 4, Name = "Hvolpur2", Reg = "IS4", Sex = "F", LitterId = 2 };
            dogs.Add(hvolpur1);
            dogs.Add(hvolpur2);

            return dogs;
        }
コード例 #6
0
        // Reiknum úr innræktunarstuðull fyrir faðir A og móðir B.
        // Fallið skilar síðan lista niðurstöðum(InbreedingResult) með sameigilegum forfeðrum og innræktunargildi.
        public List<InbreedingResult> Inbreeding(Dog A, Dog B)
        {
            /*Typical coancestries between relatives are as follows:
                  1.  Father/daughter, mother/son or brother/sister → 25% (1⁄4)
                  2.  Grandfather/granddaughter or grandmother/grandson → 12.5% (1⁄8)
                  3.  Half-brother/half-sister, Double cousins → 12.5% (1⁄8)
                  4.  Uncle/niece or aunt/nephew → 12.5% (1⁄8)
                  5.  Great-grandfather/great-granddaughter or great-grandmother/great-grandson → 6.25% (1⁄16)
                  6.  Half-uncle/niece or half-aunt/nephew → 6.25% (1⁄16)
                  7.  First cousins → 6.25% (1⁄16)
                 */

            List<InbreedingResult> inbreedingResult = new List<InbreedingResult>();

            //if father and mother have the same parents, the tree does not need to be checked further. No more possible path.
            if ((A.Litter.FatherId == B.Litter.FatherId) && (A.Litter.MotherId == B.Litter.MotherId))
            {
                inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId, 0.25));
                inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId, 0.0));     // result value only added once.
            }
            //To do: get mothers (10%) and fathers(5%) inbreeding and calculate: result = result*1.15

            //***Pathmothod: n=2****
            //Incest: because father or mother appears on both sides, we concentrate on the tree of the longer relation.
            //     It´s not the perfect calculation, but it gives a better result (**still in construction)
            // Father/daughter
            else if (A.Id == B.Litter.FatherId)
            {
                inbreedingResult.Add(new InbreedingResult( A.Id,0.25));

                if (B.Litter.Mother.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id, 0.25)); } //check if Father is also Grandfather
                else if (B.Litter.Mother.Litter.Father.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult( A.Id, 0.0625)); } //check if Father is mothers Great Grandfather
                else if (B.Litter.Mother.Litter.Mother.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id, 0.0625)); }

                else if (B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.03125)); } //check if Father is mothers Great Great Grandfather
                else if (B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.03125)); }
                else if (B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.03125)); }
                else if (B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.03125)); }

                else if (B.Litter.Mother.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id, 0.015625)); } //check if Father is mothers Great Great Great Grandfather
                else if (B.Litter.Mother.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id, 0.015625)); }
                else if (B.Litter.Mother.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id, 0.015625)); }
                else if (B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id, 0.015625)); }
                else if (B.Litter.Mother.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id, 0.015625)); }
                else if (B.Litter.Mother.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id, 0.015625)); }
                else if (B.Litter.Mother.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id, 0.015625)); }
                else if (B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id, 0.015625)); }

                //To do: get fathers inbreeding (F) and calculate: result = result * 1.F
            }
            //mother/son
            else if (B.Id == A.Litter.MotherId)
            {
                inbreedingResult.Add(new InbreedingResult(A.Id,0.25));

                if (A.Litter.Mother.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.125)); } //check if Mother is also Grandmother
                else if (A.Litter.Mother.Litter.Father.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.0625)); } //check if mother is fathers Great Grandmother
                else if (A.Litter.Mother.Litter.Mother.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.0625)); }

                else if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.03125)); } //check if Mother is fathers Great Great Grandmother
                else if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.03125)); }
                else if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.03125)); }
                else if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.03125)); }

                else if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id, 0.015625)); } //check if Mother is fathers Great Great Great Grandmother
                else if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id, 0.015625)); }
                else if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id, 0.015625)); }
                else if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id, 0.015625)); }
                else if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id, 0.015625)); }
                else if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id, 0.015625)); }
                else if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id, 0.015625)); }
                else if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id, 0.015625)); }

                //To do: get mothers inbreeding (F) and calculate: result = result * 1.F
            }

            else
            {       //*****(n=3)******
                if (A.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.125)); } // A and B have same father
                if (A.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.125)); } // A and B have same mother

                    // Check for no 2.  Grandfather/granddaughter or grandmother/grandson → 12.5% (1⁄8)
                if (A.Id == B.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Id,0.125)); } // A is B´s Grandfather (farfar)
                if (A.Id == B.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Id,0.125)); } // A is B´s Grandfather (morfar)
                if (A.Litter.Mother.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.125)); } // B is A´s Grandmother (mormor)
                if (A.Litter.Father.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.125)); } // B is A´s Grandmother (farmor)

                    // Check for no 4.  Uncle/niece or aunt/nephew → 12.5% (1⁄8), if full related, half is 6.25%
                    // ***(n=4)***
                if (A.Litter.FatherId == B.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.0625)); } //A´s Father is B´s Grandpa (farfar)
                if (A.Litter.MotherId == B.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.0625)); } //A´s Mother is B´s Grandmother (farmor)
                if (A.Litter.FatherId == B.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.0625)); } //A´s Father is B´s Grandpa (morfar)
                if (A.Litter.MotherId == B.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.0625)); } //A´s Mother is B´s Grandmother (farmor)
                if (A.Litter.Father.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.0625)); } //B´s Father is A´s Grandpa (farfar)
                if (A.Litter.Father.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.0625)); } //B´s Mother is A´s Grandmother (farmor)
                if (A.Litter.Mother.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.0625)); } //B´s Father is A´s Grandpa (morfar)
                if (A.Litter.Mother.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.0625)); } //B´s Mother is A´s Grandmother (farmor)

                    // 5.  Great-grandfather/great-granddaughter or great-grandmother/great-grandson → 6.25% (1⁄16)
                if (A.Id == B.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Id,0.0625)); } //A is B´s GreatGrandpa (either mom´s
                if (A.Id == B.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Id,0.0625)); } //                or dad/granddad´s side)
                if (A.Id == B.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Id,0.0625)); }
                if (A.Id == B.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Id,0.0625)); }

                if (A.Litter.Father.Litter.Father.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.0625)); } //B is A´s GreatGrandmother (either mom´s
                if (A.Litter.Mother.Litter.Father.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.0625)); } //                or dad´s side)
                if (A.Litter.Father.Litter.Mother.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.0625)); }
                if (A.Litter.Mother.Litter.Mother.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.0625)); }

                    // 6.  Half-uncle/niece or half-aunt/nephew → 6.25% (1⁄16) --> covered under nr.4

                    // 7.  First cousins → 6.25% (1⁄16) - Syskina börn - sami afi og amma, if two lines under 8. are true
                    // 8.  Half First cousins → 3.125% (1⁄32) - Either grandma og grandpa the same
                    // ***(n=5)***
                if (A.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.FatherId,0.03125)); }  //  Same grandfather
                if (A.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.FatherId,0.03125)); }
                if (A.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.FatherId,0.03125)); }
                if (A.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.FatherId,0.03125)); }

                if (A.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.MotherId,0.03125)); }  //  Same grandmother
                if (A.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.MotherId,0.03125)); }
                if (A.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.MotherId,0.03125)); }
                if (A.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.MotherId,0.03125)); }

                    // 9.  → 6,25% (1⁄32) - Great Grandma is the mother (Great-uncle/ neice and Great-aunt/ uncle)
                if (A.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.03125)); } //A´s great grandmother is B´s mother
                if (A.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.03125)); }
                if (A.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.03125)); }
                if (A.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.03125)); }

                if (A.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.03125)); }
                if (A.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.03125)); }
                if (A.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.03125)); }
                if (A.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.03125)); }

                if (B.Litter.Father.Litter.Father.Litter.MotherId == A.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.03125)); }
                if (B.Litter.Mother.Litter.Father.Litter.MotherId == A.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.03125)); }
                if (B.Litter.Father.Litter.Mother.Litter.MotherId == A.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.03125)); }
                if (B.Litter.Mother.Litter.Mother.Litter.MotherId == A.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.03125)); }

                if (B.Litter.Father.Litter.Father.Litter.FatherId == A.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.03125)); }
                if (B.Litter.Mother.Litter.Father.Litter.FatherId == A.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.03125)); }
                if (B.Litter.Father.Litter.Mother.Litter.FatherId == A.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.03125)); }
                if (B.Litter.Mother.Litter.Mother.Litter.FatherId == A.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.03125)); }

                    //10.  ********n=6******** adding 0.015625
                    //1 generation against 4 Generations:
                    //short generation from mother
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.015625)); }//A´s Great great grandmother is B´s mother
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.015625)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.015625)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.015625)); }

                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.015625)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.015625)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.015625)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.MotherId,0.015625)); }

                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.015625)); }//A´s Great great grandpa is B´s father
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.015625)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.015625)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.015625)); }

                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.015625)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.015625)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.015625)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.FatherId,0.015625)); }

                    //1 generation against 4 Generations:
                    // short generation from father
                if (B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == A.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.015625)); }//A´s Great great grandmother is B´s mother
                if (B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == A.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.015625)); }
                if (B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == A.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.015625)); }
                if (B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == A.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.015625)); }

                if (B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == A.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.015625)); }
                if (B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == A.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.015625)); }
                if (B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == A.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.015625)); }
                if (B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == A.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.MotherId,0.015625)); }

                if (B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == A.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.015625)); }//A´s Great great grandpa is B´s father
                if (B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId == A.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.015625)); }
                if (B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == A.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.015625)); }
                if (B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId == A.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.015625)); }

                if (B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId == A.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.015625)); }
                if (B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == A.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.015625)); }
                if (B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId == A.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.015625)); }
                if (B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == A.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.FatherId,0.015625)); }

                    //2 Generations on one side against 3 Generations on other side
                    //shorter up from Mother
                if (A.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.MotherId,0.015625)); }//A´s Great grandma is B´s grandma
                if (A.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.MotherId,0.015625)); }
                if (A.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.MotherId,0.015625)); }
                if (A.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.MotherId,0.015625)); }

                if (A.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.MotherId,0.015625)); }
                if (A.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.MotherId,0.015625)); }
                if (A.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.MotherId,0.015625)); }
                if (A.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.MotherId,0.015625)); }

                if (A.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.FatherId,0.015625)); }//A´s Great grandfather is B´s grandma
                if (A.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.FatherId,0.015625)); }
                if (A.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.FatherId,0.015625)); }
                if (A.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.FatherId,0.015625)); }

                if (A.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.FatherId,0.015625)); }
                if (A.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.FatherId,0.015625)); }
                if (A.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.FatherId,0.015625)); }
                if (A.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.FatherId,0.015625)); }

                    //2 Generations on one side against 3 Generations on other side
                    //shorter up from Father
                if (B.Litter.Father.Litter.Father.Litter.MotherId == A.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Father.Litter.MotherId,0.015625)); }//B´s Great grandma is A´s grandma
                if (B.Litter.Father.Litter.Mother.Litter.MotherId == A.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Father.Litter.MotherId,0.015625)); }
                if (B.Litter.Mother.Litter.Father.Litter.MotherId == A.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Father.Litter.MotherId,0.015625)); }
                if (B.Litter.Mother.Litter.Mother.Litter.MotherId == A.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Father.Litter.MotherId,0.015625)); }

                if (B.Litter.Father.Litter.Father.Litter.MotherId == A.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Mother.Litter.MotherId,0.015625)); }
                if (B.Litter.Father.Litter.Mother.Litter.MotherId == A.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Mother.Litter.MotherId,0.015625)); }
                if (B.Litter.Mother.Litter.Father.Litter.MotherId == A.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Mother.Litter.MotherId,0.015625)); }
                if (B.Litter.Mother.Litter.Mother.Litter.MotherId == A.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Mother.Litter.MotherId,0.015625)); }

                if (B.Litter.Father.Litter.Father.Litter.FatherId == A.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Father.Litter.FatherId,0.015625)); }//B´s Great grandfather is A´s grandma
                if (B.Litter.Father.Litter.Mother.Litter.FatherId == A.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Father.Litter.FatherId,0.015625)); }
                if (B.Litter.Mother.Litter.Father.Litter.FatherId == A.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Father.Litter.FatherId,0.015625)); }
                if (B.Litter.Mother.Litter.Mother.Litter.FatherId == A.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Father.Litter.FatherId,0.015625)); }

                if (B.Litter.Father.Litter.Father.Litter.FatherId == A.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Mother.Litter.FatherId,0.015625)); }
                if (B.Litter.Father.Litter.Mother.Litter.FatherId == A.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Mother.Litter.FatherId,0.015625)); }
                if (B.Litter.Mother.Litter.Father.Litter.FatherId == A.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Mother.Litter.FatherId,0.015625)); }
                if (B.Litter.Mother.Litter.Mother.Litter.FatherId == A.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(A.Litter.Mother.Litter.FatherId,0.015625)); }

                    //O generation up from one side, 5 generations up from other side
                    //mother
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); } //A´s great great great grandmother is B
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }

                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }

                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }

                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == B.Id) { inbreedingResult.Add(new InbreedingResult(B.Id,0.015625)); }

                    //father
                if (B.Litter.Father.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); } //B´s great great great grandmother is A
                if (B.Litter.Father.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }
                if (B.Litter.Father.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }
                if (B.Litter.Father.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }

                if (B.Litter.Father.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }
                if (B.Litter.Father.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }
                if (B.Litter.Father.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }
                if (B.Litter.Father.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }

                if (B.Litter.Mother.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }
                if (B.Litter.Mother.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }
                if (B.Litter.Mother.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }
                if (B.Litter.Mother.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }

                if (B.Litter.Mother.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }
                if (B.Litter.Mother.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }
                if (B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }
                if (B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == A.Id) { inbreedingResult.Add(new InbreedingResult(A.Id,0.015625)); }

                    //****n=7******
                    //Great Greandparents
                    //if great grandpa the same
                if (A.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.FatherId,0.0078125)); }
                if (A.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.FatherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.FatherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.FatherId,0.0078125)); }

                if (A.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.FatherId,0.0078125)); }
                if (A.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.FatherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.FatherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.FatherId,0.0078125)); }

                if (A.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.FatherId,0.0078125)); }
                if (A.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.FatherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.FatherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.FatherId,0.0078125)); }

                if (A.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.FatherId,0.0078125)); }
                if (A.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.FatherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.FatherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.FatherId,0.0078125)); }

                //if great grandma the same
                if (A.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.MotherId,0.0078125)); }
                if (A.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.MotherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.MotherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.MotherId,0.0078125)); }

                if (A.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.MotherId,0.0078125)); }
                if (A.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.MotherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.MotherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.MotherId,0.0078125)); }

                if (A.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.MotherId,0.0078125)); }
                if (A.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.MotherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.MotherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.MotherId,0.0078125)); }

                if (A.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.MotherId,0.0078125)); }
                if (A.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.MotherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.MotherId,0.0078125)); }
                if (A.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.MotherId,0.0078125)); }

                //A and B have the G.G.G, Grandparents starting down from top of the pedigree.

                //starting with the G.G.G:Grand father - the first line.
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }

                // The second line
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }

                // The 3rd line of G.G.G.Gfathers
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }

                // The 4th line of G.G.G.Gfathers
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }

                // The 5th line og G.G.G. Gfathers
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }

                // The 6th line og G.G.G. Gfathers
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }

                // The 7th line og G.G.G. Gfathers
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }

                // The 8th line og G.G.G. Gfathers
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.FatherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.FatherId, 0.00195)); }

                //starting with the G.G.G:Grand Mothers - the first line.
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }

                //starting with the G.G.G:Grand Mothers - the 2nd line.
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }

                //t 3rd line line.
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }

                //the 4th line line.
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }

                //the 5th line line.
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }

                //the 6th line line.
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }

                //the 7th line line.
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }

                //the 8th line line.
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Father.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Father.Litter.Mother.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Father.Litter.MotherId, 0.00195)); }
                if (A.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId == B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId) { inbreedingResult.Add(new InbreedingResult(B.Litter.Mother.Litter.Mother.Litter.Mother.Litter.MotherId, 0.00195)); }

            }

            //Grate Great Greandparents
            //if great great grandpa the same

              //   result = result*100;
              //   inbreedingResult.Result = result;
             return inbreedingResult;
        }
コード例 #7
0
 // Fáum inn Id af hundi og skilum foreldrum í lista.
 private List<Dog> parents(Dog d)
 {
     List<Dog> pList = new List<Dog>();
     pList.Add(d.Litter.Father);
     pList.Add(d.Litter.Mother);
     return pList;
 }
コード例 #8
0
ファイル: DogController.cs プロジェクト: gudni12345/isic-data
        // Býr til list af foreldrum fyrir ættbók.
        public List<Dog> FetchPedigree(Dog dog)
        {
            List<Dog> parentList = new List<Dog>();
            List<Dog> pTemp = new List<Dog>();
            List<Dog> pTemp2 = new List<Dog>();
            List<Dog> pTemp3 = new List<Dog>();
            parentList = parents(dog);  // Skilar foreldrum.  2 hundar

            foreach (Dog d in parentList)
            {
                if (pTemp == null)
                    pTemp = parents(d);
                else
                    pTemp.AddRange(parents(d));        // 4 hundar.
            }

            parentList.AddRange(pTemp);  // 6 hundar komnir.

            foreach (Dog d in pTemp) // finnur foreldra fyrir þessa 4 hunda.
            {
                if (pTemp2 == null)
                    pTemp2 = parents(d);
                else
                pTemp2.AddRange(parents(d));        // skila 8 hundar.
            }
            parentList.AddRange(pTemp2);    // 6 + 8 = 14 stk
            pTemp = null;

            foreach (Dog d in pTemp2) // finnur foreldra fyrir þessa 8 hunda.
            {
                if (pTemp == null)
                    pTemp = parents(d);
                else
                    pTemp.AddRange(parents(d));        //skila 16 hundar.
            }
            parentList.AddRange(pTemp);  // 14 + 16 = 30 stk

            pTemp2 = null;

            foreach (Dog d in pTemp) // finnur þetta foreldra fyrir 16 hundana ?
            {
                if (pTemp2 == null)
                    pTemp2 = parents(d);
                else
                    pTemp2.AddRange(parents(d));        // skila 32 hundar.
            }

            parentList.AddRange(pTemp2);  // 16 + 32 = 48 stk

            return parentList;
        }
コード例 #9
0
ファイル: DogController.cs プロジェクト: gudni12345/isic-data
        public ActionResult Edit(Dog dog)
        {
            // The litter is displayed in form. the following code is to clear false positive validation errors
            if ((dog.LitterId != null) && (dog.Litter.PersonId == null))
            {
                if (ModelState.ContainsKey("Litter.PersonId"))
                    ModelState["Litter.PersonId"].Errors.Clear();
            }

            if (ModelState.IsValid)
            {
                string fileName = null;
                dog.BornInCountry = null;      // Link to Country table dismissed in this change. the field is not changeable in the view.

                dog.Litter = null;

                try  // Try to save picture
                {
                    if (Request.Files.Count > 0)
                    {
                        var file = Request.Files[0];

                        if (file != null && file.ContentLength > 0)
                        {
                            WebImage img = new WebImage(file.InputStream);   // Making sure the picture is of rigth size
                            if (img.Width > 500)
                                img.Resize(500, 315);

                            var extension = Path.GetExtension(file.FileName);
                            fileName = Regex.Replace(dog.Reg, @"[\[\]\\\^\$\.\|\?\*\+\(\)\{\}%,;><!@#&\-\+/]", "");
                            fileName = fileName + extension;
                            var path = Path.Combine(Server.MapPath("~/Photos/"), fileName);

                            img.Save(path);
                            TempData["Success"] = "Picture for the " + dog.Name + " was successfully saved.";
                        }
                    }
                }
                catch (Exception)
                {
                    ViewData["Error"] = "Unable to save picture";
                }

                if (fileName != null)
                    dog.PicturePath = "~/Photos/"+fileName;
                db.UpdateDog(dog);
               // db.Entry(dog).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.ColorId = new SelectList(db.allColors, "Id", "ColorText", dog.ColorId);
            ViewBag.PersonId = new SelectList(db.allPersons, "Id", "Name", dog.PersonId);
            ViewBag.CountryId = new SelectList(db.allCountries, "Id", "Name", dog.BornInCountryId);

            return View(dog);
        }
コード例 #10
0
 public void InsertOrUpdate(Dog dog)
 {
     context.Add(dog);
 }
コード例 #11
0
ファイル: DogRepository.cs プロジェクト: gudni12345/isic-data
 public void UpdateDog(Dog dog)
 {
     db.Entry(dog).State = EntityState.Modified;
 }
コード例 #12
0
ファイル: DogRepository.cs プロジェクト: gudni12345/isic-data
 public void InsertOrUpdateDog(Dog dog)
 {
     if (dog.Id == default(int))
     {
         // New entity
         db.Dog.Add(dog);
     }
     else
     {
         // Existing entity
         db.Entry(dog).State = EntityState.Modified;
     }
 }
コード例 #13
0
        public ActionResult Index(DogViewModel viewModel)
        {
            if (viewModel.Litter.FatherId != 0)  // The name of the father is displayed in form. the following code is to clear false positive validation errors
            {
                Dog father = db.Dog.Find(viewModel.Litter.FatherId);
                viewModel.Litter.Father.Name = father.Name;
                viewModel.Litter.Father.Sex = "M";
                if (ModelState.ContainsKey("Litter.Father.Sex"))
                    ModelState["Litter.Father.Sex"].Errors.Clear();
                if (ModelState.ContainsKey("Litter.Father.Name"))
                    ModelState["Litter.Father.Name"].Errors.Clear();
            }

            if (viewModel.Litter.MotherId != 0)
            {
                Dog mother = db.Dog.Find(viewModel.Litter.MotherId);
                viewModel.Litter.Mother.Name = mother.Name;
                viewModel.Litter.Mother.Sex = "F";
                if (ModelState.ContainsKey("Litter.Mother.Sex"))
                    ModelState["Litter.Mother.Sex"].Errors.Clear();
                if (ModelState.ContainsKey("Litter.Mother.Name"))
                    ModelState["Litter.Mother.Name"].Errors.Clear();
            }

            if (viewModel.Litter.DateOfBirth == null)
            {
                ModelState.AddModelError("DateOfBirth", "Date is required.");
            }
            if (viewModel.Litter.PersonId == null)
            {
                ModelState.AddModelError("PersonId", "Breeder is required.");
            }

            ViewBag.ColorId = new SelectList(db.Color, "Id", "ColorText");
            ViewBag.successMessage = "";

            List<string> genderList = new List<string>() { "Male", "Female" };
            ViewBag.Gender = new SelectList(genderList);

            if (!ModelState.IsValid)
            {
                var errors = ModelState.SelectMany(x => x.Value.Errors.Select(z => z.Exception));
                return View(viewModel);
            }

            if (ModelState.IsValid)
            {
                try
                {

                    int uId = (int)WebMatrix.WebData.WebSecurity.GetUserId(User.Identity.Name);
                    Litter l = new Litter()
                    {
                        DateOfBirth = viewModel.Litter.DateOfBirth,
                        FatherId = viewModel.Litter.FatherId,
                        MotherId = viewModel.Litter.MotherId,
                        PersonId = viewModel.Litter.PersonId,    // Breeder person.
                        UsersId =  uId                          // User logged in
                    };

                    db.Litter.Add(l);
                    db.SaveChanges();                           // Litter saved

                    foreach (Dog dp in viewModel.Dogs)
                    {

                        Users u = db.Users.Find(uId);  // Find Admin that is logged in.

                        Dog d = new Dog()
                        {
                            Name = dp.Name,
                            Reg = dp.Reg,
                            Sex = dp.Sex,
                            ColorId = dp.ColorId,
                            LitterId = l.Id,             // Dog linked with privious litter.
                            BornInCountryId = u.CountryId // Dog gets same Country as the Admin.
                        };
                        if (d.Sex.Equals("Male")) d.Sex = "M";
                        if (d.Sex.Equals("Female")) d.Sex = "F";

                        db.Dog.Add(d);
                        db.SaveChanges();   // Dog saved
                    }    //end foreach DogAndPerson

                    TempData["Success"] = "Data was successfully saved.";
                } //end try
                catch (Exception)
                {
                    ViewData["Error"] = "Unable to save";
                    TempData["Error"] = "!Unable to save data.";
                    //return RedirectToAction("Error");
                }

                return RedirectToAction("Index","Dog");  // Success
            } //end if Model state is valid

            return RedirectToAction("Index");
        }