Esempio n. 1
0
 public virtual TimeZoneInfo GetCustomerTimeZone(Customer customer)
 {
     TimeZoneInfo timeZoneInfo = null;
     if (_dateTimeSettings.AllowCustomersToSetTimeZone && customer != null)
     {
         // nếu có thì lấy time zone của customer. Thông tin time zone của customer được lưu trong generic attribute
         string timeZoneId = customer.GetAttribute<string>(SystemCustomerAttributeNames.TimeZoneId, _genericAttributeService);
         if(!string.IsNullOrEmpty(timeZoneId))
             try
             {
                 timeZoneInfo = FindTimeZoneById(timeZoneId);
             }catch(Exception ex)
             {
                 Debug.WriteLine(ex.ToString());
             }
     }
     // nếu ko có, lấy time zone của store
     if (timeZoneInfo == null) timeZoneInfo = DefaultStoreTimeZone;
     return timeZoneInfo;
 }