Example #1
0
        public Dog FindRecommodation(List<Dog> d, Dog nDog)
        {
            Dog bestMatch = new Dog();

            foreach (Dog i in d)
            {
                i.Points += IsAMatch((int)i.ActivityLevel, (int)nDog.ActivityLevel);
                i.Points += IsAMatch((int)i.Coatlength, (int)nDog.Coatlength);
                i.Points += IsAMatch((int)i.GroomingLevel, (int)nDog.GroomingLevel);
                i.Points += IsAMatch((int)i.IntelligenceLevel, (int)nDog.IntelligenceLevel);
                i.Points += IsAMatch((int)i.SheddingLevel, (int)nDog.SheddingLevel);
                i.Points += IsAMatch((int)i.Size, (int)nDog.Size);
                i.Points += IsAMatch(i.Drools, nDog.Drools);
                i.Points += IsAMatch(i.GoodWithChildren, nDog.GoodWithChildren);
            }

            PrintInfo(d);

            var best = from x in d
                       orderby x.Points descending
                       select x;
            bestMatch = best.First();

            return bestMatch;
        }
        public Dog findClosestMatch(Dog wantedDog)
        {
            //makes dog list
            List<Dog> dogList = new List<Dog>();
            dogList = makeDogList();

            Dog closestMatch = new Dog();

            double highestMatchValue = 0;
            foreach(Dog dog in dogList)
            {
                //calls methods to assign values to find closest match
                double dogValue = 0;
                dogValue += getBoolValue(wantedDog.GoodWithChildren, dog.GoodWithChildren);
                dogValue += getBoolValue(wantedDog.Drools, dog.Drools);
                dogValue += getELengthValue(wantedDog.CoatLength, dog.CoatLength);
                dogValue += getEScaleValue(wantedDog.ActivityLevel, dog.ActivityLevel);
                dogValue += getEScaleValue(wantedDog.SheddingLevel, dog.SheddingLevel);
                dogValue += getEScaleValue(wantedDog.GroomingLevel, dog.GroomingLevel);
                dogValue += getEScaleValue(wantedDog.IntelligenceLevel, dog.IntelligenceLevel);
                dogValue += getESizeValue(wantedDog.Size, dog.Size);

                //if the current dog has a higher match value than the previous highest it now becomes the highest
                if(dogValue > highestMatchValue)
                {
                    highestMatchValue = dogValue;
                    closestMatch = dog;
                }
            }

            return closestMatch;
        }
        /// <summary>
        /// Suggest a Dog
        /// </summary>
        /// <param name="searchDog">Dog with search parameters within it</param>
        /// <returns>Suggested Dog from database</returns>
        public Dog suggestDog(Dog searchDog)
        {
            //Keeps track of the top score of the best dog so far
            double topScore = 0;
            //Keeps track of which dog has that score
            int topDog = 0;

            for (int i = 0; i < dogList.Count; i++)
            {
                //Grab a dog to score
                Dog thisDog = dogList[i];
                //Keep track of the score
                double score;
                //Get score for this dog
                score = rankDog(thisDog, searchDog);

                if (score > topScore)
                {
                    topScore = score;
                    topDog = i;
                }
            }
                //Return best dog
                return dogList[topDog];
        }
 public ActionResult DogSelector(Dog dogQualities)
 {
     Dog chosenDog = null;
     chosenDog = chooseDog(dogQualities);
     if (chosenDog != null)
         return View("DogRecommendation", chosenDog);
     else
         return View("NoSuitableDog");
 }
        public ActionResult Index(Dog searchDog)
        {
            //Create new database(this seems pretty inefficient)
            DatabaseManager db = new DatabaseManager();

            //Ask database for a dog based on the details provided from the user
            Dog suggestedDog = db.suggestDog(searchDog);

            //Display results to user
            return View("Suggestion", suggestedDog);
        }
