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,264 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Base.App;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using Saxonite.Net.Standard.Base.Bus.Reference;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Mgr.Reference
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SaxReferenceGolfMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// Reference Mgr - Golf - USGA Course
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxGolfUsgaCourse CreateUsgaCourse(SysId facilityId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool UsgaCourseExistsById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SaxGolfUsgaCourse.Params prmUsgaCourse = new SaxGolfUsgaCourse.Params();
|
||||
prmUsgaCourse.IdsIncluded.Add(id);
|
||||
prmUsgaCourse.StatusCat = SaxGolfUsgaCourse.StatusCat.Any;
|
||||
return GetUsgaCourseCount(prmUsgaCourse) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxGolfUsgaCourse GetUsgaCourse(SaxGolfUsgaCourse.Params prmUsgaCourse);
|
||||
public SaxGolfUsgaCourse GetUsgaCourseById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SaxGolfUsgaCourse.Params prmUsgaCourse = new SaxGolfUsgaCourse.Params();
|
||||
prmUsgaCourse.IdsIncluded.Add(id);
|
||||
prmUsgaCourse.StatusCat = SaxGolfUsgaCourse.StatusCat.Any;
|
||||
return GetUsgaCourse(prmUsgaCourse);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidUsgaCourse(SaxGolfUsgaCourse usgaCourse)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (usgaCourse == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidUsgaCourseData(usgaCourse.GetData(), new SaxGolfUsgaCourse.ErrField());
|
||||
}
|
||||
public virtual bool IsValidUsgaCourseData(SaxGolfUsgaCourse.Data data, SaxGolfUsgaCourse.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Facility.
|
||||
if (errField.FacilityId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.FacilityId))
|
||||
{
|
||||
errField.FacilityId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Facility must be specified");
|
||||
}
|
||||
// Course Id.
|
||||
if (errField.CourseId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.UsgaCourseId))
|
||||
{
|
||||
errField.CourseId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Course Id must be specified");
|
||||
}
|
||||
// Caption.
|
||||
if (errField.Caption != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Caption, "caption", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Caption), true))
|
||||
{
|
||||
errField.Caption = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Course name.
|
||||
if (errField.CourseName != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.CourseName, "name", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_CourseName), true))
|
||||
{
|
||||
errField.CourseName = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Full name.
|
||||
if (errField.FullName != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.FullName, "full name", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_FullName)))
|
||||
{
|
||||
errField.FullName = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Address line 1.
|
||||
if (errField.Address1 != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Address1, "address line 1", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Address1)))
|
||||
{
|
||||
errField.Address1 = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Address line 2.
|
||||
if (errField.Address2 != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Address2, "address line 2", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Address2)))
|
||||
{
|
||||
errField.Address2 = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// City.
|
||||
if (errField.City != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.City, "city", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_City)))
|
||||
{
|
||||
errField.City = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Postal Code.
|
||||
if (errField.PostalCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PostalCode, "postal code", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_PostalCode)))
|
||||
{
|
||||
errField.PostalCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Email.
|
||||
if (errField.Email != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Email, "email", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Email)))
|
||||
{
|
||||
errField.Email = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Telephone.
|
||||
if (errField.Telephone != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Telephone, "telephone", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Telephone)))
|
||||
{
|
||||
errField.Telephone = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(data.StatusCode, "status", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SaxGolfUsgaCourse.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Associated data - ignore for deleted items.
|
||||
if (!data.IsStatusDeleted)
|
||||
{
|
||||
|
||||
// Facility.
|
||||
if (errField.FacilityId != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.FacilityId))
|
||||
{
|
||||
SaxGolfUsgaFacility.Params prmFacility = new SaxGolfUsgaFacility.Params();
|
||||
prmFacility.IdsIncluded.Add(data.FacilityId);
|
||||
prmFacility.StatusCat = SaxGolfUsgaFacility.StatusCat.NotDeleted;
|
||||
if (ReferenceGolfMgr.GetUsgaFacilityCount(prmFacility) < 1)
|
||||
{
|
||||
errField.FacilityId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid course specified");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item database interface.
|
||||
public abstract bool InsertUsgaCourse(SaxGolfUsgaCourse usgaCourse, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateUsgaCourse(SaxGolfUsgaCourse usgaCourse, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool UsgaCourseCanBeDeleted(SaxGolfUsgaCourse usgaCourse)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteUsgaCourse(SaxGolfUsgaCourse usgaCourse, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Bulk updates.
|
||||
public class UsgaCourseData
|
||||
{
|
||||
public SysId UsgaFacilityId { get; set; }
|
||||
public SysId UsgaCourseId { get; set; }
|
||||
public SysId LegacyCrpCourseId { get; set; }
|
||||
public string Caption { get; set; } = null;
|
||||
public string CourseName { get; set; } = null;
|
||||
public string FullName { get; set; } = null;
|
||||
public string Address1 { get; set; } = null;
|
||||
public string Address2 { get; set; } = null;
|
||||
public string City { get; set; } = null;
|
||||
public string PostalCode { get; set; } = null;
|
||||
public string Email { get; set; } = null;
|
||||
public string Telephone { get; set; } = null;
|
||||
}
|
||||
/// <summary>
|
||||
/// Bulk update USGA Courses.
|
||||
/// <para>- Facility code must be supplied to identify parent.</para>
|
||||
/// <para>- Course Id must be supplied to act as identifier.</para>
|
||||
/// <para>- Other properties are validated as per province rules - check error state.</para>
|
||||
/// <para>- Other properties are left as is if null.</para>
|
||||
/// </summary>
|
||||
public abstract bool BulkUpdateUsgaCourses(List<UsgaCourseData> courses, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetUsgaCourseColumnDfn(SaxGolfUsgaCourse.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetUsgaCourseQueryFilter(SaxGolfUsgaCourse.Params prmUsgaCourse);
|
||||
public abstract long GetUsgaCourseCount(SaxGolfUsgaCourse.Params prmUsgaCourse);
|
||||
public abstract List<SaxGolfUsgaCourse> GetUsgaCourseList(SaxGolfUsgaCourse.Params prmUsgaCourse);
|
||||
public abstract DbResultSet ExecuteUsgaCourseQuery(List<ColumnDfn> columns, SaxGolfUsgaCourse.Params prmUsgaCourse);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Extract and format result set data value where specific handling is required.
|
||||
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
|
||||
/// </summary>
|
||||
public virtual DataValue GetUsgaCourseDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxGolfUsgaCourse.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// Notes.
|
||||
case SaxGolfUsgaCourse.Column.Notes:
|
||||
{
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Status.
|
||||
case SaxGolfUsgaCourse.Column.Status_Desc:
|
||||
case SaxGolfUsgaCourse.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SaxGolfUsgaCourse.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||
else if (column.Id == (int)SaxGolfUsgaCourse.Column.Status_Ind)
|
||||
value = new DataValue(SaxGolfUsgaCourse.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
default:
|
||||
value = values.GetValue(column.DataName);
|
||||
break;
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user