public static void CreateAirbnbNY022(PriceMap Map, AirBnbRoomMap AirbnbRooms)
        {
            if (!Map.Data.ContainsKey("NY022"))
            {
                return;
            }

            var list = Map.Data["NY022"];
            var unit = PropertyMap.GetBySenstayID("NY022");

            if (unit == null)
            {
                return;
            }

            var result = new AirbnbUnitDailyPriceList();

            foreach (var item in list)
            {
                result.Add(new AirbnbUnitDailyPrice
                {
                    Month         = item.Month,
                    Day           = item.Day,
                    Year          = 2016,
                    Price         = item.Price,
                    RoomID        = unit.AirbnbID,
                    UnitSenStayID = "NY022"
                });
            }
            result.Save();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Config.I.UseProxy = true;

            AirBnbAccounts.Load();

            var map = AirBnbRoomMap.Load();

            foreach (var airAccount in AirBnbAccounts.Accounts)
            {
                if (map.GetAccount(airAccount.Email) != null)
                {
                    N.Note(airAccount.Email + " skiped");
                    continue;
                }

                for (var proxyNum = 0; proxyNum < 1; proxyNum++)
                {
                    var email = airAccount.Email;
                    N.Note("Processing account " + email + " with proxy " + airAccount.ProxyAddress[proxyNum]);
                    var profile = SeleniumProxy.GetFirefoxProfileWithProxy(airAccount.ProxyAddress, proxyNum);
                    var driver  = SeleniumFactory.GetFirefoxDriver(profile);
                    try
                    {
                        var signInSucceed = AirBnbLogin.Process(driver, airAccount);
                        if (signInSucceed.Status == AirBnbLoginStatus.Failed)
                        {
                            N.Note("Password for " + email + " is wrong or account unreachable");
                            try
                            {
                                driver.Quit();
                            }
                            catch
                            {
                            }
                            break;
                        }
                        var item = AirBnbScrapeRooms.GetRoomList(driver, airAccount);
                        map.List.Add(item);

                        driver.Quit();
                    }
                    catch (Exception e)
                    {
                        N.Note("Error " + airAccount.Email + " : " + e + "".Substring(0, 100) + "...");
                        driver.Quit();
                    }
                }
            }
            map.Save();
        }
        public static void ParseFolder(string Path)
        {
            var seasons = StreamlineSeasonGroup.Load();
            var streamlineCollection = StreamlinePropertyCollection.Load();
            var units = streamlineCollection.CreateIndex();
            var map   = new PriceMap();
            var files = Temp.GetFileList(@"*.csv", Path);

            foreach (var file in files)
            {
                ProcessSourceFile(file, units, seasons, map);
            }

            CreatePriceScripts(map, units, seasons);


            var airbnbRooms = AirBnbRoomMap.Load();

            PropertyMap.SetMap(airbnbRooms, streamlineCollection);
            CreateAirbnbNY022(map, airbnbRooms);
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Pricing sync for AirBnb");
            Config.I.UseProxy = true;

            AirBnbAccounts.Load();
            var roomsMap             = AirBnbRoomMap.Load();
            var streamlineCollection = StreamlinePropertyCollection.Load();

            PropertyMap.SetMap(roomsMap, streamlineCollection);

            var property = PropertyMap.GetBySenstayID("LA029");
            var proxyNum = 0;

            var airAccount = AirBnbAccounts.GetAccountByEmail(property.AirbnbAccountEmail);

            var email = airAccount.Email;

            N.Note("Processing account " + email + " with proxy " + airAccount.ProxyAddress[proxyNum]);
            var profile = SeleniumProxy.GetFirefoxProfileWithProxy(airAccount.ProxyAddress, proxyNum);

            using (var driver = SeleniumFactory.GetFirefoxDriver(profile))
            {
                var signInSucceed = AirBnbLogin.Process(driver, airAccount);
                if (signInSucceed.Status != AirBnbLoginStatus.Sucess)
                {
                    N.Note("Password for " + email + " is wrong or account unreachable");
                    try
                    {
                        driver.Quit();
                    }
                    catch
                    {
                        // ignored
                    }
                }
                AirBnbCalendar.SetPricesForUnit(driver, property, AirbnbUnitDailyPriceList.Load());
            }
        }