TimeZoneInfo GetTimeZone( Tenant tenant) { return tenant.TimeZone ?? TimeZoneInfo.Local; }
Tenant ToTenant(Record r) { var tenant = new Tenant(); tenant.Name = r.GetString("name"); tenant.DisplayName = r.GetString("displayName"); var cultureName = r.GetString("culture"); tenant.Culture = cultureName != null ? new CultureInfo(cultureName) : CultureInfo.CurrentCulture; var timeZone = r.GetString("timeZone"); tenant.TimeZone = timeZone != null ? TimeZoneInfo.FindSystemTimeZoneById(timeZone) : TimeZoneInfo.Local; var items = r.GetString("items"); tenant.Items = !string.IsNullOrEmpty(items) ? Json.Deserialize<Map>(items) : new Map(); return tenant; }
CultureInfo GetCulture(string cultureName, Tenant tenant) { if(cultureName != null) { return new CultureInfo(cultureName); } return tenant.Culture ?? CultureInfo.CurrentCulture; }
public Tenant LoadTenant(string name) { if(foo == null) { foo = new Tenant() { Culture = new System.Globalization.CultureInfo("es-ES"), TimeZone = TimeZoneInfo.Local }; } return foo; }