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); }
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)); }
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)); } }
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)); }
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)); }