Ejemplo n.º 1
0
        public static IOrder OffsetOrderTimeFieldsToEasternStandard(IOrder order)
        {
            // convert sendtime to eastern
            // (since postAPI currently uses that instead of UTC like it should)
            order.SendTimeUTC = ConvertToEasternTime(order.SendTimeUTC);

            // likewise convert stop and start time to eastern
            if (order.HasProperty("StopTimeUTC"))
            {
                var prop = order.GetType().GetProperty("StopTimeUTC");
                var offsetTime = ConvertToEasternTime(Convert.ToDateTime(prop.GetValue(order, null)));
                prop.SetValue(order, offsetTime, null);
            }

            if (order.HasProperty("RestartTimeUTC"))
            {
                var prop = order.GetType().GetProperty("RestartTimeUTC");
                var offsetTime = ConvertToEasternTime(Convert.ToDateTime(prop.GetValue(order, null)));
                prop.SetValue(order, offsetTime, null);
            }

            // only on voice for now
            if (order.HasProperty("StopDateTimeUTC"))
            {
                var prop = order.GetType().GetProperty("StopDateTimeUTC");
                var offsetTime = ConvertToEasternTime(Convert.ToDateTime(prop.GetValue(order, null)));
                prop.SetValue(order, offsetTime, null);
            }

            return order;
        }