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,256 @@
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
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;
|
||||
using static Sarand.Net.Standard.Base.Bus.SacsHierarchyItem;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Bus.Reference
|
||||
{
|
||||
//=======================================================================
|
||||
// Golf - USGA Country.
|
||||
//=======================================================================
|
||||
public abstract class SaxGolfUsgaCountry : SaxDisposableHierarchyItem, IDisposable
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
CountryCode,
|
||||
EntCountryCode,
|
||||
CountryName,
|
||||
ProvincesUpdateAt_Date,
|
||||
// Associated data.
|
||||
ProvinceCount_All,
|
||||
ProvinceCount_Active,
|
||||
FacilityCount_All,
|
||||
FacilityCount_Active,
|
||||
/// <summary>Facility population %.</summary>
|
||||
FacilityPercent,
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Desc,
|
||||
Status_Ind,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public String CountryCode { get; set; } = String.Empty;
|
||||
public String EntCountryCode { get; set; } = String.Empty;
|
||||
public String CountryName { get; set; } = String.Empty;
|
||||
public DateTime? ProvincesUpdateAt { get; set; } = null;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Properties.
|
||||
public String CountryCode
|
||||
{
|
||||
get { return data.CountryCode; }
|
||||
set { CheckChanged(data.CountryCode, value); data.CountryCode = value; }
|
||||
}
|
||||
public String EntCountryCode
|
||||
{
|
||||
get { return data.EntCountryCode; }
|
||||
set { CheckChanged(data.EntCountryCode, value); data.EntCountryCode = value; }
|
||||
}
|
||||
public String CountryName
|
||||
{
|
||||
get { return data.CountryName; }
|
||||
set { CheckChanged(data.CountryName, value); data.CountryName = value; }
|
||||
}
|
||||
public DateTime? ProvincesUpdateAt
|
||||
{
|
||||
get { return data.ProvincesUpdateAt; }
|
||||
set { CheckChangedNullable(data.ProvincesUpdateAt, value); data.ProvincesUpdateAt = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
CountryCode = data.CountryCode;
|
||||
EntCountryCode = data.EntCountryCode;
|
||||
CountryName = data.CountryName;
|
||||
ProvincesUpdateAt = data.ProvincesUpdateAt;
|
||||
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 CountryCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue EntCountryCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue CountryName { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ProvincesUpdateAt { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxGolfUsgaCountry(SysId id) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
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_UsgaCountry, 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 String CountryCode
|
||||
{
|
||||
get { return data.CountryCode; }
|
||||
set { data.CountryCode = value; }
|
||||
}
|
||||
public String EntCountryCode
|
||||
{
|
||||
get { return data.EntCountryCode; }
|
||||
set { data.EntCountryCode = value; }
|
||||
}
|
||||
public String CountryName
|
||||
{
|
||||
get { return data.CountryName; }
|
||||
set { data.CountryName = value; }
|
||||
}
|
||||
public DateTime? ProvincesUpdateAt
|
||||
{
|
||||
get { return data.ProvincesUpdateAt; }
|
||||
set { data.ProvincesUpdateAt = 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>();
|
||||
/// <summary>Generic filter - partial country code or name.</summary>
|
||||
public String CountryFilter { get; set; }
|
||||
/// <summary>Restrict the results by code.</summary>
|
||||
public HashSet<String> CountryCodesIncluded { get; } = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
|
||||
public String CountryNameFull { get; set; }
|
||||
public String CountryNamePartial { get; set; }
|
||||
// Flags.
|
||||
public FlagState PriorityFlagState { get; set; } = FlagState.Either;
|
||||
// Associated data.
|
||||
public BoolState HasProvinces { get; set; } = BoolState.Either;
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list extension methods.
|
||||
public static class SaxGolfUsgaCountryList
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
public static SaxGolfUsgaCountry GetCountryById(this IEnumerable<SaxGolfUsgaCountry> values, SysId countryId)
|
||||
{
|
||||
if (!SysId.IsValid(countryId)) return null;
|
||||
foreach (SaxGolfUsgaCountry country in values)
|
||||
if (country.Id.Equals(countryId)) return country;
|
||||
return null;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,428 @@
|
||||
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;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,344 @@
|
||||
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 Facility.
|
||||
//=======================================================================
|
||||
public abstract class SaxGolfUsgaFacility : SaxDisposableHierarchyItem, IDisposable
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
CountryId,
|
||||
Country_Name,
|
||||
ProvinceId,
|
||||
Province_Name,
|
||||
UsgaFacilityId,
|
||||
FacilityName,
|
||||
Address1,
|
||||
Address2,
|
||||
City,
|
||||
PostalCode,
|
||||
Email,
|
||||
Telephone,
|
||||
// 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 ProvinceId { get; set; }
|
||||
public SysId UsgaFacilityId { get; set; }
|
||||
public String FacilityName { 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;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Properties.
|
||||
public SysId ProvinceId
|
||||
{
|
||||
get { return data.ProvinceId; }
|
||||
set { CheckChanged(data.ProvinceId, value); data.ProvinceId = value; }
|
||||
}
|
||||
public SysId UsgaFacilityId
|
||||
{
|
||||
get { return data.UsgaFacilityId; }
|
||||
set { CheckChanged(data.UsgaFacilityId, value); data.UsgaFacilityId = value; }
|
||||
}
|
||||
public String FacilityName
|
||||
{
|
||||
get { return data.FacilityName; }
|
||||
set { CheckChanged(data.FacilityName, value); data.FacilityName = 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; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
ProvinceId = data.ProvinceId;
|
||||
UsgaFacilityId = data.UsgaFacilityId;
|
||||
FacilityName = data.FacilityName;
|
||||
Address1 = data.Address1;
|
||||
Address2 = data.Address2;
|
||||
City = data.City;
|
||||
PostalCode = data.PostalCode;
|
||||
Latitude = data.Latitude;
|
||||
Longitude = data.Longitude;
|
||||
Email = data.Email;
|
||||
Telephone = data.Telephone;
|
||||
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 ProvinceId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UsgaFacilityId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue FacilityName { 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;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxGolfUsgaFacility(SysId id, SysId provinceId) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
this.ProvinceId = provinceId;
|
||||
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_UsgaFacility, 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 ProvinceId
|
||||
{
|
||||
get { return data.ProvinceId; }
|
||||
set { data.ProvinceId = value; }
|
||||
}
|
||||
public SysId UsgaFacilityId
|
||||
{
|
||||
get { return data.UsgaFacilityId; }
|
||||
set { data.UsgaFacilityId = value; }
|
||||
}
|
||||
public String FacilityName
|
||||
{
|
||||
get { return data.FacilityName; }
|
||||
set { data.FacilityName = 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; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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
|
||||
{
|
||||
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>();
|
||||
/// <summary>USGA Facility Ids.</summary>
|
||||
public List<SysId> UsgaFacilityIdsIncluded { get; } = new List<SysId>();
|
||||
/// <summary>Generic filter - partial province code or name.</summary>
|
||||
public String FacilityFilter { get; set; }
|
||||
public String FacilityNameFull { get; set; }
|
||||
public String FacilityNamePartial { get; set; }
|
||||
// Associated data.
|
||||
public BoolState HasCourses { 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; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list extension methods.
|
||||
public static class SaxGolfUsgaFacilityList
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
public static SaxGolfUsgaFacility GetFacilityById(this IEnumerable<SaxGolfUsgaFacility> values, SysId facilityId)
|
||||
{
|
||||
if (!SysId.IsValid(facilityId)) return null;
|
||||
foreach (SaxGolfUsgaFacility province in values)
|
||||
if (province.Id.Equals(facilityId)) return province;
|
||||
return null;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,363 @@
|
||||
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 Marker.
|
||||
//=======================================================================
|
||||
public abstract class SaxGolfUsgaMarker : SaxDisposableHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
CountryId,
|
||||
Country_Name,
|
||||
ProvinceId,
|
||||
Province_Name,
|
||||
FacilityId,
|
||||
Facility_Name,
|
||||
CourseId,
|
||||
UsgaCourseId,
|
||||
Course_Name,
|
||||
UsgaMarkerId,
|
||||
Caption,
|
||||
Holes,
|
||||
HolesCaption,
|
||||
Tee,
|
||||
Gender,
|
||||
SlopeRating,
|
||||
Par,
|
||||
CourseRating,
|
||||
BogeyRating,
|
||||
Length,
|
||||
// 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 CourseId { get; set; }
|
||||
public SysId UsgaMarkerId { get; set; }
|
||||
public String Caption { get; set; } = "";
|
||||
public short Holes { get; set; }
|
||||
public String HolesCaption { get; set; } = "";
|
||||
public String Tee { get; set; } = "";
|
||||
public String Gender { get; set; } = "";
|
||||
public short SlopeRating { get; set; }
|
||||
public short Par { get; set; }
|
||||
public decimal CourseRating { get; set; }
|
||||
public decimal BogeyRating { get; set; }
|
||||
public short Length { 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 CourseId
|
||||
{
|
||||
get { return data.CourseId; }
|
||||
set { CheckChanged(data.CourseId, value); data.CourseId = value; }
|
||||
}
|
||||
public SysId UsgaMarkerId
|
||||
{
|
||||
get { return data.UsgaMarkerId; }
|
||||
set { CheckChanged(data.UsgaMarkerId, value); data.UsgaMarkerId = value; }
|
||||
}
|
||||
public String Caption
|
||||
{
|
||||
get { return data.Caption; }
|
||||
set { CheckChanged(data.Caption, value); data.Caption = value; }
|
||||
}
|
||||
public short Holes
|
||||
{
|
||||
get { return data.Holes; }
|
||||
set { CheckChanged(data.Holes, value); data.Holes = value; }
|
||||
}
|
||||
public String HolesCaption
|
||||
{
|
||||
get { return data.HolesCaption; }
|
||||
set { CheckChanged(data.HolesCaption, value); data.HolesCaption = value; }
|
||||
}
|
||||
public String Tee
|
||||
{
|
||||
get { return data.Tee; }
|
||||
set { CheckChanged(data.Tee, value); data.Tee = value; }
|
||||
}
|
||||
public String Gender
|
||||
{
|
||||
get { return data.Gender; }
|
||||
set { CheckChanged(data.Gender, value); data.Gender = value; }
|
||||
}
|
||||
public short SlopeRating
|
||||
{
|
||||
get { return data.SlopeRating; }
|
||||
set { CheckChanged(data.SlopeRating, value); data.SlopeRating = value; }
|
||||
}
|
||||
public short Par
|
||||
{
|
||||
get { return data.Par; }
|
||||
set { CheckChanged(data.Par, value); data.Par = value; }
|
||||
}
|
||||
public decimal CourseRating
|
||||
{
|
||||
get { return data.CourseRating; }
|
||||
set { CheckChanged(data.CourseRating, value); data.CourseRating = value; }
|
||||
}
|
||||
public decimal BogeyRating
|
||||
{
|
||||
get { return data.BogeyRating; }
|
||||
set { CheckChanged(data.BogeyRating, value); data.BogeyRating = value; }
|
||||
}
|
||||
public short Length
|
||||
{
|
||||
get { return data.Length; }
|
||||
set { CheckChanged(data.Length, value); data.Length = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
CourseId = data.CourseId;
|
||||
UsgaMarkerId = data.UsgaMarkerId;
|
||||
Caption = data.Caption;
|
||||
Holes = data.Holes;
|
||||
HolesCaption = data.HolesCaption;
|
||||
Tee = data.Tee;
|
||||
Gender = data.Gender;
|
||||
SlopeRating = data.SlopeRating;
|
||||
Par = data.Par;
|
||||
CourseRating = data.CourseRating;
|
||||
BogeyRating = data.BogeyRating;
|
||||
Length = data.Length;
|
||||
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 CourseId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UsgaMarkerId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Caption { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Holes { get; set; } = ValidValue.Valid;
|
||||
public ValidValue HolesCaption { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Tee { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Gender { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SlopeRating { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Par { get; set; } = ValidValue.Valid;
|
||||
public ValidValue CourseRating { get; set; } = ValidValue.Valid;
|
||||
public ValidValue BogeyRating { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Length { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxGolfUsgaMarker(SysId id, SysId facilityId) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
this.CourseId = 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_UsgaMarker, 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");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public SysId CourseId
|
||||
{
|
||||
get { return data.CourseId; }
|
||||
set { data.CourseId = value; }
|
||||
}
|
||||
public SysId UsgaMarkerId
|
||||
{
|
||||
get { return data.UsgaMarkerId; }
|
||||
set { data.UsgaMarkerId = value; }
|
||||
}
|
||||
public String Caption
|
||||
{
|
||||
get { return data.Caption; }
|
||||
set { data.Caption = value; }
|
||||
}
|
||||
public short Holes
|
||||
{
|
||||
get { return data.Holes; }
|
||||
set { data.Holes = value; }
|
||||
}
|
||||
public String HolesCaption
|
||||
{
|
||||
get { return data.HolesCaption; }
|
||||
set { data.HolesCaption = value; }
|
||||
}
|
||||
public String Tee
|
||||
{
|
||||
get { return data.Tee; }
|
||||
set { data.Tee = value; }
|
||||
}
|
||||
public String Gender
|
||||
{
|
||||
get { return data.Gender; }
|
||||
set { data.Gender = value; }
|
||||
}
|
||||
public short SlopeRating
|
||||
{
|
||||
get { return data.SlopeRating; }
|
||||
set { data.SlopeRating = value; }
|
||||
}
|
||||
public short Par
|
||||
{
|
||||
get { return data.Par; }
|
||||
set { data.Par = value; }
|
||||
}
|
||||
public decimal CourseRating
|
||||
{
|
||||
get { return data.CourseRating; }
|
||||
set { data.CourseRating = value; }
|
||||
}
|
||||
public decimal BogeyRating
|
||||
{
|
||||
get { return data.BogeyRating; }
|
||||
set { data.BogeyRating = value; }
|
||||
}
|
||||
public short Length
|
||||
{
|
||||
get { return data.Length; }
|
||||
set { data.Length = 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
|
||||
{
|
||||
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> CourseIdsIncluded { get; } = new List<SysId>();
|
||||
/// <summary>USGA Marker Ids.</summary>
|
||||
public List<SysId> UsgaMarkerIdsIncluded { get; } = new List<SysId>();
|
||||
/// <summary>Generic filter - partial caption, holes, tee, gender etc.</summary>
|
||||
public String MarkerFilter { get; set; }
|
||||
// Marker proprerties.
|
||||
public short Holes { get; set; }
|
||||
public String Gender { get; set; }
|
||||
// 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; }
|
||||
public String Alias_Course{ get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list extension methods.
|
||||
public static class SaxGolfUsgaMarkerList
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
public static SaxGolfUsgaMarker GetMarkerById(this IEnumerable<SaxGolfUsgaMarker> values, SysId markerId)
|
||||
{
|
||||
if (!SysId.IsValid(markerId)) return null;
|
||||
foreach (SaxGolfUsgaMarker province in values)
|
||||
if (province.Id.Equals(markerId)) return province;
|
||||
return null;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
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 Province.
|
||||
//=======================================================================
|
||||
public abstract class SaxGolfUsgaProvince : SaxDisposableHierarchyItem, IDisposable
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
CountryId,
|
||||
Country_Name,
|
||||
ProvinceCode,
|
||||
EntProvinceCode,
|
||||
ProvinceName,
|
||||
CoursesUpdateAt_Date,
|
||||
// Associated data.
|
||||
FacilityCount_All,
|
||||
FacilityCount_Active,
|
||||
CourseCount_All,
|
||||
CourseCount_Active,
|
||||
/// <summary>Marker population %.</summary>
|
||||
MarkerPercent,
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Desc,
|
||||
Status_Ind,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public SysId CountryId { get; set; }
|
||||
public String ProvinceCode { get; set; } = String.Empty;
|
||||
public String EntProvinceCode { get; set; } = String.Empty;
|
||||
public String ProvinceName { get; set; } = String.Empty;
|
||||
public DateTime? CoursesUpdateAt { get; set; } = null;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Properties.
|
||||
public SysId CountryId
|
||||
{
|
||||
get { return data.CountryId; }
|
||||
set { CheckChanged(data.CountryId, value); data.CountryId = value; }
|
||||
}
|
||||
public String ProvinceCode
|
||||
{
|
||||
get { return data.ProvinceCode; }
|
||||
set { CheckChanged(data.ProvinceCode, value); data.ProvinceCode = value; }
|
||||
}
|
||||
public String EntProvinceCode
|
||||
{
|
||||
get { return data.EntProvinceCode; }
|
||||
set { CheckChanged(data.EntProvinceCode, value); data.EntProvinceCode = value; }
|
||||
}
|
||||
public String ProvinceName
|
||||
{
|
||||
get { return data.ProvinceName; }
|
||||
set { CheckChanged(data.ProvinceName, value); data.ProvinceName = value; }
|
||||
}
|
||||
public DateTime? CoursesUpdateAt
|
||||
{
|
||||
get { return data.CoursesUpdateAt; }
|
||||
set { CheckChangedNullable(data.CoursesUpdateAt, value); data.CoursesUpdateAt = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
CountryId = data.CountryId;
|
||||
ProvinceCode = data.ProvinceCode;
|
||||
EntProvinceCode = data.EntProvinceCode;
|
||||
ProvinceName = data.ProvinceName;
|
||||
CoursesUpdateAt = data.CoursesUpdateAt;
|
||||
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 CountryId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ProvinceCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue EntProvinceCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ProvinceName { get; set; } = ValidValue.Valid;
|
||||
public ValidValue CoursesUpdateAt { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxGolfUsgaProvince(SysId id, SysId countryId) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
this.CountryId = countryId;
|
||||
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_UsgaProvince, 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 CountryId
|
||||
{
|
||||
get { return data.CountryId; }
|
||||
set { data.CountryId = value; }
|
||||
}
|
||||
public String ProvinceCode
|
||||
{
|
||||
get { return data.ProvinceCode; }
|
||||
set { data.ProvinceCode = value; }
|
||||
}
|
||||
public String EntProvinceCode
|
||||
{
|
||||
get { return data.EntProvinceCode; }
|
||||
set { data.EntProvinceCode = value; }
|
||||
}
|
||||
public String ProvinceName
|
||||
{
|
||||
get { return data.ProvinceName; }
|
||||
set { data.ProvinceName = value; }
|
||||
}
|
||||
public DateTime? CoursesUpdateAt
|
||||
{
|
||||
get { return data.CoursesUpdateAt; }
|
||||
set { data.CoursesUpdateAt = 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> CountryIdsIncluded { get; } = new List<SysId>();
|
||||
/// <summary>Generic filter - partial province code or name.</summary>
|
||||
public String ProvinceFilter { get; set; }
|
||||
public String ProvinceCodeFull { get; set; }
|
||||
public String ProvinceNameFull { get; set; }
|
||||
public String ProvinceNamePartial { get; set; }
|
||||
// Flags.
|
||||
public FlagState PriorityFlagState { get; set; } = FlagState.Either;
|
||||
// Associated data.
|
||||
public BoolState HasFacilities { 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; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list extension methods.
|
||||
public static class SaxGolfUsgaProvinceList
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
public static SaxGolfUsgaProvince GetProvinceById(this IEnumerable<SaxGolfUsgaProvince> values, SysId provinceId)
|
||||
{
|
||||
if (!SysId.IsValid(provinceId)) return null;
|
||||
foreach (SaxGolfUsgaProvince province in values)
|
||||
if (province.Id.Equals(provinceId)) return province;
|
||||
return null;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user