v1.3.0 Restructure Saxonite workspace and upgrade to .NET 10 (#1)

Move Saxonite’s projects into a dedicated `Workspace` folder and align the solution with .NET 10 and the current Common workspace. Update encryption integration, test project structure and coverage, and repository guidance and upgrade notes.

- Relocate application and library projects while retaining Git rename history.
- Split tests into Admin, Online, and Shared projects; add representative behavioral and serialization tests.
- Update Common integration, application version, and repository documentation.

Application version: 1.3.0

Reviewed-on: #1
Co-authored-by: andy <andy@sarand.com>
This commit was merged in pull request #1.
This commit is contained in:
2026-10-16 18:24:16 +01:00
committed by andy
parent 2c3fb146ab
commit 9f22b522df
1996 changed files with 1992 additions and 1179 deletions
@@ -0,0 +1,202 @@
using Sarand.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
using System.Text;
namespace Saxonite.Net.Standard.Base.App
{
//=======================================================================
// S A X S y s t e m - C o n f i g
//=======================================================================
static partial class Sax
{
//-------------------------------------------------------------------
// Application configuration defaults.
public static class Config
{
public static String Context_Defaults { get; } = "Defaults";
public static class Security
{
public static class Password
{
}
public static class Activation
{
public static int EmailLinkExpiresMins_Default { get; } = 60 * 6;
public static int EmailLinkExpiresMins_Min { get; } = 30;
public static int EmailLinkExpiresMins_Max { get; } = 60 * 24;
}
public static class SignIn
{
public static class PasswordRequest
{
public static int EmailLinkExpiresMins_Default { get; } = 60 * 3;
public static int EmailLinkExpiresMins_Min { get; } = 30;
public static int EmailLinkExpiresMins_Max { get; } = 60 * 24;
}
public static class KeepLoggedIn
{
public static bool Allowed_Default { get; } = true;
public static int CookieExpiresDays_Default { get; } = 10;
public static int CookieExpiresDays_Min { get; } = 1;
public static int CookieExpiresDays_Max { get; } = 30;
}
}
}
public static class User
{
public static class Image
{
// Physical image maximum dimensions - reduced on upload.
public static ushort WidthMax { get; } = 240;
public static ushort HeightMax { get; } = 320;
// Maximum image display dimensions - organisation list.
public static ushort DisplayWidthMax_List { get; } = 48;
public static ushort DisplayHeightMax_List { get; } = 48;
// Maximum image display dimensions - organisation edit etc.
public static ushort DisplayWidthMax_Item { get; } = 96;
public static ushort DisplayHeightMax_Item { get; } = 96;
}
}
public static class Organisation
{
public static class Logo
{
// Physical image maximum dimensions - reduced on upload.
public static ushort WidthMax { get; } = 240;
public static ushort HeightMax { get; } = 240;
// Maximum image display dimensions - organisation list.
public static ushort DisplayWidthMax_List { get; } = 48;
public static ushort DisplayHeightMax_List { get; } = 48;
// Maximum image display dimensions - organisation edit etc.
public static ushort DisplayWidthMax_Item { get; } = 96;
public static ushort DisplayHeightMax_Item { get; } = 96;
}
}
public static class Activities
{
public static class Thumbnail
{
// Maximum image display dimensions - activity list (eg. Online Home page).
public static ushort DisplayWidthMax_List { get; } = 180;
public static ushort DisplayHeightMax_List { get; } = 120;
}
}
public static class Articles
{
public static class Segments
{
public static ushort Max { get; } = 12;
public static ushort CharsMax { get; } = 8000;
}
public static class Images
{
// Physical image maximum dimensions - reduced on upload.
public static ushort WidthMax { get; } = 800;
public static ushort HeightMax { get; } = 640;
}
public static ushort PublishMaxDaysBefore { get; } = 7;
public static ushort PublishMaxDaysAhead { get; } = 10;
}
public class Online
{
public static class Session
{
public static class Cookie
{
/// <summary>Default cookie name: '.AspNetCore.Session'</summary>
public static String Name { get; } = "Saxonite.Online.Session";
public static bool HttpOnly { get; } = true;
public static TimeSpan IdleTimeout { get; } = SacsSystem.DebugMode ? TimeSpan.FromMinutes(5) : TimeSpan.FromMinutes(60);
public static long RememberMeTimeoutMilis { get; } = (long)(SacsSystem.DebugMode ? TimeSpan.FromMinutes(1) : TimeSpan.FromMinutes(15)).TotalMilliseconds;
}
public static class DataCommit
{
public static class IntervalSecs
{
public static int Initial { get; } = SacsSystem.DebugMode ? 10 : 10;
public static int DataWaiting { get; } = SacsSystem.DebugMode ? 1 : 2;
public static int NoDataWaiting { get; } = SacsSystem.DebugMode ? 5 : 10;
}
}
}
public static class DataCache
{
public static class RefreshIntervalSecs
{
public static int Initial { get; } = SacsSystem.DebugMode ? 2 : 5;
public static int Periodic { get; } = SacsSystem.DebugMode ? 120 : 1800;
}
}
public static class Search
{
public static class Users
{
public static ushort PageLengthDefault { get; } = 8;
public static ushort PageLengthMax { get; } = 20;
}
public static class Organisations
{
public static ushort PageLengthDefault { get; } = 8;
public static ushort PageLengthMax { get; } = 20;
}
}
}
public class Api
{
public static class Session
{
public static class Cookie
{
/// <summary>Default cookie name: '.AspNetCore.Session'</summary>
public static String Name { get; } = "Saxonite.Api.Session";
public static bool HttpOnly { get; } = true;
public static TimeSpan IdleTimeout { get; } = SacsSystem.DebugMode ? TimeSpan.FromMinutes(5) : TimeSpan.FromMinutes(15);
public static long KeepLoggedInTimeoutMillis { get; } = (long)(SacsSystem.DebugMode ? TimeSpan.FromMinutes(1) : TimeSpan.FromMinutes(5)).TotalMilliseconds;
}
}
}
public class Admin
{
public static class Session
{
public static class Cookie
{
/// <summary>Default cookie name: '.AspNetCore.Session'</summary>
public static String Name { get; } = "Saxonite.Admin.Session";
public static bool HttpOnly { get; } = true;
public static TimeSpan IdleTimeout { get; } = SacsSystem.DebugMode ? TimeSpan.FromMinutes(5) : TimeSpan.FromMinutes(15);
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 ? 8 : 12;
public static int HoursBetweenCountryLookup { get; set; } = SacsSystem.DebugMode ? 24 : 24 * 5;
}
}
}
}
public static class Links
{
public static class Targets
{
public static String Website { get; } = "sax-lnk-web";
public static String Wikipedia { get; } = "sax-lnk-wikip";
public static String Facebook { get; } = "sax-lnk-fbook";
public static String Twitter { get; } = "sax-lnk-twit";
public static String Instagram { get; } = "sax-lnk-insta";
public static String LinkedIn { get; } = "sax-lnk-lnkin";
public static String Article { get; } = "sax-art-lnk";
}
}
}
//-------------------------------------------------------------------
}
}
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Saxonite.Net.Standard.Base.App
{
//=======================================================================
static partial class Sax
{
//-------------------------------------------------------------------
public enum Sport
{
Baseball,
Basketball,
Dodgeball,
RugbyUnion,
RugbyLeague,
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,149 @@
using Microsoft.Extensions.Logging;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Saxonite.Net.Standard.Base.App
{
//=======================================================================
static partial class Sax
{
//-------------------------------------------------------------------
// Application version.
//-------------------------------------------------------------------
public static class Version
{
private static String version { get; } = "1.3.0.0";
// Retrieve version.
public static String GetFullVersion () { return version; }
public static String GetAppVersion ()
{
if (!SaxSystem.DebugMode)
{
try
{
// Live instance version is only first 3 elements.
String[] versionElements = version.Split('.');
return String.Join(".", versionElements.Take(3));
}
catch (Exception exc) { SaLogger.Warn("Sax.Version.GetAppVersion " + ExceptionUtil.GetErrorStateMessage(exc)); }
}
return version;
}
}
//-------------------------------------------------------------------
// Version history.
//-------------------------------------------------------------------
// 1.2.11 6-Jul-2023
// - Organisation associations, admin download. [Feb24]
// - Basic Api app. [Apr24]
// - Admin Database and logs pages evolved. [May24]
// - Online events upgraded. [Aug24]
// 1.2.10 11-Oct-2022
// - Online organisations display issue fixed.
// - User Sport 'Preparing' options.
// - User reports.
// 1.2.9 12-Oct-2022
// - Online Sports Experience update bug resolved.
// - Sports Experience Awards.
// - Profile Sports and Organisations on separate pages.
// - User Eligibility.
// 1.2.8 16-Jul-2022 Online Organisations - Select Region
// - Fix problem with selecting organisation region.
// - Admin - Organisation associations, in progress.
// 1.2.7 9-Jun-2022 Online Activity list images
// - Organisation logo and article thumbnail in article list.
// 1.2.6 16-May-2022 Image resizing
// - Profile and article images resized to maximum width/height.
// - Organisation About and Facilities properties.
// - Online profile and search organisation contact methods.
// - Admin organisation address.
// 1.2.5 20-Apr-2022 Article feedback
// - Online Activity/Article feedback 5 stars, summary on Article list/popup.
// - Online Activity filter.
// - Admin - User - Sports listed.
// 1.2.4 3-Mar-2022 View own articles.
// - Online Home page lists own articlesregardless of sport/region.
// - Admin System Database Table info.
// 1.2.3 16-Feb-2022 User online activity.
// - Record user last online.
// - Online Organisation category select - remove Partner/Other.
// - Online Article edit - clear publication on add, future publication.
// - Admin Users - region selection.
// 1.2.2 8-Dec-2021 Online Activities.
// - Organisation Events.
// 1.2.1 20-Nov-2021 Online Profile.
// - Online Organisation edit.
// 1.2.0 1-Nov-2021 'Admin' Organisation role
// - 'Admin' Organisation role
// - Azure App Service configuration.
// 1.1.8 21-Oct-2021 Online Users Search
// - Online Search - Users.
// - Admin Account Users filter.
// 1.1.7 14-Oct-2021 Online Organisation Search
// - Online Profile Sport About & snags.
// - Online Organisation Search.
// - Admin Awaiting item counts on home page.
// 1.1.6 19-Sep-2021 Online profile.
// - Online burger menus - all menus with icons.
// - Online Profile - About.
// - Sport specific speciality label.
// 1.1.5 19-Aug-2021 Profile Sport Experience.
// - Online Profile Sport Experience.
// 1.1.4 9-Aug-2021 Organisation Articles.
// - Journalist Article renamed Article and Organisation Id added.
// - Online Organisation Articles. Contact Gender & DOB.
// - Admin Send Emails for User.
// 1.1.3 23-Jul-2021 Online Members.
// - Online Members.
// - Admin organisation activation.
// 1.1.2 10-Jul-2021 Organisation Request.
// - Online Organisation Request.
// - Admin data maintenance paging, organisations filter.
// 1.1.1 2-Jul-2021 Add User fix.
// - Admin fix Internals Region cache issue on null value.
// - Optional user title.
// 1.1.0 25-Jun-2021 Article publication. Admin Regions.
// - Online Articles publication date and paging.
// - Admin Region paging and parent selection.
// 1.0.9 22-Jun-2021 Journalist Articles
// - Online Article Images.
// 1.0.8 15-Jun-2021 Online Article Content
// - Journalist Articles styled content.
// - Online home page click through activity for details with reaction.
// 1.0.7 8-Jun-2021 Online Activities & Profile
// - Style Online Activities by type.
// - Profile Contact Image upload.
// 1.0.6 2-Jun-2021 Online Profile
// - Refresh Online Session with profile region and sport changes.
// - Profile Sport - participation and officiating dropdowns.
// 1.0.5 31-May-2021 Activity Index
// - Admin Database Schema (Home) and Tables page.
// - Online Account country, Home activities.
// 1.0.4 20-May-2021 Online profile sports & opportunities
// - Admin Organisation Region & Sport.
// - Online Profile Sports - simple list with name.
// - Online Organisation Opportunities.
// 1.0.3 11-May-2021 Admin Organisation Members
// - Admin data filters & styling, organisation members.
// - Online Profile Organisations - simple list with name.
// - Online region and sport popups sorted and OK working.
// 1.0.2 6-May-2021 Online bug fix.
// - Resolve Online region & sport popup issue.
// 1.0.1 4-May-2021 Demo test #2.
// - Admin Form styling. Fixed: Create User, Request Password.
// - Online Security forms, Profile - Contact.
// 1.0.0 3-May-2021 Initial demo test version.
// - Admin/Online security.
// - Admin Users, Organisations, Regions, Sports
// - Online Journalist Articles (header).
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,479 @@
using Sarand.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
using System.Text;
namespace Saxonite.Net.Standard.Base.App
{
//=======================================================================
public static partial class Sax
{
//-------------------------------------------------------------------
/// <summary>
/// Code types (static lists).
/// <para>Defined by the underlying system and available for use throughout any application.</para>
/// <para>Only maintainable by updates to the software, ie. not held on the database.</para>
/// </summary>
public enum CodeType
{
YesNo,
DataItemType,
Gender,
SportGrouping,
SportSpecialityLabel,
SportContactType,
SportParticipating,
SportPreparing,
SportOfficiating,
RegionType,
EligibilityType,
UserRole,
Title,
ImageType,
OrganisationType,
OrganisationCategory,
OrganisationRole,
AssociationType,
AddressType,
ContactMethod,
EventType,
OpportunityType,
ActivityReaction,
// Support.
UserReportType,
SupportItemProcessType
};
//-------------------------------------------------------------------
public enum Application
{
Online = 100,
Api = 400,
Admin = 900,
}
//-------------------------------------------------------------------
public enum Environment
{
Development = 0,
Staging = 50,
Production = 90,
}
//-------------------------------------------------------------------
public enum InstanceType
{
Prod,
UAT,
QC,
Dev
}
//-------------------------------------------------------------------
public enum Database
{
Unknown = 0,
Core = 10,
Reference = 20,
Support = 90,
}
//-------------------------------------------------------------------
/// <summary>Yes or No option.</summary>
public enum YesNo
{
Unknown = 0,
Yes,
No
}
//-------------------------------------------------------------------
public enum DataItemType
{
Unknown = 0,
/* Do not change the numeric values - tied to database. */
// Reference data.
Region = 10,
Sport = 11,
// Accounts.
UserAccount = 100,
UserRole = 101,
UserOrganisation = 102,
UserSport = 103,
UserSportExperience = 104,
UserEligibility = 105,
Organisation = 120,
// Activity data.
ActivityIndex = 200,
UserActivity = 202,
Article = 210,
OrganisationOpportunity = 220,
OrganisationEvent = 225,
// Item link components.
ItemImage = 400,
ItemAddress = 405,
ItemAssociation = 410,
ItemSport = 420,
// Reference.
Golf_UsgaCountry = 1000,
Golf_UsgaProvince = 1001,
Golf_UsgaFacility = 1002,
Golf_UsgaCourse = 1003,
Golf_UsgaMarker = 1004,
// Support.
UserReport = 9010,
SupportItemProcess = 9020,
}
//-------------------------------------------------------------------
public enum Gender
{
Unknown = 0,
/* Do not change the numeric values - tied to database. */
Female = 1,
Male = 2,
TransFemale = 10,
TransMale = 11,
Nonconforming = 20,
PreferNotToSay = 99,
}
//-------------------------------------------------------------------
public enum RegionType
{
Unknown = 0,
/* Do not change the numeric values - tied to database. */
Universe = 1,
Galaxy = 2,
World = 5,
Continent = 10,
SubContinent = 20,
/// <summary>Country - self-governing political entity, eg. Country, State (not US state)</summary>
Country = 30,
/// <summary>Nation, eg. Home Nation.</summary>
Nation = 50,
/// <summary>STate - major subdivision of country, eg. US state.</summary>
State = 70,
/// <summary>Province - eg. GB County.</summary>
Province = 90
}
//-------------------------------------------------------------------
public enum EligibilityType
{
Unknown = 0,
/* Do not change the numeric values - tied to database. */
Birth = 10,
Naturalised = 20,
Parent = 100,
Grandparent = 110,
Passport = 200,
Visa = 210,
}
//-------------------------------------------------------------------
/// <summary>User Config</summary>
public enum UserConfigType
{
/* Do not change the values - tied to database. */
Online_Profile = 100,
}
//-------------------------------------------------------------------
/// <summary>User roles</summary>
public enum UserRole
{
Unknown = 0,
/* Do not change the values - tied to database. */
Journalist,
SystemAdmin,
SystemReviewer,
}
//-------------------------------------------------------------------
/// <summary>Sport Grouping</summary>
public enum SportGrouping
{
/* Do not change the values/codes - tied to database. */
Specific = 10,
Banner = 20,
Group = 30,
}
//-------------------------------------------------------------------
/// <summary>Sport Speciality Label</summary>
public enum SportSpecialityLabel
{
Default = 0,
/* Do not change the values/codes - tied to database. */
Positon = 10,
Discipline = 20,
NotRelevant = 90,
}
//-------------------------------------------------------------------
/// <summary>Sport Contact Type</summary>
public enum SportContactType
{
Unknown = 0,
/* Do not change the values/codes - tied to database. */
Coach = 100,
Manager = 200,
Agent = 300,
}
//-------------------------------------------------------------------
/// <summary>Sport Participating</summary>
public enum SportParticipating
{
Unknown = 0,
/* Do not change the values/codes - tied to database. */
Professional = 100,
Regular = 200,
Occasional = 300,
Spectator = 400,
Interested = 900,
}
//-------------------------------------------------------------------
/// <summary>Sport Preparing</summary>
public enum SportPreparing
{
Unknown = 0,
/* Do not change the values/codes - tied to database. */
Coach = 100,
Manager = 200,
Agent = 300,
}
//-------------------------------------------------------------------
/// <summary>Sport Officiating</summary>
public enum SportOfficiating
{
Unknown = 0,
/* Do not change the values/codes - tied to database. */
Professional = 100,
Regular = 200,
Occasional = 300,
Interested = 900,
}
//-------------------------------------------------------------------
/// <summary>Titles - for Contact details.</summary>
public enum Title
{
Unknown = 0,
Mr,
Mrs,
Miss,
Mx,
Dr,
Sir,
Madam,
Lord,
Lady
}
//-------------------------------------------------------------------
/// <summary>Image Types.</summary>
public enum ImageType
{
Unknown,
/// <summary>User's profile image.</summary>
Avatar = 100,
/// <summary>User's profile image, uploaded awaiting confirmation.</summary>
Avatar_Upload = 101,
/// <summary>Organisation's main logo.</summary>
OrganisationLogo = 120,
/// <summary>Organisation's main logo, uploaded awaiting confirmation.</summary>
OrganisationLogo_Upload = 121,
/// <summary>Article image.</summary>
Article = 200,
/// <summary>Article image uploaded, awaiting confirmation.</summary>
Article_Upload = 201,
}
//-------------------------------------------------------------------
/// <summary>Organisation Types.</summary>
public enum OrganisationType
{
Unknown = 0,
/* Do not change the names/codes - tied to database. */
Commercial,
SocialEnterprise,
CommunityGroup,
Charity,
PublicSector,
}
//-------------------------------------------------------------------
/// <summary>Organisation Category.</summary>
public enum OrganisationCategory
{
Unknown = 0,
/* Do not change the names/codes - tied to database. */
Association,
Club,
Society,
Education,
SportDepartment,
Syndicate,
/// <summary>Commercial partner</summary>
Partner,
/// <summary>Other</summary>
Other,
}
//-------------------------------------------------------------------
/// <summary>Organisation roles</summary>
public enum OrganisationRole
{
Unknown = 0,
/* Do not change the values/codes - tied to database. */
Member,
Admin,
MemberAdmin,
ScheduleAdmin,
OpportunityAdmin,
ArticleAdmin,
}
//-------------------------------------------------------------------
// Associations.
/// <summary>
/// <u><b>Association type.</b></u>
/// <br>- Affiliate - parent-child relationship.</br>
/// <br>- Partner - equal sided relationship.</br>
/// </summary>
public enum AssociationType
{
Unknown = 0,
/* Do not change the numeric values - tied to database. */
/// <summary>'To' Affiliated to 'From' item. From/To: Organisation.</summary>
Affiliate = 10,
/// <summary>Partner items. From/To: Organisation.</summary>
Partner = 20,
}
/// <summary>
/// Association type option.
/// <br>- Encompasses association type and 'direction' from the perspective of one of the organisations.</br>
/// <br>- Affiliate relationship is either from the parent or to the child.</br>
/// <br>- Partner relationships are directionless.</br>
/// </summary>
public enum AssociationTypeOption
{
Unknown = 0,
AffiliateParent,
AffiliateChild,
Partner,
}
//-------------------------------------------------------------------
public enum AddressType
{
Unknown = 0,
/* Do not change the numeric values - tied to database. */
Location = 10,
Home = 20,
Office = 50,
Delivery = 60,
}
//-------------------------------------------------------------------
public enum ContactMethodType
{
Unknown,
Phone,
Email,
WebUrl,
}
//-------------------------------------------------------------------
public enum ContactMethod
{
Unknown = 0,
/* Do not change the numeric values or names - tied to database. */
PhoneMain = 10,
PhoneMobile = 20,
PhoneHome = 30,
PhoneOffice = 40,
// Online.
Email = 100,
Website = 200,
Wikipedia = 210,
Location = 220,
// Social media.
LinkedIn = 300,
Twitter = 310,
Facebook = 320,
Instagram = 330,
YouTube = 340,
Twitch = 350,
}
//-------------------------------------------------------------------
/// <summary>Event Type</summary>
public enum EventType
{
Unknown = 0,
/* Do not change the values or codes - tied to database. */
Playing,
Training,
Organisation,
Social,
}
//-------------------------------------------------------------------
/// <summary>Opportunity Type</summary>
public enum OpportunityType
{
Unknown = 0,
/* Do not change the values or codes - tied to database. */
Playing,
Official,
Coaching,
Volunteer,
Staff,
Board,
}
//-------------------------------------------------------------------
/// <summary>Activity Reaction</summary>
public enum ActivityReaction
{
Unknown = 0,
/* Do not change the values or codes - tied to database. */
OK = 1,
Good = 2,
VeryGood = 3,
Outstanding = 4,
Exceptional = 5,
}
//-------------------------------------------------------------------
// Support.
//-------------------------------------------------------------------
/// <summary>User Report Type</summary>
public enum UserReportType
{
Unknown = 0,
/* Do not change the values or codes - tied to database. */
Enhancement = 10,
Information = 20,
Bug = 30,
}
/// <summary>Support Item Process Type</summary>
public enum SupportItemProcessType
{
Unknown = 0,
/* Do not change the values or codes - tied to database. */
OrganisationSchedulePopulation = 200,
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,48 @@
using Sarand.Net.Standard.Base.Dbas;
using Saxonite.Net.Standard.Base.Consoles;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
using System.Text;
using Sarand.Net.Standard.Base.Core;
namespace Saxonite.Net.Standard.Base.App
{
//=======================================================================
public abstract class SaxApplication_Base : SacsDisposable
{
//-------------------------------------------------------------------
// Protected construction.
protected SaxApplication_Base()
{
App = this;
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
App = null;
}
}
//-------------------------------------------------------------------
// Globals.
public static SaxApplication_Base App { get; private set; }
public abstract SaxSystem System { get; }
public abstract SaxConsoleHelper ConsoleHelper { get; }
// Database.
public abstract ISacsDatabase GetDatabase(SaxSessionContext sessionContext, Sax.Database databaseType);
public abstract IDatabaseInfo CreateDbInfo(SaxSessionContext sessionContext, Sax.Database databaseType);
// Application instance.
public abstract Sax.InstanceType InstanceType { get; }
public bool IsLiveHost() { return InstanceType == Sax.InstanceType.Prod; }
public bool IsTestHost() { return InstanceType != Sax.InstanceType.Prod; }
public bool IsDevHost() { return InstanceType == Sax.InstanceType.Dev; }
public abstract String EnvironmentName { get; }
// Email configuration.
public abstract SaxEmailConfig EmailConfig { get; }
//-------------------------------------------------------------------
}
//=======================================================================
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,518 @@
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 Tue 27-Aug-2024 19:41:31
//---------------------------------------------------------------------------
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_ProvincesUpdateAt,
UsgaCountry_Notes,
UsgaCountry_Flags,
UsgaCountry_Status,
UsgaCountry_CreateOn,
UsgaCountry_CreateBy,
UsgaCountry_CreateHost,
UsgaCountry_UpdateOn,
UsgaCountry_UpdateBy,
UsgaCountry_UpdateHost,
UsgaCourse_Id,
UsgaCourse_FacilityId,
UsgaCourse_UsgaCourseId,
UsgaCourse_LegacyCrpCourseId,
UsgaCourse_Caption,
UsgaCourse_CourseName,
UsgaCourse_FullName,
UsgaCourse_Address1,
UsgaCourse_Address2,
UsgaCourse_City,
UsgaCourse_PostalCode,
UsgaCourse_Latitude,
UsgaCourse_Longitude,
UsgaCourse_Email,
UsgaCourse_Telephone,
UsgaCourse_MarkersUpdateAt,
UsgaCourse_MarkersData,
UsgaCourse_Notes,
UsgaCourse_Flags,
UsgaCourse_Status,
UsgaCourse_CreateOn,
UsgaCourse_CreateBy,
UsgaCourse_CreateHost,
UsgaCourse_UpdateOn,
UsgaCourse_UpdateBy,
UsgaCourse_UpdateHost,
UsgaFacility_Id,
UsgaFacility_ProvinceId,
UsgaFacility_UsgaFacilityId,
UsgaFacility_FacilityName,
UsgaFacility_Address1,
UsgaFacility_Address2,
UsgaFacility_City,
UsgaFacility_PostalCode,
UsgaFacility_Latitude,
UsgaFacility_Longitude,
UsgaFacility_Email,
UsgaFacility_Telephone,
UsgaFacility_Notes,
UsgaFacility_Flags,
UsgaFacility_Status,
UsgaFacility_CreateOn,
UsgaFacility_CreateBy,
UsgaFacility_CreateHost,
UsgaFacility_UpdateOn,
UsgaFacility_UpdateBy,
UsgaFacility_UpdateHost,
UsgaMarker_Id,
UsgaMarker_CourseId,
UsgaMarker_UsgaMarkerId,
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_CoursesUpdateAt,
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 = 98;
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,"ProvincesUpdateAt",9,93,false,16),
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,"UsgaCourseId",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,"PostalCode",0,-9,false,20),
new ColumnDfn(2,"Latitude",8,3,false,9),
new ColumnDfn(2,"Longitude",8,3,false,9),
new ColumnDfn(2,"Email",0,-9,false,200),
new ColumnDfn(2,"Telephone",0,-9,false,200),
new ColumnDfn(2,"MarkersUpdateAt",9,93,false,16),
new ColumnDfn(2,"MarkersData",0,-9,false,0),
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,"UsgaFacilityId",5,-5,false,19),
new ColumnDfn(3,"FacilityName",0,-9,false,200),
new ColumnDfn(3,"Address1",0,-9,false,200),
new ColumnDfn(3,"Address2",0,-9,false,200),
new ColumnDfn(3,"City",0,-9,false,200),
new ColumnDfn(3,"PostalCode",0,-9,false,20),
new ColumnDfn(3,"Latitude",8,3,false,9),
new ColumnDfn(3,"Longitude",8,3,false,9),
new ColumnDfn(3,"Email",0,-9,false,200),
new ColumnDfn(3,"Telephone",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,"UsgaMarkerId",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,200),
new ColumnDfn(4,"Tee",0,-9,false,200),
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,"CoursesUpdateAt",9,93,false,16),
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",
};
//-------------------------------------------------------------------
}
}
@@ -0,0 +1,376 @@
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 Thu 22-Aug-2024 18:00:17
//---------------------------------------------------------------------------
namespace Saxonite.Base.App
{
public class SaxDbDfn_Support
{
//-------------------------------------------------------------------
// Table identifiers.
public enum TableIdx
{
Unknown = 0,
UserReport,
UserReportComment,
}
//-------------------------------------------------------------------
// Column identifiers.
public enum ColumnIdx
{
Unknown = 0,
UserReport_Id,
UserReport_UserAccountId,
UserReport_ReportType,
UserReport_Title,
UserReport_Report,
UserReport_RecordedOn,
UserReport_ReportData,
UserReport_Notes,
UserReport_Flags,
UserReport_Status,
UserReport_CreateOn,
UserReport_CreateBy,
UserReport_CreateHost,
UserReport_UpdateOn,
UserReport_UpdateBy,
UserReport_UpdateHost,
UserReportComment_Id,
UserReportComment_UserReportId,
UserReportComment_RecordedAt,
UserReportComment_UserAccountId,
UserReportComment_CommentData,
UserReportComment_Notes,
UserReportComment_Flags,
UserReportComment_Status,
UserReportComment_CreateOn,
UserReportComment_CreateBy,
UserReportComment_CreateHost,
UserReportComment_UpdateOn,
UserReportComment_UpdateBy,
UserReportComment_UpdateHost,
}
//-------------------------------------------------------------------
// Data members.
private static readonly int tableCount = 2;
private static readonly int columnCount = 30;
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_Support.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_Support.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("dbo","UserReport"),
new TableDfn("dbo","UserReportComment"),
};
//-------------------------------------------------------------------
// 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,"UserAccountId",4,4,false,10),
new ColumnDfn(1,"ReportType",3,5,false,5),
new ColumnDfn(1,"Title",0,-9,false,1000),
new ColumnDfn(1,"Report",0,-9,false,0),
new ColumnDfn(1,"RecordedOn",9,93,false,16),
new ColumnDfn(1,"ReportData",0,-9,false,0),
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,"UserReportId",5,-5,false,19),
new ColumnDfn(2,"RecordedAt",9,93,false,23),
new ColumnDfn(2,"UserAccountId",4,4,false,10),
new ColumnDfn(2,"CommentData",0,-9,false,0),
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),
};
//-------------------------------------------------------------------
// 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",
};
//-------------------------------------------------------------------
}
}
@@ -0,0 +1,23 @@
using Saxonite.Net.Standard.Base.Consoles;
using System;
using System.Collections.Generic;
using System.Text;
namespace Saxonite.Net.Standard.Base.App
{
//=======================================================================
public static class SaxGlobals
{
//-------------------------------------------------------------------
// System.
public static SaxSystem System { get { return App.System; } }
//-------------------------------------------------------------------
// Application.
public static SaxApplication_Base App { get { return SaxApplication_Base.App; } }
public static SaxConsoleHelper ConsoleHelper { get { return App.ConsoleHelper; } }
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,378 @@
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Saxonite.Net.Standard.Base.Mgr;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
using System.Text;
using Saxonite.Net.Standard.Base.Consoles;
using Saxonite.Net.Standard.Base.Bus;
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
{
//=======================================================================
public class SaxInternals : SacsDisposable
{
//-------------------------------------------------------------------
// Data members.
private class DataMembers
{
public bool useDataCacheConsole;
}
private readonly DataMembers data = new DataMembers();
private class Managers
{
public SaxReferenceMgr referenceMgr = null;
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();
private class Consoles
{
public SaxActivityConsole activityConsole;
public SaxEmailConsole emailConsole;
}
private readonly Consoles con = new Consoles();
//-------------------------------------------------------------------
// Construction.
public SaxInternals(SaxSessionContext sessionContext, bool useDataCacheConsole = true)
{
if (sessionContext == null)
throw new NotSupportedException("Unable to create Internals with invalid session context");
data.useDataCacheConsole = useDataCacheConsole;
System = SaxGlobals.System;
SessionContext = sessionContext;
try
{
// Check for data cache.
// NB Must not do this if Internals constructed by the DataCache console itself as cached data will not be requested from here.
if (useDataCacheConsole)
{
// Inside try..catch as Admin app throws exception on GetDataCacheConsole().
SaxDataCacheConsole dataCacheConsole = SaxGlobals.ConsoleHelper.GetDataCacheConsole(SessionContext);
if (dataCacheConsole != null)
dataCacheConsole.PopulateCachedDataToInternals(this);
}
}
catch (Exception) { }
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (mgr.referenceMgr != null) mgr.referenceMgr.Dispose(); mgr.referenceMgr = null;
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;
}
}
//-------------------------------------------------------------------
// Properties.
public bool DebugMode { get; } = SacsSystem.DebugMode;
public SaxSystem System { get; }
public SaxSessionContext SessionContext { get; }
public ISacsDatabase CoreDatabase { get { return SaxGlobals.App.GetDatabase(SessionContext, Sax.Database.Core); } }
public IDatabaseInfo CreateCoreDbInfo()
{
return SaxGlobals.App.CreateDbInfo(SessionContext, Sax.Database.Core);
}
//-------------------------------------------------------------------
// System codes.
private readonly Dictionary<Sax.CodeType, List<TypeCodeDesc>> codeTypes = new Dictionary<Sax.CodeType, List<TypeCodeDesc>>();
public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
{
if (!codeTypes.ContainsKey(codeType))
codeTypes.Add(codeType, SaxSystem.GetCodesOfType(codeType));
return new List<TypeCodeDesc>(codeTypes[codeType]);
}
public List<TypeCodeDesc> DataItemTypeCodes { get { return GetCodesOfType(Sax.CodeType.DataItemType); } }
public List<TypeCodeDesc> YesNoCodes { get { return GetCodesOfType(Sax.CodeType.YesNo); } }
public List<TypeCodeDesc> GenderCodes { get { return GetCodesOfType(Sax.CodeType.Gender); } }
public List<TypeCodeDesc> SportGroupingCodes { get { return GetCodesOfType(Sax.CodeType.SportGrouping); } }
public List<TypeCodeDesc> SportSpecialityLabelCodes { get { return GetCodesOfType(Sax.CodeType.SportSpecialityLabel); } }
public List<TypeCodeDesc> SportContactTypeCodes { get { return GetCodesOfType(Sax.CodeType.SportContactType); } }
public List<TypeCodeDesc> SportParticipatingCodes { get { return GetCodesOfType(Sax.CodeType.SportParticipating); } }
public List<TypeCodeDesc> SportPreparingCodes { get { return GetCodesOfType(Sax.CodeType.SportPreparing); } }
public List<TypeCodeDesc> SportOfficiatingCodes { get { return GetCodesOfType(Sax.CodeType.SportOfficiating); } }
public List<TypeCodeDesc> RegionTypeCodes { get { return GetCodesOfType(Sax.CodeType.RegionType); } }
public List<TypeCodeDesc> EligibilityTypeCodes { get { return GetCodesOfType(Sax.CodeType.EligibilityType); } }
public List<TypeCodeDesc> UserRoleCodes { get { return GetCodesOfType(Sax.CodeType.UserRole); } }
public List<TypeCodeDesc> OrganisationTypeCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationType); } }
public List<TypeCodeDesc> OrganisationCategoryCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationCategory); } }
public List<TypeCodeDesc> OrganisationRoleCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationRole); } }
public List<TypeCodeDesc> AssociationTypeCodes { get { return GetCodesOfType(Sax.CodeType.AssociationType); } }
public List<TypeCodeDesc> AddressTypeCodes { get { return GetCodesOfType(Sax.CodeType.AddressType); } }
public List<TypeCodeDesc> ContactMethodCodes { get { return GetCodesOfType(Sax.CodeType.ContactMethod); } }
public List<TypeCodeDesc> EventTypeCodes { get { return GetCodesOfType(Sax.CodeType.EventType); } }
public List<TypeCodeDesc> OpportunityTypeCodes { get { return GetCodesOfType(Sax.CodeType.OpportunityType); } }
public List<TypeCodeDesc> ActivityReactionCodes { get { return GetCodesOfType(Sax.CodeType.ActivityReaction); } }
// Support.
public List<TypeCodeDesc> UserReportTypeCodes { get { return GetCodesOfType(Sax.CodeType.UserReportType); } }
public List<TypeCodeDesc> SupportItemProcessTypeCodes { get { return GetCodesOfType(Sax.CodeType.SupportItemProcessType); } }
//-------------------------------------------------------------------
// Consoles.
public SaxConsoleHelper ConsoleHelper { get { return SaxGlobals.App.ConsoleHelper; } }
public SaxDataCacheConsole DataCacheConsole { get { return SaxGlobals.ConsoleHelper.GetDataCacheConsole(SessionContext); } }
public SaxSessionDataConsole SessionDataConsole { get { return SaxGlobals.ConsoleHelper.GetSessionDataConsole(SessionContext); } }
public SaxActivityConsole ActivityConsole { get { if (con.activityConsole == null) con.activityConsole = ConsoleHelper.CreateActivityConsole(SessionContext); return con.activityConsole; } }
public SaxEmailConsole EmailConsole { get { if (con.emailConsole == null) con.emailConsole = ConsoleHelper.CreateEmailConsole(SessionContext); return con.emailConsole; } }
//-------------------------------------------------------------------
// Managers.
public SaxReferenceMgr ReferenceMgr
{
get
{
if (mgr.referenceMgr == null)
mgr.referenceMgr = System.CreateReferenceMgr(SessionContext, this);
return mgr.referenceMgr;
}
}
public SaxAccountMgr AccountMgr
{
get
{
if (mgr.accountMgr == null)
mgr.accountMgr = System.CreateAccountMgr(SessionContext, this);
return mgr.accountMgr;
}
}
public SaxActivityMgr ActivityMgr
{
get
{
if (mgr.activityMgr == null)
mgr.activityMgr = System.CreateActivityMgr(SessionContext, this);
return mgr.activityMgr;
}
}
public SaxItemDataMgr ItemDataMgr
{
get
{
if (mgr.itemDataMgr == null)
mgr.itemDataMgr = System.CreateItemDataMgr(SessionContext, this);
return mgr.itemDataMgr;
}
}
public SaxReferenceGolfMgr ReferenceGolfMgr
{
get
{
if (mgr.referenceGolfMgr == null)
mgr.referenceGolfMgr = System.CreateReferenceGolfMgr(SessionContext, this);
return mgr.referenceGolfMgr;
}
}
public SaxSupportMgr SupportMgr
{
get
{
if (mgr.supportMgr == null)
mgr.supportMgr = System.CreateSupportMgr(SessionContext, this);
return mgr.supportMgr;
}
}
//-------------------------------------------------------------------
// Regions.
// NB Online application caches regions and sports so these may be pre-populated in the Internals.
// Otherwise they are populated on first request.
private readonly Dictionary<SysId, SaxRegion.Data> regionCache = new Dictionary<SysId, SaxRegion.Data>();
private bool regionCacheFullyPopulated = false;
public void PopulateRegionCache(List<SaxRegion.Data> regions)
{
foreach (SaxRegion.Data regionData in regions)
regionCache[regionData.Id] = regionData.Clone();
regionCacheFullyPopulated = true;
//if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}(regions) Regions populated: {regionCache.Count}.");
}
public void RefreshRegionCache()
{
if (regionCacheFullyPopulated) return;
DateTime startedAt = DateTime.Now;
SaxRegion.Params prmRegion = new SaxRegion.Params();
prmRegion.StatusCat = SaxRegion.StatusCat.NotDeleted;
int regionsQueried = 0;
foreach (SaxRegion region in ReferenceMgr.GetRegionList(prmRegion))
{
regionsQueried++;
regionCache[region.Id] = region.GetData();
region.Dispose();
}
regionCacheFullyPopulated = true;
SaLogger.Debug($"{SysUtil.Fn} Regions queried: {regionsQueried}. Regions in cache: {regionCache.Count}. Elapsed: {DateUtil.FormatNumberOfSeconds((DateTime.Now - startedAt).TotalSeconds)}.");
}
private void QueryRegionsToCache(List<SysId> regionsIds)
{
if (regionCacheFullyPopulated) return;
SaxRegion.Params prmRegion = new SaxRegion.Params();
prmRegion.IdsIncluded.AddRange(regionsIds.FindAll(item => SysId.IsValid(item) && !regionCache.ContainsKey(item)));
prmRegion.StatusCat = SaxRegion.StatusCat.NotDeleted;
if (prmRegion.IdsIncluded.Count > 0)
{
// At least one region needs to be retrieved.
DateTime startedAt = DateTime.Now;
int regionsQueried = 0;
foreach (SaxRegion region in ReferenceMgr.GetRegionList(prmRegion))
{
regionsQueried++;
regionCache[region.Id] = region.GetData();
region.Dispose();
}
SaLogger.Debug($"{SysUtil.Fn}(regionIds) Regions queried: {regionsQueried}. Regions in cache: {regionCache.Count}. Elapsed: {DateUtil.FormatNumberOfSeconds((DateTime.Now - startedAt).TotalSeconds)}.");
}
}
public SaxRegion.Data GetRegion(SysId regionId)
{
QueryRegionsToCache(new List<SysId>() { regionId });
return regionCache.GetValue(regionId, null);
}
public List<SaxRegion.Data> GetRegions(List<SysId> regionIds)
{
List<SaxRegion.Data> regions = new List<SaxRegion.Data>();
QueryRegionsToCache(regionIds);
foreach (SysId regionId in regionIds)
{
if (!SysId.IsValid(regionId)) continue;
SaxRegion.Data region = regionCache.GetValue(regionId, null);
if (region != null)
regions.Add(region);
}
return regions;
}
//-------------------------------------------------------------------
// Sports.
// NB Online application caches sports and sports so these may be pre-populated in the Internals.
// Otherwise they are populated on first request.
private readonly Dictionary<SysId, SaxSport.Data> sportCache = new Dictionary<SysId, SaxSport.Data>();
private bool sportCacheFullyPopulated = false;
public void PopulateSportCache(List<SaxSport.Data> sports)
{
foreach (SaxSport.Data sportData in sports)
sportCache[sportData.Id] = sportData.Clone();
sportCacheFullyPopulated = true;
//if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}(sports) Sports populated: {sportCache.Count}.");
}
public void RefreshSportCache()
{
if (sportCacheFullyPopulated) return;
DateTime startedAt = DateTime.Now;
SaxSport.Params prmSport = new SaxSport.Params();
prmSport.StatusCat = SaxSport.StatusCat.NotDeleted;
int sportsQueried = 0;
foreach (SaxSport sport in ReferenceMgr.GetSportList(prmSport))
{
sportsQueried++;
sportCache[sport.Id] = sport.GetData();
sport.Dispose();
}
sportCacheFullyPopulated = true;
SaLogger.Debug($"{SysUtil.Fn} Sports queried: {sportsQueried}. Sports in cache: {sportCache.Count}. Elapsed: {DateUtil.FormatNumberOfSeconds((DateTime.Now - startedAt).TotalSeconds)}.");
}
private void QuerySportsToCache(List<SysId> sportsIds)
{
if (sportCacheFullyPopulated) return;
SaxSport.Params prmSport = new SaxSport.Params();
prmSport.IdsIncluded.AddRange(sportsIds.FindAll(item => SysId.IsValid(item) && !sportCache.ContainsKey(item)));
prmSport.StatusCat = SaxSport.StatusCat.NotDeleted;
if (prmSport.IdsIncluded.Count > 0)
{
// At least one sport needs to be retrieved.
DateTime startedAt = DateTime.Now;
int sportsQueried = 0;
foreach (SaxSport sport in ReferenceMgr.GetSportList(prmSport))
{
sportsQueried++;
sportCache[sport.Id] = sport.GetData();
sport.Dispose();
}
SaLogger.Debug($"{SysUtil.Fn}(sportIds) Sports queried: {sportsQueried}. Sports in cache: {sportCache.Count}. Elapsed: {DateUtil.FormatNumberOfSeconds((DateTime.Now - startedAt).TotalSeconds)}.");
}
}
public SaxSport.Data GetSport(SysId sportId)
{
QuerySportsToCache(new List<SysId>() { sportId });
return sportCache.GetValue(sportId, null);
}
public List<SaxSport.Data> GetSports(List<SysId> sportIds)
{
List<SaxSport.Data> sports = new List<SaxSport.Data>();
QuerySportsToCache(sportIds);
foreach (SysId sportId in sportIds)
{
if (!SysId.IsValid(sportId)) continue;
SaxSport.Data sport = sportCache.GetValue(sportId, null);
if (sport != null)
sports.Add(sport);
}
return sports;
}
//-------------------------------------------------------------------
// Common Data Components
//-------------------------------------------------------------------
// User Accounts.
private readonly Dictionary<SysId, SaxUserAccount> userAccountCache = new Dictionary<SysId, SaxUserAccount>();
public SaxUserAccount GetUserAccount(SysId userAccountId)
{
if (!SysId.IsValid(userAccountId)) return null;
if (!userAccountCache.ContainsKey(userAccountId))
userAccountCache.Add(userAccountId, AccountMgr.GetUserAccountById(userAccountId));
return userAccountCache.GetValue(userAccountId, null);
}
public String GetUserAccountEmailAddress(SysId userAccountId)
{
SaxUserAccount userAccount = GetUserAccount(userAccountId);
return userAccount?.EmailAddress ?? "";
}
public String GetUserAccountDisplayName(SysId userAccountId)
{
SaxUserAccount userAccount = GetUserAccount(userAccountId);
return userAccount?.GetDisplayName() ?? "";
}
//-------------------------------------------------------------------
// User Accounts.
private readonly Dictionary<SysId, SaxOrganisation> organisationCache = new Dictionary<SysId, SaxOrganisation>();
public SaxOrganisation GetOrganisation(SysId organisationId)
{
if (!SysId.IsValid(organisationId)) return null;
if (!organisationCache.ContainsKey(organisationId))
organisationCache.Add(organisationId, AccountMgr.GetOrganisationById(organisationId));
return organisationCache.GetValue(organisationId, null);
}
public String GetOrganisationName(SysId organisationId)
{
SaxOrganisation organisation = GetOrganisation(organisationId);
return organisation?.Name ?? "";
}
public SysId GetOrganisationRegionId(SysId organisationId)
{
SaxOrganisation organisation = GetOrganisation(organisationId);
return organisation?.RegionIdPrimary ?? new SysId();
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,29 @@
using Sarand.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
using System.Text;
namespace Saxonite.Net.Standard.Base.App
{
//=======================================================================
public class SaxSessionContext : SacsSessionContext
{
//-------------------------------------------------------------------
/// <summary>Hidden construction for deserialisation.</summary>
protected SaxSessionContext()
{
}
// Protected construction - use derived object.
protected SaxSessionContext(ushort sessionIdx, Sax.Application application) : base(sessionIdx)
{
Application = application;
}
//-------------------------------------------------------------------
// Properties.
public Sax.Application Application { get; private set; }
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,174 @@
using Newtonsoft.Json;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Saxonite.Net.Standard.Base.Bus;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Sarand.Net.Standard.Base.Utils;
using Newtonsoft.Json.Converters;
using Sarand.Net.Standard.Base.Helpers;
namespace Saxonite.Net.Standard.Base.App
{
//=======================================================================
public abstract class SaxSessionData
{
//-------------------------------------------------------------------
private static long sessionIdxRoot = SacsRandomHelper.GetInt32(1000, 1999);
//-------------------------------------------------------------------
// Construction.
/// <summary>Protected constructor for deserialisation only.</summary>
protected SaxSessionData(long sessionIdx, int itemIdx, SaxSessionContext sessionContext)
{
SessionIdx = sessionIdx;
ItemIdx = itemIdx;
SessionContext = sessionContext;
userData = CreateUserData(SessionContext, null, null);
}
/// <summary>
/// Primary constructor - on user login.
/// <para>SessionContext and UserAccount must be supplied.</para>
/// <para>Roles list is optional.</para>
/// </summary>
protected SaxSessionData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles)
{
SessionIdx = ++sessionIdxRoot;
ItemIdx = 1000;
SessionContext = sessionContext;
userData = CreateUserData(SessionContext, userAccount, userRoles);
}
//-------------------------------------------------------------------
// Properties.
// Session and Item indexers.
public long SessionIdx { get; }
public int ItemIdx { get; private set; }
[JsonIgnore]
public int NextItemIdx { get { return ++ItemIdx; } }
// Session context.
public SaxSessionContext SessionContext { get; }
[JsonIgnore]
public bool ValidUserSession { get { return SysId.IsValid(User.UserAccountId) && SysId.IsValid(User.UserAccountId); } }
[JsonIgnore]
public DbUpdateInfo DbUpdateInfo
{
get
{
return new DbUpdateInfo(User.UserAccountId, StringUtil.OnEmpty(User.DisplayName, User.EmailAddress), SaxSystem.ComputerName);
}
}
//-------------------------------------------------------------------
// User.
public class UserData
{
protected UserData() { }
protected UserData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles)
{
if (userAccount != null)
{
UserAccountId = userAccount.Id;
RefreshUserData(userAccount);
if (sessionContext.Application == Sax.Application.Admin)
{
// Admin 'Keep logged in' recorded against System Admin user role.
SaxUserRole userRole = userRoles.Find(item => item.UserRole == Sax.UserRole.SystemAdmin);
if (userRole != null)
KeepLoggedIn = userRole.KeepLoggedIn;
}
else if (sessionContext.Application == Sax.Application.Online)
// Online 'Keep logged in' recorded against System Admin user role.
KeepLoggedIn = userAccount.KeepLoggedIn;
else Debugger.Break();
if (userRoles != null)
{
foreach (SaxUserRole userRole in userRoles.FindAll(item => item.IsStatusActive))
roles.Add(new RoleData(userRole));
}
}
}
protected UserData(UserData userData)
{
UserAccountId = userData.UserAccountId;
Title = userData.Title;
FirstName = userData.FirstName;
LastName = userData.LastName;
DisplayName = userData.DisplayName;
EmailAddress = userData.EmailAddress;
RegionIdCountry = userData.RegionIdCountry;
RegionIdProvince = userData.RegionIdProvince;
KeepLoggedIn = userData.KeepLoggedIn;
roles.AddRange(userData.Roles);
}
// Properties.
public SysId UserAccountId { get; protected set; }
public String Title { get; protected set; }
public String FirstName { get; protected set; }
public String LastName { get; protected set; }
public String DisplayName { get; protected set; }
public String EmailAddress { get; protected set; }
public SysId RegionIdCountry { get; protected set; }
public SysId RegionIdProvince { get; protected set; }
public bool KeepLoggedIn { get; protected set; }
public bool UserAccountSupplied { get; protected set; }
// Refresh properties.
protected bool RefreshUserData(SaxUserAccount userAccount)
{
// Check that user matches the session.
if (!SysId.IsValid(UserAccountId) || !SysId.IsValid(userAccount?.Id ?? null) || !UserAccountId.Equals(userAccount.Id)) return false;
// Refresh properties.
Title = userAccount.Title;
FirstName = userAccount.FirstName;
LastName = userAccount.LastName;
DisplayName = userAccount.GetDisplayName();
EmailAddress = userAccount.EmailAddress;
RegionIdCountry = userAccount.RegionIdCountry;
RegionIdProvince = userAccount.RegionIdProvince;
return true;
}
// Roles.
public class RoleData
{
public RoleData(SaxUserRole userRole)
{
if (userRole != null)
{
Role = userRole.UserRole;
Status = userRole.Status;
}
}
public Sax.UserRole Role { get; protected set; }
public SaStatus Status { get; protected set; }
}
private readonly List<RoleData> roles = new List<RoleData>();
public List<RoleData> Roles { get { return new List<RoleData>(roles); } protected set { roles.Clear(); roles.AddRange(value); } }
[JsonIgnore]
public bool IsSystemAdmin { get { return roles?.Exists(item => item.Role == Sax.UserRole.SystemAdmin) ?? false; } }
[JsonIgnore]
public bool IsSystemReviewer { get { return roles?.Exists(item => item.Role == Sax.UserRole.SystemReviewer) ?? false; } }
[JsonIgnore]
public bool SupportMenuAllowed { get { return roles?.Exists(item => item.Role == Sax.UserRole.SystemAdmin || item.Role == Sax.UserRole.SystemReviewer) ?? false; } }
[JsonIgnore]
public bool IsJournalist { get { return roles?.Exists(item => item.Role == Sax.UserRole.Journalist) ?? false; } }
}
protected abstract UserData CreateUserData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles);
private UserData userData;
public UserData User { get { return userData; } }
/// <summary>User - JSON deserialisation route.</summary>
protected void SetUser(UserData user)
{
if (this.userData != null && User.UserAccountSupplied)
throw new NotSupportedException("Session User cannot be replaced.");
this.userData = user;
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,329 @@
using Sarand.Net.Standard.Base.Core;
using System;
using System.Collections.Generic;
using System.Text;
namespace Saxonite.Net.Standard.Base.App
{
//=======================================================================
// S A X S y s t e m - C o d e T y p e s
//=======================================================================
partial class SaxSystem
{
//-------------------------------------------------------------------
// Data members.
// Code types.
private static readonly List<TypeCodeDesc> yesNoCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> dataItemTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> genderCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportGroupingCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportSpecialityLabelCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportContactCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportParticipatingCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportPreparingCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportOfficiatingCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> regionTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> eligibilityTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> userRoleCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> titleCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> imageTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> organisationTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> organisationCategoryCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> organisationRoleCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> associationTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> addressTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> contactMethodCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> eventTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> opportunityTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> activityReactionCodes = new List<TypeCodeDesc>();
// Support.
private static readonly List<TypeCodeDesc> userReportTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> supportItemProcessTypeCodes = new List<TypeCodeDesc>();
//-------------------------------------------------------------------
// C o d e T y p e s
//-------------------------------------------------------------------
public static List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
{
// Lists are cloned to avoid modifications to the internal static lists.
switch (codeType)
{
case Sax.CodeType.YesNo:
return new List<TypeCodeDesc>(yesNoCodes);
case Sax.CodeType.DataItemType:
return new List<TypeCodeDesc>(dataItemTypeCodes);
case Sax.CodeType.Gender:
return new List<TypeCodeDesc>(genderCodes);
case Sax.CodeType.SportGrouping:
return new List<TypeCodeDesc>(sportGroupingCodes);
case Sax.CodeType.SportSpecialityLabel:
return new List<TypeCodeDesc>(sportSpecialityLabelCodes);
case Sax.CodeType.SportContactType:
return new List<TypeCodeDesc>(sportContactCodes);
case Sax.CodeType.SportParticipating:
return new List<TypeCodeDesc>(sportParticipatingCodes);
case Sax.CodeType.SportPreparing:
return new List<TypeCodeDesc>(sportPreparingCodes);
case Sax.CodeType.SportOfficiating:
return new List<TypeCodeDesc>(sportOfficiatingCodes);
case Sax.CodeType.RegionType:
return new List<TypeCodeDesc>(regionTypeCodes);
case Sax.CodeType.EligibilityType:
return new List<TypeCodeDesc>(eligibilityTypeCodes);
case Sax.CodeType.UserRole:
return new List<TypeCodeDesc>(userRoleCodes);
case Sax.CodeType.Title:
return new List<TypeCodeDesc>(titleCodes);
case Sax.CodeType.ImageType:
return new List<TypeCodeDesc>(imageTypeCodes);
case Sax.CodeType.OrganisationType:
return new List<TypeCodeDesc>(organisationTypeCodes);
case Sax.CodeType.OrganisationCategory:
return new List<TypeCodeDesc>(organisationCategoryCodes);
case Sax.CodeType.OrganisationRole:
return new List<TypeCodeDesc>(organisationRoleCodes);
case Sax.CodeType.AssociationType:
return new List<TypeCodeDesc>(associationTypeCodes);
case Sax.CodeType.AddressType:
return new List<TypeCodeDesc>(addressTypeCodes);
case Sax.CodeType.ContactMethod:
return new List<TypeCodeDesc>(contactMethodCodes);
case Sax.CodeType.EventType:
return new List<TypeCodeDesc>(eventTypeCodes);
case Sax.CodeType.OpportunityType:
return new List<TypeCodeDesc>(opportunityTypeCodes);
case Sax.CodeType.ActivityReaction:
return new List<TypeCodeDesc>(activityReactionCodes);
// Support.
case Sax.CodeType.UserReportType:
return new List<TypeCodeDesc>(userReportTypeCodes);
case Sax.CodeType.SupportItemProcessType:
return new List<TypeCodeDesc>(supportItemProcessTypeCodes);
default:
throw new NotSupportedException(nameof(SaxSystem) + ".GetCodesOfType Unexpected code type: " + codeType.ToString());
}
}
//-------------------------------------------------------------------
/// <summary>Static code type initialisation.</summary>
private static void InitCodeTypes()
{
//---------------------------------------------------------------
// Yes No options.
yesNoCodes.Add(Sax.YesNo.Yes, "YES", "Yes");
yesNoCodes.Add(Sax.YesNo.No, "NO", "No");
//---------------------------------------------------------------
// Data item types.
// Reference data.
dataItemTypeCodes.Add(Sax.DataItemType.Region, "Region", "Region");
dataItemTypeCodes.Add(Sax.DataItemType.Sport, "Sport", "Sport");
// Accounts.
dataItemTypeCodes.Add(Sax.DataItemType.UserAccount, "UserAccount", "User Account");
dataItemTypeCodes.Add(Sax.DataItemType.UserRole, "UserRole", "User Role");
dataItemTypeCodes.Add(Sax.DataItemType.UserOrganisation, "UserOrganisation", "User Organisation");
dataItemTypeCodes.Add(Sax.DataItemType.UserSport, "UserSport", "User Sport");
dataItemTypeCodes.Add(Sax.DataItemType.Organisation, "Organisation", "Organisation");
// Activity data.
dataItemTypeCodes.Add(Sax.DataItemType.ActivityIndex, "ActivityIndex", "Activity Index");
dataItemTypeCodes.Add(Sax.DataItemType.UserActivity, "UserActivity", "User Activity");
dataItemTypeCodes.Add(Sax.DataItemType.Article, "Article", "Article");
dataItemTypeCodes.Add(Sax.DataItemType.OrganisationOpportunity, "OrganisationOpportunity", "Organisation Opportunity");
dataItemTypeCodes.Add(Sax.DataItemType.OrganisationEvent, "OrganisationEvent", "Organisation Event");
// Item link components.
dataItemTypeCodes.Add(Sax.DataItemType.ItemSport, "ItemSport", "Item Sport");
dataItemTypeCodes.Add(Sax.DataItemType.ItemImage, "ItemImage", "Item Image");
//---------------------------------------------------------------
// Gender.
genderCodes.Add(Sax.Gender.Female, "Female", "Female");
genderCodes.Add(Sax.Gender.Male, "Male", "Male");
genderCodes.Add(Sax.Gender.TransFemale, "TransFemale", "TransFemale");
genderCodes.Add(Sax.Gender.TransMale, "TransMale", "TransMale");
genderCodes.Add(Sax.Gender.Nonconforming, "Nonconforming", "Nonconforming");
genderCodes.Add(Sax.Gender.PreferNotToSay, "PreferNotToSay", "Prefer not to say");
//---------------------------------------------------------------
// Sport grouping.
sportGroupingCodes.Add(Sax.SportGrouping.Specific, "SPC", "Specific");
sportGroupingCodes.Add(Sax.SportGrouping.Banner, "BNR", "Banner");
sportGroupingCodes.Add(Sax.SportGrouping.Group, "GRP", "Group");
//---------------------------------------------------------------
// Sport speciality label.
sportSpecialityLabelCodes.Add(Sax.SportSpecialityLabel.Positon, "POS", "Positon");
sportSpecialityLabelCodes.Add(Sax.SportSpecialityLabel.Discipline, "DIS", "Discipline");
sportSpecialityLabelCodes.Add(Sax.SportSpecialityLabel.NotRelevant, "NRE", "Not relevant");
//---------------------------------------------------------------
// Sport contact.
sportContactCodes.Add(Sax.SportContactType.Coach, "COA", "Coach");
sportContactCodes.Add(Sax.SportContactType.Manager, "MAN", "Manager");
sportContactCodes.Add(Sax.SportContactType.Agent, "AGE", "Agent");
//---------------------------------------------------------------
// Sport participating.
sportParticipatingCodes.Add(Sax.SportParticipating.Professional, "PRO", "Professional");
sportParticipatingCodes.Add(Sax.SportParticipating.Regular, "REG", "Regular");
sportParticipatingCodes.Add(Sax.SportParticipating.Occasional, "OCC", "Occasional");
sportParticipatingCodes.Add(Sax.SportParticipating.Spectator, "SPC", "Spectator");
sportParticipatingCodes.Add(Sax.SportParticipating.Interested, "INT", "Interested");
//---------------------------------------------------------------
// Sport preparing.
sportPreparingCodes.Add(Sax.SportPreparing.Coach, "CCH", "Coach");
sportPreparingCodes.Add(Sax.SportPreparing.Manager, "MGR", "Manager");
sportPreparingCodes.Add(Sax.SportPreparing.Agent, "AGT", "Agent");
//---------------------------------------------------------------
// Sport officiating.
sportOfficiatingCodes.Add(Sax.SportOfficiating.Professional, "PRO", "Professional");
sportOfficiatingCodes.Add(Sax.SportOfficiating.Regular, "REG", "Regular");
sportOfficiatingCodes.Add(Sax.SportOfficiating.Occasional, "OCC", "Occasional");
//---------------------------------------------------------------
// Region types.
regionTypeCodes.Add(Sax.RegionType.Universe, "UNIV", "Universe");
regionTypeCodes.Add(Sax.RegionType.Galaxy, "GALAX", "Galaxy");
regionTypeCodes.Add(Sax.RegionType.World, "WORLD", "World");
regionTypeCodes.Add(Sax.RegionType.Continent, "CONT", "Continent");
regionTypeCodes.Add(Sax.RegionType.SubContinent, "SUBC", "Sub-Continent");
regionTypeCodes.Add(Sax.RegionType.Country, "COUN", "Country");
regionTypeCodes.Add(Sax.RegionType.State, "STAT", "State");
regionTypeCodes.Add(Sax.RegionType.Province, "PROV", "Province");
//---------------------------------------------------------------
// Eligibility types.
eligibilityTypeCodes.Add(Sax.EligibilityType.Birth, "BTH", "Birth");
eligibilityTypeCodes.Add(Sax.EligibilityType.Naturalised, "NLD", "Naturalised");
eligibilityTypeCodes.Add(Sax.EligibilityType.Parent, "PRT", "Parent");
eligibilityTypeCodes.Add(Sax.EligibilityType.Grandparent, "GRD", "Grandparent");
eligibilityTypeCodes.Add(Sax.EligibilityType.Passport, "PST", "Passport");
eligibilityTypeCodes.Add(Sax.EligibilityType.Visa, "VSA", "Visa");
//---------------------------------------------------------------
// User roles.
userRoleCodes.Add(Sax.UserRole.Journalist, "JRNLST", "Journalist");
userRoleCodes.Add(Sax.UserRole.SystemAdmin, "SYSADM", "System Admin");
userRoleCodes.Add(Sax.UserRole.SystemReviewer, "SYSRVR", "System Reviewer");
//---------------------------------------------------------------
// Titles.
titleCodes.Add(Sax.Title.Mr, "Mr", "Mr");
titleCodes.Add(Sax.Title.Mrs, "Mrs", "Mrs");
titleCodes.Add(Sax.Title.Miss, "Miss", "Miss");
titleCodes.Add(Sax.Title.Mx, "Mx", "Mx");
titleCodes.Add(Sax.Title.Dr, "Dr", "Dr");
titleCodes.Add(Sax.Title.Sir, "Sir", "Sir");
titleCodes.Add(Sax.Title.Lord, "Lord", "Lord");
titleCodes.Add(Sax.Title.Lady, "Lady", "Lady");
//---------------------------------------------------------------
// Image types.
imageTypeCodes.Add(Sax.ImageType.Avatar, "Avatar", "Avatar");
imageTypeCodes.Add(Sax.ImageType.Avatar_Upload, "AvatarUpload", "Avatar - upload");
imageTypeCodes.Add(Sax.ImageType.OrganisationLogo, "OrganisationLogo", "Organisation logo");
imageTypeCodes.Add(Sax.ImageType.OrganisationLogo_Upload, "OrganisationLogoUpload", "Organisation logo - upload");
imageTypeCodes.Add(Sax.ImageType.Article, "Article", "Article");
imageTypeCodes.Add(Sax.ImageType.Article_Upload, "ArticleUpload", "Article - upload");
//---------------------------------------------------------------
// Organisation types.
organisationTypeCodes.Add(Sax.OrganisationType.SocialEnterprise, "SEN", "Social Enterprise");
organisationTypeCodes.Add(Sax.OrganisationType.CommunityGroup, "CGR", "Community Group");
organisationTypeCodes.Add(Sax.OrganisationType.Charity, "CTY", "Charity");
organisationTypeCodes.Add(Sax.OrganisationType.Commercial, "CMC", "Commercial");
organisationTypeCodes.Add(Sax.OrganisationType.PublicSector, "PBS", "Public Sector");
//---------------------------------------------------------------
// Organisation categories.
organisationCategoryCodes.Add(Sax.OrganisationCategory.Association, "ASC", "Association");
organisationCategoryCodes.Add(Sax.OrganisationCategory.Club, "CLB", "Club");
organisationCategoryCodes.Add(Sax.OrganisationCategory.Society, "SOC", "Society");
organisationCategoryCodes.Add(Sax.OrganisationCategory.Education, "EDU", "Education");
organisationCategoryCodes.Add(Sax.OrganisationCategory.SportDepartment, "SPD", "Sport Department");
organisationCategoryCodes.Add(Sax.OrganisationCategory.Syndicate, "SYN", "Syndicate");
organisationCategoryCodes.Add(Sax.OrganisationCategory.Partner, "PRT", "Partner");
organisationCategoryCodes.Add(Sax.OrganisationCategory.Other, "OTH", "Other");
//---------------------------------------------------------------
// Organisation roles.
organisationRoleCodes.Add(Sax.OrganisationRole.Member, "MBR", "Member");
organisationRoleCodes.Add(Sax.OrganisationRole.Admin, "ADM", "Admin");
organisationRoleCodes.Add(Sax.OrganisationRole.MemberAdmin, "MBA", "Members");
organisationRoleCodes.Add(Sax.OrganisationRole.ScheduleAdmin, "SCA", "Schedule");
organisationRoleCodes.Add(Sax.OrganisationRole.OpportunityAdmin, "OPA", "Opportunities");
organisationRoleCodes.Add(Sax.OrganisationRole.ArticleAdmin, "ARA", "Articles");
//---------------------------------------------------------------
// Association Types.
associationTypeCodes.Add(Sax.AssociationType.Affiliate, "Affiliate", "Affiliate");
associationTypeCodes.Add(Sax.AssociationType.Partner, "Partner", "Partner");
//---------------------------------------------------------------
// Address Types.
addressTypeCodes.Add(Sax.AddressType.Location, "Location", "Location");
addressTypeCodes.Add(Sax.AddressType.Home, "Home", "Home");
addressTypeCodes.Add(Sax.AddressType.Office, "Office", "Office");
addressTypeCodes.Add(Sax.AddressType.Delivery, "Delivery", "Delivery");
//---------------------------------------------------------------
// Contact methods.
contactMethodCodes.Add(Sax.ContactMethod.PhoneMain, Sax.ContactMethod.PhoneMain.ToString(), "Phone - main");
contactMethodCodes.Add(Sax.ContactMethod.PhoneMobile, Sax.ContactMethod.PhoneMobile.ToString(), "Phone - mobile");
contactMethodCodes.Add(Sax.ContactMethod.PhoneHome, Sax.ContactMethod.PhoneHome.ToString(), "Phone - home");
contactMethodCodes.Add(Sax.ContactMethod.PhoneOffice, Sax.ContactMethod.PhoneOffice.ToString(), "Phone - office");
// Online.
contactMethodCodes.Add(Sax.ContactMethod.Email, Sax.ContactMethod.Email.ToString(), "Email");
contactMethodCodes.Add(Sax.ContactMethod.Website, Sax.ContactMethod.Website.ToString(), "Website");
contactMethodCodes.Add(Sax.ContactMethod.Wikipedia, Sax.ContactMethod.Wikipedia.ToString(), "Wikipedia");
// Social media.
contactMethodCodes.Add(Sax.ContactMethod.LinkedIn, Sax.ContactMethod.LinkedIn.ToString(), "LinkedIn");
contactMethodCodes.Add(Sax.ContactMethod.Twitter, Sax.ContactMethod.Twitter.ToString(), "X");
contactMethodCodes.Add(Sax.ContactMethod.Facebook, Sax.ContactMethod.Facebook.ToString(), "Facebook");
contactMethodCodes.Add(Sax.ContactMethod.Instagram, Sax.ContactMethod.Instagram.ToString(), "Instagram");
contactMethodCodes.Add(Sax.ContactMethod.YouTube, Sax.ContactMethod.YouTube.ToString(), "YouTube");
contactMethodCodes.Add(Sax.ContactMethod.Twitch, Sax.ContactMethod.Twitch.ToString(), "Twitch");
//---------------------------------------------------------------
// Event types.
eventTypeCodes.Add(Sax.EventType.Playing, "PLG", "Playing");
eventTypeCodes.Add(Sax.EventType.Training, "TRN", "Training");
eventTypeCodes.Add(Sax.EventType.Organisation, "ORG", "Organisation");
eventTypeCodes.Add(Sax.EventType.Social, "SCL", "Social");
//---------------------------------------------------------------
// Opportunity types.
opportunityTypeCodes.Add(Sax.OpportunityType.Playing, "PLG", "Playing");
opportunityTypeCodes.Add(Sax.OpportunityType.Official, "OFL", "Official");
opportunityTypeCodes.Add(Sax.OpportunityType.Coaching, "CHG", "Coaching");
opportunityTypeCodes.Add(Sax.OpportunityType.Volunteer, "VTR", "Volunteer");
opportunityTypeCodes.Add(Sax.OpportunityType.Staff, "STF", "Staff");
opportunityTypeCodes.Add(Sax.OpportunityType.Board, "BRD", "Board");
//---------------------------------------------------------------
// Activity Reactions.
activityReactionCodes.Add(Sax.ActivityReaction.Good, "Good", "Good");
activityReactionCodes.Add(Sax.ActivityReaction.VeryGood, "VeryGood", "Very Good");
activityReactionCodes.Add(Sax.ActivityReaction.Exceptional, "Exceptional", "Exceptional");
//---------------------------------------------------------------
// Support.
// User Report Types.
userReportTypeCodes.Add(Sax.UserReportType.Enhancement, "ENH", "Enhancement request");
userReportTypeCodes.Add(Sax.UserReportType.Information, "INF", "Information request");
userReportTypeCodes.Add(Sax.UserReportType.Bug, "BUG", "Bug report");
// Support Item Process Types.
supportItemProcessTypeCodes.Add(Sax.SupportItemProcessType.OrganisationSchedulePopulation, "OSP", "Organisation schedule population");
//---------------------------------------------------------------
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,31 @@
using Sarand.Net.Standard.Base.Core;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
using System.Text;
namespace Saxonite.Net.Standard.Base.App
{
//=======================================================================
// S A X S y s t e m - S t a t i c s
//=======================================================================
partial class SaxSystem
{
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
/// <summary>Static initialisation.</summary>
static SaxSystem()
{
//---------------------------------------------------------------
// Code types.
InitCodeTypes();
//---------------------------------------------------------------
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,51 @@
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Saxonite.Net.Standard.Base.Mgr;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
using System.Text;
using Saxonite.Net.Standard.Base.Mgr.Support;
using Saxonite.Net.Standard.Base.Mgr.Reference;
using Sarand.Net.Standard.Base.Utils;
namespace Saxonite.Net.Standard.Base.App
{
//=======================================================================
public abstract partial class SaxSystem : SacsSystem
{
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Protected Construction.
protected SaxSystem() : base()
{
}
//-------------------------------------------------------------------
// Environment.
//-------------------------------------------------------------------
public static Sax.Environment GetEnvironment()
{
if (ComputerName.ContainsCI("Sarand602"))
return Sax.Environment.Production;
if (ComputerName.ContainsCI("Sarand"))
return Sax.Environment.Development;
return Sax.Environment.Production;
}
//-------------------------------------------------------------------
// Business components.
//-------------------------------------------------------------------
public abstract SaxReferenceMgr CreateReferenceMgr(SaxSessionContext sessionContext, SaxInternals internals);
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);
//-------------------------------------------------------------------
}
//=======================================================================
}