Exemplo n.º 1
0
        public async Task <Lookup> GetLookupListByKeyAsync(string key)
        {
            var lookup = await _dataContext.FirstOrDefaultAsync <Lookup, Lookup>(q => q.Where(l => l.Key == key));

            if (lookup == null)
            {
                lookup = await _systemDataContext.FirstOrDefaultAsync <Lookup, Lookup>(q => q.Where(l => l.Key == key));
            }

            return(lookup);
        }
Exemplo n.º 2
0
        private async Task <ConfigurationSetting> GetConfigurationSettingAsync(string key, string groupId, string culture, string section)
        {
            IGroupDataContext dataContext = _groupDataContextFactory.CreateGroupDataContext(groupId);

            var config = await dataContext.FirstOrDefaultAsync <ConfigurationSetting, ConfigurationSetting>(q =>
                                                                                                            q.Where(c =>
                                                                                                                    (c.Culture == culture || c.Culture == "*") &&
                                                                                                                    (c.Section == section || c.Section == "*") &&
                                                                                                                    c.Key == key)
                                                                                                            .OrderBy(c => c.Priority));

            return(config);
        }
        private async Task <LocalisationText> GetLocalisationTextAsync(string key, string groupId, string culture, string section)
        {
            IGroupDataContext dataContext = _groupDataContextFactory.CreateGroupDataContext(groupId);

            var text = await dataContext.FirstOrDefaultAsync <LocalisationText, LocalisationText>(q =>
                                                                                                  q.Where(c =>
                                                                                                          (c.Culture == culture || c.Culture == "*") &&
                                                                                                          (c.Section == section || c.Section == "*") &&
                                                                                                          c.Key == key)
                                                                                                  .OrderBy(c => c.Priority));

            return(text);
        }
Exemplo n.º 4
0
        private async Task <AlertTemplate> GetTemplateAsync(string key, string groupId, string culture, string channel)
        {
            IGroupDataContext dataContext = _groupDataContextFactory.CreateGroupDataContext(groupId);

            var text = await dataContext.FirstOrDefaultAsync <AlertTemplate, AlertTemplate>(q =>
                                                                                            q.Where(c =>
                                                                                                    (c.Culture == culture || c.Culture == "*") &&
                                                                                                    c.Section == "*" &&
                                                                                                    c.Key == key &&
                                                                                                    c.Channel == channel)
                                                                                            .OrderBy(c => c.Priority));

            return(text);
        }