Exemple #1
0
        public async Task <string> GetTemplate(
            MessageTemplateName name,
            CultureInfo culture,
            MessageTemplateType type,
            int environmentId)
        {
            const string query = @"
SELECT [Id]
      ,[Description]
      ,[Type]
      ,[Locale]
      ,[Name]
      ,[Template]
      ,[EnvironmentId]
  FROM [dom].[Message]
where [Name] = @Name
  and [Type] = @Type
  and [EnvironmentId] = @EnvironmentId
order by [Locale]
";

            using (var con = _connectionProvider.Connection)
            {
                var templates = await con.QueryAsync <MessageTemplate>(query,
                                                                       new
                {
                    Name          = name.ToString(),
                    Type          = type.ToString(),
                    EnvironmentId = environmentId,
                });

                return(culture.GetMatchedTemplate(templates.ToArray()));
            }
        }
        public async Task <string> GetTemplate(
            MessageTemplateName name,
            CultureInfo culture,
            MessageTemplateType type,
            int environmentId)
        {
            const string query = @"
select ""Id"", ""Description"", ""Type"", ""Locale"", ""Name"", ""Template"", ""EnvironmentId""
from dom.""Message""
where ""Name"" = @Name
  and ""Type"" = @Type
  and ""EnvironmentId"" = @EnvironmentId
order by ""Locale""
";

            using (var con = _connectionProvider.Connection)
            {
                var templates = await con.QueryAsync <MessageTemplate>(query,
                                                                       new
                {
                    Name          = name.ToString(),
                    Type          = type.ToString(),
                    EnvironmentId = environmentId,
                });

                return(culture.GetMatchedTemplate(templates.ToArray()));
            }
        }