Files
andy 9f22b522df v1.3.0 Restructure Saxonite workspace and upgrade to .NET 10 (#1)
Move Saxonite’s projects into a dedicated `Workspace` folder and align the solution with .NET 10 and the current Common workspace. Update encryption integration, test project structure and coverage, and repository guidance and upgrade notes.

- Relocate application and library projects while retaining Git rename history.
- Split tests into Admin, Online, and Shared projects; add representative behavioral and serialization tests.
- Update Common integration, application version, and repository documentation.

Application version: 1.3.0

Reviewed-on: #1
Co-authored-by: andy <andy@sarand.com>
2026-10-16 18:24:16 +01:00

67 lines
2.2 KiB
C#

using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using System;
namespace Saxonite.Net.Standard.Base.Bus
{
//=======================================================================
/// <summary>Combines Common error-state behavior with Saxonite disposal behavior.</summary>
public abstract class SaxDisposableStateItem : SacsDisposable
{
public enum ErrorMessage
{
DatabaseNotAvailable,
DatabaseQueryException,
ItemNotSpecified,
ValidItemId,
InvalidItemId,
ItemIdNotSpecified,
ItemTypeNotSpecified,
InvalidItemSpecified,
MultipleItemsFound,
InvalidDate,
InvalidStatus,
}
private SacsErrorState errorState;
public bool OK { get { return !HasErrorState(); } }
public bool HasErrorState() { return errorState != null; }
public SacsErrorState ErrorState { get { return errorState; } }
public String ErrorStateMessage { get { return errorState?.Message ?? String.Empty; } }
public bool SetErrorState(String message)
{
if (StringUtil.IsBlank(message)) return false;
errorState = new SacsErrorState(message);
return false;
}
public void ClearErrorState() { errorState = null; }
protected bool SetErrorState(ErrorMessage errorMessage) { return SetErrorState(GetErrorMessage(errorMessage)); }
private String GetErrorMessage(ErrorMessage errorMessage)
{
return errorMessage switch
{
ErrorMessage.DatabaseNotAvailable => "Database is not available",
ErrorMessage.DatabaseQueryException => "Database query exception",
ErrorMessage.ItemNotSpecified => "Item not specified",
ErrorMessage.ValidItemId => "Item has a valid id",
ErrorMessage.InvalidItemId => "Invalid item id",
ErrorMessage.ItemIdNotSpecified => "Item Id must be specified",
ErrorMessage.ItemTypeNotSpecified => "Item type must be specified",
ErrorMessage.InvalidItemSpecified => "Invalid item specified",
ErrorMessage.MultipleItemsFound => "Multiple items found",
ErrorMessage.InvalidDate => "Invalid date",
ErrorMessage.InvalidStatus => "Invalid status",
_ => errorMessage.ToString(),
};
}
protected override void Dispose(bool disposing)
{
}
}
//=======================================================================
}