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>
429 lines
13 KiB
C#
429 lines
13 KiB
C#
using NPOI.SS.Formula.Functions;
|
|
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;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Saxonite.Net.Standard.Base.Bus.Reference
|
|
{
|
|
//=======================================================================
|
|
// Golf - USGA Course.
|
|
//=======================================================================
|
|
public abstract class SaxGolfUsgaCourse : SaxDisposableHierarchyItem, IDisposable
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Columns.
|
|
public enum Column
|
|
{
|
|
Pos,
|
|
Id,
|
|
CountryId,
|
|
Country_Name,
|
|
ProvinceId,
|
|
Province_Name,
|
|
FacilityId,
|
|
Facility_Name,
|
|
UsgaCourseId,
|
|
LegacyCrpCourseId,
|
|
Caption,
|
|
CourseName,
|
|
FullName,
|
|
Address1,
|
|
Address2,
|
|
City,
|
|
PostalCode,
|
|
Email,
|
|
Telephone,
|
|
MarkersUpdateOn_Date,
|
|
// Associated data.
|
|
MarkerCount_All,
|
|
MarkerCount_Active,
|
|
// Common.
|
|
Notes,
|
|
Flags,
|
|
Status,
|
|
Status_Desc,
|
|
Status_Ind,
|
|
CreateOn_Date,
|
|
UpdateOn_Date,
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
/// <summary>Properties other than common.</summary>
|
|
public class DataProperties
|
|
{
|
|
public SysId FacilityId { get; set; }
|
|
public SysId UsgaCourseId { get; set; }
|
|
public SysId LegacyCrpCourseId { get; set; }
|
|
public String Caption { get; set; } = String.Empty;
|
|
public String CourseName { get; set; } = String.Empty;
|
|
public String FullName { get; set; } = String.Empty;
|
|
public String Address1 { get; set; } = String.Empty;
|
|
public String Address2 { get; set; } = String.Empty;
|
|
public String City { get; set; } = String.Empty;
|
|
public String PostalCode { get; set; } = String.Empty;
|
|
public Decimal? Latitude { get; set; } = null;
|
|
public Decimal? Longitude { get; set; } = null;
|
|
public String Email { get; set; } = String.Empty;
|
|
public String Telephone { get; set; } = String.Empty;
|
|
public DateTime? MarkersUpdateAt { get; set; } = null;
|
|
public String MarkersData { get; set; } = String.Empty;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Data.
|
|
public new class Data : SacsHierarchyItem.Data
|
|
{
|
|
// Data members.
|
|
private readonly DataProperties data = new DataProperties();
|
|
// Construction.
|
|
public Data()
|
|
{
|
|
Status = DefaultStatus;
|
|
}
|
|
// Properties.
|
|
public SysId FacilityId
|
|
{
|
|
get { return data.FacilityId; }
|
|
set { CheckChanged(data.FacilityId, value); data.FacilityId = value; }
|
|
}
|
|
public SysId UsgaCourseId
|
|
{
|
|
get { return data.UsgaCourseId; }
|
|
set { CheckChanged(data.UsgaCourseId, value); data.UsgaCourseId = value; }
|
|
}
|
|
public SysId LegacyCrpCourseId
|
|
{
|
|
get { return data.LegacyCrpCourseId; }
|
|
set { CheckChanged(data.LegacyCrpCourseId, value); data.LegacyCrpCourseId = value; }
|
|
}
|
|
public String Caption
|
|
{
|
|
get { return data.Caption; }
|
|
set { CheckChanged(data.Caption, value); data.Caption = value; }
|
|
}
|
|
public String CourseName
|
|
{
|
|
get { return data.CourseName; }
|
|
set { CheckChanged(data.CourseName, value); data.CourseName = value; }
|
|
}
|
|
public String FullName
|
|
{
|
|
get { return data.FullName; }
|
|
set { CheckChanged(data.FullName, value); data.FullName = value; }
|
|
}
|
|
public String Address1
|
|
{
|
|
get { return data.Address1; }
|
|
set { CheckChanged(data.Address1, value); data.Address1 = value; }
|
|
}
|
|
public String Address2
|
|
{
|
|
get { return data.Address2; }
|
|
set { CheckChanged(data.Address2, value); data.Address2 = value; }
|
|
}
|
|
public String City
|
|
{
|
|
get { return data.City; }
|
|
set { CheckChanged(data.City, value); data.City = value; }
|
|
}
|
|
public String PostalCode
|
|
{
|
|
get { return data.PostalCode; }
|
|
set { CheckChanged(data.PostalCode, value); data.PostalCode = value; }
|
|
}
|
|
public decimal? Latitude
|
|
{
|
|
get { return data.Latitude; }
|
|
set { CheckChangedNullable(data.Latitude, value); data.Latitude = value; }
|
|
}
|
|
public decimal? Longitude
|
|
{
|
|
get { return data.Longitude; }
|
|
set { CheckChangedNullable(data.Longitude, value); data.Longitude = value; }
|
|
}
|
|
public String Email
|
|
{
|
|
get { return data.Email; }
|
|
set { CheckChanged(data.Email, value); data.Email = value; }
|
|
}
|
|
public String Telephone
|
|
{
|
|
get { return data.Telephone; }
|
|
set { CheckChanged(data.Telephone, value); data.Telephone = value; }
|
|
}
|
|
public DateTime? MarkersUpdateAt
|
|
{
|
|
get { return data.MarkersUpdateAt; }
|
|
set { CheckChangedNullable(data.MarkersUpdateAt, value); data.MarkersUpdateAt = value; }
|
|
}
|
|
public String MarkersData
|
|
{
|
|
get { return data.MarkersData; }
|
|
set { CheckChanged(data.MarkersData, value); data.MarkersData = value; }
|
|
}
|
|
// Population.
|
|
internal void PopulateFrom(Data data)
|
|
{
|
|
FacilityId = data.FacilityId;
|
|
UsgaCourseId = data.UsgaCourseId;
|
|
LegacyCrpCourseId = data.LegacyCrpCourseId;
|
|
Caption = data.Caption;
|
|
CourseName = data.CourseName;
|
|
FullName = data.FullName;
|
|
Address1 = data.Address1;
|
|
Address2 = data.Address2;
|
|
City = data.City;
|
|
PostalCode = data.PostalCode;
|
|
Latitude = data.Latitude;
|
|
Longitude = data.Longitude;
|
|
Email = data.Email;
|
|
Telephone = data.Telephone;
|
|
MarkersUpdateAt = data.MarkersUpdateAt;
|
|
MarkersData = data.MarkersData;
|
|
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 FacilityId { get; set; } = ValidValue.Valid;
|
|
public ValidValue CourseId { get; set; } = ValidValue.Valid;
|
|
public ValidValue LegacyCrpCourseId { get; set; } = ValidValue.Valid;
|
|
public ValidValue Caption { get; set; } = ValidValue.Valid;
|
|
public ValidValue CourseName { get; set; } = ValidValue.Valid;
|
|
public ValidValue FullName { get; set; } = ValidValue.Valid;
|
|
public ValidValue Address1 { get; set; } = ValidValue.Valid;
|
|
public ValidValue Address2 { get; set; } = ValidValue.Valid;
|
|
public ValidValue City { get; set; } = ValidValue.Valid;
|
|
public ValidValue PostalCode { get; set; } = ValidValue.Valid;
|
|
public ValidValue Latitude { get; set; } = ValidValue.Valid;
|
|
public ValidValue Longitude { get; set; } = ValidValue.Valid;
|
|
public ValidValue Email { get; set; } = ValidValue.Valid;
|
|
public ValidValue Telephone { get; set; } = ValidValue.Valid;
|
|
public ValidValue MarkersUpdateAt { get; set; } = ValidValue.Valid;
|
|
public ValidValue MarkersData { get; set; } = ValidValue.Valid;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Data members.
|
|
private readonly Data data = new Data();
|
|
|
|
//-------------------------------------------------------------------
|
|
// Construction.
|
|
protected SaxGolfUsgaCourse(SysId id, SysId facilityId) : base(id)
|
|
{
|
|
base.SetData(data);
|
|
this.FacilityId = facilityId;
|
|
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.Golf_UsgaCourse, Id);
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
public void Dispose() { }
|
|
|
|
//-------------------------------------------------------------------
|
|
// 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");
|
|
this.data.PopulateFrom(data);
|
|
}
|
|
public SysId FacilityId
|
|
{
|
|
get { return data.FacilityId; }
|
|
set { data.FacilityId = value; }
|
|
}
|
|
public SysId UsgaCourseId
|
|
{
|
|
get { return data.UsgaCourseId; }
|
|
set { data.UsgaCourseId = value; }
|
|
}
|
|
public SysId LegacyCrpCourseId
|
|
{
|
|
get { return data.LegacyCrpCourseId; }
|
|
set { data.LegacyCrpCourseId = value; }
|
|
}
|
|
public String Caption
|
|
{
|
|
get { return data.Caption; }
|
|
set { data.Caption = value; }
|
|
}
|
|
public String CourseName
|
|
{
|
|
get { return data.CourseName; }
|
|
set { data.CourseName = value; }
|
|
}
|
|
public String FullName
|
|
{
|
|
get { return data.FullName; }
|
|
set { data.FullName = value; }
|
|
}
|
|
public String Address1
|
|
{
|
|
get { return data.Address1; }
|
|
set { data.Address1 = value; }
|
|
}
|
|
public String Address2
|
|
{
|
|
get { return data.Address2; }
|
|
set { data.Address2 = value; }
|
|
}
|
|
public String City
|
|
{
|
|
get { return data.City; }
|
|
set { data.City = value; }
|
|
}
|
|
public String PostalCode
|
|
{
|
|
get { return data.PostalCode; }
|
|
set { data.PostalCode = value; }
|
|
}
|
|
public decimal? Latitude
|
|
{
|
|
get { return data.Latitude; }
|
|
set { data.Latitude = value; }
|
|
}
|
|
public decimal? Longitude
|
|
{
|
|
get { return data.Longitude; }
|
|
set { data.Longitude = value; }
|
|
}
|
|
public String Email
|
|
{
|
|
get { return data.Email; }
|
|
set { data.Email = value; }
|
|
}
|
|
public String Telephone
|
|
{
|
|
get { return data.Telephone; }
|
|
set { data.Telephone = value; }
|
|
}
|
|
public DateTime? MarkersUpdateAt
|
|
{
|
|
get { return data.MarkersUpdateAt; }
|
|
set { data.MarkersUpdateAt = value; }
|
|
}
|
|
public String MarkersData
|
|
{
|
|
get { return data.MarkersData; }
|
|
set { data.MarkersData = value; }
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Flags - positions 1-16 available.
|
|
public const byte Flag_Priority = 0x01;
|
|
public bool Priority
|
|
{
|
|
get { return GetFlag(Flag_Priority); }
|
|
set { SetFlag(Flag_Priority, value); }
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// 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
|
|
{
|
|
NotDeleted = 0,
|
|
ActiveOnly,
|
|
InactiveOnly,
|
|
Any,
|
|
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> ProvinceIdsIncluded { get; } = new List<SysId>();
|
|
public List<SysId> FacilityIdsIncluded { get; } = new List<SysId>();
|
|
/// <summary>USGA Course Ids.</summary>
|
|
public List<SysId> UsgaCourseIdsIncluded { get; } = new List<SysId>();
|
|
/// <summary>Generic filter - partial name, address etc.</summary>
|
|
public String CourseFilter { get; set; }
|
|
public String CourseNameFull { get; set; }
|
|
public String CourseNamePartial { get; set; }
|
|
public BoolState HasMarkersData { get; set; } = BoolState.Either;
|
|
// Flags.
|
|
public FlagState PriorityFlagState { get; set; } = FlagState.Either;
|
|
// Associated data.
|
|
public BoolState HasMarkers { get; set; } = BoolState.Either;
|
|
// Common properties.
|
|
public String NotesPartial { get; set; }
|
|
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
|
|
// Table aliases - blank if not linked.
|
|
public String Alias_Country { get; set; }
|
|
public String Alias_Province { get; set; }
|
|
public String Alias_Facility { get; set; }
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
// Item list extension methods.
|
|
public static class SaxGolfUsgaCourseList
|
|
{
|
|
//-------------------------------------------------------------------
|
|
public static SaxGolfUsgaCourse GetCourseById(this IEnumerable<SaxGolfUsgaCourse> values, SysId courseId)
|
|
{
|
|
if (!SysId.IsValid(courseId)) return null;
|
|
foreach (SaxGolfUsgaCourse province in values)
|
|
if (province.Id.Equals(courseId)) return province;
|
|
return null;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
|
|
//=======================================================================
|
|
}
|