Example #6
0
        public static Dog CompareDogs(Dog desiredDog, List<Dog> allDogs)
        {
            Dog closestMatch = new Dog();
            List<int> scores = new List<int>();
            int i = 0;

            foreach (Dog dog in allDogs)
            {
                int score = 0;
                if (desiredDog.ActivityLevel == dog.ActivityLevel)
                {
                    scores.Insert(i, score++);
                }
                if (desiredDog.CoatLength == dog.CoatLength)
                {
                    scores.Insert(i, score++);
                }
                if (desiredDog.Drools == dog.Drools)
                {
                    scores.Insert(i, score++);
                }
                if (desiredDog.GoodWithChildren == dog.GoodWithChildren)
                {
                    scores.Insert(i, score++);
                }
                if (desiredDog.IntelligenceLevel == dog.IntelligenceLevel)
                {
                    scores.Insert(i, score++);
                }
                if (desiredDog.SheddingLevel == dog.SheddingLevel)
                {
                    scores.Insert(i, score++);
                }
                if (desiredDog.Size == dog.Size)
                {
                    scores.Insert(i, score++);
                }
                if (desiredDog.GroomingLevel == dog.GroomingLevel)
                {
                    scores.Insert(i, score++);
                }

                i++;

            }

            int maxIndex = scores.IndexOf(scores.Max());
            closestMatch = allDogs[maxIndex];

            return closestMatch;
        }
        private double calculateDifferenceForDog(Dog userDreamDog, Dog matchDog)
        {
            double matchScore = 0;

            matchScore += calculateDifferenceForValue(userDreamDog.HighActivityLevel, matchDog.HighActivityLevel);
            matchScore += calculateDifferenceForValue(userDreamDog.HighSheddingLevel, matchDog.HighSheddingLevel);
            matchScore += calculateDifferenceForValue(userDreamDog.HighGroomingLevel, matchDog.HighGroomingLevel);
            matchScore += calculateDifferenceForValue(userDreamDog.Intelligent, matchDog.Intelligent);
            matchScore += calculateDifferenceForValue(userDreamDog.GoodWithChildren, matchDog.GoodWithChildren);
            matchScore += calculateDifferenceForValue(userDreamDog.DroolingLevel, matchDog.DroolingLevel);
            matchScore += calculateDifferenceForValue(userDreamDog.LongCoat, matchDog.LongCoat);
            matchScore += calculateDifferenceForValue(userDreamDog.BigDog, matchDog.BigDog);

            return matchScore;
        }
        private Dog chooseDog(Dog dogQualities)
        {
            Dog appropriateDog = null;
            DogDatabase database = new DogDatabase();
            foreach (Dog currentDog in database.database)
            {
                if (checkChildren(dogQualities.GoodWithChildren, currentDog.GoodWithChildren))
                    if (checkDrools(dogQualities.Drools, currentDog.Drools))
                        if (dogQualities.Coatlength.Equals(currentDog.Coatlength))
                            if (checkScalers(dogQualities.ActivityLevel, currentDog.ActivityLevel))
                                if (checkScalers(dogQualities.SheddingLevel, currentDog.SheddingLevel))
                                    if (checkScalers(dogQualities.GroomingLevel, currentDog.GroomingLevel))
                                        if (checkScalers(dogQualities.IntelligenceLevel, currentDog.IntelligenceLevel))
                                            if (checkSize(dogQualities.Size, currentDog.Size))
                                                appropriateDog = currentDog;
            }

            return appropriateDog;
        }
        public ActionResult Result(EScale highActivityLevel, EScale highSheddingLevel, EScale highGroomingLevel, EScale intelligent, EScale goodWithChildren, EScale drools, EScale longCoat, EScale bigDog)
        {
            List<Dog> doggyDB = makeDatabase(); // Seems like a sensible enough name

            Dog userDreamDog = new Dog()
            {
                HighActivityLevel = highActivityLevel,
                HighSheddingLevel = highSheddingLevel,
                HighGroomingLevel = highGroomingLevel,
                Intelligent = intelligent,
                GoodWithChildren = goodWithChildren,
                DroolingLevel = drools,
                LongCoat = longCoat,
                BigDog = bigDog
            };

            Dog result = findBestMatch(userDreamDog, doggyDB);

            return View(result);
        }
Example #10
0
 public ActionResult Index(bool goodWithChildren, bool drools, ELength coatlength, 
     EScale activityLevel, EScale sheddingLevel,  EScale groomingLevel,
     EScale intelligenceLevel, ESize size)
 {
     Dog requestedDog = new Dog
     {
         GoodWithChildren = goodWithChildren,
         Drools = drools,
         Coatlength = coatlength,
         ActivityLevel = activityLevel,
         SheddingLevel = sheddingLevel,
         GroomingLevel = groomingLevel,
         IntelligenceLevel = intelligenceLevel,
         Size = size
     };
     Dog returnDog = findDogRecommendation(requestedDog);
     if (returnDog.BreedName != null)
         return View("DogRecommendation", returnDog);
     else
         return View("NoDogRecommendation");
 }
