Пример #1
0
 public DomainNotification(DomainNotificationType type, string property, string valor)
 {
     Tipo           = type;
     Valor          = valor;
     DataOcorrencia = DateTime.Now;
     PropertyName   = property;
 }
 public DomainNotification(
     string key,
     string value,
     DomainNotificationType type = DomainNotificationType.Conflict)
 {
     Key   = key;
     Value = value;
     DomainNotificationType = type;
 }
Пример #3
0
        public void NotificarException(DomainNotificationType notificationType, Exception exception)
        {
            DomainEvent.Raise(new DomainNotification(notificationType, exception.Message));

            if (exception.InnerException != null)
            {
                DomainEvent.Raise(new DomainNotification(notificationType, exception.InnerException.Message));
            }
        }
Пример #4
0
 public DomainNotification(DomainHandlerType handlerType, DomainNotificationType domainNotificationType, string key, string value, Guid?entityPrimaryKey = null)
 {
     DomainNotificationId   = Guid.NewGuid();
     HandlerType            = handlerType;
     DomainNotificationType = domainNotificationType;
     Version          = 1;
     Key              = key;
     Value            = value;
     EntityPrimaryKey = entityPrimaryKey;
 }
Пример #5
0
        private int GetStatusCodeByNotificationType(DomainNotificationType errorType)
        {
            return(errorType switch
            {
                //Conflict
                DomainNotificationType.UserAlreadyExists
                => 409,

                //Unprocessable Entity
                DomainNotificationType.UserInvalid
                => 422,

                //Not Found
                DomainNotificationType.UserNotFound
                => 404,

                (_) => 500,
            });
Пример #6
0
 public DomainNotification(string message, DomainNotificationType type)
 {
     Message = message;
     Type    = type;
 }
Пример #7
0
 public DomainNotification(DomainNotificationType type, string value)
 {
     Type  = type;
     Value = value;
 }
Пример #8
0
 public DomainNotification(string title, string body, DomainNotificationType type)
 {
     Title = title;
     Body  = body;
     Type  = type;
 }
 // 获取当前生命周期内的 DomainNotificationType 通知信息
 public virtual List <DomainNotification> GetSpecifyTypeNotifications(DomainNotificationType domainNotificationType)
 {
     return(_ListNotification.Where(w => w.DomainNotificationType == domainNotificationType).ToList());
 }
 private void Notify(string message, DomainNotificationType type)
 => _notifications.Add(new DomainNotification(type, message));
Пример #11
0
 public static DomainNotification Criar(DomainNotificationType type, string message)
 {
     return(new DomainNotification(type, message));
 }