Exemple #1
0
        static void Main(string[] args)
        {
            var index = 0;

            var m = new Model1();
            var restaurants =
                m.Resturantes.
                Where(x => x.Offline == 0
                && x.autoOffline == 0
                && x.jupiterclosed == 0
                && x.status == 0).ToList();

            var total = restaurants.Count();

            Console.WriteLine(total);

            var rep = new RestaurantRepository();
            restaurants.ForEach(f =>
            {
                rep.Insert(new RestaurantEntity
                {
                    RowKey = f.Restaurantname,
                    Id = Guid.NewGuid().ToString(),
                    PartitionKey = f.Zipcode.Trim().ToUpper(),
                    PostCode2 = f.zipcode2.Trim().ToUpper(),
                    City = f.City,
                    Email = f.Email,
                    Address = f.Address,
                    MobilePhone = f.MobilePhone,
                    InvoiceEmail = f.invoicemail,
                    Description = f.LongDescr,
                    ShortDescription = f.ShortDescr,
                    LogoUrl = "http://d30v2pzvrfyzpo.cloudfront.net/uk/images/restaurants/" + f.ID + ".gif",
                    FakeId = Convert.ToString(f.ID),
                    DeliversTo = f.Xtrazip,
                    ContactName = f.AttName,
                    ContactPhone = f.AttPhone,
                    Latitude = Convert.ToString(f.Latitude),
                    Longitude = Convert.ToString(f.Longitude),
                    LegalName = f.LegalName,
                    FoodType = GetCousine(f.CountryID, f.SecondCountryID),
                    Bank = f.banknavn,
                    SaleFee = f.Transfee.HasValue ? f.Transfee.Value : 0,
                    FakeNumVotes = f.numOfRatings.HasValue ? f.numOfRatings.Value : 0,
                    FakeRating = f.RatingStars.HasValue ? decimal.ToDouble(f.RatingStars.Value) : 0
                });

                Debug.WriteLine("Missing: " + (total - index++));
            });

            //var model2 = new Model2();
            //var zipcodes = model2.Zipcodes.Where(x => x.Deleted == 0).ToList();
            //var total = zipcodes.Count();

            //Console.WriteLine(total);

            //var repository = new PostCodeRepository();
            //index = 0;

            //zipcodes.ForEach(z =>
            //{
            //    repository.Insert(new PostCodeEntity
            //    {
            //        PostCode = z.zipcodename,
            //        Name = z.cityname,
            //        Region = GetRegion(z.RegionID)
            //    });

            //    Debug.WriteLine("Missing: " + (total - index++));
            //});

            //var prospects = new Prospect();
            //var people = prospects.Earnmoneys.ToList();

            //## Create SearchIndex
            //var rep = new RestaurantRepository();
            var repMenu = new SearchRepository();

            rep.GetAll().Where(x => x.FakeNumVotes > 20).Take(100).ToList().ForEach(x => repMenu.InsertRestaurant("NW6", x));

            Console.WriteLine("done!");
            Console.ReadLine();
        }
Exemple #2
0
        public ActionResult About(string id = "nw6")
        {
            var repository = new RestaurantRepository();

            return View(repository.GetByPostCode(id));
        }