Example #11
0
        private Dog doTheSelect(Dog selectedDog)
        {
            Dog doge = null;
            List<int> similarityRate = new List<int>();
            for (int i = 0; i < allDogs.Count; i++)
            {
                int similarity = 0;
                similarity = (allDogs[i].ActivityLevel == selectedDog.ActivityLevel) ? similarity + 1 : whatIfNoPreference(similarity, selectedDog.ActivityLevel);
                similarity = (allDogs[i].SheddingLevel == selectedDog.SheddingLevel) ? similarity  + 1 : whatIfNoPreference(similarity, selectedDog.SheddingLevel);
                similarity = (allDogs[i].GroomingLevel == selectedDog.GroomingLevel) ? similarity + 1 : whatIfNoPreference(similarity, selectedDog.GroomingLevel);
                similarity = (allDogs[i].IntelligenceLevel == selectedDog.IntelligenceLevel) ? similarity + 1 : whatIfNoPreference(similarity, selectedDog.IntelligenceLevel);

                similarity = (allDogs[i].Size == selectedDog.Size) ? similarity + 1 : similarity;
                similarity = (allDogs[i].GoodWithChildren == selectedDog.GoodWithChildren) ? similarity + 1 : similarity;
                similarity = (allDogs[i].Drools == selectedDog.Drools) ? similarity + 1 : similarity;
                similarity = (allDogs[i].Coatlength == selectedDog.Coatlength) ? similarity + 1 : similarity;
                similarityRate.Add(similarity);
            }
            int highestRate = similarityRate.Max();
            List<Dog> possibleOptions = new List<Dog>();
            for (int i = 0; i < allDogs.Count; i++)
            {
                if (similarityRate[i] == highestRate)
                {
                    possibleOptions.Add(allDogs[i]);
                }
            }
            Random rand = new Random();
            if(possibleOptions.Count > 1)
            {
                doge = possibleOptions[rand.Next(possibleOptions.Count)];
            }
            else
            {
                doge = possibleOptions[0];
            }
            return doge;
        }
        public ActionResult SelectedDog(EScale activityLevel, EScale sheddingLevel, EScale groomingLevel, EScale intelligenceLevel, ELength coatlength, ESize size, bool goodWithChildren, bool drools)
        {
            DatabaseManager dbm = new DatabaseManager();
            db = dbm.makeDatabase();

            Dog nDog = new Dog();
            nDog.ActivityLevel = activityLevel;
            nDog.SheddingLevel = sheddingLevel;
            nDog.GroomingLevel = groomingLevel;
            nDog.IntelligenceLevel = intelligenceLevel;
            nDog.Coatlength = coatlength;
            nDog.Size = size;
            nDog.GoodWithChildren = goodWithChildren;
            nDog.Drools = drools;

            nDog.BreedName = db[0].BreedName;
            nDog.ImageName = db[0].ImageName;
            nDog.DisplayName = db[0].DisplayName;

            Dog recommendation = dbm.FindRecommodation(db, nDog);

            return View(recommendation);
        }
 private Dog findBestMatch(Dog userDreamDog, List<Dog> doggyDB)
 {
     return doggyDB.OrderByDescending(dog => calculateDifferenceForDog(userDreamDog, dog)).FirstOrDefault();
 }
Example #14
0
        private double DogCompatibility(Dog requestedDog, Dog dogFromList)
        {
            double returnValue = 0;

            // Dogs need to pass both boolean tests before being considered a match
            if (requestedDog.Drools == dogFromList.Drools && requestedDog.GoodWithChildren == dogFromList.GoodWithChildren)
            {
                // Create a list to store the dog scores
                // We will populate this list by using two methods to compute a score for each feature
                List<int> scores = new List<int>();

                // For the fields without a NoPreference Enum, we can just use calculateFeaturreCompatibility
                scores.Add(calculateFeatureCompatibility((int)dogFromList.Coatlength, (int)requestedDog.Coatlength));
                scores.Add(calculateFeatureCompatibility((int)dogFromList.Size, (int)requestedDog.Size));

                // With the fields using a NoPreference Enum, we need to use another method that will filter first
                scores.Add(calculateLevelFeatures((int)dogFromList.ActivityLevel, (int)requestedDog.ActivityLevel));
                scores.Add(calculateLevelFeatures((int)dogFromList.SheddingLevel, (int)requestedDog.SheddingLevel));
                scores.Add(calculateLevelFeatures((int)dogFromList.GroomingLevel, (int)requestedDog.GroomingLevel));
                scores.Add(calculateLevelFeatures((int)dogFromList.IntelligenceLevel, (int)requestedDog.IntelligenceLevel));

                // Because we use a list, we can use .Average()
                returnValue = scores.Average();
            }
            else
                returnValue = 0;    // If we don't pass boolean test, we're not compatible at all

            return returnValue;
        }
