How to receive (Orchard)TimeZoneInfo in an random class?

Topics: Core
Jul 16, 2012 at 1:26 PM
Edited Jul 16, 2012 at 1:26 PM

How to receive (orchard)TimeZoneInfo  in an random class?

In the controller I receive here so:

 

public MyController(IOrchardServices services, IRepository<SettingsRecord> repository,
                                          IScheduleService scheduleService,
                                          IEnumerable<ITimeZoneSelector> timeZoneSelectors,
                                          IWorkContextAccessor workContextAccessor)
        {
            _repository = repository;
            _scheduleService = scheduleService;
            Services = services;
            _timeZoneSelectors = timeZoneSelectors;
            _workContextAccessor = workContextAccessor.GetContext();


            T = NullLocalizer.Instance;
            Logger = NullLogger.Instance;
        }

public ActionResult Index()
        {
            var context = new CurrentTimeZoneWorkContext(_timeZoneSelectors);
            var getTimeZone = context.Get<TimeZoneInfo>("CurrentTimeZone");
            TimeZoneInfo timeZoneInfo = getTimeZone(_workContextAccessor);
...
}

 

How to receive for example:

 

public class MyClass
    {
        

        public Myclass()
        {
        }

      public TimeZoneInfo GetTimeZone()
{
???
}

}