51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
using System;
|
|
using System.Text.RegularExpressions;
|
|
using System.Text;
|
|
using System.Collections.Generic;
|
|
using Radzen;
|
|
|
|
public static class NotificationHelper
|
|
{
|
|
// Special character replacement map
|
|
public static NotificationMessage CreateNotificationMessage(string messageText, int severity, string summary, string detail, int duration = 4000, bool showProgress = true, Action<Radzen.NotificationMessage> callBack = null)
|
|
{
|
|
NotificationSeverity messageSeverity;
|
|
switch (severity)
|
|
{
|
|
case 0:
|
|
messageSeverity = NotificationSeverity.Error;
|
|
break;
|
|
case 1:
|
|
messageSeverity = NotificationSeverity.Info;
|
|
break;
|
|
case 2:
|
|
messageSeverity = NotificationSeverity.Success;
|
|
break;
|
|
case 3:
|
|
messageSeverity = NotificationSeverity.Warning;
|
|
break;
|
|
default:
|
|
messageSeverity = NotificationSeverity.Info;
|
|
break;
|
|
}
|
|
|
|
var message = new NotificationMessage
|
|
{
|
|
//error 0, info 1, success 2, warning 3
|
|
|
|
Severity = messageSeverity,
|
|
Summary = summary,
|
|
Detail = detail,
|
|
Duration = duration,
|
|
ShowProgress = showProgress,
|
|
Click = callBack,
|
|
CloseOnClick = true,
|
|
Payload = DateTime.Now
|
|
};
|
|
|
|
return message;
|
|
}
|
|
|
|
|
|
}
|