Example #15
0
        // Patricia's Method -- will make a list to act as a database
        private List<Dog> makeDatabase()
        {
            List<Dog> newDatabase = new List<Dog>();

            Dog afghanHound = new Dog();
            afghanHound.BreedName = "afghanHound";
            afghanHound.DisplayName = "Afghan Hound";
            afghanHound.ActivityLevel = EScale.High;
            afghanHound.Coatlength = ELength.Long;
            afghanHound.Drools = false;
            afghanHound.GoodWithChildren = false;
            afghanHound.GroomingLevel = EScale.High;
            afghanHound.IntelligenceLevel = EScale.Low;
            afghanHound.SheddingLevel = EScale.High;
            afghanHound.Size = ESize.Large;
            afghanHound.ImageName = "AfghanHound.jpg";
            newDatabase.Add(afghanHound);

            Dog bassetHound = new Dog();
            bassetHound.BreedName = "BassetHound";
            bassetHound.DisplayName = "Basset Hound";
            bassetHound.ActivityLevel = EScale.Medium;
            bassetHound.Coatlength = ELength.Short;
            bassetHound.Drools = true;
            bassetHound.GoodWithChildren = true;
            bassetHound.GroomingLevel = EScale.Low;
            bassetHound.IntelligenceLevel = EScale.Medium;
            bassetHound.SheddingLevel = EScale.Low;
            bassetHound.Size = ESize.Medium;
            bassetHound.ImageName = "BassetHound.jpg";
            newDatabase.Add(bassetHound);

            Dog beagle = new Dog()
            {
                BreedName = "Beagle",
                DisplayName = "Beagle",
                ActivityLevel = EScale.High,
                Coatlength = ELength.Short,
                Drools = false,
                GoodWithChildren = true,
                GroomingLevel = EScale.Medium,
                IntelligenceLevel = EScale.Medium,
                SheddingLevel = EScale.Low,
                Size = ESize.Medium,
                ImageName = "Beagle.jpg"
            };
            newDatabase.Add(beagle);

            Dog bichonFrise = new Dog()
            {
                BreedName = "BichonFrise",
                DisplayName = "Bichon Frise",
                ActivityLevel = EScale.High,
                Coatlength = ELength.Medium,
                Drools = false,
                GoodWithChildren = true,
                GroomingLevel = EScale.High,
                IntelligenceLevel = EScale.High,
                SheddingLevel = EScale.Low,
                Size = ESize.Small,
                ImageName = "Bichonfrise.jpg"
            };
            newDatabase.Add(bichonFrise);

            Dog borzoi = new Dog()
            {
                BreedName = "Borzoi",
                DisplayName = "Borzoi",
                ActivityLevel = EScale.High,
                Coatlength = ELength.Long,
                Drools = false,
                GoodWithChildren = false,
                GroomingLevel = EScale.High,
                IntelligenceLevel = EScale.High,
                SheddingLevel = EScale.High,
                Size = ESize.Large,
                ImageName = "Borzoi.jpg"
            };
            newDatabase.Add(borzoi);

            Dog bulldog = new Dog()
            {
                BreedName = "Bulldog",
                DisplayName = "Bull Dog",
                ActivityLevel = EScale.Medium,
                Coatlength = ELength.Short,
                Drools = true,
                GoodWithChildren = false,
                GroomingLevel = EScale.Low,
                IntelligenceLevel = EScale.Medium,
                SheddingLevel = EScale.Low,
                Size = ESize.Medium,
                ImageName = "Bulldog.jpg"
            };
            newDatabase.Add(bulldog);

            Dog cav = new Dog()
            {
                BreedName = "CavalierKingCharlesSpaniel",
                DisplayName = "Cavalier King Charles Spaniel",
                ActivityLevel = EScale.Medium,
                Coatlength = ELength.Medium,
                Drools = false,
                GoodWithChildren = true,
                GroomingLevel = EScale.High,
                IntelligenceLevel = EScale.Medium,
                SheddingLevel = EScale.Medium,
                Size = ESize.Small,
                ImageName = "CavalierKingCharlesSpaniel.jpg"
            };
            newDatabase.Add(cav);

            Dog chowchow = new Dog()
            {
                BreedName = "Chowchow",
                DisplayName = "Chow Chow",
                ActivityLevel = EScale.Medium,
                Coatlength = ELength.Long,
                Drools = true,
                GoodWithChildren = false,
                GroomingLevel = EScale.High,
                IntelligenceLevel = EScale.High,
                SheddingLevel = EScale.High,
                Size = ESize.Large,
                ImageName = "Chowchow.jpg"
            };
            newDatabase.Add(chowchow);

            Dog dalmation = new Dog()
            {
                BreedName = "Dalmation",
                DisplayName = "Dalmation",
                ActivityLevel = EScale.High,
                Coatlength = ELength.Short,
                Drools = false,
                GoodWithChildren = false,
                GroomingLevel = EScale.Medium,
                IntelligenceLevel = EScale.High,
                SheddingLevel = EScale.Low,
                Size = ESize.Large,
                ImageName = "Dalmation.jpg"
            };
            newDatabase.Add(dalmation);

            Dog goldenRetriever = new Dog()
            {
                BreedName = "GoldenRetriever",
                DisplayName = "Golden Retriever",
                ActivityLevel = EScale.High,
                Coatlength = ELength.Long,
                Drools = false,
                GoodWithChildren = true,
                GroomingLevel = EScale.Medium,
                IntelligenceLevel = EScale.High,
                SheddingLevel = EScale.High,
                Size = ESize.Large,
                ImageName = "GoldenRetriever.jpg"
            };
            newDatabase.Add(goldenRetriever);

            Dog maltese = new Dog()
            {
                BreedName = "Maltese",
                DisplayName = "Maltese",
                ActivityLevel = EScale.High,
                Coatlength = ELength.Long,
                Drools = false,
                GoodWithChildren = true,
                GroomingLevel = EScale.High,
                IntelligenceLevel = EScale.High,
                SheddingLevel = EScale.High,
                Size = ESize.Miniature,
                ImageName = "Maltese.jpg"
            };
            newDatabase.Add(maltese);

            Dog newfoundland = new Dog()
            {
                BreedName = "Newfoundland",
                DisplayName = "Newfoundland",
                ActivityLevel = EScale.High,
                Coatlength = ELength.Long,
                Drools = true,
                GoodWithChildren = true,
                GroomingLevel = EScale.Medium,
                IntelligenceLevel = EScale.High,
                SheddingLevel = EScale.High,
                Size = ESize.Giant,
                ImageName = "newfoundland.jpg"
            };
            newDatabase.Add(newfoundland);

            Dog oldEnglishSheepdog = new Dog()
            {
                BreedName = "OldEnglishSheepdog",
                DisplayName = "Old English Sheepdog",
                ActivityLevel = EScale.High,
                Coatlength = ELength.Long,
                Drools = true,
                GoodWithChildren = true,
                GroomingLevel = EScale.High,
                IntelligenceLevel = EScale.Medium,
                SheddingLevel = EScale.High,
                Size = ESize.Giant,
                ImageName = "OldEnglishSheepdog.jpg"
            };
            newDatabase.Add(oldEnglishSheepdog);

            Dog pug = new Dog()
            {
                BreedName = "Pug",
                DisplayName = "Pug",
                ActivityLevel = EScale.High,
                Coatlength = ELength.Short,
                Drools = false,
                GoodWithChildren = true,
                GroomingLevel = EScale.Low,
                IntelligenceLevel = EScale.Low,
                SheddingLevel = EScale.Low,
                Size = ESize.Miniature,
                ImageName = "Pug.jpg"
            };
            newDatabase.Add(pug);

            Dog westHighlandWhiteTerrier = new Dog()
            {
                BreedName = "WestHighlandWhiteTerrier",
                DisplayName = "West Highland White Terrier",
                ActivityLevel = EScale.High,
                Coatlength = ELength.Medium,
                Drools = false,
                GoodWithChildren = true,
                GroomingLevel = EScale.Medium,
                IntelligenceLevel = EScale.High,
                SheddingLevel = EScale.Medium,
                Size = ESize.Small,
                ImageName = "WestHighlandWhiteTerrier.jpg"
            };
            newDatabase.Add(westHighlandWhiteTerrier);

            return newDatabase;
        }
