示例#1
0
        public static void ProcessPricePush()
        {
            N.Note("Price input file has been updated");


            DateTime processStartedAt = DateTime.UtcNow;

            N.Note("Process started at :" + processStartedAt.ToString());

            var pricePushLogger = new OperationsJsonLogger <PricePushResult>(Config.I.PricingPushAttemptsLogFile, processStartedAt);
            var properties      = PricingPushCSVReader.ReadPricingData(pricePushLogger);
            PricingPushNotification pricingPushNotification = new PricingPushNotification();

            if (properties != null)
            {
                pricingPushNotification.SendInitialNotification(processStartedAt);

                if (Config.I.PushPriceToAirBnb)
                {
                    if (!string.IsNullOrEmpty(properties[0].AirbnbId))
                    {
                        N.Note("Starting the price push to AirBnb");

                        pricePushLogger.Log(new PricePushResult(Channel.AirBnb, PricePushLogArea.ProcessStarted, PricingPushLogType.Information, "Pricing push process started at :" + DateTime.UtcNow.ToString()));

                        PricingPushCSVReader.LogPropertiesForAirBnb(properties, pricePushLogger);
                        // Kick start the Airbnb process.
                        PricePush.PushPriceToAirBnb(processStartedAt, pricePushLogger, properties);

                        N.Note("Pricing push to AirBnb is finished");
                        // Read the log files and send the email with respect to Airbnb.

                        N.Note("Send notification email for AirBnb");

                        pricingPushNotification.SendNotification(processStartedAt);
                    }
                }

                if (Config.I.PushPriceToStreamLine)
                {
                    if (!string.IsNullOrEmpty(properties[0].StreamLineHomeId))
                    {
                        N.Note("Starting the price push to Streamline");

                        pricePushLogger.Log(new PricePushResult(Channel.StreamLine, PricePushLogArea.ProcessStarted, PricingPushLogType.Information, "Pricing push process started at :" + DateTime.UtcNow.ToString()));

                        PricingPushCSVReader.LogPropertiesForStreamLine(properties, pricePushLogger);
                        // Kick start the Stream Line process
                        StreamlinePricePush.PushPriceToStreamLine(processStartedAt, pricePushLogger, properties);

                        N.Note("Pricing push to streamline is finished");

                        N.Note("Send notification email for Streamline");

                        pricingPushNotification.SendNotificationToStreamLine(processStartedAt);
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// Main method.
        /// </summary>
        /// <param name="args">Arguments which can be passed into the program.</param>
        public static void Main(string[] args)
        {
            Console.WriteLine("Begin pricing push to AirBnb");

            var pricePushLogger = new OperationsJsonLogger <PricePushResult>(Config.I.PricingPushAttemptsLogFile, DateTime.UtcNow);
            var properties      = PricingPushCSVReader.ReadPricingData(pricePushLogger);

            PricePush.PushPriceToAirBnb(DateTime.UtcNow, pricePushLogger, properties);

            Console.WriteLine("End pricing push to AirBnb");
        }