Beispiel #1
0
        public static string GetUserTimeZone(string userId)
        {
            using (var db = new TransafeRxEntities())
            {
                var timeZone = db.GetUserTimeZone(userId).SingleOrDefault() ?? "UTC";

                return(timeZone);
            }
        }
Beispiel #2
0
        public static TimeZoneAdjustedDateInfo GetTimeZoneAdjustedDateInfo(string userId, Instant instant)
        {
            using (var db = new TransafeRxEntities())
            {
                var timeZone = DateTimeZoneProviders.Tzdb.GetZoneOrNull(db.GetUserTimeZone(userId).SingleOrDefault() ?? "UTC");

                return(new TimeZoneAdjustedDateInfo
                {
                    DateUTC = instant.ToDateTimeUtc(),
                    DateDTO = instant.InZone(timeZone).ToDateTimeOffset(),
                    DateCTZ = timeZone.Id
                });
            }
        }