Пример #1
0
        internal Guid InsertNotificationTemplate(Guid notificationId, NotificationTemplateDefinition notification)
        {
            var id = notification.Id.IsSet
                ? notification.Id.Value
                : Guid.NewGuid();
            var sql = @"INSERT INTO Core_NotificationTemplates
           (Id
           ,Name
           ,NotificationId
           ,IsEnabled)
     VALUES
           (@Id
           ,@Name
           ,@NotificationId
           ,@IsEnabled)";

            ExecuteNonQuery(sql, command => {
                command.AddParameter("@Id", id);
                command.AddParameter("@Name", notification.Name.Value);
                command.AddParameter("@NotificationId", notificationId);
                command.AddParameter("@IsEnabled", notification.IsEnabled.Value);
            });

            return(id);
        }
        public TNext AddSmsTemplate(Guid id, string name, string body)
        {
            var template = new NotificationTemplateDefinition();

            template.Id.Set(id);
            template.Name.Set(name);
            template.Body.Set(body);

            template.IsEnabled.Set(true);
            template.SendType.Set(Domain.Enums.RefListNotificationType.SMS);
            template.BodyFormat.Set(Domain.Enums.RefListNotificationTemplateType.PlainText);

            _context.Expressions.Add(new AddNotificationTemplateExpression
            {
                Template  = template,
                Namespace = Expression.Namespace,
                Name      = Expression.Name
            });

            return(this as TNext);
        }