/// <summary> /// Load latest site configuration record from the database. /// </summary> /// <returns>false if no record found, true indicates the latest record is available in Settings.CurrSiteConfig</returns> public static async Task <bool> LoadCurrSiteConfig() { try { Settings.CurrSiteConfig = await GetCurrConfig(); if (Settings.CurrSiteConfig != null) { if (Settings.CurrSiteConfig.InviteTemplateId != null) { Settings.CurrSiteConfig.InviteTemplateContent = await InviteTemplate.GetTemplate(Settings.CurrSiteConfig.InviteTemplateId); } } Settings.SiteConfigReady = (Settings.CurrSiteConfig != null); return(Settings.SiteConfigReady); } catch (Exception ex) { Logging.WriteToAppLog("Problem loading site config", System.Diagnostics.EventLogEntryType.Error, ex); Settings.SiteConfigReady = false; return(Settings.SiteConfigReady); } }
/// <summary> /// Load latest site configuration record from the database. /// </summary> /// <returns>false if no record found, true indicates the latest record is available in Settings.CurrSiteConfig</returns> public static bool LoadCurrSiteConfig() { try { CurrSiteConfig = DocDBRepo.DB <SiteConfig> .GetItemsAsync(c => c.DocType == DocTypes.SiteConfig).Result.LastOrDefault(); if (CurrSiteConfig != null) { if (CurrSiteConfig.InviteTemplateId != null) { CurrSiteConfig.InviteTemplateContent = InviteTemplate.GetTemplate(CurrSiteConfig.InviteTemplateId).GetAwaiter().GetResult(); } } SiteConfigReady = (CurrSiteConfig != null); return(SiteConfigReady); } catch (Exception ex) { Logging.WriteToAppLog("Problem loading site config", System.Diagnostics.EventLogEntryType.Error, ex); SiteConfigReady = false; return(SiteConfigReady); } }