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>
175 lines
5.3 KiB
C#
175 lines
5.3 KiB
C#
using Sarand.Net.Standard.Base.Bus;
|
|
using Sarand.Net.Standard.Base.Core;
|
|
using Sarand.Net.Standard.Base.Utils;
|
|
using Saxonite.Net.Standard.Base.App;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Saxonite.Net.Standard.Base.Bus
|
|
{
|
|
//=======================================================================
|
|
// User Session.
|
|
//=======================================================================
|
|
/// <summary>
|
|
/// User Session - persistent properties from the user's session.
|
|
/// </summary>
|
|
public abstract class SaxUserSession : SaxDisposableHierarchyItem
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Columns.
|
|
public enum Column
|
|
{
|
|
Pos,
|
|
Id,
|
|
// User.
|
|
UserAccountId,
|
|
User_EmailAddress,
|
|
User_DisplayName,
|
|
User_Title,
|
|
User_FirstName,
|
|
User_LastName,
|
|
// Session data.
|
|
// Associated data.
|
|
// Common.
|
|
Flags,
|
|
CreateOn_Date,
|
|
UpdateOn_Date,
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
/// <summary>Properties other than common.</summary>
|
|
public class DataProperties
|
|
{
|
|
public SysId UserAccountId { get; set; }
|
|
public List<SysId> ActivityIndexIds { get; } = new List<SysId>();
|
|
public String UserSessionData { get; set; }
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Data.
|
|
public new class Data : SacsHierarchyItem.Data
|
|
{
|
|
// Data members.
|
|
private readonly DataProperties data = new DataProperties();
|
|
// Construction.
|
|
public Data()
|
|
{
|
|
}
|
|
// Properties.
|
|
public SysId UserAccountId
|
|
{
|
|
get { return data.UserAccountId; }
|
|
set { CheckChanged(data.UserAccountId, value); data.UserAccountId = value; }
|
|
}
|
|
public List<SysId> ActivityIndexIds
|
|
{
|
|
get { return data.ActivityIndexIds.ToList(); }
|
|
set { CheckChanged(data.ActivityIndexIds, value); data.ActivityIndexIds.Clear(); data.ActivityIndexIds.AddRange(value); }
|
|
}
|
|
public String UserSessionData
|
|
{
|
|
get { return data.UserSessionData; }
|
|
set { CheckChanged(data.UserSessionData, value); data.UserSessionData = value; }
|
|
}
|
|
// Population.
|
|
internal void PopulateFrom(Data data)
|
|
{
|
|
UserAccountId = data.UserAccountId;
|
|
ActivityIndexIds = data.ActivityIndexIds;
|
|
UserSessionData = data.UserSessionData;
|
|
base.PopulateFrom(data);
|
|
}
|
|
public Data Clone()
|
|
{
|
|
Data data = new Data();
|
|
data.PopulateFrom(this);
|
|
return data;
|
|
}
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Error field - identify properties with validation error.
|
|
public new class ErrField : SacsHierarchyItem.ErrField
|
|
{
|
|
// Identifies the field that has invalid data.
|
|
public ValidValue UserAccountId { get; set; } = ValidValue.Valid;
|
|
public ValidValue ActivityIndexIds { get; set; } = ValidValue.Valid;
|
|
public ValidValue UserSessionData { get; set; } = ValidValue.Valid;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
private readonly Data data = new Data();
|
|
|
|
//-------------------------------------------------------------------
|
|
// Construction.
|
|
protected SaxUserSession(SysId userAccountId) : base()
|
|
{
|
|
base.SetData(data);
|
|
UserAccountId = userAccountId;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Utilities.
|
|
public override bool ItemHasId() { return false; }
|
|
|
|
//-------------------------------------------------------------------
|
|
// Properties.
|
|
public static String ActivityIndexDelim { get; } = ",";
|
|
public Data GetData() { return data.Clone(); }
|
|
public void SetData(Data data)
|
|
{
|
|
// Properties that cannot be changed if previously specified.
|
|
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
|
|
throw new NotSupportedException($"{SysUtil.Fn} User Account Id cannot be changed");
|
|
this.data.PopulateFrom(data);
|
|
}
|
|
public SysId UserAccountId
|
|
{
|
|
get { return data.UserAccountId; }
|
|
protected set { data.UserAccountId = value; }
|
|
}
|
|
public List<SysId> ActivityIndexIds
|
|
{
|
|
get { return data.ActivityIndexIds; }
|
|
set { data.ActivityIndexIds = value; }
|
|
}
|
|
public String UserSessionData
|
|
{
|
|
get { return data.UserSessionData; }
|
|
set { data.UserSessionData = value; }
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Flags - positions 1-16 available.
|
|
|
|
//-------------------------------------------------------------------
|
|
// A s s o c i a t e d D a t a
|
|
//-------------------------------------------------------------------
|
|
|
|
//-------------------------------------------------------------------
|
|
// P a r a m s
|
|
//-------------------------------------------------------------------
|
|
// List parameters.
|
|
/// <summary>
|
|
/// Item list parameters.
|
|
/// </summary>
|
|
public new class Params : SacsHierarchyItem.Params
|
|
{
|
|
// List filtering.
|
|
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
// Item list extension methods.
|
|
public static class SaxUserSessionList
|
|
{
|
|
}
|
|
|
|
//=======================================================================
|
|
}
|