BusinessMgr 3.0.2 .Net8
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>Sacs</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -14,12 +14,13 @@ using System.Collections.Specialized;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Web;
|
||||
|
||||
namespace Sacs.Web.Components
|
||||
{
|
||||
//=======================================================================
|
||||
public class SaController : Controller
|
||||
public class SaController : Controller, ISacsStateItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
@@ -246,7 +247,7 @@ namespace Sacs.Web.Components
|
||||
public AjaxResponse_Base SetSessionExpired(String title, String text)
|
||||
{
|
||||
SessionExpired = true;
|
||||
return SetMessage(title, text);
|
||||
return SetPopupMessage(title, text);
|
||||
}
|
||||
public AjaxResponse_Base SetGoHome()
|
||||
{
|
||||
@@ -256,21 +257,53 @@ namespace Sacs.Web.Components
|
||||
public AjaxResponse_Base SetGoHome(String title, String text)
|
||||
{
|
||||
GoHome = true;
|
||||
return SetMessage(title, text);
|
||||
return SetPopupMessage(title, text);
|
||||
}
|
||||
// Message - displays alert popup.
|
||||
|
||||
// Inline message - to display on view.
|
||||
public class InlineMessageData
|
||||
{
|
||||
public String Text { get; init; }
|
||||
public bool? Warning { get { return Level == SaMessageLevel.Warning ? true : null; } }
|
||||
public bool? Error { get { return Level == SaMessageLevel.Error ? true : null; } }
|
||||
[JsonIgnore]
|
||||
public SaMessageLevel Level { get; init; } = SaMessageLevel.Info;
|
||||
}
|
||||
public InlineMessageData InlineMessage { get; private set; }
|
||||
public AjaxResponse_Base SetInfoMessage(String message)
|
||||
{
|
||||
if (!StringUtil.IsBlank(message))
|
||||
InlineMessage = new() { Text = message };
|
||||
if (InlineMessage is not null) throw new NotSupportedException("Inline message already populated");
|
||||
return this;
|
||||
}
|
||||
public AjaxResponse_Base SetWarningMessage(String message)
|
||||
{
|
||||
if (!StringUtil.IsBlank(message))
|
||||
InlineMessage = new() { Text = message, Level = SaMessageLevel.Warning };
|
||||
return this;
|
||||
}
|
||||
public AjaxResponse_Base SetErrorMessage(String message)
|
||||
{
|
||||
if (!StringUtil.IsBlank(message))
|
||||
InlineMessage = new() { Text = message, Level = SaMessageLevel.Error };
|
||||
return this;
|
||||
}
|
||||
|
||||
// Popup Message - displays in modal popup.
|
||||
public class MessageData
|
||||
{
|
||||
public String Title { get; set; }
|
||||
public String Text { get; set; }
|
||||
}
|
||||
public MessageData Message { get; private set; }
|
||||
public AjaxResponse_Base SetMessage(String title, String text)
|
||||
public MessageData PopupMessage { get; private set; }
|
||||
public AjaxResponse_Base SetPopupMessage(String title, String text)
|
||||
{
|
||||
if (!StringUtil.IsBlank(text))
|
||||
Message = new MessageData() { Title = title, Text = text };
|
||||
PopupMessage = new MessageData() { Title = title, Text = text };
|
||||
return this;
|
||||
}
|
||||
|
||||
// Confirmation message - to query user.
|
||||
public class ConfirmMessageData : MessageData
|
||||
{
|
||||
@@ -284,6 +317,20 @@ namespace Sacs.Web.Components
|
||||
return this;
|
||||
}
|
||||
public bool? HasConfirmMessage { get { return ConfirmMessage != null ? true : null; } }
|
||||
|
||||
// Notify message - briefly displays after response received.
|
||||
public class NotifyMessageData
|
||||
{
|
||||
public String Title { get; set; }
|
||||
public String Message { get; set; }
|
||||
}
|
||||
public NotifyMessageData NotifyMessage { get; private set; }
|
||||
public AjaxResponse_Base SetNotifyMessage(String title, String message)
|
||||
{
|
||||
NotifyMessage = new NotifyMessageData() { Title = title, Message = message };
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -295,15 +342,15 @@ namespace Sacs.Web.Components
|
||||
{
|
||||
if (model.ErrorMessages.Any())
|
||||
{
|
||||
SetMessage(StringUtil.OnBlank(messageTitle, model.GetText("label.error", "Error")), model.ErrorMessages.Concat("", "\n"));
|
||||
SetPopupMessage(StringUtil.OnBlank(messageTitle, model.GetText("label.error", "Error")), model.ErrorMessages.Concat("", "\n"));
|
||||
}
|
||||
else if (model.WarningMessages.Any())
|
||||
{
|
||||
SetMessage(StringUtil.OnBlank(messageTitle, model.GetText("label.warning", "Warning")), model.WarningMessages.Concat("", "\n"));
|
||||
SetPopupMessage(StringUtil.OnBlank(messageTitle, model.GetText("label.warning", "Warning")), model.WarningMessages.Concat("", "\n"));
|
||||
}
|
||||
else if (model.InfoMessages.Any())
|
||||
{
|
||||
SetNotification(StringUtil.OnBlank(messageTitle, model.GetText("label.notification", "Notificaton")), model.InfoMessages.Concat("", "\n"));
|
||||
SetNotifyMessage(StringUtil.OnBlank(messageTitle, model.GetText("label.notification", "Notificaton")), model.InfoMessages.Concat("", "\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,20 +538,6 @@ namespace Sacs.Web.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Notification - briefly displays after response received.
|
||||
public class NotificationData
|
||||
{
|
||||
public String Title { get; set; }
|
||||
public String Message { get; set; }
|
||||
}
|
||||
public NotificationData Notification { get; private set; }
|
||||
public AjaxResponse_Data SetNotification(String title, String message)
|
||||
{
|
||||
Notification = new NotificationData() { Title = title, Message = message };
|
||||
return this;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Paged data.
|
||||
public class PagingData
|
||||
|
||||
Reference in New Issue
Block a user