Example #16
0
        // Return a Dog that is closest to the features of the requested dog
        private Dog findDogRecommendation(Dog requestedDog)
        {
            allDogs = makeDatabase();       // Fake Database

            Dog topDog = null;              // Dog instance that we will store our current best candidate in
            double topDogScore = 0;         // Score that this dog has - The current top score

            foreach (Dog dog in allDogs)
            {
                double dogScore = DogCompatibility(requestedDog, dog);  // Get dog compatibility score
                if (dogScore > topDogScore)                             // If we score higher than current top dog
                {
                    topDog = dog;                                       // We ar the top dog
                    topDogScore = dogScore;                             // And hold the new high score
                }

            }

            return topDog;
        }
        public ActionResult RecommendedDog(Dog desiredDog)
        {
            Dog closestMatch = DogMatcher.CompareDogs(desiredDog, allDogs);

            return View(closestMatch);
        }
        public ActionResult ShowSelect(bool GoodWithChildren, bool Drooling, ELength CoatLength, EScale ActivityLevel, 
            EScale SheddingLevel, EScale GroomingLevel, EScale IntelligenceLevel, ESize Size)
        {
            //makes the wanted dog
            Dog wantedDog = new Dog
            {
                ActivityLevel = ActivityLevel,
                SheddingLevel = SheddingLevel,
                GroomingLevel = GroomingLevel,
                IntelligenceLevel = IntelligenceLevel,
                GoodWithChildren = GoodWithChildren,
                Drools = Drooling,
                CoatLength = CoatLength,
                Size = Size
            };

            //calls method to find closest dog
            Dog closestMatch = findClosestMatch(wantedDog);

            //returns the view and dog
            return View("DogRecomendation", closestMatch);
        }
        //=========================================================================
        private List<Dog> makeDatabase()
        {
            List<Dog> newDatabase = new List<Dog>();

            Dog afghanHound = new Dog();
            afghanHound.BreedName = "afghanHound";
            afghanHound.DisplayName = "Afghan Hound";
            afghanHound.HighActivityLevel = EScale.HIGH;
            afghanHound.LongCoat = EScale.HIGH;
            afghanHound.DroolingLevel = EScale.LOW;
            afghanHound.GoodWithChildren = EScale.LOW;
            afghanHound.HighGroomingLevel = EScale.HIGH;
            afghanHound.Intelligent = EScale.LOW;
            afghanHound.HighSheddingLevel = EScale.HIGH;
            afghanHound.BigDog = EScale.HIGH;
            afghanHound.ImageName = "AfghanHound.jpg";
            newDatabase.Add(afghanHound);

            Dog bassetHound = new Dog();
            bassetHound.BreedName = "BassetHound";
            bassetHound.DisplayName = "Basset Hound";
            bassetHound.HighActivityLevel = EScale.MEDIUM;
            bassetHound.LongCoat = EScale.LOW;
            bassetHound.DroolingLevel = EScale.HIGH;
            bassetHound.GoodWithChildren = EScale.HIGH;
            bassetHound.HighGroomingLevel = EScale.LOW;
            bassetHound.Intelligent = EScale.MEDIUM;
            bassetHound.HighSheddingLevel = EScale.LOW;
            bassetHound.BigDog = EScale.MEDIUM;
            bassetHound.ImageName = "BassetHound.jpg";
            newDatabase.Add(bassetHound);

            Dog beagle = new Dog()
            {
                BreedName = "Beagle",
                DisplayName = "Beagle",
                HighActivityLevel = EScale.HIGH,
                LongCoat = EScale.LOW,
                DroolingLevel = EScale.LOW,
                GoodWithChildren = EScale.HIGH,
                HighGroomingLevel = EScale.MEDIUM,
                Intelligent = EScale.MEDIUM,
                HighSheddingLevel = EScale.LOW,
                BigDog = EScale.LOW,
                ImageName = "Beagle.jpg"
            };
            newDatabase.Add(beagle);

            Dog bichonFrise = new Dog()
            {
                BreedName = "BichonFrise",
                DisplayName = "Bichon Frise",
                HighActivityLevel = EScale.HIGH,
                LongCoat = EScale.MEDIUM,
                DroolingLevel = EScale.LOW,
                GoodWithChildren = EScale.HIGH,
                HighGroomingLevel = EScale.HIGH,
                Intelligent = EScale.HIGH,
                HighSheddingLevel = EScale.LOW,
                BigDog = EScale.LOW,
                ImageName = "Bichonfrise.jpg"
            };
            newDatabase.Add(bichonFrise);

            Dog borzoi = new Dog()
            {
                BreedName = "Borzoi",
                DisplayName = "Borzoi",
                HighActivityLevel = EScale.HIGH,
                LongCoat = EScale.HIGH,
                DroolingLevel = EScale.LOW,
                GoodWithChildren = EScale.LOW,
                HighGroomingLevel = EScale.HIGH,
                Intelligent = EScale.HIGH,
                HighSheddingLevel = EScale.HIGH,
                BigDog = EScale.HIGH,
                ImageName = "Borzoi.jpg"
            };
            newDatabase.Add(borzoi);

            Dog bulldog = new Dog()
            {
                BreedName = "Bulldog",
                DisplayName = "Bull Dog",
                HighActivityLevel = EScale.MEDIUM,
                LongCoat = EScale.LOW,
                DroolingLevel = EScale.HIGH,
                GoodWithChildren = EScale.LOW,
                HighGroomingLevel = EScale.LOW,
                Intelligent = EScale.MEDIUM,
                HighSheddingLevel = EScale.LOW,
                BigDog = EScale.LOW,
                ImageName = "Bulldog.jpg"
            };
            newDatabase.Add(bulldog);

            Dog cav = new Dog()
            {
                BreedName = "CavalierKingCharlesSpaniel",
                DisplayName = "Cavalier King Charles Spaniel",
                HighActivityLevel = EScale.MEDIUM,
                LongCoat = EScale.MEDIUM,
                DroolingLevel = EScale.LOW,
                GoodWithChildren = EScale.HIGH,
                HighGroomingLevel = EScale.HIGH,
                Intelligent = EScale.MEDIUM,
                HighSheddingLevel = EScale.MEDIUM,
                BigDog = EScale.LOW,
                ImageName = "CavalierKingCharlesSpaniel.jpg"
            };
            newDatabase.Add(cav);

            Dog chowchow = new Dog()
            {
                BreedName = "Chowchow",
                DisplayName = "Chow Chow",
                HighActivityLevel = EScale.MEDIUM,
                LongCoat = EScale.HIGH,
                DroolingLevel = EScale.HIGH,
                GoodWithChildren = EScale.LOW,
                HighGroomingLevel = EScale.HIGH,
                Intelligent = EScale.HIGH,
                HighSheddingLevel = EScale.HIGH,
                BigDog = EScale.HIGH,
                ImageName = "Chowchow.jpg"
            };
            newDatabase.Add(chowchow);

            Dog dalmation = new Dog()
            {
                BreedName = "Dalmation",
                DisplayName = "Dalmation",
                HighActivityLevel = EScale.HIGH,
                LongCoat = EScale.LOW,
                DroolingLevel = EScale.LOW,
                GoodWithChildren = EScale.LOW,
                HighGroomingLevel = EScale.MEDIUM,
                Intelligent = EScale.HIGH,
                HighSheddingLevel = EScale.LOW,
                BigDog = EScale.HIGH,
                ImageName = "Dalmation.jpg"
            };
            newDatabase.Add(dalmation);

            Dog goldenRetriever = new Dog()
            {
                BreedName = "GoldenRetriever",
                DisplayName = "Golden Retriever",
                HighActivityLevel = EScale.HIGH,
                LongCoat = EScale.HIGH,
                DroolingLevel = EScale.LOW,
                GoodWithChildren = EScale.HIGH,
                HighGroomingLevel = EScale.MEDIUM,
                Intelligent = EScale.HIGH,
                HighSheddingLevel = EScale.HIGH,
                BigDog = EScale.HIGH,
                ImageName = "GoldenRetriever.jpg"
            };
            newDatabase.Add(goldenRetriever);

            Dog maltese = new Dog()
            {
                BreedName = "Maltese",
                DisplayName = "Maltese",
                HighActivityLevel = EScale.HIGH,
                LongCoat = EScale.HIGH,
                DroolingLevel = EScale.LOW,
                GoodWithChildren = EScale.HIGH,
                HighGroomingLevel = EScale.HIGH,
                Intelligent = EScale.HIGH,
                HighSheddingLevel = EScale.HIGH,
                BigDog = EScale.LOW,
                ImageName = "Maltese.jpg"
            };
            newDatabase.Add(maltese);

            Dog newfoundland = new Dog()
            {
                BreedName = "Newfoundland",
                DisplayName = "Newfoundland",
                HighActivityLevel = EScale.HIGH,
                LongCoat = EScale.HIGH,
                DroolingLevel = EScale.HIGH,
                GoodWithChildren = EScale.HIGH,
                HighGroomingLevel = EScale.MEDIUM,
                Intelligent = EScale.HIGH,
                HighSheddingLevel = EScale.HIGH,
                BigDog = EScale.HIGH,
                ImageName = "newfoundland.jpg"
            };
            newDatabase.Add(newfoundland);

            Dog oldEnglishSheepdog = new Dog()
            {
                BreedName = "OldEnglishSheepdog",
                DisplayName = "Old English Sheepdog",
                HighActivityLevel = EScale.HIGH,
                LongCoat = EScale.HIGH,
                DroolingLevel = EScale.HIGH,
                GoodWithChildren = EScale.HIGH,
                HighGroomingLevel = EScale.HIGH,
                Intelligent = EScale.MEDIUM,
                HighSheddingLevel = EScale.HIGH,
                BigDog = EScale.HIGH,
                ImageName = "OldEnglishSheepdog.jpg"
            };
            newDatabase.Add(oldEnglishSheepdog);

            Dog pug = new Dog()
            {
                BreedName = "Pug",
                DisplayName = "Pug",
                HighActivityLevel = EScale.HIGH,
                LongCoat = EScale.LOW,
                DroolingLevel = EScale.LOW,
                GoodWithChildren = EScale.HIGH,
                HighGroomingLevel = EScale.LOW,
                Intelligent = EScale.LOW,
                HighSheddingLevel = EScale.LOW,
                BigDog = EScale.LOW,
                ImageName = "Pug.jpg"
            };
            newDatabase.Add(pug);

            Dog westHighlandWhiteTerrier = new Dog()
            {
                BreedName = "WestHighlandWhiteTerrier",
                DisplayName = "West Highland White Terrier",
                HighActivityLevel = EScale.HIGH,
                LongCoat = EScale.MEDIUM,
                DroolingLevel = EScale.LOW,
                GoodWithChildren = EScale.HIGH,
                HighGroomingLevel = EScale.MEDIUM,
                Intelligent = EScale.HIGH,
                HighSheddingLevel = EScale.MEDIUM,
                BigDog = EScale.LOW,
                ImageName = "WestHighlandWhiteTerrier.jpg"
            };
            newDatabase.Add(westHighlandWhiteTerrier);

            return newDatabase;
        }
