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>
This commit was merged in pull request #1.
This commit is contained in:
@@ -0,0 +1,304 @@
|
||||
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
|
||||
{
|
||||
//=======================================================================
|
||||
// UserSport.
|
||||
//=======================================================================
|
||||
public abstract class SaxUserSport : SaxDisposableHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
// User.
|
||||
UserAccountId,
|
||||
User_EmailAddress,
|
||||
User_DisplayName,
|
||||
User_Title,
|
||||
User_FirstName,
|
||||
User_LastName,
|
||||
// Sport.
|
||||
SportId,
|
||||
Sport_Name,
|
||||
About,
|
||||
SportParticipating,
|
||||
SportParticipating_Code,
|
||||
SportParticipating_Desc,
|
||||
SportPreparing,
|
||||
SportPreparing_Code,
|
||||
SportPreparing_Desc,
|
||||
SportOfficiating,
|
||||
SportOfficiating_Code,
|
||||
SportOfficiating_Desc,
|
||||
// Associated data.
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Desc,
|
||||
Status_Ind,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public SysId UserAccountId { get; set; }
|
||||
public SysId SportId { get; set; }
|
||||
public String About { get; set; } = String.Empty;
|
||||
public String ContactsData { get; set; } = String.Empty;
|
||||
public Sax.SportParticipating Participating { get; set; }
|
||||
public Sax.SportPreparing Preparing { get; set; }
|
||||
public Sax.SportOfficiating Officiating { get; set; }
|
||||
public String UserSportData { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Properties.
|
||||
public SysId UserAccountId
|
||||
{
|
||||
get { return data.UserAccountId; }
|
||||
set { CheckChanged(data.UserAccountId, value); data.UserAccountId = value; }
|
||||
}
|
||||
public SysId SportId
|
||||
{
|
||||
get { return data.SportId; }
|
||||
set { CheckChanged(data.SportId, value); data.SportId = value; }
|
||||
}
|
||||
public String About
|
||||
{
|
||||
get { return data.About; }
|
||||
set { CheckChanged(data.About, value); data.About = value; }
|
||||
}
|
||||
public String ContactsData
|
||||
{
|
||||
get { return data.ContactsData; }
|
||||
set { CheckChanged(data.ContactsData, value); data.ContactsData = value; }
|
||||
}
|
||||
public Sax.SportParticipating Participating
|
||||
{
|
||||
get { return data.Participating; }
|
||||
set { CheckChanged((int)data.Participating, (int)value); data.Participating = value; }
|
||||
}
|
||||
public Sax.SportPreparing Preparing
|
||||
{
|
||||
get { return data.Preparing; }
|
||||
set { CheckChanged((int)data.Preparing, (int)value); data.Preparing = value; }
|
||||
}
|
||||
public Sax.SportOfficiating Officiating
|
||||
{
|
||||
get { return data.Officiating; }
|
||||
set { CheckChanged((int)data.Officiating, (int)value); data.Officiating = value; }
|
||||
}
|
||||
public String UserSportData
|
||||
{
|
||||
get { return data.UserSportData; }
|
||||
set { CheckChanged(data.UserSportData, value); data.UserSportData = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
UserAccountId = data.UserAccountId;
|
||||
SportId = data.SportId;
|
||||
About = data.About;
|
||||
ContactsData = data.ContactsData;
|
||||
Participating = data.Participating;
|
||||
Preparing = data.Preparing;
|
||||
Officiating = data.Officiating;
|
||||
UserSportData = data.UserSportData;
|
||||
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 SportId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue About { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ContactsAbout { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Participating { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Preparing { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Officiating { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UserSportData { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxUserSport(SysId id, SysId userAccountId, SysId sportId) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
UserAccountId = userAccountId;
|
||||
SportId = sportId;
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> validStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Active,
|
||||
SaStatus.Inactive,
|
||||
SaStatus.Deleted,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(validStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
if (status == SaStatus.Active) return DataValue.TriStateType.Green;
|
||||
if (status == SaStatus.Inactive) return DataValue.TriStateType.Red;
|
||||
if (status == SaStatus.Deleted) return DataValue.TriStateType.Purple;
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
public ItemId GetItemId()
|
||||
{
|
||||
return new ItemId((short)Sax.DataItemType.UserSport, Id);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
|
||||
throw new NotSupportedException($"{SysUtil.Fn} User Account Id cannot be changed");
|
||||
if (SysId.IsValid(SportId) && SysId.ToInt(SportId) != SysId.ToInt(data.SportId))
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Sport Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public SysId UserAccountId
|
||||
{
|
||||
get { return data.UserAccountId; }
|
||||
protected set { data.UserAccountId = value; }
|
||||
}
|
||||
public SysId SportId
|
||||
{
|
||||
get { return data.SportId; }
|
||||
protected set { data.SportId = value; }
|
||||
}
|
||||
public String About
|
||||
{
|
||||
get { return data.About; }
|
||||
set { data.About = value; }
|
||||
}
|
||||
public String ContactsData
|
||||
{
|
||||
get { return data.ContactsData; }
|
||||
set { data.ContactsData = value; }
|
||||
}
|
||||
public Sax.SportParticipating Participating
|
||||
{
|
||||
get { return data.Participating; }
|
||||
set { data.Participating = value; }
|
||||
}
|
||||
public Sax.SportPreparing Preparing
|
||||
{
|
||||
get { return data.Preparing; }
|
||||
set { data.Preparing = value; }
|
||||
}
|
||||
public Sax.SportOfficiating Officiating
|
||||
{
|
||||
get { return data.Officiating; }
|
||||
set { data.Officiating = value; }
|
||||
}
|
||||
public String UserSportData
|
||||
{
|
||||
get { return data.UserSportData; }
|
||||
set { data.UserSportData = 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.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
ActiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
/// </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> SportIdsIncluded { get; } = new List<SysId>();
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list extension methods.
|
||||
public static class SaxUserSportList
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Extract Sport Ids.
|
||||
public static List<SysId> GetSportIds(this IEnumerable<SaxUserSport> values)
|
||||
{
|
||||
List<SysId> sportIds = new List<SysId>();
|
||||
foreach (SaxUserSport userSport in values)
|
||||
sportIds.AddId(userSport.SportId);
|
||||
return sportIds;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user