示例#1
0
        public static void RegisterAlertType(AlertTypeEntity alertType)
        {
            if (!alertType.Key.HasText())
            {
                throw new InvalidOperationException("alertType must have a key, use MakeSymbol method after the constructor when declaring it");
            }

            SystemAlertTypes.Add(alertType);
        }
示例#2
0
        public static AlertEntity CreateAlert <T>(this Lite <T> entity, string text, AlertTypeEntity alertType, DateTime?alertDate = null, Lite <IUserEntity> user = null, string title = null) where T : class, IEntity
        {
            if (Started == false)
            {
                return(null);
            }

            var result = new AlertEntity
            {
                AlertDate = alertDate ?? TimeZoneManager.Now,
                CreatedBy = user ?? UserHolder.Current?.ToLite(),
                Text      = text,
                Title     = title,
                Target    = (Lite <Entity>)entity,
                AlertType = alertType
            };

            return(result.Execute(AlertOperation.Save));
        }
示例#3
0
        public static AlertEntity CreateAlertForceNew <T>(this Lite <T> entity, string text, AlertTypeEntity alertType, DateTime?alertDate = null, Lite <IUserEntity> user = null) where T : class, IEntity
        {
            if (Started == false)
            {
                return(null);
            }

            using (Transaction tr = Transaction.ForceNew())
            {
                var alerta = entity.CreateAlert(text, alertType, alertDate, user);

                return(tr.Commit(alerta));
            }
        }
示例#4
0
 public static AlertEntity CreateAlertForceNew(this IEntity entity, string text, AlertTypeEntity alertType, DateTime?alertDate = null, Lite <IUserEntity> user = null)
 {
     return(CreateAlertForceNew(entity.ToLite(), text, alertType, alertDate, user));
 }
示例#5
0
 public static AlertEntity CreateAlert(this IEntity entity, string text, AlertTypeEntity alertType, DateTime?alertDate = null, Lite <IUserEntity> user = null, string title = null)
 {
     return(CreateAlert(entity.ToLiteFat(), text, alertType, alertDate, user, title));
 }