Exemplo n.º 1
0
        public static void CreateIndex(object closet)
        {
            using (SearchEngineService ses = SearchEngineService.GetByCloset(Convert.ToInt32(closet)))
            {
                IList <SearchEngineEntry> lst = new List <SearchEngineEntry>();
                for (int i = ((Convert.ToInt32(closet) - 1) * maxRecordsPerCloset); i < maxRecordsPerCloset * Convert.ToInt32(closet); i++)
                {
                    SearchEngineEntry see = new SearchEngineEntry();
                    see.EntryId = i;

                    int amountOfClothes = rnd.Next(10) + 1;

                    see.Categories   = GetRandom(categories, amountOfClothes / 2);
                    see.Colors       = GetRandom(colors, amountOfClothes);
                    see.Silouhettes  = GetRandom(silouhettes, amountOfClothes);
                    see.EventTypes   = GetRandom(eventTypes);
                    see.Fabrics      = GetRandom(fabrics);
                    see.Seasons      = GetRandom(seasons);
                    see.Tags         = GetRandom(tags);
                    see.EditorRating = Convert.ToInt32(GetRandom(rating, 1));
                    see.FriendRating = 0;
                    see.FlavorId     = Convert.ToInt32(GetRandom(flavor, 1));

                    see.CreatedByMe = false;
                    see.MyRating    = 0;

                    if (i == 1)
                    {
                        see.MyRating = 5;
                    }

                    if (i <= 10)
                    {
                        see.FriendRating = 3;
                    }

                    lst.Add(see);
                }

                ses.AddEntries(lst);
            }
        }