Example #20
0
 public ActionResult Index(Dog selectedDog)
 {
     allDogs = makeDatabase();
     return View("AfterSelected", doTheSelect(selectedDog));
 }
Example #21
0
        /// <summary>
        /// Calculate a score between a dog and the requested type of dog
        /// </summary>
        /// <param name="currentDog">Dog to calculate score for</param>
        /// <param name="searchDog">Requested type of dog</param>
        /// <returns>Score based on comparasion</returns>
        private double rankDog(Dog currentDog, Dog searchDog)
        {
            double score = 0;

            //Check Activity level
            if (currentDog.ActivityLevel == searchDog.ActivityLevel || searchDog.ActivityLevel==Dog.EScale.NoPreference)
            {
                score++;
            }

            //Check CoatLength
            if (currentDog.CoatLength == searchDog.CoatLength)
            {
                score++;
            }

            //Check Drools
            if (currentDog.Drools == searchDog.Drools)
            {
                score++;
            }

            //Check GoodWithChildren
            if (currentDog.GoodWithChildren == searchDog.GoodWithChildren)
            {
                score++;
            }

            //Check GroomingLevel
            if (currentDog.GroomingLevel == searchDog.GroomingLevel || searchDog.GroomingLevel==Dog.EScale.NoPreference)
            {
                score++;
            }

            //Check IntelligenceLevel
            if (currentDog.IntelligenceLevel == searchDog.IntelligenceLevel || searchDog.IntelligenceLevel==Dog.EScale.NoPreference)
            {
                score++;
            }

            //Check SheddingLevel
            if (currentDog.SheddingLevel == searchDog.SheddingLevel || searchDog.SheddingLevel == Dog.EScale.NoPreference)
            {
                score++;
            }

            //Check Size
            if (currentDog.Size == searchDog.Size)
            {
                score++;
            }

            return score;
        }