1.2.11.4
This commit is contained in:
@@ -169,6 +169,18 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public static long KeepLoggedInTimeoutMillis { get; } = (long)(SacsSystem.DebugMode ? TimeSpan.FromMinutes(1) : TimeSpan.FromMinutes(5)).TotalMilliseconds;
|
||||
}
|
||||
}
|
||||
public static class Processes
|
||||
{
|
||||
public static class Scheduled
|
||||
{
|
||||
public static class UsgaGolfDataLookup
|
||||
{
|
||||
public static bool Enabled { get; set; } = SacsSystem.DebugMode ? true : true;
|
||||
public static int MinsBetweenExecution { get; set; } = SacsSystem.DebugMode ? 12 : 20;
|
||||
public static int HoursBetweenCountryLookup { get; set; } = SacsSystem.DebugMode ? 24 : 24 * 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static class Links
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.2.11.3";
|
||||
private static String version { get; } = "1.2.11.4";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
@@ -41,8 +41,9 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
// Version history.
|
||||
//-------------------------------------------------------------------
|
||||
// 1.2.11 6-Jul-2023
|
||||
// - Organisation associations, admin download [Feb24].
|
||||
// - Basic Api app [Apr24].
|
||||
// - Organisation associations, admin download. [Feb24]
|
||||
// - Basic Api app. [Apr24]
|
||||
// - Admin Database and logs pages evolved. [May24]
|
||||
// 1.2.10 11-Oct-2022
|
||||
// - Online organisations display issue fixed.
|
||||
// - User Sport 'Preparing' options.
|
||||
|
||||
@@ -55,7 +55,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
{
|
||||
Unknown = 0,
|
||||
Core = 10,
|
||||
Support = 20,
|
||||
Reference = 20,
|
||||
Support = 90,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -103,8 +104,14 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
ItemAddress = 405,
|
||||
ItemAssociation = 410,
|
||||
ItemSport = 420,
|
||||
// Reference.
|
||||
Golf_UsgaCountry = 1000,
|
||||
Golf_UsgaProvince = 1001,
|
||||
Golf_UsgaFacility = 1002,
|
||||
Golf_UsgaCourse = 1003,
|
||||
Golf_UsgaMarker = 1004,
|
||||
// Support.
|
||||
UserReport = 1010,
|
||||
UserReport = 9010,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Feb-2023 18:02:24
|
||||
// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
@@ -435,10 +435,19 @@ namespace Saxonite.Base.App
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String tableName = tables[(int)tableIdx];
|
||||
String tableName = tables[(int)tableIdx].Name;
|
||||
if (delimitReservedWords) tableName = DelimitReservedWord(tableName);
|
||||
return tableName;
|
||||
}
|
||||
public static String GetTableNameQual (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String schemaName = tables[(int)tableIdx].Schema;
|
||||
String tableName = tables[(int)tableIdx].Name;
|
||||
if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); tableName = DelimitReservedWord(tableName); }
|
||||
return (StringUtil.IsBlank(schemaName) ? "" : schemaName + ".") + tableName;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Identify the table that corresponds with the specified column.
|
||||
@@ -488,8 +497,15 @@ namespace Saxonite.Base.App
|
||||
}
|
||||
public static String DelimitReservedWord (String word)
|
||||
{
|
||||
if (!IsReservedWord(word)) return word;
|
||||
switch (reservedWordDelim)
|
||||
return IsReservedWord(word) ? DelimitWord(word) : word;
|
||||
}
|
||||
public static String DelimitWord (String word)
|
||||
{
|
||||
return DelimitWord(word, reservedWordDelim);
|
||||
}
|
||||
public static String DelimitWord (String word, DbReservedWordDelim wordDelim)
|
||||
{
|
||||
switch (wordDelim)
|
||||
{
|
||||
case DbReservedWordDelim.None:
|
||||
break;
|
||||
@@ -566,30 +582,40 @@ namespace Saxonite.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table definitions.
|
||||
private static readonly String[] tables =
|
||||
private class TableDfn
|
||||
{
|
||||
"ActivityFeedback",
|
||||
"ActivityIndex",
|
||||
"Article",
|
||||
"ItemAddress",
|
||||
"ItemAssociation",
|
||||
"ItemImage",
|
||||
"ItemSport",
|
||||
"Organisation",
|
||||
"OrganisationEvent",
|
||||
"OrganisationOpportunity",
|
||||
"Region",
|
||||
"Sport",
|
||||
"UserAccount",
|
||||
"UserActivity",
|
||||
"UserConfig",
|
||||
"UserEligibility",
|
||||
"UserOnline",
|
||||
"UserOrganisation",
|
||||
"UserRole",
|
||||
"UserSession",
|
||||
"UserSport",
|
||||
"UserSportExperience",
|
||||
internal String Schema { get; set; }
|
||||
internal String Name { get; set; }
|
||||
internal TableDfn (String schema, String name)
|
||||
{
|
||||
this.Schema= schema;
|
||||
this.Name = name;
|
||||
}
|
||||
}
|
||||
private static readonly TableDfn[] tables =
|
||||
{
|
||||
new TableDfn("dbo","ActivityFeedback"),
|
||||
new TableDfn("dbo","ActivityIndex"),
|
||||
new TableDfn("dbo","Article"),
|
||||
new TableDfn("dbo","ItemAddress"),
|
||||
new TableDfn("dbo","ItemAssociation"),
|
||||
new TableDfn("dbo","ItemImage"),
|
||||
new TableDfn("dbo","ItemSport"),
|
||||
new TableDfn("dbo","Organisation"),
|
||||
new TableDfn("dbo","OrganisationEvent"),
|
||||
new TableDfn("dbo","OrganisationOpportunity"),
|
||||
new TableDfn("dbo","Region"),
|
||||
new TableDfn("dbo","Sport"),
|
||||
new TableDfn("dbo","UserAccount"),
|
||||
new TableDfn("dbo","UserActivity"),
|
||||
new TableDfn("dbo","UserConfig"),
|
||||
new TableDfn("dbo","UserEligibility"),
|
||||
new TableDfn("dbo","UserOnline"),
|
||||
new TableDfn("dbo","UserOrganisation"),
|
||||
new TableDfn("dbo","UserRole"),
|
||||
new TableDfn("dbo","UserSession"),
|
||||
new TableDfn("dbo","UserSport"),
|
||||
new TableDfn("dbo","UserSportExperience"),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -612,8 +638,6 @@ namespace Saxonite.Base.App
|
||||
this.DataLen = dataLen;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private static readonly ColumnDfn[] columns =
|
||||
{
|
||||
new ColumnDfn(1,"ItemType",3,5,false,5),
|
||||
|
||||
@@ -0,0 +1,488 @@
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
public class SaxDbDfn_Reference
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Table identifiers.
|
||||
public enum TableIdx
|
||||
{
|
||||
Unknown = 0,
|
||||
UsgaCountry,
|
||||
UsgaCourse,
|
||||
UsgaFacility,
|
||||
UsgaMarker,
|
||||
UsgaProvince,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Column identifiers.
|
||||
public enum ColumnIdx
|
||||
{
|
||||
Unknown = 0,
|
||||
UsgaCountry_Id,
|
||||
UsgaCountry_CountryCode,
|
||||
UsgaCountry_CountryName,
|
||||
UsgaCountry_EntCountryCode,
|
||||
UsgaCountry_Notes,
|
||||
UsgaCountry_Flags,
|
||||
UsgaCountry_Status,
|
||||
UsgaCountry_CreateOn,
|
||||
UsgaCountry_CreateBy,
|
||||
UsgaCountry_CreateHost,
|
||||
UsgaCountry_UpdateOn,
|
||||
UsgaCountry_UpdateBy,
|
||||
UsgaCountry_UpdateHost,
|
||||
UsgaCourse_Id,
|
||||
UsgaCourse_FacilityId,
|
||||
UsgaCourse_CourseId,
|
||||
UsgaCourse_LegacyCrpCourseId,
|
||||
UsgaCourse_Caption,
|
||||
UsgaCourse_CourseName,
|
||||
UsgaCourse_FullName,
|
||||
UsgaCourse_Address1,
|
||||
UsgaCourse_Address2,
|
||||
UsgaCourse_City,
|
||||
UsgaCourse_Email,
|
||||
UsgaCourse_Telephone,
|
||||
UsgaCourse_Notes,
|
||||
UsgaCourse_Flags,
|
||||
UsgaCourse_Status,
|
||||
UsgaCourse_CreateOn,
|
||||
UsgaCourse_CreateBy,
|
||||
UsgaCourse_CreateHost,
|
||||
UsgaCourse_UpdateOn,
|
||||
UsgaCourse_UpdateBy,
|
||||
UsgaCourse_UpdateHost,
|
||||
UsgaFacility_Id,
|
||||
UsgaFacility_ProvinceId,
|
||||
UsgaFacility_FacilityId,
|
||||
UsgaFacility_FacilityName,
|
||||
UsgaFacility_Notes,
|
||||
UsgaFacility_Flags,
|
||||
UsgaFacility_Status,
|
||||
UsgaFacility_CreateOn,
|
||||
UsgaFacility_CreateBy,
|
||||
UsgaFacility_CreateHost,
|
||||
UsgaFacility_UpdateOn,
|
||||
UsgaFacility_UpdateBy,
|
||||
UsgaFacility_UpdateHost,
|
||||
UsgaMarker_Id,
|
||||
UsgaMarker_CourseId,
|
||||
UsgaMarker_MarkerId,
|
||||
UsgaMarker_Caption,
|
||||
UsgaMarker_Holes,
|
||||
UsgaMarker_HolesCaption,
|
||||
UsgaMarker_Tee,
|
||||
UsgaMarker_Gender,
|
||||
UsgaMarker_SlopeRating,
|
||||
UsgaMarker_Par,
|
||||
UsgaMarker_CourseRating,
|
||||
UsgaMarker_BogeyRating,
|
||||
UsgaMarker_Length,
|
||||
UsgaMarker_Notes,
|
||||
UsgaMarker_Flags,
|
||||
UsgaMarker_Status,
|
||||
UsgaMarker_CreateOn,
|
||||
UsgaMarker_CreateBy,
|
||||
UsgaMarker_CreateHost,
|
||||
UsgaMarker_UpdateOn,
|
||||
UsgaMarker_UpdateBy,
|
||||
UsgaMarker_UpdateHost,
|
||||
UsgaProvince_Id,
|
||||
UsgaProvince_CountryId,
|
||||
UsgaProvince_ProvinceCode,
|
||||
UsgaProvince_EntProvinceCode,
|
||||
UsgaProvince_ProvinceName,
|
||||
UsgaProvince_Notes,
|
||||
UsgaProvince_Flags,
|
||||
UsgaProvince_Status,
|
||||
UsgaProvince_CreateOn,
|
||||
UsgaProvince_CreateBy,
|
||||
UsgaProvince_CreateHost,
|
||||
UsgaProvince_UpdateOn,
|
||||
UsgaProvince_UpdateBy,
|
||||
UsgaProvince_UpdateHost,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 5;
|
||||
private static readonly int columnCount = 83;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve Table details (eg. name: 'Company').
|
||||
public static int GetTableCount ()
|
||||
{
|
||||
return tableCount;
|
||||
}
|
||||
public static String GetTableName (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String tableName = tables[(int)tableIdx].Name;
|
||||
if (delimitReservedWords) tableName = DelimitReservedWord(tableName);
|
||||
return tableName;
|
||||
}
|
||||
public static String GetTableNameQual (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String schemaName = tables[(int)tableIdx].Schema;
|
||||
String tableName = tables[(int)tableIdx].Name;
|
||||
if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); tableName = DelimitReservedWord(tableName); }
|
||||
return (StringUtil.IsBlank(schemaName) ? "" : schemaName + ".") + tableName;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Identify the table that corresponds with the specified column.
|
||||
public static TableIdx GetTableForColumn (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return TableIdx.Unknown;
|
||||
return columns[columnIdx].TableIdx;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve the specified Column's name (Qualified include table name: '(<Table>.Column>)').
|
||||
public static String GetColumnName (ColumnIdx column, bool delimitReservedWords = true)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return String.Empty;
|
||||
String columnName = columns[columnIdx].Name;
|
||||
if (delimitReservedWords) columnName = DelimitReservedWord(columnName);
|
||||
return columnName;
|
||||
}
|
||||
public static String GetColumnNameQual (ColumnIdx column, String tableAlias = "", bool braces = false)
|
||||
{
|
||||
String columnName = GetColumnName(column);
|
||||
if (!String.IsNullOrEmpty(columnName))
|
||||
{
|
||||
String tableName = StringUtil.EmptyOnNull(tableAlias);
|
||||
if (tableName.IsEmpty()) tableName = GetTableName(GetTableForColumn(column));
|
||||
columnName = tableName + (tableName.Length > 0 ? "." : "") + columnName;
|
||||
if (braces)
|
||||
columnName = "(" + columnName + ")";
|
||||
}
|
||||
return columnName;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static DbReservedWordDelim reservedWordDelim = DbReservedWordDelim.SquareBrackets;
|
||||
public static void SetReservedWordDelim (DbReservedWordDelim reservedWordDelim)
|
||||
{
|
||||
SaxDbDfn_Reference.reservedWordDelim = reservedWordDelim;
|
||||
}
|
||||
public static bool IsReservedWord (String word)
|
||||
{
|
||||
if (String.IsNullOrEmpty(word)) return false;
|
||||
if (reservedWords.Contains(word, StringComparer.OrdinalIgnoreCase)) return true;
|
||||
return false;
|
||||
}
|
||||
public static String DelimitReservedWord (String word)
|
||||
{
|
||||
return IsReservedWord(word) ? DelimitWord(word) : word;
|
||||
}
|
||||
public static String DelimitWord (String word)
|
||||
{
|
||||
return DelimitWord(word, reservedWordDelim);
|
||||
}
|
||||
public static String DelimitWord (String word, DbReservedWordDelim wordDelim)
|
||||
{
|
||||
switch (wordDelim)
|
||||
{
|
||||
case DbReservedWordDelim.None:
|
||||
break;
|
||||
case DbReservedWordDelim.DoubleQuotes:
|
||||
word = "\"" + word + "\"";
|
||||
break;
|
||||
case DbReservedWordDelim.SquareBrackets:
|
||||
default:
|
||||
word = "[" + word + "]";
|
||||
break;
|
||||
}
|
||||
return word;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve information about the specified Column.
|
||||
public static DbColumnDataType GetColDataType (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return DbColumnDataType.Unknown;
|
||||
return columns[columnIdx].DataType;
|
||||
}
|
||||
public static short GetColNativeDataType (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return 0;
|
||||
return columns[columnIdx].NativeDataType;
|
||||
}
|
||||
public static void SetMaxTextLen (ulong maxTextLen)
|
||||
{
|
||||
SaxDbDfn_Reference.maxTextLen = maxTextLen;
|
||||
}
|
||||
public static bool IsColFmtText (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return false;
|
||||
return (columns[columnIdx].DataType == DbColumnDataType.VarChar);
|
||||
}
|
||||
public static ulong GetColTextLen (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return 0;
|
||||
if (columns[columnIdx].DataType == DbColumnDataType.VarChar)
|
||||
{
|
||||
ulong textLen = columns[columnIdx].DataLen;
|
||||
if (maxTextLen > 0 && textLen > maxTextLen) textLen = maxTextLen;
|
||||
return textLen;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public static bool IsColFmtBool (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return false;
|
||||
return (columns[columnIdx].DataType == DbColumnDataType.Bit);
|
||||
}
|
||||
public static bool IsColFmtNumeric (ColumnIdx column)
|
||||
{
|
||||
int columnIdx = (int)column - 1;
|
||||
if (columnIdx < 0 || columnIdx >= columnCount) return false;
|
||||
switch (columns[columnIdx].DataType)
|
||||
{
|
||||
case DbColumnDataType.TinyInt:
|
||||
case DbColumnDataType.SmallInt:
|
||||
case DbColumnDataType.Int:
|
||||
case DbColumnDataType.BigInt:
|
||||
case DbColumnDataType.Single:
|
||||
case DbColumnDataType.Double:
|
||||
case DbColumnDataType.Decimal:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table definitions.
|
||||
private class TableDfn
|
||||
{
|
||||
internal String Schema { get; set; }
|
||||
internal String Name { get; set; }
|
||||
internal TableDfn (String schema, String name)
|
||||
{
|
||||
this.Schema= schema;
|
||||
this.Name = name;
|
||||
}
|
||||
}
|
||||
private static readonly TableDfn[] tables =
|
||||
{
|
||||
new TableDfn("golf","UsgaCountry"),
|
||||
new TableDfn("golf","UsgaCourse"),
|
||||
new TableDfn("golf","UsgaFacility"),
|
||||
new TableDfn("golf","UsgaMarker"),
|
||||
new TableDfn("golf","UsgaProvince"),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table column definitions.
|
||||
private class ColumnDfn
|
||||
{
|
||||
internal TableIdx TableIdx { get; set; }
|
||||
internal String Name { get; set; }
|
||||
internal DbColumnDataType DataType { get; set; }
|
||||
internal short NativeDataType { get; set; }
|
||||
internal bool IsIdentity { get; set; }
|
||||
internal ulong DataLen { get; set; }
|
||||
internal ColumnDfn (int tableIdx, String name, int dataType, short nativeDataType, bool isIdentity, ulong dataLen)
|
||||
{
|
||||
this.TableIdx = (TableIdx)tableIdx;
|
||||
this.Name = name;
|
||||
this.DataType = (DbColumnDataType)dataType;
|
||||
this.NativeDataType = nativeDataType;
|
||||
this.IsIdentity = isIdentity;
|
||||
this.DataLen = dataLen;
|
||||
}
|
||||
}
|
||||
private static readonly ColumnDfn[] columns =
|
||||
{
|
||||
new ColumnDfn(1,"Id",5,-5,true,19),
|
||||
new ColumnDfn(1,"CountryCode",0,12,false,10),
|
||||
new ColumnDfn(1,"CountryName",0,-9,false,200),
|
||||
new ColumnDfn(1,"EntCountryCode",0,12,false,10),
|
||||
new ColumnDfn(1,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(1,"Flags",3,5,false,5),
|
||||
new ColumnDfn(1,"Status",0,12,false,3),
|
||||
new ColumnDfn(1,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(1,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(1,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(1,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(1,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(1,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(2,"Id",5,-5,true,19),
|
||||
new ColumnDfn(2,"FacilityId",5,-5,false,19),
|
||||
new ColumnDfn(2,"CourseId",5,-5,false,19),
|
||||
new ColumnDfn(2,"LegacyCrpCourseId",5,-5,false,19),
|
||||
new ColumnDfn(2,"Caption",0,-9,false,200),
|
||||
new ColumnDfn(2,"CourseName",0,-9,false,200),
|
||||
new ColumnDfn(2,"FullName",0,-9,false,200),
|
||||
new ColumnDfn(2,"Address1",0,-9,false,200),
|
||||
new ColumnDfn(2,"Address2",0,-9,false,200),
|
||||
new ColumnDfn(2,"City",0,-9,false,200),
|
||||
new ColumnDfn(2,"Email",0,-9,false,200),
|
||||
new ColumnDfn(2,"Telephone",0,-9,false,200),
|
||||
new ColumnDfn(2,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(2,"Flags",3,5,false,5),
|
||||
new ColumnDfn(2,"Status",0,12,false,3),
|
||||
new ColumnDfn(2,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(2,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(2,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(2,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(2,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(2,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(3,"Id",5,-5,true,19),
|
||||
new ColumnDfn(3,"ProvinceId",5,-5,false,19),
|
||||
new ColumnDfn(3,"FacilityId",5,-5,false,19),
|
||||
new ColumnDfn(3,"FacilityName",0,-9,false,200),
|
||||
new ColumnDfn(3,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(3,"Flags",3,5,false,5),
|
||||
new ColumnDfn(3,"Status",0,12,false,3),
|
||||
new ColumnDfn(3,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(3,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(3,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(3,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(3,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(3,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(4,"Id",5,-5,true,19),
|
||||
new ColumnDfn(4,"CourseId",5,-5,false,19),
|
||||
new ColumnDfn(4,"MarkerId",5,-5,false,19),
|
||||
new ColumnDfn(4,"Caption",0,-9,false,200),
|
||||
new ColumnDfn(4,"Holes",3,5,false,5),
|
||||
new ColumnDfn(4,"HolesCaption",0,-9,false,32),
|
||||
new ColumnDfn(4,"Tee",0,-9,false,32),
|
||||
new ColumnDfn(4,"Gender",0,-9,false,32),
|
||||
new ColumnDfn(4,"SlopeRating",3,5,false,5),
|
||||
new ColumnDfn(4,"Par",3,5,false,5),
|
||||
new ColumnDfn(4,"CourseRating",8,3,false,9),
|
||||
new ColumnDfn(4,"BogeyRating",8,3,false,9),
|
||||
new ColumnDfn(4,"Length",3,5,false,5),
|
||||
new ColumnDfn(4,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(4,"Flags",3,5,false,5),
|
||||
new ColumnDfn(4,"Status",0,12,false,3),
|
||||
new ColumnDfn(4,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(4,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(4,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(4,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(4,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(4,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(5,"Id",5,-5,true,19),
|
||||
new ColumnDfn(5,"CountryId",5,-5,false,19),
|
||||
new ColumnDfn(5,"ProvinceCode",0,12,false,20),
|
||||
new ColumnDfn(5,"EntProvinceCode",0,12,false,20),
|
||||
new ColumnDfn(5,"ProvinceName",0,-9,false,200),
|
||||
new ColumnDfn(5,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(5,"Flags",3,5,false,5),
|
||||
new ColumnDfn(5,"Status",0,12,false,3),
|
||||
new ColumnDfn(5,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(5,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(5,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(5,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(5,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(5,"UpdateHost",0,12,false,100),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static readonly List<String> reservedWords = new List<String>()
|
||||
{
|
||||
"ADD",
|
||||
"ALL",
|
||||
"ALTER",
|
||||
"AND",
|
||||
"ANY",
|
||||
"AS",
|
||||
"ASC",
|
||||
"AVG",
|
||||
"BEGIN",
|
||||
"BETWEEN",
|
||||
"BY",
|
||||
"CASE",
|
||||
"CAST",
|
||||
"COLUMN",
|
||||
"COMMIT",
|
||||
"CONSTRAINT",
|
||||
"CONVERT",
|
||||
"COUNT",
|
||||
"CREATE",
|
||||
"CURRENCY",
|
||||
"DEFAULT",
|
||||
"DELETE",
|
||||
"DESC",
|
||||
"DISTINCT",
|
||||
"DROP",
|
||||
"ELSE",
|
||||
"END",
|
||||
"EXECUTE",
|
||||
"EXISTS",
|
||||
"FALSE",
|
||||
"FROM",
|
||||
"GRANT",
|
||||
"GROUP",
|
||||
"HAVING",
|
||||
"IN",
|
||||
"INDEX",
|
||||
"INNER",
|
||||
"INSERT",
|
||||
"INTO",
|
||||
"IS",
|
||||
"JOIN",
|
||||
"KEY",
|
||||
"LEFT",
|
||||
"LIKE",
|
||||
"MAX",
|
||||
"MIN",
|
||||
"NOT",
|
||||
"NULL",
|
||||
"ON",
|
||||
"OR",
|
||||
"ORDER",
|
||||
"OUTER",
|
||||
"OUTPUT",
|
||||
"PRIMARY",
|
||||
"PROCEDURE",
|
||||
"REVOKE",
|
||||
"ROLLBACK",
|
||||
"ROWCOUNT",
|
||||
"SELECT",
|
||||
"SET",
|
||||
"SQL",
|
||||
"SUM",
|
||||
"TABLE",
|
||||
"THEN",
|
||||
"TRANSACTION",
|
||||
"TRUE",
|
||||
"UNION",
|
||||
"UNIQUE",
|
||||
"UPDATE",
|
||||
"USER",
|
||||
"VALUES",
|
||||
"VIEW",
|
||||
"WHEN",
|
||||
"WHERE",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 8-Feb-2023 18:02:24
|
||||
// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:56
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
@@ -74,10 +74,19 @@ namespace Saxonite.Base.App
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String tableName = tables[(int)tableIdx];
|
||||
String tableName = tables[(int)tableIdx].Name;
|
||||
if (delimitReservedWords) tableName = DelimitReservedWord(tableName);
|
||||
return tableName;
|
||||
}
|
||||
public static String GetTableNameQual (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String schemaName = tables[(int)tableIdx].Schema;
|
||||
String tableName = tables[(int)tableIdx].Name;
|
||||
if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); tableName = DelimitReservedWord(tableName); }
|
||||
return (StringUtil.IsBlank(schemaName) ? "" : schemaName + ".") + tableName;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Identify the table that corresponds with the specified column.
|
||||
@@ -127,8 +136,15 @@ namespace Saxonite.Base.App
|
||||
}
|
||||
public static String DelimitReservedWord (String word)
|
||||
{
|
||||
if (!IsReservedWord(word)) return word;
|
||||
switch (reservedWordDelim)
|
||||
return IsReservedWord(word) ? DelimitWord(word) : word;
|
||||
}
|
||||
public static String DelimitWord (String word)
|
||||
{
|
||||
return DelimitWord(word, reservedWordDelim);
|
||||
}
|
||||
public static String DelimitWord (String word, DbReservedWordDelim wordDelim)
|
||||
{
|
||||
switch (wordDelim)
|
||||
{
|
||||
case DbReservedWordDelim.None:
|
||||
break;
|
||||
@@ -205,10 +221,20 @@ namespace Saxonite.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table definitions.
|
||||
private static readonly String[] tables =
|
||||
private class TableDfn
|
||||
{
|
||||
"UserReport",
|
||||
"UserReportComment",
|
||||
internal String Schema { get; set; }
|
||||
internal String Name { get; set; }
|
||||
internal TableDfn (String schema, String name)
|
||||
{
|
||||
this.Schema= schema;
|
||||
this.Name = name;
|
||||
}
|
||||
}
|
||||
private static readonly TableDfn[] tables =
|
||||
{
|
||||
new TableDfn("dbo","UserReport"),
|
||||
new TableDfn("dbo","UserReportComment"),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -231,8 +257,6 @@ namespace Saxonite.Base.App
|
||||
this.DataLen = dataLen;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private static readonly ColumnDfn[] columns =
|
||||
{
|
||||
new ColumnDfn(1,"Id",5,-5,true,19),
|
||||
|
||||
@@ -11,6 +11,7 @@ using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Standard.Base.Mgr.Support;
|
||||
using Saxonite.Net.Standard.Base.Mgr.Reference;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.App
|
||||
{
|
||||
@@ -30,6 +31,9 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public SaxAccountMgr accountMgr = null;
|
||||
public SaxActivityMgr activityMgr = null;
|
||||
public SaxItemDataMgr itemDataMgr = null;
|
||||
// Reference.
|
||||
public SaxReferenceGolfMgr referenceGolfMgr = null;
|
||||
// Support.
|
||||
public SaxSupportMgr supportMgr = null;
|
||||
}
|
||||
private readonly Managers mgr = new Managers();
|
||||
@@ -72,6 +76,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
if (mgr.accountMgr != null) mgr.accountMgr.Dispose(); mgr.accountMgr = null;
|
||||
if (mgr.activityMgr != null) mgr.activityMgr.Dispose(); mgr.activityMgr = null;
|
||||
if (mgr.itemDataMgr != null) mgr.itemDataMgr.Dispose(); mgr.itemDataMgr = null;
|
||||
if (mgr.referenceGolfMgr != null) mgr.referenceGolfMgr.Dispose(); mgr.referenceGolfMgr = null;
|
||||
if (mgr.supportMgr != null) mgr.supportMgr.Dispose(); mgr.supportMgr = null;
|
||||
if (con.activityConsole != null) con.activityConsole.Dispose(); con.activityConsole = null;
|
||||
}
|
||||
@@ -166,6 +171,15 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
return mgr.itemDataMgr;
|
||||
}
|
||||
}
|
||||
public SaxReferenceGolfMgr ReferenceGolfMgr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mgr.referenceGolfMgr == null)
|
||||
mgr.referenceGolfMgr = System.CreateReferenceGolfMgr(SessionContext, this);
|
||||
return mgr.referenceGolfMgr;
|
||||
}
|
||||
}
|
||||
public SaxSupportMgr SupportMgr
|
||||
{
|
||||
get
|
||||
|
||||
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Saxonite.Net.Standard.Base.Mgr.Support;
|
||||
using Saxonite.Net.Standard.Base.Mgr.Reference;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.App
|
||||
{
|
||||
@@ -28,6 +29,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public abstract SaxAccountMgr CreateAccountMgr(SaxSessionContext sessionContext, SaxInternals internals);
|
||||
public abstract SaxItemDataMgr CreateItemDataMgr(SaxSessionContext sessionContext, SaxInternals internals);
|
||||
public abstract SaxActivityMgr CreateActivityMgr(SaxSessionContext sessionContext, SaxInternals internals);
|
||||
public abstract SaxReferenceGolfMgr CreateReferenceGolfMgr(SaxSessionContext sessionContext, SaxInternals internals);
|
||||
public abstract SaxSupportMgr CreateSupportMgr(SaxSessionContext sessionContext, SaxInternals internals);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
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 : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
CountryCode,
|
||||
EntCountryCode,
|
||||
CountryName,
|
||||
// Associated data.
|
||||
// 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;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
CountryCode = data.CountryCode;
|
||||
EntCountryCode = data.EntCountryCode;
|
||||
CountryName = data.CountryName;
|
||||
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;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(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; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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>();
|
||||
/// <summary>Generic filter - partial country code or name.</summary>
|
||||
public String CountryFilter { get; set; }
|
||||
public String CountryCodeFull { get; set; }
|
||||
public String CountryNameFull { get; set; }
|
||||
public String CountryNamePartial { get; set; }
|
||||
// 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,345 @@
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
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 : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
CountryId,
|
||||
Country_Name,
|
||||
ProvinceId,
|
||||
Province_Name,
|
||||
FacilityId,
|
||||
Facility_Name,
|
||||
CourseId,
|
||||
LegacyCrpCourseId,
|
||||
Caption,
|
||||
CourseName,
|
||||
FullName,
|
||||
Address1,
|
||||
Address2,
|
||||
City,
|
||||
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 FacilityId { get; set; }
|
||||
public SysId CourseId { 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 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 FacilityId
|
||||
{
|
||||
get { return data.FacilityId; }
|
||||
set { CheckChanged(data.FacilityId, value); data.FacilityId = value; }
|
||||
}
|
||||
public SysId CourseId
|
||||
{
|
||||
get { return data.CourseId; }
|
||||
set { CheckChanged(data.CourseId, value); data.CourseId = 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 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)
|
||||
{
|
||||
FacilityId = data.FacilityId;
|
||||
CourseId = data.CourseId;
|
||||
LegacyCrpCourseId = data.LegacyCrpCourseId;
|
||||
Caption = data.Caption;
|
||||
CourseName = data.CourseName;
|
||||
FullName = data.FullName;
|
||||
Address1 = data.Address1;
|
||||
Address2 = data.Address2;
|
||||
City = data.City;
|
||||
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 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 Email { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Telephone { 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);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public SysId FacilityId
|
||||
{
|
||||
get { return data.FacilityId; }
|
||||
set { data.FacilityId = value; }
|
||||
}
|
||||
public SysId CourseId
|
||||
{
|
||||
get { return data.CourseId; }
|
||||
set { data.CourseId = 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 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
|
||||
{
|
||||
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> ProvinceIdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> FacilityIdsIncluded { get; } = new List<SysId>();
|
||||
/// <summary>USGA Course Ids.</summary>
|
||||
public List<SysId> CourseIdsIncluded { 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; }
|
||||
// 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,229 @@
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
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 : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
CountryId,
|
||||
Country_Name,
|
||||
ProvinceId,
|
||||
Province_Name,
|
||||
FacilityId,
|
||||
FacilityName,
|
||||
// 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 FacilityId { get; set; }
|
||||
public String FacilityName { 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 FacilityId
|
||||
{
|
||||
get { return data.FacilityId; }
|
||||
set { CheckChanged(data.FacilityId, value); data.FacilityId = value; }
|
||||
}
|
||||
public String FacilityName
|
||||
{
|
||||
get { return data.FacilityName; }
|
||||
set { CheckChanged(data.FacilityName, value); data.FacilityName = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
ProvinceId = data.ProvinceId;
|
||||
FacilityId = data.FacilityId;
|
||||
FacilityName = data.FacilityName;
|
||||
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 FacilityId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue FacilityName { 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);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public SysId ProvinceId
|
||||
{
|
||||
get { return data.ProvinceId; }
|
||||
set { data.ProvinceId = value; }
|
||||
}
|
||||
public SysId FacilityId
|
||||
{
|
||||
get { return data.FacilityId; }
|
||||
set { data.FacilityId = value; }
|
||||
}
|
||||
public String FacilityName
|
||||
{
|
||||
get { return data.FacilityName; }
|
||||
set { data.FacilityName = 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> ProvinceIdsIncluded { get; } = new List<SysId>();
|
||||
/// <summary>USGA Facility Ids.</summary>
|
||||
public List<SysId> FacilityIdsIncluded { 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; }
|
||||
// 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,359 @@
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
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 : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
CountryId,
|
||||
Country_Name,
|
||||
ProvinceId,
|
||||
Province_Name,
|
||||
FacilityId,
|
||||
Facility_Name,
|
||||
CourseId,
|
||||
Course_Name,
|
||||
MarkerId,
|
||||
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 MarkerId { 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 MarkerId
|
||||
{
|
||||
get { return data.MarkerId; }
|
||||
set { CheckChanged(data.MarkerId, value); data.MarkerId = 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;
|
||||
MarkerId = data.MarkerId;
|
||||
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 MarkerId { 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)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public SysId CourseId
|
||||
{
|
||||
get { return data.CourseId; }
|
||||
set { data.CourseId = value; }
|
||||
}
|
||||
public SysId MarkerId
|
||||
{
|
||||
get { return data.MarkerId; }
|
||||
set { data.MarkerId = 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
|
||||
{
|
||||
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> CourseIdsIncluded { get; } = new List<SysId>();
|
||||
/// <summary>USGA Marker Ids.</summary>
|
||||
public List<SysId> MarkerIdsIncluded { get; } = new List<SysId>();
|
||||
/// <summary>Generic filter - partial caption, holes, tee, gender etc.</summary>
|
||||
public String MarkerFilter { 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,239 @@
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
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 : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
CountryId,
|
||||
Country_Name,
|
||||
ProvinceCode,
|
||||
EntProvinceCode,
|
||||
ProvinceName,
|
||||
// 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 CountryId { get; set; }
|
||||
public String ProvinceCode { get; set; } = String.Empty;
|
||||
public String EntProvinceCode { get; set; } = String.Empty;
|
||||
public String ProvinceName { 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 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; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
CountryId = data.CountryId;
|
||||
ProvinceCode = data.ProvinceCode;
|
||||
EntProvinceCode = data.EntProvinceCode;
|
||||
ProvinceName = data.ProvinceName;
|
||||
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;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(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; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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> 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; }
|
||||
// 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;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -174,10 +174,10 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxOrganisationEvent(SysId id, SysId OrganisationId) : base(id)
|
||||
protected SaxOrganisationEvent(SysId id, SysId organisationId) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
this.OrganisationId = OrganisationId;
|
||||
this.OrganisationId = organisationId;
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
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.Mgr.Reference
|
||||
{
|
||||
//=======================================================================
|
||||
public class SaxItemMgr_Reference : SaxItemMgr
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
protected SaxItemMgr_Reference(SaxSessionContext sessionContext, SaxInternals internals) :
|
||||
base(sessionContext, internals)
|
||||
{
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public ISacsDatabase ReferenceDatabase { get { return SaxGlobals.App.GetDatabase(SessionContext, Sax.Database.Reference); } }
|
||||
public IDatabaseInfo ReferenceDbInfo { get { return SaxGlobals.App.CreateDbInfo(SessionContext, Sax.Database.Reference); } }
|
||||
// Managers.
|
||||
public SaxReferenceGolfMgr ReferenceGolfMgr { get { return Internals.ReferenceGolfMgr; } }
|
||||
// Application codes.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
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.Reference;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Mgr.Reference
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SaxReferenceGolfMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// Reference Mgr - Golf - USGA Country
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxGolfUsgaCountry CreateUsgaCountry();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool UsgaCountryExistsById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SaxGolfUsgaCountry.Params prmUsgaCountry = new SaxGolfUsgaCountry.Params();
|
||||
prmUsgaCountry.IdsIncluded.Add(id);
|
||||
prmUsgaCountry.StatusCat = SaxGolfUsgaCountry.StatusCat.Any;
|
||||
return GetUsgaCountryCount(prmUsgaCountry) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxGolfUsgaCountry GetUsgaCountry(SaxGolfUsgaCountry.Params prmUsgaCountry);
|
||||
public SaxGolfUsgaCountry GetUsgaCountryById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SaxGolfUsgaCountry.Params prmUsgaCountry = new SaxGolfUsgaCountry.Params();
|
||||
prmUsgaCountry.IdsIncluded.Add(id);
|
||||
prmUsgaCountry.StatusCat = SaxGolfUsgaCountry.StatusCat.Any;
|
||||
return GetUsgaCountry(prmUsgaCountry);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidUsgaCountry(SaxGolfUsgaCountry usgaCountry)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (usgaCountry == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidUsgaCountryData(usgaCountry.GetData(), new SaxGolfUsgaCountry.ErrField());
|
||||
}
|
||||
public virtual bool IsValidUsgaCountryData(SaxGolfUsgaCountry.Data data, SaxGolfUsgaCountry.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Country code.
|
||||
if (errField.CountryCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.CountryCode, "code", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryCode), true))
|
||||
{
|
||||
errField.CountryCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// ENT Country code.
|
||||
if (errField.EntCountryCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.EntCountryCode, "ent code", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_EntCountryCode)))
|
||||
{
|
||||
errField.EntCountryCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Country name.
|
||||
if (errField.CountryName != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.CountryName, "name", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryName), true))
|
||||
{
|
||||
errField.CountryName = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_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.UsgaCountry_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SaxGolfUsgaCountry.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item database interface.
|
||||
public abstract bool InsertUsgaCountry(SaxGolfUsgaCountry usgaCountry, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateUsgaCountry(SaxGolfUsgaCountry usgaCountry, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool UsgaCountryCanBeDeleted(SaxGolfUsgaCountry usgaCountry)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteUsgaCountry(SaxGolfUsgaCountry usgaCountry, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Bulk updates.
|
||||
public class UsgaCountryData
|
||||
{
|
||||
public String CountryCode { get; set; }
|
||||
public String EntCountryCode { get; set; } = null;
|
||||
public String CountryName { get; set; } = null;
|
||||
}
|
||||
/// <summary>
|
||||
/// Bulk update USGA Countries.
|
||||
/// <para>- Country code must be supplied to act as identifier.</para>
|
||||
/// <para>- Other properties are validated as per country rules - check error state.</para>
|
||||
/// <para>- Other properties are left as is if null.</para>
|
||||
/// </summary>
|
||||
public abstract bool BulkUpdateUsgaCountries(List<UsgaCountryData> countries, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetUsgaCountryQueryFilter(SaxGolfUsgaCountry.Params prmUsgaCountry);
|
||||
public abstract long GetUsgaCountryCount(SaxGolfUsgaCountry.Params prmUsgaCountry);
|
||||
public long GetActiveUsgaCountryCount() { return GetUsgaCountryCount(new SaxGolfUsgaCountry.Params()); }
|
||||
public abstract List<SaxGolfUsgaCountry> GetUsgaCountryList(SaxGolfUsgaCountry.Params prmUsgaCountry);
|
||||
public abstract DbResultSet ExecuteUsgaCountryQuery(List<ColumnDfn> columns, SaxGolfUsgaCountry.Params prmUsgaCountry);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <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 GetUsgaCountryDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxGolfUsgaCountry.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// Notes.
|
||||
case SaxGolfUsgaCountry.Column.Notes:
|
||||
{
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Status.
|
||||
case SaxGolfUsgaCountry.Column.Status_Desc:
|
||||
case SaxGolfUsgaCountry.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SaxGolfUsgaCountry.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||
else if (column.Id == (int)SaxGolfUsgaCountry.Column.Status_Ind)
|
||||
value = new DataValue(SaxGolfUsgaCountry.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
default:
|
||||
value = values.GetValue(column.DataName);
|
||||
break;
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
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.CourseId))
|
||||
{
|
||||
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;
|
||||
}
|
||||
// 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 FacilityId { get; set; }
|
||||
public SysId CourseId { get; set; }
|
||||
public SysId LegacyCrpCourseId { get; set; }
|
||||
public string Caption { get; set; }
|
||||
public string CourseName { get; set; }
|
||||
public string FullName { get; set; }
|
||||
public string Address1 { get; set; }
|
||||
public string Address2 { get; set; }
|
||||
public string City { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string Telephone { get; set; }
|
||||
}
|
||||
/// <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;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
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 Facility
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxGolfUsgaFacility CreateUsgaFacility(SysId provinceId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool UsgaFacilityExistsById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SaxGolfUsgaFacility.Params prmUsgaFacility = new SaxGolfUsgaFacility.Params();
|
||||
prmUsgaFacility.IdsIncluded.Add(id);
|
||||
prmUsgaFacility.StatusCat = SaxGolfUsgaFacility.StatusCat.Any;
|
||||
return GetUsgaFacilityCount(prmUsgaFacility) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxGolfUsgaFacility GetUsgaFacility(SaxGolfUsgaFacility.Params prmUsgaFacility);
|
||||
public SaxGolfUsgaFacility GetUsgaFacilityById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SaxGolfUsgaFacility.Params prmUsgaFacility = new SaxGolfUsgaFacility.Params();
|
||||
prmUsgaFacility.IdsIncluded.Add(id);
|
||||
prmUsgaFacility.StatusCat = SaxGolfUsgaFacility.StatusCat.Any;
|
||||
return GetUsgaFacility(prmUsgaFacility);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidUsgaFacility(SaxGolfUsgaFacility usgaFacility)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (usgaFacility == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidUsgaFacilityData(usgaFacility.GetData(), new SaxGolfUsgaFacility.ErrField());
|
||||
}
|
||||
public virtual bool IsValidUsgaFacilityData(SaxGolfUsgaFacility.Data data, SaxGolfUsgaFacility.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Province.
|
||||
if (errField.ProvinceId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.ProvinceId))
|
||||
{
|
||||
errField.ProvinceId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Province must be specified");
|
||||
}
|
||||
// Facility code.
|
||||
if (errField.FacilityId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.FacilityId))
|
||||
{
|
||||
errField.FacilityId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Facility Id must be specified");
|
||||
}
|
||||
// Facility name.
|
||||
if (errField.FacilityName != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.FacilityName, "name", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_FacilityName), true))
|
||||
{
|
||||
errField.FacilityName = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_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.UsgaFacility_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SaxGolfUsgaFacility.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Associated data - ignore for deleted items.
|
||||
if (!data.IsStatusDeleted)
|
||||
{
|
||||
|
||||
// Province.
|
||||
if (errField.ProvinceId != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.ProvinceId))
|
||||
{
|
||||
SaxGolfUsgaProvince.Params prmProvince = new SaxGolfUsgaProvince.Params();
|
||||
prmProvince.IdsIncluded.Add(data.ProvinceId);
|
||||
prmProvince.StatusCat = SaxGolfUsgaProvince.StatusCat.NotDeleted;
|
||||
if (ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince) < 1)
|
||||
{
|
||||
errField.ProvinceId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid province specified");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item database interface.
|
||||
public abstract bool InsertUsgaFacility(SaxGolfUsgaFacility usgaFacility, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateUsgaFacility(SaxGolfUsgaFacility usgaFacility, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool UsgaFacilityCanBeDeleted(SaxGolfUsgaFacility usgaFacility)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteUsgaFacility(SaxGolfUsgaFacility usgaFacility, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Bulk updates.
|
||||
public class UsgaFacilityData
|
||||
{
|
||||
public String ProvinceCode { get; set; }
|
||||
public SysId FacilityId { get; set; }
|
||||
public String FacilityName { get; set; } = null;
|
||||
}
|
||||
/// <summary>
|
||||
/// Bulk update USGA Facilities.
|
||||
/// <para>- Province code must be supplied to identify parent.</para>
|
||||
/// <para>- Facility 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 BulkUpdateUsgaFacilities(List<UsgaFacilityData> facilities, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetUsgaFacilityColumnDfn(SaxGolfUsgaFacility.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetUsgaFacilityQueryFilter(SaxGolfUsgaFacility.Params prmUsgaFacility);
|
||||
public abstract long GetUsgaFacilityCount(SaxGolfUsgaFacility.Params prmUsgaFacility);
|
||||
public abstract List<SaxGolfUsgaFacility> GetUsgaFacilityList(SaxGolfUsgaFacility.Params prmUsgaFacility);
|
||||
public abstract DbResultSet ExecuteUsgaFacilityQuery(List<ColumnDfn> columns, SaxGolfUsgaFacility.Params prmUsgaFacility);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <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 GetUsgaFacilityDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxGolfUsgaFacility.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// Notes.
|
||||
case SaxGolfUsgaFacility.Column.Notes:
|
||||
{
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Status.
|
||||
case SaxGolfUsgaFacility.Column.Status_Desc:
|
||||
case SaxGolfUsgaFacility.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SaxGolfUsgaFacility.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||
else if (column.Id == (int)SaxGolfUsgaFacility.Column.Status_Ind)
|
||||
value = new DataValue(SaxGolfUsgaFacility.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
default:
|
||||
value = values.GetValue(column.DataName);
|
||||
break;
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
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 Marker
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxGolfUsgaMarker CreateUsgaMarker(SysId courseId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool UsgaMarkerExistsById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SaxGolfUsgaMarker.Params prmUsgaMarker = new SaxGolfUsgaMarker.Params();
|
||||
prmUsgaMarker.IdsIncluded.Add(id);
|
||||
prmUsgaMarker.StatusCat = SaxGolfUsgaMarker.StatusCat.Any;
|
||||
return GetUsgaMarkerCount(prmUsgaMarker) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxGolfUsgaMarker GetUsgaMarker(SaxGolfUsgaMarker.Params prmUsgaMarker);
|
||||
public SaxGolfUsgaMarker GetUsgaMarkerById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SaxGolfUsgaMarker.Params prmUsgaMarker = new SaxGolfUsgaMarker.Params();
|
||||
prmUsgaMarker.IdsIncluded.Add(id);
|
||||
prmUsgaMarker.StatusCat = SaxGolfUsgaMarker.StatusCat.Any;
|
||||
return GetUsgaMarker(prmUsgaMarker);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidUsgaMarker(SaxGolfUsgaMarker usgaMarker)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (usgaMarker == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidUsgaMarkerData(usgaMarker.GetData(), new SaxGolfUsgaMarker.ErrField());
|
||||
}
|
||||
public virtual bool IsValidUsgaMarkerData(SaxGolfUsgaMarker.Data data, SaxGolfUsgaMarker.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Course.
|
||||
if (errField.CourseId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.CourseId))
|
||||
{
|
||||
errField.CourseId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Course must be specified");
|
||||
}
|
||||
// Marker Id.
|
||||
if (errField.MarkerId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.MarkerId))
|
||||
{
|
||||
errField.MarkerId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Marker Id must be specified");
|
||||
}
|
||||
// Caption.
|
||||
if (errField.Caption != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Caption, "caption", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_Caption), true))
|
||||
{
|
||||
errField.Caption = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Holes.
|
||||
if (errField.Holes != SacsHierarchyItem.ValidValue.Ignore && data.Holes < 1)
|
||||
{
|
||||
errField.HolesCaption = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Holes must be specified");
|
||||
}
|
||||
// Holes caption.
|
||||
if (errField.HolesCaption != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.HolesCaption, "holes caption", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_HolesCaption)))
|
||||
{
|
||||
errField.HolesCaption = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Tee.
|
||||
if (errField.Tee != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Tee, "tee", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_Tee), true))
|
||||
{
|
||||
errField.Tee = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Gender.
|
||||
if (errField.Gender != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Gender, "gender", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_Gender)))
|
||||
{
|
||||
errField.Gender = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Slope Rating.
|
||||
if (errField.SlopeRating != SacsHierarchyItem.ValidValue.Ignore && data.SlopeRating < 1)
|
||||
{
|
||||
errField.SlopeRating = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Slope rating must be specified");
|
||||
}
|
||||
// Par.
|
||||
if (errField.Par != SacsHierarchyItem.ValidValue.Ignore && data.Par < 1)
|
||||
{
|
||||
errField.Par = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Par must be specified");
|
||||
}
|
||||
// Course Rating.
|
||||
if (errField.CourseRating != SacsHierarchyItem.ValidValue.Ignore && data.CourseRating < 1)
|
||||
{
|
||||
errField.CourseRating = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Course rating must be specified");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_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.UsgaMarker_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SaxGolfUsgaMarker.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Associated data - ignore for deleted items.
|
||||
if (!data.IsStatusDeleted)
|
||||
{
|
||||
|
||||
// Course.
|
||||
if (errField.CourseId != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.CourseId))
|
||||
{
|
||||
SaxGolfUsgaCourse.Params prmCourse = new SaxGolfUsgaCourse.Params();
|
||||
prmCourse.IdsIncluded.Add(data.CourseId);
|
||||
prmCourse.StatusCat = SaxGolfUsgaCourse.StatusCat.NotDeleted;
|
||||
if (ReferenceGolfMgr.GetUsgaCourseCount(prmCourse) < 1)
|
||||
{
|
||||
errField.CourseId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid marker specified");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item database interface.
|
||||
public abstract bool InsertUsgaMarker(SaxGolfUsgaMarker usgaMarker, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateUsgaMarker(SaxGolfUsgaMarker usgaMarker, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool UsgaMarkerCanBeDeleted(SaxGolfUsgaMarker usgaMarker)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteUsgaMarker(SaxGolfUsgaMarker usgaMarker, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Bulk updates.
|
||||
public class UsgaMarkerData
|
||||
{
|
||||
public SysId CourseId { get; set; }
|
||||
public SysId MarkerId { 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; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Bulk update USGA Markers.
|
||||
/// <para>- Course Id must be supplied to identify parent.</para>
|
||||
/// <para>- Marker Id must be supplied to act as identifier.</para>
|
||||
/// <para>- Other properties are validated as per merker rules - check error state.</para>
|
||||
/// <para>- Other properties are left as is if null.</para>
|
||||
/// </summary>
|
||||
public abstract bool BulkUpdateUsgaMarkers(List<UsgaMarkerData> markers, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetUsgaMarkerColumnDfn(SaxGolfUsgaMarker.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetUsgaMarkerQueryFilter(SaxGolfUsgaMarker.Params prmUsgaMarker);
|
||||
public abstract long GetUsgaMarkerCount(SaxGolfUsgaMarker.Params prmUsgaMarker);
|
||||
public abstract List<SaxGolfUsgaMarker> GetUsgaMarkerList(SaxGolfUsgaMarker.Params prmUsgaMarker);
|
||||
public abstract DbResultSet ExecuteUsgaMarkerQuery(List<ColumnDfn> columns, SaxGolfUsgaMarker.Params prmUsgaMarker);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <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 GetUsgaMarkerDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxGolfUsgaMarker.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// Notes.
|
||||
case SaxGolfUsgaMarker.Column.Notes:
|
||||
{
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Status.
|
||||
case SaxGolfUsgaMarker.Column.Status_Desc:
|
||||
case SaxGolfUsgaMarker.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SaxGolfUsgaMarker.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||
else if (column.Id == (int)SaxGolfUsgaMarker.Column.Status_Ind)
|
||||
value = new DataValue(SaxGolfUsgaMarker.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
default:
|
||||
value = values.GetValue(column.DataName);
|
||||
break;
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
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 Province
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxGolfUsgaProvince CreateUsgaProvince(SysId countryId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool UsgaProvinceExistsById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SaxGolfUsgaProvince.Params prmUsgaProvince = new SaxGolfUsgaProvince.Params();
|
||||
prmUsgaProvince.IdsIncluded.Add(id);
|
||||
prmUsgaProvince.StatusCat = SaxGolfUsgaProvince.StatusCat.Any;
|
||||
return GetUsgaProvinceCount(prmUsgaProvince) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxGolfUsgaProvince GetUsgaProvince(SaxGolfUsgaProvince.Params prmUsgaProvince);
|
||||
public SaxGolfUsgaProvince GetUsgaProvinceById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SaxGolfUsgaProvince.Params prmUsgaProvince = new SaxGolfUsgaProvince.Params();
|
||||
prmUsgaProvince.IdsIncluded.Add(id);
|
||||
prmUsgaProvince.StatusCat = SaxGolfUsgaProvince.StatusCat.Any;
|
||||
return GetUsgaProvince(prmUsgaProvince);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidUsgaProvince(SaxGolfUsgaProvince usgaProvince)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (usgaProvince == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidUsgaProvinceData(usgaProvince.GetData(), new SaxGolfUsgaProvince.ErrField());
|
||||
}
|
||||
public virtual bool IsValidUsgaProvinceData(SaxGolfUsgaProvince.Data data, SaxGolfUsgaProvince.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Country.
|
||||
if (errField.CountryId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.CountryId))
|
||||
{
|
||||
errField.CountryId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Country must be specified");
|
||||
}
|
||||
// Province code.
|
||||
if (errField.ProvinceCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ProvinceCode, "code", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceCode), true))
|
||||
{
|
||||
errField.ProvinceCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// ENT Province code.
|
||||
if (errField.EntProvinceCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.EntProvinceCode, "ENT code", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_EntProvinceCode), true))
|
||||
{
|
||||
errField.EntProvinceCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Province name.
|
||||
if (errField.ProvinceName != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ProvinceName, "name", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceName), true))
|
||||
{
|
||||
errField.ProvinceName = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_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.UsgaProvince_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SaxGolfUsgaProvince.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Associated data - ignore for deleted items.
|
||||
if (!data.IsStatusDeleted)
|
||||
{
|
||||
|
||||
// Country.
|
||||
if (errField.CountryId != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.CountryId))
|
||||
{
|
||||
SaxGolfUsgaCountry.Params prmCountry = new SaxGolfUsgaCountry.Params();
|
||||
prmCountry.IdsIncluded.Add(data.CountryId);
|
||||
prmCountry.StatusCat = SaxGolfUsgaCountry.StatusCat.NotDeleted;
|
||||
if (ReferenceGolfMgr.GetUsgaCountryCount(prmCountry) < 1)
|
||||
{
|
||||
errField.CountryId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid country specified");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item database interface.
|
||||
public abstract bool InsertUsgaProvince(SaxGolfUsgaProvince usgaProvince, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateUsgaProvince(SaxGolfUsgaProvince usgaProvince, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool UsgaProvinceCanBeDeleted(SaxGolfUsgaProvince usgaProvince)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteUsgaProvince(SaxGolfUsgaProvince usgaProvince, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Bulk updates.
|
||||
public class UsgaProvinceData
|
||||
{
|
||||
public String CountryCode { get; set; }
|
||||
public String ProvinceCode { get; set; }
|
||||
public String EntProvinceCode { get; set; } = null;
|
||||
public String ProvinceName { get; set; } = null;
|
||||
}
|
||||
/// <summary>
|
||||
/// Bulk update USGA Provinces.
|
||||
/// <para>- Country code must be supplied to identify parent.</para>
|
||||
/// <para>- Province code 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 BulkUpdateUsgaProvinces(List<UsgaProvinceData> provinces, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetUsgaProvinceQueryFilter(SaxGolfUsgaProvince.Params prmUsgaProvince);
|
||||
public abstract long GetUsgaProvinceCount(SaxGolfUsgaProvince.Params prmUsgaProvince);
|
||||
public abstract List<SaxGolfUsgaProvince> GetUsgaProvinceList(SaxGolfUsgaProvince.Params prmUsgaProvince);
|
||||
public abstract DbResultSet ExecuteUsgaProvinceQuery(List<ColumnDfn> columns, SaxGolfUsgaProvince.Params prmUsgaProvince);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <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 GetUsgaProvinceDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxGolfUsgaProvince.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// Notes.
|
||||
case SaxGolfUsgaProvince.Column.Notes:
|
||||
{
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Status.
|
||||
case SaxGolfUsgaProvince.Column.Status_Desc:
|
||||
case SaxGolfUsgaProvince.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SaxGolfUsgaProvince.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||
else if (column.Id == (int)SaxGolfUsgaProvince.Column.Status_Ind)
|
||||
value = new DataValue(SaxGolfUsgaProvince.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
default:
|
||||
value = values.GetValue(column.DataName);
|
||||
break;
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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.Mgr.Reference
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract partial class SaxReferenceGolfMgr : SaxItemMgr_Reference
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
protected SaxReferenceGolfMgr(SaxSessionContext sessionContext, SaxInternals internals) :
|
||||
base(sessionContext, internals)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -6,6 +6,8 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Proc.Excel;
|
||||
using Saxonite.Net.Standard.Base.Mgr.Reference;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Procs
|
||||
{
|
||||
@@ -16,9 +18,9 @@ namespace Saxonite.Net.Standard.Base.Procs
|
||||
// Definitions.
|
||||
public new class Config : SaProcess.Config
|
||||
{
|
||||
protected Config(SaxSessionContext sessionContext) : base()
|
||||
protected Config(SaxSessionContext sessionContext, DbUpdateInfo dbUpdateInfo) : base(dbUpdateInfo)
|
||||
{
|
||||
SessionContext = sessionContext;
|
||||
this.SessionContext = sessionContext;
|
||||
}
|
||||
public SaxSessionContext SessionContext { get; }
|
||||
}
|
||||
@@ -52,6 +54,7 @@ namespace Saxonite.Net.Standard.Base.Procs
|
||||
public SaxAccountMgr AccountMgr { get { return Internals.AccountMgr; } }
|
||||
public SaxActivityMgr ActivityMgr { get { return Internals.ActivityMgr; } }
|
||||
public SaxItemDataMgr ItemDataMgr { get { return Internals.ItemDataMgr; } }
|
||||
public SaxReferenceGolfMgr ReferenceGolfMgr { get { return Internals.ReferenceGolfMgr; } }
|
||||
public SaxSupportMgr SupportMgr { get { return Internals.SupportMgr; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
"Location": "MsSql:Sarand110\\SQL2016.Saxonite_Support_Dev",
|
||||
"User": "saxonite",
|
||||
"Password": "sax-dev-2021"
|
||||
},
|
||||
"Reference": {
|
||||
"Location": "MsSql:Sarand110\\SQL2016.Saxonite_Reference_Dev",
|
||||
"User": "saxonite",
|
||||
"Password": "sax-dev-2021"
|
||||
}
|
||||
},
|
||||
"Email": {
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
"User": "sax-demo-user",
|
||||
"Password": "sax-demo-202105"
|
||||
},
|
||||
"Reference": {
|
||||
"Location": "MsSql:.\\SQL2016Exp.Saxonite_Reference_Demo",
|
||||
"User": "sax-demo-user",
|
||||
"Password": "sax-demo-202105"
|
||||
},
|
||||
"Support": {
|
||||
"Location": "MsSql:.\\SQL2016Exp.Saxonite_Support_Demo",
|
||||
"User": "sax-demo-user",
|
||||
|
||||
Reference in New Issue
Block a user