From 60427e8230fe4570dff83fe2d885c6145f312d0a Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 13 Jun 2024 14:29:58 +0100 Subject: [PATCH] 1.2.11.5 --- .../Admin/App/SaxSessionData_Admin_Tester.cs | 2 +- .../App/SaxSessionData_Online_Tester.cs | 2 +- SaxoniteCoreWeb/Base/App/SaxAppConfig.cs | 2 +- SaxoniteCoreWeb/Base/App/SaxLocaliser.cs | 6 +- SaxoniteCoreWeb/Base/App/SaxStartup.cs | 2 +- .../Base/Controllers/SaxController_Base.cs | 205 +---- .../Base/Controllers/SaxController_Web.cs | 225 +++++ .../Base/Middleware/SaxModelBinder.cs | 3 + SaxoniteCoreWeb/Base/Models/SaxModel_Base.cs | 10 +- ...fUsgaDataLookup-ScheduledUsgaDataLookup.cs | 24 +- .../Base/Procs/SaxGolfUsgaDataLookup.cs | 865 ++++++++++-------- .../Admin/App/SaxApplication_Admin.cs | 4 +- .../Admin/Consoles/SaxConsoleHelper_Admin.cs | 5 +- .../Admin/Controllers/SaxController_Admin.cs | 8 +- SaxoniteCoreWebAdmin/wwwroot/css/sax-data.css | 5 + SaxoniteCoreWebAdmin/wwwroot/css/sax-form.css | 5 +- SaxoniteCoreWebAdmin/wwwroot/js/sax-home.js | 2 +- .../wwwroot/js/sax-org-dnl.js | 10 +- .../wwwroot/js/sax-sys-logs.js | 17 +- .../Online/App/SaxApplication_Online.cs | 2 +- .../Consoles/SaxConsoleHelper_Online.cs | 7 +- .../Controllers/ArticleController-Ajax.cs | 4 +- .../Controllers/SaxController_Online.cs | 8 +- .../wwwroot/css/sax-form.css | 2 +- SaxoniteStandardBase/Base/App/Sax-Config.cs | 2 +- SaxoniteStandardBase/Base/App/Sax-Version.cs | 2 +- .../Base/App/SaxDbDfn_Core.cs | 2 +- .../Base/App/SaxDbDfn_Reference.cs | 28 +- .../Base/App/SaxDbDfn_Support.cs | 2 +- SaxoniteStandardBase/Base/App/SaxInternals.cs | 12 +- .../Base/Bus/Reference/SaxGolfUsgaCountry.cs | 10 +- .../Base/Bus/Reference/SaxGolfUsgaCourse.cs | 63 +- .../Base/Bus/Reference/SaxGolfUsgaFacility.cs | 114 ++- .../Base/Bus/Reference/SaxGolfUsgaMarker.cs | 4 +- .../Base/Bus/Reference/SaxGolfUsgaProvince.cs | 10 +- .../Base/Bus/SaxActivityIndex.cs | 10 +- SaxoniteStandardBase/Base/Bus/SaxArticle.cs | 8 +- .../Base/Bus/SaxItemAddress.cs | 32 +- .../Base/Bus/SaxOrganisationEvent.cs | 16 +- .../Base/Bus/SaxOrganisationOpportunity.cs | 16 +- SaxoniteStandardBase/Base/Bus/SaxRegion.cs | 16 +- .../Base/Bus/SaxUserAccount.cs | 48 +- .../Base/Bus/SaxUserActivity.cs | 40 +- .../Base/Bus/SaxUserEligibility.cs | 8 +- SaxoniteStandardBase/Base/Bus/SaxUserRole.cs | 24 +- .../Base/Bus/SaxUserSportExperience.cs | 8 +- .../Base/Consoles/SaxActivityConsole.cs | 12 +- .../SaxReferenceGolfMgr-UsgaCourse.cs | 23 +- .../SaxReferenceGolfMgr-UsgaFacility.cs | 6 + .../Dbas/Internal/Core/ActivityFeedback_Db.cs | 5 +- .../Dbas/Internal/Core/ActivityIndex_Db.cs | 26 +- .../Dbas/Internal/Core/Article_Db.cs | 19 +- .../Dbas/Internal/Core/ItemAddress_Db.cs | 33 +- .../Dbas/Internal/Core/ItemAssociation_Db.cs | 5 +- .../Dbas/Internal/Core/ItemImage_Db.cs | 5 +- .../Dbas/Internal/Core/ItemSport_Db.cs | 5 +- .../Internal/Core/OrganisationEvent_Db.cs | 19 +- .../Core/OrganisationOpportunity_Db.cs | 19 +- .../Dbas/Internal/Core/Organisation_Db.cs | 22 +- .../Dbas/Internal/Core/Region_Db.cs | 19 +- .../Dbas/Internal/Core/Sport_Db.cs | 19 +- .../Dbas/Internal/Core/UserAccount_Db.cs | 72 +- .../Dbas/Internal/Core/UserActivity_Db.cs | 40 +- .../Dbas/Internal/Core/UserConfig_Db.cs | 12 +- .../Dbas/Internal/Core/UserEligibility_Db.cs | 19 +- .../Dbas/Internal/Core/UserOnline_Db.cs | 5 +- .../Dbas/Internal/Core/UserOrganisation_Db.cs | 5 +- .../Dbas/Internal/Core/UserRole_Db.cs | 26 +- .../Dbas/Internal/Core/UserSession_Db.cs | 7 +- .../Internal/Core/UserSportExperience_Db.cs | 13 +- .../Dbas/Internal/Core/UserSport_Db.cs | 29 +- .../Internal/Reference/Golf_UsgaCountry_Db.cs | 6 +- .../Internal/Reference/Golf_UsgaCourse_Db.cs | 31 +- .../Reference/Golf_UsgaFacility_Db.cs | 55 +- .../Internal/Reference/Golf_UsgaMarker_Db.cs | 5 +- .../Reference/Golf_UsgaProvince_Db.cs | 5 +- .../Internal/Support/UserReportComment_Db.cs | 12 +- .../Dbas/Internal/Support/UserReport_Db.cs | 5 +- .../SaxReferenceGolfMgr_Dbas-UsgaCountry.cs | 39 +- .../SaxReferenceGolfMgr_Dbas-UsgaCourse.cs | 55 +- .../SaxReferenceGolfMgr_Dbas-UsgaFacility.cs | 52 +- .../SaxReferenceGolfMgr_Dbas-UsgaMarker.cs | 10 +- .../SaxReferenceGolfMgr_Dbas-UsgaProvince.cs | 44 +- .../Mgr/SaxAccountMgr_Dbas-Organisation.cs | 10 +- .../Mgr/SaxAccountMgr_Dbas-UserAccount.cs | 12 +- .../Dbas/Mgr/SaxAccountMgr_Dbas-UserConfig.cs | 6 +- .../Mgr/SaxAccountMgr_Dbas-UserEligibility.cs | 8 +- .../Dbas/Mgr/SaxAccountMgr_Dbas-UserOnline.cs | 6 +- .../SaxAccountMgr_Dbas-UserOrganisation.cs | 6 +- .../Dbas/Mgr/SaxAccountMgr_Dbas-UserRole.cs | 6 +- .../Mgr/SaxAccountMgr_Dbas-UserSession.cs | 6 +- .../Dbas/Mgr/SaxAccountMgr_Dbas-UserSport.cs | 6 +- .../SaxAccountMgr_Dbas-UserSportExperience.cs | 6 +- .../SaxActivityMgr_Dbas-ActivityFeedback.cs | 6 +- .../Mgr/SaxActivityMgr_Dbas-ActivityIndex.cs | 10 +- .../Dbas/Mgr/SaxActivityMgr_Dbas-Article.cs | 8 +- .../SaxActivityMgr_Dbas-OrganisationEvent.cs | 6 +- ...ctivityMgr_Dbas-OrganisationOpportunity.cs | 6 +- .../Mgr/SaxActivityMgr_Dbas-UserActivity.cs | 8 +- .../Mgr/SaxItemDataMgr_Dbas-ItemAddress.cs | 8 +- .../SaxItemDataMgr_Dbas-ItemAssociation.cs | 6 +- .../Dbas/Mgr/SaxItemDataMgr_Dbas-ItemImage.cs | 6 +- .../Dbas/Mgr/SaxItemDataMgr_Dbas-ItemSport.cs | 6 +- .../Dbas/Mgr/SaxReferenceMgr_Dbas-Region.cs | 6 +- .../Dbas/Mgr/SaxReferenceMgr_Dbas-Sport.cs | 8 +- .../Support/SaxSupportMgr_Dbas-UserReport.cs | 6 +- .../Resources/Database/SaxDbDfn_Reference.xml | 260 +++++- SaxoniteWebApi/Api/App/SaxApplication_Api.cs | 3 +- .../Api/Consoles/SaxConsoleHelper_Api.cs | 15 +- .../Api/Consoles/SaxProcessConsole_Api.cs | 9 +- .../Api/Controllers/GolfController.cs | 115 +++ .../Api/Controllers/SwapiControllerBase.cs | 7 +- .../Api/Controllers/SystemController.cs | 39 +- SaxoniteWebApi/Program.cs | 6 +- 114 files changed, 2176 insertions(+), 1124 deletions(-) create mode 100644 SaxoniteCoreWeb/Base/Controllers/SaxController_Web.cs create mode 100644 SaxoniteWebApi/Api/Controllers/GolfController.cs diff --git a/SaxoniteCoreUnitTests/UnitTests/Web/Admin/App/SaxSessionData_Admin_Tester.cs b/SaxoniteCoreUnitTests/UnitTests/Web/Admin/App/SaxSessionData_Admin_Tester.cs index ab0777a..c7cf498 100644 --- a/SaxoniteCoreUnitTests/UnitTests/Web/Admin/App/SaxSessionData_Admin_Tester.cs +++ b/SaxoniteCoreUnitTests/UnitTests/Web/Admin/App/SaxSessionData_Admin_Tester.cs @@ -68,7 +68,7 @@ namespace Saxonite.Net.Core.UnitTests.Web.Admin.App SaxSessionData_Admin sessionDataDeserialised = JsonConvert.DeserializeObject( sessionDataJson, - SaxController_Base.SessionStorage.JsonDeserialisationSettings + SaxController_Web.SessionStorage.JsonDeserialisationSettings ); Assert.IsNotNull(sessionDataDeserialised); diff --git a/SaxoniteCoreUnitTestsOnline/UnitTests/Online/App/SaxSessionData_Online_Tester.cs b/SaxoniteCoreUnitTestsOnline/UnitTests/Online/App/SaxSessionData_Online_Tester.cs index a1fdd7a..cc06bcd 100644 --- a/SaxoniteCoreUnitTestsOnline/UnitTests/Online/App/SaxSessionData_Online_Tester.cs +++ b/SaxoniteCoreUnitTestsOnline/UnitTests/Online/App/SaxSessionData_Online_Tester.cs @@ -96,7 +96,7 @@ namespace Saxonite.Net.Core.UnitTests.Web.Online.App SaxSessionData_Online sessionDataDeserialised = JsonConvert.DeserializeObject( sessionDataJson, - SaxController_Base.SessionStorage.JsonDeserialisationSettings + SaxController_Web.SessionStorage.JsonDeserialisationSettings ); Assert.IsNotNull(sessionDataDeserialised); diff --git a/SaxoniteCoreWeb/Base/App/SaxAppConfig.cs b/SaxoniteCoreWeb/Base/App/SaxAppConfig.cs index b006219..03c7375 100644 --- a/SaxoniteCoreWeb/Base/App/SaxAppConfig.cs +++ b/SaxoniteCoreWeb/Base/App/SaxAppConfig.cs @@ -227,7 +227,7 @@ namespace Saxonite.Net.Core.Web.Base.App Sax.Database databaseType = EnumUtil.ParseEnum(databaseSection.Key); if (databaseType <= 0) { - SaLogger.Warn(GetType().Name + ".extractDatabaseConfig Unrecognised database: " + databaseSection.Key); + SaLogger.Warn($"{SysUtil.Fn} Unrecognised database: {databaseSection.Key}"); return; } // Extract database configuration. diff --git a/SaxoniteCoreWeb/Base/App/SaxLocaliser.cs b/SaxoniteCoreWeb/Base/App/SaxLocaliser.cs index 91d13f4..1b76605 100644 --- a/SaxoniteCoreWeb/Base/App/SaxLocaliser.cs +++ b/SaxoniteCoreWeb/Base/App/SaxLocaliser.cs @@ -73,7 +73,7 @@ namespace Saxonite.Net.Core.Web.Base.App } } if (text.ResourceNotFound && logMissingKey) - SaLogger.Debug(GetType().Name + ".GetText Key not found: " + key); + SaLogger.Debug($"{SysUtil.Fn} Key not found: {key}"); return text; } @@ -135,7 +135,7 @@ namespace Saxonite.Net.Core.Web.Base.App //------------------------------------------------------------------- public static String DateFormat_Default { get; } = "d-MMM-yyyy"; public static String DateWithWeekdayFormat_Default { get; } = "ddd d-MMM-yyyy"; - public String FormatDate(DateTime value, Boolean includeWeekday = true) + public String FormatDate(DateTime? value, Boolean includeWeekday = true) { String dateFormat = includeWeekday ? DateWithWeekdayFormat_Default : DateFormat_Default; return DateUtil.Format(value, dateFormat); @@ -175,7 +175,7 @@ namespace Saxonite.Net.Core.Web.Base.App private String GetCodeTypeCaption(Sax.CodeType codeType, T type) where T : struct, IConvertible { if (!(type is Enum)) - throw new ArgumentException(GetType().Name + ".GetCodeTypeCaption Type parameter must be an enumerated type. Type supplied: " + type.GetType().Name); + throw new ArgumentException($"{SysUtil.Fn} Type parameter must be an enumerated type. Type supplied: {type.GetType().Name}"); return GetCodeTypeCaption(codeType, (int)(type as IConvertible), type.ToString()); } private String GetCodeTypeCaption(Sax.CodeType codeType, int type, String typeName) diff --git a/SaxoniteCoreWeb/Base/App/SaxStartup.cs b/SaxoniteCoreWeb/Base/App/SaxStartup.cs index 11ef740..17b8ef4 100644 --- a/SaxoniteCoreWeb/Base/App/SaxStartup.cs +++ b/SaxoniteCoreWeb/Base/App/SaxStartup.cs @@ -116,7 +116,7 @@ namespace Saxonite.Net.Core.Web.Base.App LanguageViewLocationExpanderFormat.Suffix, opts => { opts.ResourcesPath = resourcesPath; }) .AddDataAnnotationsLocalization() - // Ignore null values during object serisliation. + // Ignore null values during object serialiation. .AddJsonOptions(options => { options.JsonSerializerOptions.DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull; }); // Configure localisation middleware. diff --git a/SaxoniteCoreWeb/Base/Controllers/SaxController_Base.cs b/SaxoniteCoreWeb/Base/Controllers/SaxController_Base.cs index 059357b..8c6dec6 100644 --- a/SaxoniteCoreWeb/Base/Controllers/SaxController_Base.cs +++ b/SaxoniteCoreWeb/Base/Controllers/SaxController_Base.cs @@ -1,37 +1,14 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Localization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.AspNetCore.Routing; -using Microsoft.Net.Http.Headers; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using Sacs.Web.Components; +using Sacs.Web.Components; using Sarand.Net.Standard.Base.App; -using Sarand.Net.Standard.Base.Bus; using Sarand.Net.Standard.Base.Core; -using Sarand.Net.Standard.Base.Dbas; using Sarand.Net.Standard.Base.Email; -using Sarand.Net.Standard.Base.Helpers; -using Sarand.Net.Standard.Base.Utils; using Saxonite.Net.Core.Web.Base.App; -using Saxonite.Net.Core.Web.Base.Consoles; -using Saxonite.Net.Core.Web.Base.Models; using Saxonite.Net.Standard.Base.App; -using Saxonite.Net.Standard.Base.Bus; using Saxonite.Net.Standard.Base.Consoles; using Saxonite.Net.Standard.Base.Mgr; using Saxonite.Net.Standard.Base.Mgr.Reference; using Saxonite.Net.Standard.Base.Mgr.Support; -using System; using System.Collections.Generic; -using System.Collections.Specialized; -using System.Globalization; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Web; namespace Saxonite.Net.Core.Web.Base.Controllers { @@ -51,7 +28,7 @@ namespace Saxonite.Net.Core.Web.Base.Controllers // Initialise console (debug) logging listener. //if (Directory.Exists(App.LoggingRootFolder) && SaxSystem.DebugMode) // SaxConsoleListener.ConfigureDebugListener(App.LoggingRootFolder); - if (DebugMode) SaLogger.Trace(GetType().Name + ".CTR"); + if (DebugMode) SaLogger.Trace($"{GetType().Name}.CTR"); } protected override void Dispose(bool disposing) { @@ -111,184 +88,6 @@ namespace Saxonite.Net.Core.Web.Base.Controllers public SaEmailConfig EmailConfig { get { return App.EmailConfig; } } public SaxEmailConsole EmailConsole { get { return Internals.EmailConsole; } } - //------------------------------------------------------------------- - // Action execution events. - //------------------------------------------------------------------- - public override void OnActionExecuting(ActionExecutingContext filterContext) - { - //if (DebugMode) SaLogger.Debug(GetType().Name + ".OnActionExecuting" + (ViewData.Model != null ? " Model: " + ViewData.Model : "")); - - // Refreh model properties. - SaxModel_Base baseModel = ViewData.Model as SaxModel_Base; - RefreshModel(baseModel); - - base.OnActionExecuting(filterContext); - } - public override void OnActionExecuted(ActionExecutedContext filterContext) - { - //if (DebugMode) SaLogger.Debug(GetType().Name + ".OnActionExecuted" + (ViewData.Model != null ? " Model: " + ViewData.Model : "")); - - // Refreh model properties. - SaxModel_Base baseModel = ViewData.Model as SaxModel_Base; - RefreshModel(baseModel); - - // Store session data if present - as potentially modfied. - if (SessionData != null) - { - // Most actions will store the session data in case it's been modified. - // Some actions (eg. score password) don't need to. - if (StoreSessionData) - { - String sessionDataJson = JsonConvert.SerializeObject(SessionData); - HttpContext.Session.Set(SessionStorage.SessionKey_SessionData, SessionStorage.sessionDataEncoding.GetBytes(sessionDataJson)); - } - } - else HttpContext.Session.Remove(SessionStorage.SessionKey_SessionData); - - // Response headers. - if (baseModel != null && baseModel.ProhibitCache) - { - if (Response.Headers.ContainsKey(HeaderNames.CacheControl)) - Response.Headers.Remove(HeaderNames.CacheControl); - Response.Headers.Add(HeaderNames.CacheControl, "no-cache, no-store, must-revalidate"); - Response.Headers.Add(HeaderNames.Pragma, "no-cache"); - Response.Headers.Add(HeaderNames.Expires, "0"); - } - - base.OnActionExecuted(filterContext); - } - - //------------------------------------------------------------------- - // Model. - //------------------------------------------------------------------- - protected void RefreshModel(SaxModel_Base model) - { - if (model == null) return; - - // Session data. - model.Controller = this; - model.SessionData = SessionData; - - // Redirect locations. - model.RedirectLocation.Base = GetRedirectLocation(RedirectLocation.WebAppBase); - model.RedirectLocation.Home = GetRedirectLocation(RedirectLocation.WebAppHome); - model.RedirectLocation.Home_SessionExpired = GetRedirectLocation(RedirectLocation.WebAppHome_SessionExpired); - } - - //------------------------------------------------------------------- - // Parameters. - //------------------------------------------------------------------- - // Online Request Password encryption parameters (key & IV) are defined in - // the base Controller so that they can be shared with the Adnin application. - // NB IV value is generated from the key and fixed so that it doesn't change when the application restarts. - // IV Must be regenerated if key is changed. - protected static String Base64Key_RequestPassword_Online { get; } = SacsEncryptionHelper.EncodePlainKey("{~Saxonite@@Request^Password=}", SacsEncryptionHelper.KeyLength); - //private static String Base64IV_RequestPassword_Generated_Online { get; } = SacsEncryptionHelper.InitSymmetricEncryptionIV(Base64Key_RequestPassword_Online); - protected static String Base64IV_RequestPassword_Online { get; } = "1VAWYTW6d72n/6HDNhbqow=="; - - //------------------------------------------------------------------- - // Session. - //------------------------------------------------------------------- - private bool UserActiveRecorded { get; set; } = false; - public bool ValidUserSession - { - get - { - if (SessionData == null || !SessionData.ValidUserSession) return false; - SaxSessionDataConsole sessionDataConsole = SessionDataConsole; - if (sessionDataConsole != null && !UserActiveRecorded) - { - // Record the user as active once per request. - sessionDataConsole.RecordUserActive(SessionUserAccountId, CreatedAt); - UserActiveRecorded = true; - } - return true; - } - } - public SysId SessionUserAccountId { get { return SessionData?.User?.UserAccountId ?? null; } } - public DbUpdateInfo DbUpdateInfo { get { return SessionData?.DbUpdateInfo ?? new DbUpdateInfo(null, "", SaxSystem.ComputerName); } } - // Referrer. - public String Referer { get { return Request.Headers["Referer"].ToString(); } } - public bool ValidReferer { get { return !StringUtil.IsEmpty(Referer); } } - - /// Store session data, eg. to start a new user session on sign-in. - protected bool SetSessionData(SaxSessionData sessionData) - { - if (sessionStorage.SessionData != null) return false; - sessionStorage.SessionData = sessionData; - return true; - } - protected void ClearSessionData() - { - if (HttpContext.Session.IsAvailable) - HttpContext.Session.Clear(); - sessionStorage.SessionData = null; - } - - //------------------------------------------------------------------- - // Session storage. - public class SessionStorage - { - public SaxSessionData SessionData { get; set; } - public static String SessionKey_SessionData { get; } = "SaxSessionData"; - public static Encoding sessionDataEncoding { get; } = Encoding.UTF8; - //JSON Serialisation. - public class SaxSessionDataContractResolver : DefaultContractResolver - { - // To allow private properties to be deserialised. - // NB Only applies to top level properties in the serialised object. - protected override List GetSerializableMembers(Type objectType) - { - var flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; - MemberInfo[] fields = objectType.GetFields(flags); - return fields - .Concat(objectType.GetProperties(flags).Where(propInfo => propInfo.CanWrite)) - .ToList(); - } - protected override IList CreateProperties(Type type, MemberSerialization memberSerialization) - { - return base.CreateProperties(type, MemberSerialization.Fields); - } - }; - public static JsonSerializerSettings JsonDeserialisationSettings = new JsonSerializerSettings - { - ContractResolver = new SaxSessionDataContractResolver(), - // Force all deserialised objects to be replaced - to avoid proxy lists not populating. - ObjectCreationHandling = ObjectCreationHandling.Replace - }; - } - private readonly SessionStorage sessionStorage = new SessionStorage(); - protected JsonSerializerSettings SaxSessionDataJsonSerializerSettings { get { return SessionStorage.JsonDeserialisationSettings; } } - - //------------------------------------------------------------------- - public SaxSessionData SessionData - { - get - { - try - { - // Retrieve session data if not already in controller. - if (sessionStorage.SessionData == null) - { - byte[] sessionDataBytes = null; - HttpContext.Session.TryGetValue(SessionStorage.SessionKey_SessionData, out sessionDataBytes); - if (sessionDataBytes != null) - { - String sessionDataJson = SessionStorage.sessionDataEncoding.GetString(sessionDataBytes); - sessionStorage.SessionData = DeserializeSessionData(sessionDataJson); - } - } - return sessionStorage.SessionData; - } - catch (Exception exc) - { - SaLogger.Warn(GetType().Name + ".SessionData " + exc.GetType().Name + " - " + exc.Message + exc.GetStackEntries().Concat("", "\n\t")); - } - return null; - } - } - protected abstract SaxSessionData DeserializeSessionData(String sessionDataJson); - //------------------------------------------------------------------- } //======================================================================= diff --git a/SaxoniteCoreWeb/Base/Controllers/SaxController_Web.cs b/SaxoniteCoreWeb/Base/Controllers/SaxController_Web.cs new file mode 100644 index 0000000..e000cd3 --- /dev/null +++ b/SaxoniteCoreWeb/Base/Controllers/SaxController_Web.cs @@ -0,0 +1,225 @@ +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Net.Http.Headers; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using Sarand.Net.Standard.Base.App; +using Sarand.Net.Standard.Base.Bus; +using Sarand.Net.Standard.Base.Dbas; +using Sarand.Net.Standard.Base.Helpers; +using Sarand.Net.Standard.Base.Utils; +using Saxonite.Net.Core.Web.Base.App; +using Saxonite.Net.Core.Web.Base.Models; +using Saxonite.Net.Standard.Base.App; +using Saxonite.Net.Standard.Base.Consoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; + +namespace Saxonite.Net.Core.Web.Base.Controllers +{ + //======================================================================= + public abstract class SaxController_Web : SaxController_Base + { + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Protected construction. + protected SaxController_Web(SaxLocaliser localiser) : base(localiser) + { + } + protected override void Dispose(bool disposing) + { + if (disposing) + { + } + base.Dispose(disposing); + } + + //------------------------------------------------------------------- + // Properties. + + //------------------------------------------------------------------- + // Action execution events. + //------------------------------------------------------------------- + public override void OnActionExecuting(ActionExecutingContext filterContext) + { + //if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}" + (ViewData.Model != null ? " Model: " + ViewData.Model : "")); + + // Refreh model properties. + SaxModel_Base baseModel = ViewData.Model as SaxModel_Base; + RefreshModel(baseModel); + + base.OnActionExecuting(filterContext); + } + public override void OnActionExecuted(ActionExecutedContext filterContext) + { + //if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}" + (ViewData.Model != null ? " Model: " + ViewData.Model : "")); + + // Refreh model properties. + SaxModel_Base baseModel = ViewData.Model as SaxModel_Base; + RefreshModel(baseModel); + + // Store session data if present - as potentially modfied. + if (SessionData != null) + { + // Most actions will store the session data in case it's been modified. + // Some actions (eg. score password) don't need to. + if (StoreSessionData) + { + String sessionDataJson = JsonConvert.SerializeObject(SessionData); + HttpContext.Session.Set(SessionStorage.SessionKey_SessionData, SessionStorage.sessionDataEncoding.GetBytes(sessionDataJson)); + } + } + else HttpContext.Session.Remove(SessionStorage.SessionKey_SessionData); + + // Response headers. + if (baseModel != null && baseModel.ProhibitCache) + { + if (Response.Headers.ContainsKey(HeaderNames.CacheControl)) + Response.Headers.Remove(HeaderNames.CacheControl); + Response.Headers.Add(HeaderNames.CacheControl, "no-cache, no-store, must-revalidate"); + Response.Headers.Add(HeaderNames.Pragma, "no-cache"); + Response.Headers.Add(HeaderNames.Expires, "0"); + } + + base.OnActionExecuted(filterContext); + } + + //------------------------------------------------------------------- + // Model. + //------------------------------------------------------------------- + protected void RefreshModel(SaxModel_Base model) + { + if (model == null) return; + + // Session data. + model.Controller = this; + model.SessionData = SessionData; + + // Redirect locations. + model.RedirectLocation.Base = GetRedirectLocation(RedirectLocation.WebAppBase); + model.RedirectLocation.Home = GetRedirectLocation(RedirectLocation.WebAppHome); + model.RedirectLocation.Home_SessionExpired = GetRedirectLocation(RedirectLocation.WebAppHome_SessionExpired); + } + + //------------------------------------------------------------------- + // Parameters. + //------------------------------------------------------------------- + // Online Request Password encryption parameters (key & IV) are defined in + // the base Controller so that they can be shared with the Adnin application. + // NB IV value is generated from the key and fixed so that it doesn't change when the application restarts. + // IV Must be regenerated if key is changed. + protected static String Base64Key_RequestPassword_Online { get; } = SacsEncryptionHelper.EncodePlainKey("{~Saxonite@@Request^Password=}", SacsEncryptionHelper.KeyLength); + //private static String Base64IV_RequestPassword_Generated_Online { get; } = SacsEncryptionHelper.InitSymmetricEncryptionIV(Base64Key_RequestPassword_Online); + protected static String Base64IV_RequestPassword_Online { get; } = "1VAWYTW6d72n/6HDNhbqow=="; + + //------------------------------------------------------------------- + // Session. + //------------------------------------------------------------------- + private bool UserActiveRecorded { get; set; } = false; + public bool ValidUserSession + { + get + { + if (SessionData == null || !SessionData.ValidUserSession) return false; + SaxSessionDataConsole sessionDataConsole = SessionDataConsole; + if (sessionDataConsole != null && !UserActiveRecorded) + { + // Record the user as active once per request. + sessionDataConsole.RecordUserActive(SessionUserAccountId, CreatedAt); + UserActiveRecorded = true; + } + return true; + } + } + public SysId SessionUserAccountId { get { return SessionData?.User?.UserAccountId ?? null; } } + public DbUpdateInfo DbUpdateInfo { get { return SessionData?.DbUpdateInfo ?? new DbUpdateInfo(null, "", SaxSystem.ComputerName); } } + // Referrer. + public String Referer { get { return Request.Headers["Referer"].ToString(); } } + public bool ValidReferer { get { return !StringUtil.IsEmpty(Referer); } } + + /// Store session data, eg. to start a new user session on sign-in. + protected bool SetSessionData(SaxSessionData sessionData) + { + if (sessionStorage.SessionData != null) return false; + sessionStorage.SessionData = sessionData; + return true; + } + protected void ClearSessionData() + { + if (HttpContext.Session.IsAvailable) + HttpContext.Session.Clear(); + sessionStorage.SessionData = null; + } + + //------------------------------------------------------------------- + // Session storage. + public class SessionStorage + { + public SaxSessionData SessionData { get; set; } + public static String SessionKey_SessionData { get; } = "SaxSessionData"; + public static Encoding sessionDataEncoding { get; } = Encoding.UTF8; + //JSON Serialisation. + public class SaxSessionDataContractResolver : DefaultContractResolver + { + // To allow private properties to be deserialised. + // NB Only applies to top level properties in the serialised object. + protected override List GetSerializableMembers(Type objectType) + { + var flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; + MemberInfo[] fields = objectType.GetFields(flags); + return fields + .Concat(objectType.GetProperties(flags).Where(propInfo => propInfo.CanWrite)) + .ToList(); + } + protected override IList CreateProperties(Type type, MemberSerialization memberSerialization) + { + return base.CreateProperties(type, MemberSerialization.Fields); + } + }; + public static JsonSerializerSettings JsonDeserialisationSettings = new JsonSerializerSettings + { + ContractResolver = new SaxSessionDataContractResolver(), + // Force all deserialised objects to be replaced - to avoid proxy lists not populating. + ObjectCreationHandling = ObjectCreationHandling.Replace + }; + } + private readonly SessionStorage sessionStorage = new SessionStorage(); + protected JsonSerializerSettings SaxSessionDataJsonSerializerSettings { get { return SessionStorage.JsonDeserialisationSettings; } } + + //------------------------------------------------------------------- + public SaxSessionData SessionData + { + get + { + try + { + // Retrieve session data if not already in controller. + if (sessionStorage.SessionData == null) + { + byte[] sessionDataBytes = null; + HttpContext.Session.TryGetValue(SessionStorage.SessionKey_SessionData, out sessionDataBytes); + if (sessionDataBytes != null) + { + String sessionDataJson = SessionStorage.sessionDataEncoding.GetString(sessionDataBytes); + sessionStorage.SessionData = DeserializeSessionData(sessionDataJson); + } + } + return sessionStorage.SessionData; + } + catch (Exception exc) + { + SaLogger.Warn($"{SysUtil.Fn} {exc.GetType().Name} - {exc.Message}{exc.GetStackEntries().Concat("", "\n\t")}"); + } + return null; + } + } + protected abstract SaxSessionData DeserializeSessionData(String sessionDataJson); + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaxoniteCoreWeb/Base/Middleware/SaxModelBinder.cs b/SaxoniteCoreWeb/Base/Middleware/SaxModelBinder.cs index 5361961..206d471 100644 --- a/SaxoniteCoreWeb/Base/Middleware/SaxModelBinder.cs +++ b/SaxoniteCoreWeb/Base/Middleware/SaxModelBinder.cs @@ -12,6 +12,9 @@ using System.Text; using System.Text.RegularExpressions; using static Saxonite.Net.Standard.Base.App.Sax.Config.Security; +// Ignore obsolete warning on ComplexTypeModelBinder. +#pragma warning disable 0618 + namespace Saxonite.Net.Core.Web.Base.Middleware { //======================================================================= diff --git a/SaxoniteCoreWeb/Base/Models/SaxModel_Base.cs b/SaxoniteCoreWeb/Base/Models/SaxModel_Base.cs index a6af467..cc8e7a1 100644 --- a/SaxoniteCoreWeb/Base/Models/SaxModel_Base.cs +++ b/SaxoniteCoreWeb/Base/Models/SaxModel_Base.cs @@ -215,10 +215,18 @@ namespace Saxonite.Net.Core.Web.Base.Models //------------------------------------------------------------------- // Display data - Dates. public String FormatDateForDisplay(DateTime value) + { + return FormatDateForDisplay((DateTime?)value); + } + public String FormatDateForDisplay(DateTime? value) { return DateUtil.Format(value, "d-MMM-yy", SessionCulture); } public String FormatDateTimeForDisplay(DateTime value) + { + return FormatDateTimeForDisplay((DateTime?)value); + } + public String FormatDateTimeForDisplay(DateTime? value) { return StringUtil.TrimAll(DateUtil.Format(value, "d-MMM-yy HH:mm", SessionCulture)); } @@ -249,7 +257,7 @@ namespace Saxonite.Net.Core.Web.Base.Models return "dd-M-yy"; } } - public String FormatDateForForm(DateTime value) + public String FormatDateForForm(DateTime? value) { return DateUtil.Format(value, "dd-MMM-yyyy", SessionCulture); } diff --git a/SaxoniteCoreWeb/Base/Procs/SaxGolfUsgaDataLookup-ScheduledUsgaDataLookup.cs b/SaxoniteCoreWeb/Base/Procs/SaxGolfUsgaDataLookup-ScheduledUsgaDataLookup.cs index 5771ea3..70cc965 100644 --- a/SaxoniteCoreWeb/Base/Procs/SaxGolfUsgaDataLookup-ScheduledUsgaDataLookup.cs +++ b/SaxoniteCoreWeb/Base/Procs/SaxGolfUsgaDataLookup-ScheduledUsgaDataLookup.cs @@ -66,7 +66,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs // Check USGA Country Province population. List usgaCountriesWithProvinces = new List(); List usgaCountriesWithNoProvinces = new List(); - foreach (SaxGolfUsgaCountry usgaCountry in usgaCountries.OrderBy(_ => SacsRandomHelper.GetInt32(Int32.MaxValue))) + foreach (SaxGolfUsgaCountry usgaCountry in usgaCountries.OrderBy(item => item.Priority ? 0 : 1).ThenBy(_ => SacsRandomHelper.GetInt32(Int32.MaxValue))) { SaxGolfUsgaProvince.Params prmUsgaProvince = new SaxGolfUsgaProvince.Params(); prmUsgaProvince.CountryIdsIncluded.Add(usgaCountry.Id); @@ -77,7 +77,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs { // Country has no Provinces - look them up. List provincesData = usgaDataLookup.LookupUsgaProvincesForCountry(usgaCountry.CountryCode); - SaLogger.Info($"{SysUtil.Fn} USGA Provinces populated for {usgaCountry.CountryCode} {usgaCountry.CountryName}: {provincesData.Count}.", true); + SaLogger.Info($"{SysUtil.Fn} USGA Provinces populated for {usgaCountry.CountryCode} {usgaCountry.CountryName}" + (usgaCountry.Priority ? " [Priority]" : "") + $": {provincesData.Count}.", true); return; } } @@ -100,12 +100,12 @@ namespace Saxonite.Net.Core.Web.Base.Procs { SaxGolfUsgaProvince.Params prmUsgaProvince = new SaxGolfUsgaProvince.Params(); prmUsgaProvince.CountryIdsIncluded.Add(usgaCountry.Id); - List usgaProvinces = internals.ReferenceGolfMgr.GetUsgaProvinceList(prmUsgaProvince).OrderBy(_ => SacsRandomHelper.GetInt32(Int32.MaxValue)).ToList(); + List usgaProvinces = internals.ReferenceGolfMgr.GetUsgaProvinceList(prmUsgaProvince).OrderBy(item => item.Priority ? 0 : 1).ThenBy(_ => SacsRandomHelper.GetInt32(Int32.MaxValue)).ToList(); if (usgaProvinces.Any()) { // Refresh Country Provinces. List provincesData = usgaDataLookup.LookupUsgaProvincesForCountry(usgaCountry.CountryCode); - SaLogger.Info($"{SysUtil.Fn} USGA Provinces refreshed for {usgaCountry.CountryCode} {usgaCountry.CountryName}: {provincesData.Count}.", true); + SaLogger.Info($"{SysUtil.Fn} USGA Provinces refreshed for {usgaCountry.CountryCode} {usgaCountry.CountryName}" + (usgaCountry.Priority ? " [Priority]" : "") + $": {provincesData.Count}.", true); return; } } @@ -124,7 +124,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs List usgaProvincesWithNoFacilities = new List(); SaxGolfUsgaProvince.Params prmUsgaProvince = new SaxGolfUsgaProvince.Params(); prmUsgaProvince.CountryIdsIncluded.Add(usgaCountry.Id); - foreach (SaxGolfUsgaProvince usgaProvince in internals.ReferenceGolfMgr.GetUsgaProvinceList(prmUsgaProvince).OrderBy(_ => SacsRandomHelper.GetInt32(Int32.MaxValue))) + foreach (SaxGolfUsgaProvince usgaProvince in internals.ReferenceGolfMgr.GetUsgaProvinceList(prmUsgaProvince).OrderBy(item => item.Priority ? 0 : 1).ThenBy(_ => SacsRandomHelper.GetInt32(Int32.MaxValue))) { SaxGolfUsgaFacility.Params prmUsgaFacility = new SaxGolfUsgaFacility.Params(); prmUsgaFacility.ProvinceIdsIncluded.Add(usgaProvince.Id); @@ -135,7 +135,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs { // Province has no Facilities - look up the courses. List coursesData = usgaDataLookup.LookupUsgaCoursesForCountryAndProvince(usgaCountry.CountryCode, usgaProvince.ProvinceCode); - SaLogger.Info($"{SysUtil.Fn} USGA Courses populated for {usgaCountry.CountryCode} {usgaCountry.CountryName} - {usgaProvince.ProvinceCode} {usgaProvince.ProvinceName}: {coursesData.Count}.", true); + SaLogger.Info($"{SysUtil.Fn} USGA Courses populated for {usgaCountry.CountryCode} {usgaCountry.CountryName} - {usgaProvince.ProvinceCode} {usgaProvince.ProvinceName}" + (usgaProvince.Priority ? " [Priority]" : "") + $": {coursesData.Count}.", true); return; } } @@ -158,14 +158,14 @@ namespace Saxonite.Net.Core.Web.Base.Procs { // Refresh Courses for Province with Facilities. List coursesData = usgaDataLookup.LookupUsgaCoursesForCountryAndProvince(usgaCountry.CountryCode, usgaProvince.ProvinceCode); - SaLogger.Info($"{SysUtil.Fn} USGA Courses refreshed for {usgaCountry.CountryCode} {usgaCountry.CountryName} - {usgaProvince.ProvinceCode} {usgaProvince.ProvinceName}: {coursesData.Count}.", true); + SaLogger.Info($"{SysUtil.Fn} USGA Courses refreshed for {usgaCountry.CountryCode} {usgaCountry.CountryName} - {usgaProvince.ProvinceCode} {usgaProvince.ProvinceName}" + (usgaProvince.Priority ? " [Priority]" : "") + $": {coursesData.Count}.", true); return; } // Compile list of Courses for this province. SaxGolfUsgaCourse.Params prmCourse = new SaxGolfUsgaCourse.Params(); prmCourse.ProvinceIdsIncluded.Add(usgaProvince.Id); - List usgaCourses = internals.ReferenceGolfMgr.GetUsgaCourseList(prmCourse).OrderBy(_ => SacsRandomHelper.GetInt32(Int32.MaxValue)).ToList(); + List usgaCourses = internals.ReferenceGolfMgr.GetUsgaCourseList(prmCourse).OrderBy(item => item.Priority ? 0 : 1).ThenBy(_ => SacsRandomHelper.GetInt32(Int32.MaxValue)).ToList(); List usgaCoursesWithMarkers = new List(); foreach (SaxGolfUsgaCourse usgaCourse in usgaCourses) { @@ -175,7 +175,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs { // Populate Markers for first course without markers. List markersData = usgaDataLookup.LookupUsgaMarkersForCourse(usgaCourse.CourseId); - SaLogger.Info($"{SysUtil.Fn} USGA Markers populated for {usgaCountry.CountryCode} {usgaCountry.CountryName} - {usgaProvince.ProvinceCode} {usgaProvince.ProvinceName} - {usgaCourse.Caption} [Id: {usgaCourse.CourseId}]: {markersData.Count}.", true); + SaLogger.Info($"{SysUtil.Fn} USGA Markers populated for {usgaCountry.CountryCode} {usgaCountry.CountryName} - {usgaProvince.ProvinceCode} {usgaProvince.ProvinceName} - {usgaCourse.Caption} [Id: {usgaCourse.CourseId}" + (usgaCourse.Priority ? ", Priority" : "") + $"]: {markersData.Count}.", true); return; } else usgaCoursesWithMarkers.Add(usgaCourse); @@ -185,7 +185,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs // Populate Markers for first course with markers. SaxGolfUsgaCourse usgaCourse = usgaCoursesWithMarkers[0]; List markersData = usgaDataLookup.LookupUsgaMarkersForCourse(usgaCourse.CourseId); - SaLogger.Info($"{SysUtil.Fn} USGA Markers refreshed for {usgaCountry.CountryCode} {usgaCountry.CountryName} - {usgaProvince.ProvinceCode} {usgaProvince.ProvinceName} - {usgaCourse.Caption} [Id: {usgaCourse.CourseId}]: {markersData.Count}.", true); + SaLogger.Info($"{SysUtil.Fn} USGA Markers refreshed for {usgaCountry.CountryCode} {usgaCountry.CountryName} - {usgaProvince.ProvinceCode} {usgaProvince.ProvinceName} - {usgaCourse.Caption} [Id: {usgaCourse.CourseId}" + (usgaCourse.Priority ? ", Priority" : "") + $"]: {markersData.Count}.", true); return; } } @@ -198,7 +198,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs if (usgaCountry != null && usgaProvince != null && usgaCountry.Id.Equals(usgaProvince.CountryId)) { List coursesData = usgaDataLookup.LookupUsgaCoursesForCountryAndProvince(usgaCountry.CountryCode, usgaProvince.ProvinceCode); - SaLogger.Info($"{SysUtil.Fn} USGA Courses populated for {usgaCountry.CountryCode} {usgaCountry.CountryName} - {usgaProvince.ProvinceCode} {usgaProvince.ProvinceName}: {coursesData.Count}. [Fallback]", true); + SaLogger.Info($"{SysUtil.Fn} USGA Courses populated for {usgaCountry.CountryCode} {usgaCountry.CountryName} - {usgaProvince.ProvinceCode} {usgaProvince.ProvinceName}" + (usgaProvince.Priority ? " [Priority]" : "") + $": {coursesData.Count}. [Fallback]", true); return; } } @@ -212,7 +212,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs if (usgaCountry != null) { List provincesData = usgaDataLookup.LookupUsgaProvincesForCountry(usgaCountry.CountryCode); - SaLogger.Info($"{SysUtil.Fn} USGA Provinces populated for {usgaCountry.CountryCode} {usgaCountry.CountryName}: {provincesData.Count}. [Fallback]", true); + SaLogger.Info($"{SysUtil.Fn} USGA Provinces populated for {usgaCountry.CountryCode} {usgaCountry.CountryName}" + (usgaCountry.Priority ? " [Priority]" : "") + $": {provincesData.Count}. [Fallback]", true); return; } } diff --git a/SaxoniteCoreWeb/Base/Procs/SaxGolfUsgaDataLookup.cs b/SaxoniteCoreWeb/Base/Procs/SaxGolfUsgaDataLookup.cs index 0d61543..1542639 100644 --- a/SaxoniteCoreWeb/Base/Procs/SaxGolfUsgaDataLookup.cs +++ b/SaxoniteCoreWeb/Base/Procs/SaxGolfUsgaDataLookup.cs @@ -2,6 +2,7 @@ using HtmlAgilityPack; using MailKit; using Microsoft.Net.Http.Headers; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Sarand.Net.Standard.Base.App; using Sarand.Net.Standard.Base.Bus; @@ -11,6 +12,7 @@ using Sarand.Net.Standard.Base.Helpers; using Sarand.Net.Standard.Base.Net; using Sarand.Net.Standard.Base.Utils; using Saxonite.Net.Standard.Base.App; +using Saxonite.Net.Standard.Base.Bus.Reference; using Saxonite.Net.Standard.Base.Mgr.Reference; using System; using System.Collections.Generic; @@ -108,8 +110,8 @@ namespace Saxonite.Net.Core.Web.Base.Procs public SysId CourseId { get; } public SysId MarkerId { get; set; } public string Caption { get { return StringUtil.TrimWhitespace(StringUtil.OnBlank(Tee) + " " + StringUtil.OnBlank(HolesCaption) + " " + StringUtil.OnBlank(Gender)); } } - public short Holes { get; } - public string HolesCaption { get; } + public short Holes { get; set; } + public string HolesCaption { get; set; } public string Tee { get; set; } public string Gender { get; set; } public short SlopeRating { get; set; } @@ -117,15 +119,16 @@ namespace Saxonite.Net.Core.Web.Base.Procs public decimal CourseRating { get; set; } public decimal BogeyRating { get; set; } public short Length { get; set; } - public bool IsValid() + public bool IsValid(bool ignorePar = false) { if (!SysId.IsValid(CourseId)) return false; - if (!SysId.IsValid(MarkerId)) return false; + // 9 hole markers do not have there own Id. + //if (!SysId.IsValid(MarkerId)) return false; if (Holes < 1) return false; if (StringUtil.IsBlank(Tee)) return false; if (StringUtil.IsBlank(Gender)) return false; if (SlopeRating == 0) return false; - if (Par == 0) return false; + if (!ignorePar && Par == 0) return false; if (CourseRating == 0) return false; return true; } @@ -240,7 +243,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs try { - // Query countries on USGA website. + // Query Countries on USGA website. CancellationToken cancelToken = new CancellationToken(); SacsHttpRequestData request = new SacsHttpRequestData(cancelToken) { Url = "https://ncrdb.usga.org/" }; SacsHttpResponseData response = SacsHttpClient.DoRequest(request).Result; @@ -285,7 +288,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs countryData.CountryName = usgaCountry.Name; countriesData.Add(countryData); } - ReferenceGolfMgr.BulkUpdateUsgaCountries(countriesData, config.DbUpdateInfo); + ReferenceGolfMgr.BulkUpdateUsgaCountries(countriesData, DbUpdateInfo); if (ReferenceGolfMgr.HasErrorState()) SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA countries: {ReferenceGolfMgr.ErrorStateMessage}."); @@ -308,77 +311,95 @@ namespace Saxonite.Net.Core.Web.Base.Procs UsgaRequestData usgaRequestData = GetUsgaRequestData(); - try + using (DisposableCollection disposableItems = new DisposableCollection()) { - // Query countries on USGA website. - CancellationToken cancelToken = new CancellationToken(); - SacsHttpRequestData request = new SacsHttpRequestData(cancelToken) { Url = "https://ncrdb.usga.org/NCRListing?handler=LoadStates" }; - // Headers. - request.RequestHeaders.Add(HeaderNames.Accept, "*/*"); - request.RequestHeaders.Add(HeaderNames.AcceptEncoding, "gzip, deflate, br, zstd"); - request.RequestHeaders.Add(HeaderNames.AcceptLanguage, "en-GB,en;q=0.9"); - request.RequestHeaders.Add(HeaderNames.DNT, "1"); - request.RequestHeaders.Add(HeaderNames.Origin, "https://ncrdb.usga.org/"); - request.RequestHeaders.Add("Priority", "u=1, i"); - request.RequestHeaders.Add(HeaderNames.Referer, "https://ncrdb.usga.org/"); - if (!StringUtil.IsBlank(usgaRequestData.RequestVerificationToken)) - request.RequestHeaders.Add("Requestverificationtoken", usgaRequestData.RequestVerificationToken); - // Content. - request.FormData.Add(new KeyValuePair("countryCode", countryCode)); - request.ContentHeaders.Add(HeaderNames.ContentType, "application/x-www-form-urlencoded; charset=UTF-8"); - // Request. - SacsHttpResponseData response = SacsHttpClient.DoRequest(request).Result; - String data = response.Data; - - if (!StringUtil.IsBlank(response.Data)) + // Retrieve and validate country. + SaxGolfUsgaCountry usgaCountry = ReferenceGolfMgr.GetUsgaCountry(new SaxGolfUsgaCountry.Params() { CountryCodeFull = countryCode }); + disposableItems.Add(usgaCountry); + if (usgaCountry == null) { - dynamic provincesJson = SacsJsonHelper.DeserializeJsonObject(response.Data); - if (provincesJson is JArray) + SaLogger.Warn($"{SysUtil.Fn} USGA Country not found for code '{countryCode}'."); + return usgaProvinces; + } + + try + { + // Query Provinces for Country on USGA website. + CancellationToken cancelToken = new CancellationToken(); + SacsHttpRequestData request = new SacsHttpRequestData(cancelToken) { Url = "https://ncrdb.usga.org/NCRListing?handler=LoadStates" }; + // Headers. + request.RequestHeaders.Add(HeaderNames.Accept, "*/*"); + request.RequestHeaders.Add(HeaderNames.AcceptEncoding, "gzip, deflate, br, zstd"); + request.RequestHeaders.Add(HeaderNames.AcceptLanguage, "en-GB,en;q=0.9"); + request.RequestHeaders.Add(HeaderNames.DNT, "1"); + request.RequestHeaders.Add(HeaderNames.Origin, "https://ncrdb.usga.org/"); + request.RequestHeaders.Add("Priority", "u=1, i"); + request.RequestHeaders.Add(HeaderNames.Referer, "https://ncrdb.usga.org/"); + if (!StringUtil.IsBlank(usgaRequestData.RequestVerificationToken)) + request.RequestHeaders.Add("Requestverificationtoken", usgaRequestData.RequestVerificationToken); + // Content. + request.FormData.Add(new KeyValuePair("countryCode", countryCode)); + request.ContentHeaders.Add(HeaderNames.ContentType, "application/x-www-form-urlencoded; charset=UTF-8"); + // Request. + SacsHttpResponseData response = SacsHttpClient.DoRequest(request).Result; + String data = response.Data; + + if (!StringUtil.IsBlank(response.Data)) { - JArray provincesArray = provincesJson as JArray; - foreach (var provinceToken in provincesArray) + dynamic provincesJson = SacsJsonHelper.DeserializeJsonObject(response.Data); + if (provincesJson is JArray) { - // Province properties. - ProvinceData provinceData = new ProvinceData(); - foreach (var propertyToken in provinceToken) + JArray provincesArray = provincesJson as JArray; + foreach (var provinceToken in provincesArray) { - if (propertyToken is JProperty) + // Province properties. + ProvinceData provinceData = new ProvinceData(); + foreach (var propertyToken in provinceToken) { - JProperty provinceProperty = propertyToken as JProperty; - String propertyName = provinceProperty.Name; - String propertyStringValue = StringUtil.TrimWhitespace(provinceProperty.Value.ToString()); - if (propertyName.EqualsCI("text")) - provinceData.Name = propertyStringValue; - else if (propertyName.EqualsCI("value")) - provinceData.Code = propertyStringValue; - else if (propertyName.EqualsCI("group")) { } - else if (propertyName.EqualsCI("selected")) { } - else if (propertyName.EqualsCI("disabled")) { } + if (propertyToken is JProperty) + { + JProperty provinceProperty = propertyToken as JProperty; + String propertyName = provinceProperty.Name; + String propertyStringValue = StringUtil.TrimWhitespace(provinceProperty.Value.ToString()); + if (propertyName.EqualsCI("text")) + provinceData.Name = propertyStringValue; + else if (propertyName.EqualsCI("value")) + provinceData.Code = propertyStringValue; + else if (propertyName.EqualsCI("group")) { } + else if (propertyName.EqualsCI("selected")) { } + else if (propertyName.EqualsCI("disabled")) { } + } } + if (!StringUtil.IsBlank(provinceData.Code) && !provinceData.Code.EqualsCI("(Select)") && !StringUtil.IsBlank(provinceData.Name)) + usgaProvinces.Add(provinceData); } - if (!StringUtil.IsBlank(provinceData.Code) && !provinceData.Code.EqualsCI("(Select)") && !StringUtil.IsBlank(provinceData.Name)) - usgaProvinces.Add(provinceData); } } - } - // Store provinces. - List provincesData = new List(); - foreach (ProvinceData usgaProvince in usgaProvinces) - { - SaxReferenceGolfMgr.UsgaProvinceData provinceData = new SaxReferenceGolfMgr.UsgaProvinceData(); - provinceData.CountryCode = countryCode; - provinceData.ProvinceCode = usgaProvince.Code; - provinceData.ProvinceName = usgaProvince.Name; - provincesData.Add(provinceData); + // Store provinces. + List provincesData = new List(); + foreach (ProvinceData usgaProvince in usgaProvinces) + { + SaxReferenceGolfMgr.UsgaProvinceData provinceData = new SaxReferenceGolfMgr.UsgaProvinceData(); + provinceData.CountryCode = countryCode; + provinceData.ProvinceCode = usgaProvince.Code; + provinceData.ProvinceName = usgaProvince.Name; + provincesData.Add(provinceData); + } + ReferenceGolfMgr.BulkUpdateUsgaProvinces(provincesData, DbUpdateInfo); + if (!ReferenceGolfMgr.HasErrorState()) + { + // Provinces updates OK. + // Clear country 'priority' flag. + usgaCountry.Priority = false; + ReferenceGolfMgr.UpdateUsgaCountry(usgaCountry, DbUpdateInfo); + } + else SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA provinces: {ReferenceGolfMgr.ErrorStateMessage}."); + } + catch (Exception exc) + { + SaLogger.Warn(SysUtil.Fn + " " + ExceptionUtil.GetLogMessage(exc, $"querying USGA provinces for {countryCode}", 0)); } - ReferenceGolfMgr.BulkUpdateUsgaProvinces(provincesData, config.DbUpdateInfo); - if (ReferenceGolfMgr.HasErrorState()) - SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA provinces: {ReferenceGolfMgr.ErrorStateMessage}."); - } - catch (Exception exc) - { - SaLogger.Warn(SysUtil.Fn + " " + ExceptionUtil.GetLogMessage(exc, $"querying USGA provinces for {countryCode}", 0)); } return usgaProvinces; } @@ -394,179 +415,205 @@ namespace Saxonite.Net.Core.Web.Base.Procs UsgaRequestData usgaRequestData = GetUsgaRequestData(); - try + using (DisposableCollection disposableItems = new DisposableCollection()) { - // Query countries on USGA website. - CancellationToken cancelToken = new CancellationToken(); - SacsHttpRequestData request = new SacsHttpRequestData(cancelToken) { Url = "https://ncrdb.usga.org/NCRListing?handler=LoadCourses" }; - // Headers. - request.RequestHeaders.Add(HeaderNames.Accept, "*/*"); - request.RequestHeaders.Add(HeaderNames.AcceptEncoding, "gzip, deflate, br, zstd"); - request.RequestHeaders.Add(HeaderNames.AcceptLanguage, "en-GB,en;q=0.9"); - request.RequestHeaders.Add(HeaderNames.DNT, "1"); - request.RequestHeaders.Add(HeaderNames.Origin, "https://ncrdb.usga.org/"); - request.RequestHeaders.Add("Priority", "u=1, i"); - request.RequestHeaders.Add(HeaderNames.Referer, "https://ncrdb.usga.org/"); - if (!StringUtil.IsBlank(usgaRequestData.RequestVerificationToken)) - request.RequestHeaders.Add("Requestverificationtoken", usgaRequestData.RequestVerificationToken); - // Content. - request.FormData.Add(new KeyValuePair("clubName", "")); - request.FormData.Add(new KeyValuePair("clubCity", "")); - request.FormData.Add(new KeyValuePair("clubState", provinceCode)); - request.FormData.Add(new KeyValuePair("clubCountry", countryCode)); - request.ContentHeaders.Add(HeaderNames.ContentType, "application/x-www-form-urlencoded; charset=UTF-8"); - // Request. - SacsHttpResponseData response = SacsHttpClient.DoRequest(request).Result; - String data = response.Data; - - if (!StringUtil.IsBlank(response.Data)) + // Retrieve and validate country. + SaxGolfUsgaCountry usgaCountry = ReferenceGolfMgr.GetUsgaCountry(new SaxGolfUsgaCountry.Params() { CountryCodeFull = countryCode }); + disposableItems.Add(usgaCountry); + if (usgaCountry == null) { - HashSet UnrecognisedCourseProperties = new HashSet(StringComparer.InvariantCultureIgnoreCase); - dynamic coursesJson = SacsJsonHelper.DeserializeJsonObject(response.Data); - if (coursesJson is JArray) + SaLogger.Warn($"{SysUtil.Fn} USGA Country not found for code '{countryCode}'."); + return usgaCourses; + } + // Retrieve and validate province. + SaxGolfUsgaProvince usgaProvince = ReferenceGolfMgr.GetUsgaProvince(new SaxGolfUsgaProvince.Params() { ProvinceCodeFull = provinceCode }); + disposableItems.Add(usgaProvince); + if (usgaProvince == null) + { + SaLogger.Warn($"{SysUtil.Fn} USGA Province not found for code '{provinceCode}'."); + return usgaCourses; + } + + try + { + // Query Courses for Country & Province on USGA website. + CancellationToken cancelToken = new CancellationToken(); + SacsHttpRequestData request = new SacsHttpRequestData(cancelToken) { Url = "https://ncrdb.usga.org/NCRListing?handler=LoadCourses" }; + // Headers. + request.RequestHeaders.Add(HeaderNames.Accept, "*/*"); + request.RequestHeaders.Add(HeaderNames.AcceptEncoding, "gzip, deflate, br, zstd"); + request.RequestHeaders.Add(HeaderNames.AcceptLanguage, "en-GB,en;q=0.9"); + request.RequestHeaders.Add(HeaderNames.DNT, "1"); + request.RequestHeaders.Add(HeaderNames.Origin, "https://ncrdb.usga.org/"); + request.RequestHeaders.Add("Priority", "u=1, i"); + request.RequestHeaders.Add(HeaderNames.Referer, "https://ncrdb.usga.org/"); + if (!StringUtil.IsBlank(usgaRequestData.RequestVerificationToken)) + request.RequestHeaders.Add("Requestverificationtoken", usgaRequestData.RequestVerificationToken); + // Content. + request.FormData.Add(new KeyValuePair("clubName", "")); + request.FormData.Add(new KeyValuePair("clubCity", "")); + request.FormData.Add(new KeyValuePair("clubState", provinceCode)); + request.FormData.Add(new KeyValuePair("clubCountry", countryCode)); + request.ContentHeaders.Add(HeaderNames.ContentType, "application/x-www-form-urlencoded; charset=UTF-8"); + // Request. + SacsHttpResponseData response = SacsHttpClient.DoRequest(request).Result; + String data = response.Data; + + if (!StringUtil.IsBlank(response.Data)) { - JArray coursesArray = coursesJson as JArray; - foreach (var courseToken in coursesArray) + HashSet UnrecognisedCourseProperties = new HashSet(StringComparer.InvariantCultureIgnoreCase); + dynamic coursesJson = SacsJsonHelper.DeserializeJsonObject(response.Data); + if (coursesJson is JArray) { - // Course properties. - CourseData courseData = new CourseData(); - foreach (var propertyToken in courseToken) + JArray coursesArray = coursesJson as JArray; + foreach (var courseToken in coursesArray) { - if (propertyToken is JProperty) + // Course properties. + CourseData courseData = new CourseData(); + foreach (var propertyToken in courseToken) { - JProperty courseProperty = propertyToken as JProperty; - String propertyName = courseProperty.Name; - String propertyStringValue = StringUtil.TrimWhitespace(courseProperty.Value.ToString()); - if (propertyName.EqualsCI("courseId")) - courseData.CourseId = propertyStringValue; - else if (propertyName.EqualsCI("legacyCRPCourseId")) - courseData.LegacyCrpCourseId = propertyStringValue; - else if (propertyName.EqualsCI("courseName")) - courseData.CourseName = propertyStringValue; - else if (propertyName.EqualsCI("facilityId")) - courseData.FacilityId = propertyStringValue; - else if (propertyName.EqualsCI("facilityName")) - courseData.FacilityName = propertyStringValue; - else if (propertyName.EqualsCI("fullName")) - courseData.FullName = propertyStringValue; - else if (propertyName.EqualsCI("address1")) - courseData.Address1 = propertyStringValue; - else if (propertyName.EqualsCI("address2")) - courseData.Address2 = propertyStringValue; - else if (propertyName.EqualsCI("city")) - courseData.City = propertyStringValue; - else if (propertyName.EqualsCI("entStateCode")) - courseData.EntProvinceCode = propertyStringValue; - else if (propertyName.EqualsCI("state")) - courseData.ProvinceCode = propertyStringValue; - else if (propertyName.EqualsCI("stateDisplay")) - courseData.Province = propertyStringValue; - else if (propertyName.EqualsCI("country")) - courseData.CountryCode = propertyStringValue; - else if (propertyName.EqualsCI("entCountryCode")) - courseData.EntCountryCode = propertyStringValue; - else if (propertyName.EqualsCI("email")) - courseData.Email = propertyStringValue; - else if (propertyName.EqualsCI("telephone")) - courseData.Telephone = propertyStringValue; - else if (propertyName.EqualsCI("ratings")) + if (propertyToken is JProperty) { - if (courseProperty.Value.Count() > 0) - courseData.Ratings.Add(""); + JProperty courseProperty = propertyToken as JProperty; + String propertyName = courseProperty.Name; + String propertyStringValue = StringUtil.TrimWhitespace(courseProperty.Value.ToString()); + if (propertyName.EqualsCI("courseId")) + courseData.CourseId = propertyStringValue; + else if (propertyName.EqualsCI("legacyCRPCourseId")) + courseData.LegacyCrpCourseId = propertyStringValue; + else if (propertyName.EqualsCI("courseName")) + courseData.CourseName = propertyStringValue; + else if (propertyName.EqualsCI("facilityId")) + courseData.FacilityId = propertyStringValue; + else if (propertyName.EqualsCI("facilityName")) + courseData.FacilityName = propertyStringValue; + else if (propertyName.EqualsCI("fullName")) + courseData.FullName = propertyStringValue; + else if (propertyName.EqualsCI("address1")) + courseData.Address1 = propertyStringValue; + else if (propertyName.EqualsCI("address2")) + courseData.Address2 = propertyStringValue; + else if (propertyName.EqualsCI("city")) + courseData.City = propertyStringValue; + else if (propertyName.EqualsCI("entStateCode")) + courseData.EntProvinceCode = propertyStringValue; + else if (propertyName.EqualsCI("state")) + courseData.ProvinceCode = propertyStringValue; + else if (propertyName.EqualsCI("stateDisplay")) + courseData.Province = propertyStringValue; + else if (propertyName.EqualsCI("country")) + courseData.CountryCode = propertyStringValue; + else if (propertyName.EqualsCI("entCountryCode")) + courseData.EntCountryCode = propertyStringValue; + else if (propertyName.EqualsCI("email")) + courseData.Email = propertyStringValue; + else if (propertyName.EqualsCI("telephone")) + courseData.Telephone = propertyStringValue; + else if (propertyName.EqualsCI("ratings")) + { + if (courseProperty.Value.Count() > 0) + courseData.Ratings.Add(""); + } + else UnrecognisedCourseProperties.Add(propertyName); } - else UnrecognisedCourseProperties.Add(propertyName); + } + if (!StringUtil.IsBlank(courseData.CourseId) && !StringUtil.IsBlank(courseData.CourseName)) + { + // Populate caption and add to list. + SetCourseCaption(courseData); + usgaCourses.Add(courseData); } } - if (!StringUtil.IsBlank(courseData.CourseId) && !StringUtil.IsBlank(courseData.CourseName)) - { - // Populate caption and add to list. - SetCourseCaption(courseData); - usgaCourses.Add(courseData); - } } + if (UnrecognisedCourseProperties.Any()) + SaLogger.Warn(SysUtil.Fn + " Unrecognised USGA course properties: " + String.Join(", ", UnrecognisedCourseProperties)); } - if (UnrecognisedCourseProperties.Any()) - SaLogger.Warn(SysUtil.Fn + " Unrecognised USGA course properties: " + String.Join(", ", UnrecognisedCourseProperties)); - } - // Store countries. - Dictionary countriesData = new Dictionary(); - foreach (CourseData usgaCourse in usgaCourses) - { - SaxReferenceGolfMgr.UsgaCountryData countryData = new SaxReferenceGolfMgr.UsgaCountryData(); - countryData.CountryCode = usgaCourse.CountryCode; - countryData.EntCountryCode = usgaCourse.EntCountryCode; - countriesData[countryData.CountryCode] = countryData; - } - ReferenceGolfMgr.BulkUpdateUsgaCountries(countriesData.Values.ToList(), config.DbUpdateInfo); - if (ReferenceGolfMgr.HasErrorState()) - SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA countries: {ReferenceGolfMgr.ErrorStateMessage}."); - - // Store provinces. - Dictionary provincesData = new Dictionary(); - foreach (CourseData usgaCourse in usgaCourses) - { - SaxReferenceGolfMgr.UsgaProvinceData provinceData = new SaxReferenceGolfMgr.UsgaProvinceData(); - provinceData.CountryCode = usgaCourse.CountryCode; - provinceData.ProvinceCode = usgaCourse.ProvinceCode; - provinceData.EntProvinceCode = usgaCourse.EntProvinceCode; - provincesData[provinceData.ProvinceCode] = provinceData; - } - ReferenceGolfMgr.BulkUpdateUsgaProvinces(provincesData.Values.ToList(), config.DbUpdateInfo); - if (ReferenceGolfMgr.HasErrorState()) - SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA provinces: {ReferenceGolfMgr.ErrorStateMessage}."); - - // Store facilities. - Dictionary facilitiesData = new Dictionary(); - foreach (CourseData usgaCourse in usgaCourses) - { - if (StringUtil.IsBlank(usgaCourse.FacilityId)) continue; - SaxReferenceGolfMgr.UsgaFacilityData facilityData = new SaxReferenceGolfMgr.UsgaFacilityData(); - facilityData.ProvinceCode = provinceCode; - facilityData.FacilityId = StringUtil.ToSysId(usgaCourse.FacilityId); - facilityData.FacilityName = usgaCourse.FacilityName; - if (!SysId.IsValid(facilityData.FacilityId)) + // Store countries. + Dictionary countriesData = new Dictionary(); + foreach (CourseData usgaCourse in usgaCourses) { - SaLogger.Warn($"{SysUtil.Fn} Invalid Facility Id for {usgaCourse.CourseName}: {usgaCourse.FacilityId}."); - continue; + SaxReferenceGolfMgr.UsgaCountryData countryData = new SaxReferenceGolfMgr.UsgaCountryData(); + countryData.CountryCode = usgaCourse.CountryCode; + countryData.EntCountryCode = usgaCourse.EntCountryCode; + countriesData[countryData.CountryCode] = countryData; } - facilitiesData[facilityData.FacilityId] = facilityData; - } - ReferenceGolfMgr.BulkUpdateUsgaFacilities(facilitiesData.Values.ToList(), config.DbUpdateInfo); - if (ReferenceGolfMgr.HasErrorState()) - SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA facilities: {ReferenceGolfMgr.ErrorStateMessage}."); + ReferenceGolfMgr.BulkUpdateUsgaCountries(countriesData.Values.ToList(), DbUpdateInfo); + if (ReferenceGolfMgr.HasErrorState()) + SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA countries: {ReferenceGolfMgr.ErrorStateMessage}."); - // Store courses. - Dictionary coursesData = new Dictionary(); - foreach (CourseData usgaCourse in usgaCourses) - { - if (StringUtil.IsBlank(usgaCourse.CourseId)) continue; - SaxReferenceGolfMgr.UsgaCourseData courseData = new SaxReferenceGolfMgr.UsgaCourseData(); - courseData.FacilityId = StringUtil.ToSysId(usgaCourse.FacilityId); - courseData.CourseId = StringUtil.ToSysId(usgaCourse.CourseId); - courseData.LegacyCrpCourseId = StringUtil.ToSysId(usgaCourse.LegacyCrpCourseId); - courseData.Caption = usgaCourse.Caption; - courseData.CourseName = usgaCourse.CourseName; - courseData.FullName = usgaCourse.FullName; - courseData.Address1 = usgaCourse.Address1; - courseData.Address2 = usgaCourse.Address2; - courseData.City = usgaCourse.City; - courseData.Email = usgaCourse.Email; - courseData.Telephone = usgaCourse.Telephone; - if (!SysId.IsValid(courseData.CourseId)) + // Store provinces. + Dictionary provincesData = new Dictionary(); + foreach (CourseData usgaCourse in usgaCourses) { - SaLogger.Warn($"{SysUtil.Fn} Invalid Course Id for {usgaCourse.CourseName}: {usgaCourse.CourseId}."); - continue; + SaxReferenceGolfMgr.UsgaProvinceData provinceData = new SaxReferenceGolfMgr.UsgaProvinceData(); + provinceData.CountryCode = usgaCourse.CountryCode; + provinceData.ProvinceCode = usgaCourse.ProvinceCode; + provinceData.EntProvinceCode = usgaCourse.EntProvinceCode; + provincesData[provinceData.ProvinceCode] = provinceData; } - coursesData[courseData.CourseId] = courseData; + ReferenceGolfMgr.BulkUpdateUsgaProvinces(provincesData.Values.ToList(), DbUpdateInfo); + if (ReferenceGolfMgr.HasErrorState()) + SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA provinces: {ReferenceGolfMgr.ErrorStateMessage}."); + + // Store facilities. + Dictionary facilitiesData = new Dictionary(); + foreach (CourseData usgaCourse in usgaCourses) + { + if (StringUtil.IsBlank(usgaCourse.FacilityId)) continue; + SaxReferenceGolfMgr.UsgaFacilityData facilityData = new SaxReferenceGolfMgr.UsgaFacilityData(); + facilityData.ProvinceCode = provinceCode; + facilityData.FacilityId = StringUtil.ToSysId(usgaCourse.FacilityId); + facilityData.FacilityName = usgaCourse.FacilityName; + if (!SysId.IsValid(facilityData.FacilityId)) + { + SaLogger.Warn($"{SysUtil.Fn} Invalid Facility Id for {usgaCourse.CourseName}: {usgaCourse.FacilityId}."); + continue; + } + facilitiesData[facilityData.FacilityId] = facilityData; + } + ReferenceGolfMgr.BulkUpdateUsgaFacilities(facilitiesData.Values.ToList(), DbUpdateInfo); + if (ReferenceGolfMgr.HasErrorState()) + SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA facilities: {ReferenceGolfMgr.ErrorStateMessage}."); + + // Store courses. + Dictionary coursesData = new Dictionary(); + foreach (CourseData usgaCourse in usgaCourses) + { + if (StringUtil.IsBlank(usgaCourse.CourseId)) continue; + SaxReferenceGolfMgr.UsgaCourseData courseData = new SaxReferenceGolfMgr.UsgaCourseData(); + courseData.FacilityId = StringUtil.ToSysId(usgaCourse.FacilityId); + courseData.CourseId = StringUtil.ToSysId(usgaCourse.CourseId); + courseData.LegacyCrpCourseId = StringUtil.ToSysId(usgaCourse.LegacyCrpCourseId); + courseData.Caption = usgaCourse.Caption; + courseData.CourseName = usgaCourse.CourseName; + courseData.FullName = usgaCourse.FullName; + courseData.Address1 = usgaCourse.Address1; + courseData.Address2 = usgaCourse.Address2; + courseData.City = usgaCourse.City; + courseData.Email = usgaCourse.Email; + courseData.Telephone = usgaCourse.Telephone; + if (!SysId.IsValid(courseData.CourseId)) + { + SaLogger.Warn($"{SysUtil.Fn} Invalid Course Id for {usgaCourse.CourseName}: {usgaCourse.CourseId}."); + continue; + } + coursesData[courseData.CourseId] = courseData; + } + ReferenceGolfMgr.BulkUpdateUsgaCourses(coursesData.Values.ToList(), DbUpdateInfo); + if (!ReferenceGolfMgr.HasErrorState()) + { + // Courses updates OK. + // Clear province 'priority' flag. + usgaProvince.Priority = false; + ReferenceGolfMgr.UpdateUsgaProvince(usgaProvince, DbUpdateInfo); + } + else SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA courses: {ReferenceGolfMgr.ErrorStateMessage}."); + } + catch (Exception exc) + { + SaLogger.Warn(SysUtil.Fn + " " + ExceptionUtil.GetLogMessage(exc, $"querying USGA courses for {countryCode}", 0)); } - ReferenceGolfMgr.BulkUpdateUsgaCourses(coursesData.Values.ToList(), config.DbUpdateInfo); - if (ReferenceGolfMgr.HasErrorState()) - SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA courses: {ReferenceGolfMgr.ErrorStateMessage}."); - } - catch (Exception exc) - { - SaLogger.Warn(SysUtil.Fn + " " + ExceptionUtil.GetLogMessage(exc, $"querying USGA courses for {countryCode}", 0)); } return usgaCourses; } @@ -649,196 +696,240 @@ namespace Saxonite.Net.Core.Web.Base.Procs public int ColIdx_Length { get; set; } = -1; } /// + /// Class to allow markers list to be serialised as 'Markers'. + /// + private class MarkersData + { + public List Markers { get; } = new List(); + } + /// /// USGA Markers for course. /// public List LookupUsgaMarkersForCourse(SysId usgaCourseId) { - List usgaMarkers = new List(); - if (!SysId.IsValid(usgaCourseId)) return usgaMarkers; + MarkersData markersData = new MarkersData(); + if (!SysId.IsValid(usgaCourseId)) return markersData.Markers; MarkerColumnData markerColumns = new MarkerColumnData(); - try + using (DisposableCollection disposableItems = new DisposableCollection()) { - // Query countries on USGA website. - CancellationToken cancelToken = new CancellationToken(); - SacsHttpRequestData request = new SacsHttpRequestData(cancelToken) { Url = $"https://ncrdb.usga.org/courseTeeInfo?CourseID={usgaCourseId}" }; - SacsHttpResponseData response = SacsHttpClient.DoRequest(request).Result; - String data = response.Data; - - if (!StringUtil.IsBlank(response.Data)) + // Retrieve and validate course. + SaxGolfUsgaCourse.Params prmCourse = new SaxGolfUsgaCourse.Params(); + prmCourse.CourseIdsIncluded.Add(usgaCourseId); + SaxGolfUsgaCourse usgaCourse = ReferenceGolfMgr.GetUsgaCourse(prmCourse); + disposableItems.Add(usgaCourse); + if (usgaCourse == null) { - // Parse HTML. - HtmlDocument htmlDoc = new HtmlDocument(); - htmlDoc.LoadHtml(response.Data); + SaLogger.Warn($"{SysUtil.Fn} USGA Course not found for Id '{usgaCourseId}'."); + return markersData.Markers; + } - // Locate countries list. - HtmlNode teeTableNode = htmlDoc.GetElementbyId("gvTee"); - if (teeTableNode != null) + try + { + // Query course markers on USGA website. + CancellationToken cancelToken = new CancellationToken(); + SacsHttpRequestData request = new SacsHttpRequestData(cancelToken) { Url = $"https://ncrdb.usga.org/courseTeeInfo?CourseID={usgaCourseId}" }; + SacsHttpResponseData response = SacsHttpClient.DoRequest(request).Result; + String data = response.Data; + + if (!StringUtil.IsBlank(response.Data)) { - // Identify marker columns. - int teeColumnIdx = -1; - foreach (HtmlNode teeHeaderNode in teeTableNode.SelectNodes("./tr[1]/th")) + // Parse HTML. + HtmlDocument htmlDoc = new HtmlDocument(); + htmlDoc.LoadHtml(response.Data); + + // Locate countries list. + HtmlNode teeTableNode = htmlDoc.GetElementbyId("gvTee"); + if (teeTableNode != null) { - teeColumnIdx++; - String headerText = StringUtil.TrimWhitespace(WebUtil.HtmlDecode(teeHeaderNode.InnerText)); - if (StringUtil.IsBlank(headerText) || headerText.EqualsCI("CH")) - { - // Columns ignored. - } - else if (headerText.EqualsCI("Tee Name")) markerColumns.ColIdx_Tee = teeColumnIdx; - else if (headerText.EqualsCI("Gender")) markerColumns.ColIdx_Gender = teeColumnIdx; - else if (headerText.EqualsCI("Par")) markerColumns.ColIdx_Par = teeColumnIdx; - else if (headerText.EqualsCI("TeeId")) markerColumns.ColIdx_MarkerId = teeColumnIdx; - else if (headerText.EqualsCI("Length")) markerColumns.ColIdx_Length = teeColumnIdx; - // Specific part-course (9 holes) values. - else if (headerText.EqualsCI("RatingF9")) markerColumns.ColIdx_Front9CourseRating = teeColumnIdx; - else if (headerText.EqualsCI("RatingB9")) markerColumns.ColIdx_Back9CourseRating = teeColumnIdx; - else if (headerText.EqualsCI("Front (9)")) markerColumns.ColIdx_Front9 = teeColumnIdx; - else if (headerText.EqualsCI("Back (9)")) markerColumns.ColIdx_Back9 = teeColumnIdx; - else if (headerText.EqualsCI("Bogey Rating (F9)")) markerColumns.ColIdx_Front9BogeyRating = teeColumnIdx; - else if (headerText.EqualsCI("Bogey Rating (B9)")) markerColumns.ColIdx_Back9BogeyRating = teeColumnIdx; - else if (headerText.EqualsCI("Slope (F9)")) markerColumns.ColIdx_Front9SlopeRating = teeColumnIdx; - else if (headerText.EqualsCI("Slope (B9)")) markerColumns.ColIdx_Back9SlopeRating = teeColumnIdx; - // Less specific full-course (commonly 18 holes) values. - else if (headerText.IsMatchCI("Course Rating")) markerColumns.ColIdx_CourseRating = teeColumnIdx; - else if (headerText.IsMatchCI("Bogey Rating")) markerColumns.ColIdx_BogeyRating = teeColumnIdx; - else if (headerText.IsMatchCI("Slope Rating")) markerColumns.ColIdx_SlopeRating = teeColumnIdx; - else SaLogger.Info($"{SysUtil.Fn} Unexpected Marker column header: {headerText}"); - } - foreach (HtmlNode teeRowNode in teeTableNode.SelectNodes("./tr[position()>1]")) - { - MarkerData markerData18 = new MarkerData(usgaCourseId, 18, "18"); - MarkerData markerDataF9 = new MarkerData(usgaCourseId, 9, "F9"); - MarkerData markerDataB9 = new MarkerData(usgaCourseId, 9, "B9"); - teeColumnIdx = -1; - foreach (HtmlNode teePropertyNode in teeRowNode.SelectNodes("./td")) + // Identify marker columns. + int teeColumnIdx = -1; + foreach (HtmlNode teeHeaderNode in teeTableNode.SelectNodes("./tr[1]/th")) { teeColumnIdx++; - String propertyText = StringUtil.TrimWhitespace(WebUtil.HtmlDecode(teePropertyNode.InnerText)); - if (markerColumns.ColIdx_Tee == teeColumnIdx) + String headerText = StringUtil.TrimWhitespace(WebUtil.HtmlDecode(teeHeaderNode.InnerText)); + if (StringUtil.IsBlank(headerText) || headerText.EqualsCI("CH")) { - markerData18.Tee = propertyText; - markerDataF9.Tee = propertyText; - markerDataB9.Tee = propertyText; - } - else if (markerColumns.ColIdx_Gender == teeColumnIdx) - { - markerData18.Gender = propertyText; - markerDataF9.Gender = propertyText; - markerDataB9.Gender = propertyText; - } - else if (markerColumns.ColIdx_Par == teeColumnIdx) - { - markerData18.Par = StringUtil.ToShort(propertyText); - } - else if (markerColumns.ColIdx_CourseRating == teeColumnIdx) - { - markerData18.CourseRating = StringUtil.ToDecimal(propertyText); - } - else if (markerColumns.ColIdx_BogeyRating == teeColumnIdx) - { - markerData18.BogeyRating = StringUtil.ToDecimal(propertyText); - } - else if (markerColumns.ColIdx_SlopeRating == teeColumnIdx) - { - markerData18.SlopeRating = StringUtil.ToShort(propertyText); - } - else if (markerColumns.ColIdx_Front9CourseRating == teeColumnIdx) - { - if (markerDataF9.CourseRating == 0) - markerDataF9.CourseRating = StringUtil.ToDecimal(propertyText); - } - else if (markerColumns.ColIdx_Back9CourseRating == teeColumnIdx) - { - if (markerDataB9.CourseRating == 0) - markerDataB9.CourseRating = StringUtil.ToDecimal(propertyText); - } - else if (markerColumns.ColIdx_Front9 == teeColumnIdx) - { - // Format: CourseRating / SlopeRating. - markerDataF9.CourseRating = StringUtil.ToDecimal(Regex.Replace(propertyText, "\\s*/.*$", "")); - markerDataF9.SlopeRating = StringUtil.ToShort(Regex.Replace(propertyText, "^.*/\\s*", "")); - } - else if (markerColumns.ColIdx_Back9 == teeColumnIdx) - { - // Format: CourseRating / SlopeRating. - markerDataB9.CourseRating = StringUtil.ToDecimal(Regex.Replace(propertyText, "\\s*/.*$", "")); - markerDataB9.SlopeRating = StringUtil.ToShort(Regex.Replace(propertyText, "^.*/\\s*", "")); - } - else if (markerColumns.ColIdx_Front9BogeyRating == teeColumnIdx) - { - markerDataF9.BogeyRating = StringUtil.ToDecimal(propertyText); - } - else if (markerColumns.ColIdx_Back9BogeyRating == teeColumnIdx) - { - markerDataB9.BogeyRating = StringUtil.ToDecimal(propertyText); - } - else if (markerColumns.ColIdx_Front9SlopeRating == teeColumnIdx) - { - if (markerDataF9.SlopeRating == 0) - markerDataF9.SlopeRating = StringUtil.ToShort(propertyText); - } - else if (markerColumns.ColIdx_Back9SlopeRating == teeColumnIdx) - { - // Back 9 Slope Rating populated with value for Front 9. - //markerDataB9.SlopeRating = StringUtil.ToInt(propertyText); - } - else if (markerColumns.ColIdx_MarkerId == teeColumnIdx) - { - markerData18.MarkerId = StringUtil.ToSysId(propertyText); - // Unclear if Tee Id is relevant to 9 holes. - //markerDataF9.MarkerId = StringUtil.ToSysId(propertyText); - //markerDataB9.MarkerId = StringUtil.ToSysId(propertyText); - } - else if (markerColumns.ColIdx_Length == teeColumnIdx) - { - markerData18.Length = StringUtil.ToShort(propertyText); + // Columns ignored. } + else if (headerText.EqualsCI("Tee Name")) markerColumns.ColIdx_Tee = teeColumnIdx; + else if (headerText.EqualsCI("Gender")) markerColumns.ColIdx_Gender = teeColumnIdx; + else if (headerText.EqualsCI("Par")) markerColumns.ColIdx_Par = teeColumnIdx; + else if (headerText.EqualsCI("TeeId")) markerColumns.ColIdx_MarkerId = teeColumnIdx; + else if (headerText.EqualsCI("Length")) markerColumns.ColIdx_Length = teeColumnIdx; + // Specific part-course (9 holes) values. + else if (headerText.EqualsCI("RatingF9")) markerColumns.ColIdx_Front9CourseRating = teeColumnIdx; + else if (headerText.EqualsCI("RatingB9")) markerColumns.ColIdx_Back9CourseRating = teeColumnIdx; + else if (headerText.EqualsCI("Front (9)")) markerColumns.ColIdx_Front9 = teeColumnIdx; + else if (headerText.EqualsCI("Back (9)")) markerColumns.ColIdx_Back9 = teeColumnIdx; + else if (headerText.EqualsCI("Bogey Rating (F9)")) markerColumns.ColIdx_Front9BogeyRating = teeColumnIdx; + else if (headerText.EqualsCI("Bogey Rating (B9)")) markerColumns.ColIdx_Back9BogeyRating = teeColumnIdx; + else if (headerText.EqualsCI("Slope (F9)")) markerColumns.ColIdx_Front9SlopeRating = teeColumnIdx; + else if (headerText.EqualsCI("Slope (B9)")) markerColumns.ColIdx_Back9SlopeRating = teeColumnIdx; + // Less specific full-course (commonly 18 holes) values. + else if (headerText.IsMatchCI("Course Rating")) markerColumns.ColIdx_CourseRating = teeColumnIdx; + else if (headerText.IsMatchCI("Bogey Rating")) markerColumns.ColIdx_BogeyRating = teeColumnIdx; + else if (headerText.IsMatchCI("Slope Rating")) markerColumns.ColIdx_SlopeRating = teeColumnIdx; + else SaLogger.Info($"{SysUtil.Fn} Unexpected Marker column header: {headerText}"); } + foreach (HtmlNode teeRowNode in teeTableNode.SelectNodes("./tr[position()>1]")) + { + MarkerData markerData18 = new MarkerData(usgaCourseId, 18, "18"); + MarkerData markerDataF9 = new MarkerData(usgaCourseId, 9, "F9"); + MarkerData markerDataB9 = new MarkerData(usgaCourseId, 9, "B9"); + teeColumnIdx = -1; + foreach (HtmlNode teePropertyNode in teeRowNode.SelectNodes("./td")) + { + teeColumnIdx++; + String propertyText = StringUtil.TrimWhitespace(WebUtil.HtmlDecode(teePropertyNode.InnerText)); + if (markerColumns.ColIdx_Tee == teeColumnIdx) + { + markerData18.Tee = propertyText; + markerDataF9.Tee = propertyText; + markerDataB9.Tee = propertyText; + } + else if (markerColumns.ColIdx_Gender == teeColumnIdx) + { + markerData18.Gender = propertyText; + markerDataF9.Gender = propertyText; + markerDataB9.Gender = propertyText; + } + else if (markerColumns.ColIdx_Par == teeColumnIdx) + { + markerData18.Par = StringUtil.ToShort(propertyText); + if (markerData18.Par <= 50) + { + markerData18.Holes = 9; + markerData18.HolesCaption = "9"; + } + } + else if (markerColumns.ColIdx_CourseRating == teeColumnIdx) + { + markerData18.CourseRating = StringUtil.ToDecimal(propertyText); + } + else if (markerColumns.ColIdx_BogeyRating == teeColumnIdx) + { + markerData18.BogeyRating = StringUtil.ToDecimal(propertyText); + } + else if (markerColumns.ColIdx_SlopeRating == teeColumnIdx) + { + markerData18.SlopeRating = StringUtil.ToShort(propertyText); + } + else if (markerColumns.ColIdx_Front9CourseRating == teeColumnIdx) + { + if (markerDataF9.CourseRating == 0) + markerDataF9.CourseRating = StringUtil.ToDecimal(propertyText); + } + else if (markerColumns.ColIdx_Back9CourseRating == teeColumnIdx) + { + if (markerDataB9.CourseRating == 0) + markerDataB9.CourseRating = StringUtil.ToDecimal(propertyText); + } + else if (markerColumns.ColIdx_Front9 == teeColumnIdx) + { + // Format: CourseRating / SlopeRating. + markerDataF9.CourseRating = StringUtil.ToDecimal(Regex.Replace(propertyText, "\\s*/.*$", "")); + markerDataF9.SlopeRating = StringUtil.ToShort(Regex.Replace(propertyText, "^.*/\\s*", "")); + } + else if (markerColumns.ColIdx_Back9 == teeColumnIdx) + { + // Format: CourseRating / SlopeRating. + markerDataB9.CourseRating = StringUtil.ToDecimal(Regex.Replace(propertyText, "\\s*/.*$", "")); + markerDataB9.SlopeRating = StringUtil.ToShort(Regex.Replace(propertyText, "^.*/\\s*", "")); + } + else if (markerColumns.ColIdx_Front9BogeyRating == teeColumnIdx) + { + markerDataF9.BogeyRating = StringUtil.ToDecimal(propertyText); + } + else if (markerColumns.ColIdx_Back9BogeyRating == teeColumnIdx) + { + markerDataB9.BogeyRating = StringUtil.ToDecimal(propertyText); + } + else if (markerColumns.ColIdx_Front9SlopeRating == teeColumnIdx) + { + if (markerDataF9.SlopeRating == 0) + markerDataF9.SlopeRating = StringUtil.ToShort(propertyText); + } + else if (markerColumns.ColIdx_Back9SlopeRating == teeColumnIdx) + { + // Back 9 Slope Rating populated with value for Front 9. + //markerDataB9.SlopeRating = StringUtil.ToInt(propertyText); + } + else if (markerColumns.ColIdx_MarkerId == teeColumnIdx) + { + markerData18.MarkerId = StringUtil.ToSysId(propertyText); + // Unclear if Tee Id is relevant to 9 holes. + //markerDataF9.MarkerId = StringUtil.ToSysId(propertyText); + //markerDataB9.MarkerId = StringUtil.ToSysId(propertyText); + } + else if (markerColumns.ColIdx_Length == teeColumnIdx) + { + markerData18.Length = StringUtil.ToShort(propertyText); + } + } - // Add valid markers to list. - if (markerData18.IsValid()) - usgaMarkers.Add(markerData18); - if (markerDataF9.IsValid()) - usgaMarkers.Add(markerDataF9); - if (markerDataB9.IsValid()) - usgaMarkers.Add(markerDataB9); + // Front and Back 9 likely missing par values - derive from course ratings. + if (markerData18.IsValid() && markerDataF9.IsValid(true) && markerDataF9.Par == 0 && markerDataB9.IsValid(true) && markerDataB9.Par == 0) + { + decimal combined9sCourseRating = markerDataF9.CourseRating + markerDataB9.CourseRating; + markerDataF9.Par = (short)Math.Round(markerData18.Par * markerDataF9.CourseRating / combined9sCourseRating); + markerDataB9.Par = (short)(markerData18.Par - markerDataF9.Par); + } + + // Add valid markers to list. + if (markerData18.IsValid()) + markersData.Markers.Add(markerData18); + if (markerDataF9.IsValid()) + markersData.Markers.Add(markerDataF9); + if (markerDataB9.IsValid()) + markersData.Markers.Add(markerDataB9); + } + } + else SaLogger.Warn(SysUtil.Fn + " Tee table not found."); + } + + // Store markers. + List markersUpdateData = new List(); + foreach (MarkerData usgaMarker in markersData.Markers) + { + if (!SysId.IsValid(usgaMarker.CourseId)) continue; + //if (!SysId.IsValid(usgaMarker.MarkerId)) continue; + if (StringUtil.IsBlank(usgaMarker.Caption)) continue; + SaxReferenceGolfMgr.UsgaMarkerData markerData = new SaxReferenceGolfMgr.UsgaMarkerData(); + markerData.CourseId = usgaMarker.CourseId; + markerData.MarkerId = usgaMarker.MarkerId; + markerData.Caption = usgaMarker.Caption; + markerData.Holes = usgaMarker.Holes; + markerData.HolesCaption = usgaMarker.HolesCaption; + markerData.Tee = usgaMarker.Tee; + markerData.Gender = usgaMarker.Gender; + markerData.SlopeRating = usgaMarker.SlopeRating; + markerData.Par = usgaMarker.Par; + markerData.CourseRating = usgaMarker.CourseRating; + markerData.BogeyRating = usgaMarker.BogeyRating; + markerData.Length = usgaMarker.Length; + markersUpdateData.Add(markerData); + } + ReferenceGolfMgr.BulkUpdateUsgaMarkers(markersUpdateData, DbUpdateInfo); + if (!ReferenceGolfMgr.HasErrorState()) + { + // Courses updates OK. + // Store Marker data and clear Course 'priority' flag. + if (markersData.Markers.Any()) + { + usgaCourse.MarkersData = JsonConvert.SerializeObject(markersData); + usgaCourse.Priority = false; + ReferenceGolfMgr.UpdateUsgaCourse(usgaCourse, DbUpdateInfo); } } - else SaLogger.Warn(SysUtil.Fn + " Tee table not found."); + else SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA markers: {ReferenceGolfMgr.ErrorStateMessage}."); } - - // Store markers. - List markersData = new List(); - foreach (MarkerData usgaMarker in usgaMarkers) + catch (Exception exc) { - if (!SysId.IsValid(usgaMarker.CourseId)) continue; - //if (!SysId.IsValid(usgaMarker.MarkerId)) continue; - if (StringUtil.IsBlank(usgaMarker.Caption)) continue; - SaxReferenceGolfMgr.UsgaMarkerData markerData = new SaxReferenceGolfMgr.UsgaMarkerData(); - markerData.CourseId = usgaMarker.CourseId; - markerData.MarkerId = usgaMarker.MarkerId; - markerData.Caption = usgaMarker.Caption; - markerData.Holes = usgaMarker.Holes; - markerData.HolesCaption = usgaMarker.HolesCaption; - markerData.Tee = usgaMarker.Tee; - markerData.Gender = usgaMarker.Gender; - markerData.SlopeRating = usgaMarker.SlopeRating; - markerData.Par = usgaMarker.Par; - markerData.CourseRating = usgaMarker.CourseRating; - markerData.BogeyRating = usgaMarker.BogeyRating; - markerData.Length = usgaMarker.Length; - markersData.Add(markerData); + SaLogger.Warn(SysUtil.Fn + " " + ExceptionUtil.GetLogMessage(exc, $"querying USGA markers for course Id: {usgaCourseId}", 0)); } - ReferenceGolfMgr.BulkUpdateUsgaMarkers(markersData, config.DbUpdateInfo); - if (ReferenceGolfMgr.HasErrorState()) - SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA markers: {ReferenceGolfMgr.ErrorStateMessage}."); } - catch (Exception exc) - { - SaLogger.Warn(SysUtil.Fn + " " + ExceptionUtil.GetLogMessage(exc, $"querying USGA markers for course Id: {usgaCourseId}", 0)); - } - return usgaMarkers; + return markersData.Markers; } //------------------------------------------------------------------ diff --git a/SaxoniteCoreWebAdmin/Admin/App/SaxApplication_Admin.cs b/SaxoniteCoreWebAdmin/Admin/App/SaxApplication_Admin.cs index b4c057d..b1f9ecf 100644 --- a/SaxoniteCoreWebAdmin/Admin/App/SaxApplication_Admin.cs +++ b/SaxoniteCoreWebAdmin/Admin/App/SaxApplication_Admin.cs @@ -31,7 +31,7 @@ namespace Saxonite.Net.Core.Web.Admin.App { //------------------------------------------------------------------- // Data members. - private bool generateDatabaseDefinitions = true; + private bool generateDatabaseDefinitions = false; private bool populateRegions = false; private Dictionary appConfigs = new Dictionary(); private Dictionary emailConfigs = new Dictionary(); @@ -55,7 +55,7 @@ namespace Saxonite.Net.Core.Web.Admin.App } catch (Exception exc) { - SaLogger.Error(GetType().Name + ".CTR " + ExceptionUtil.GetErrorStateMessage(exc)); + SaLogger.Error($"{GetType().Name}.CTR {ExceptionUtil.GetErrorStateMessage(exc)}"); throw; } } diff --git a/SaxoniteCoreWebAdmin/Admin/Consoles/SaxConsoleHelper_Admin.cs b/SaxoniteCoreWebAdmin/Admin/Consoles/SaxConsoleHelper_Admin.cs index 0402260..bd38a33 100644 --- a/SaxoniteCoreWebAdmin/Admin/Consoles/SaxConsoleHelper_Admin.cs +++ b/SaxoniteCoreWebAdmin/Admin/Consoles/SaxConsoleHelper_Admin.cs @@ -1,4 +1,5 @@ -using Saxonite.Net.Core.Web.Admin.App; +using Sarand.Net.Standard.Base.Utils; +using Saxonite.Net.Core.Web.Admin.App; using Saxonite.Net.Core.Web.Base.Consoles; using Saxonite.Net.Standard.Base.App; using Saxonite.Net.Standard.Base.Consoles; @@ -58,7 +59,7 @@ namespace Saxonite.Net.Core.Web.Admin.Consoles private Dictionary processConsoles { get; } = new Dictionary(); public SaxProcessConsole GetProcessConsole(SaxSessionContext sessionContext) { - if (sessionContext == null) throw new NotSupportedException(GetType().Name + ".GetProcessConsole Session Context must be specified"); + if (sessionContext == null) throw new NotSupportedException($"{SysUtil.Fn} Session Context must be specified."); SaxProcessConsole_Admin processConsole = processConsoles.GetValueOrDefault(sessionContext.Index, null); if (processConsole == null) { diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/SaxController_Admin.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/SaxController_Admin.cs index d70536a..8f4d412 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/SaxController_Admin.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/SaxController_Admin.cs @@ -21,7 +21,7 @@ using System.Web; namespace Saxonite.Net.Core.Web.Admin.Controllers { //======================================================================= - public class SaxController_Admin : SaxController_Base + public class SaxController_Admin : SaxController_Web { //------------------------------------------------------------------- // Data members. @@ -98,7 +98,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers userRole.KeepLoggedIn = keepLoggedIn; userRole.LastLoginAt = DateTime.Now; userRole.InvalidLoginCount = 0; - userRole.LastInvalidLoginAt = DateTime.MinValue; + userRole.LastInvalidLoginAt = null; if (!AccountMgr.UpdateUserRole(userRole, DbUpdateInfo)) { SaLogger.Warn(fn + " Failed to update Admin user role for " + userAccount.EmailAddress + ": " + AccountMgr.ErrorStateMessage); @@ -197,7 +197,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers if (StringUtil.IsEmpty(GetRequestCookie(KeepLoggedIn.CookieName))) return; // Clear cookie by setting expiry date in the past. SetResponseCookie(KeepLoggedIn.CookieName, "", DateTime.Today.AddDays(-7), true); - SaLogger.Info(GetType().Name + ".ClearKeepLoggedInCookie 'Keep Logged In' cookie cleared."); + SaLogger.Info($"{SysUtil.Fn} 'Keep Logged In' cookie cleared."); } //------------------------------------------------------------------- @@ -245,7 +245,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers NameValueCollection linkParams = DecryptParameters(encryptedParams, KeepLoggedIn.Base64IV, KeepLoggedIn.Base64Key); keepLoggedInParams.UserAccountId = new SysId(StringUtil.ToInt(linkParams.Get(ParamName_KeepLoggedIn_UserAccountId))); } - if (DebugMode) SaLogger.Info(GetType().Name + ".ExtractKeepLoggedInParams UserAccountId: " + SysId.ToString(keepLoggedInParams.UserAccountId)); + if (DebugMode) SaLogger.Info($"{SysUtil.Fn} UserAccountId: " + SysId.ToString(keepLoggedInParams.UserAccountId)); return keepLoggedInParams; } diff --git a/SaxoniteCoreWebAdmin/wwwroot/css/sax-data.css b/SaxoniteCoreWebAdmin/wwwroot/css/sax-data.css index 25abdd5..3db2aef 100644 --- a/SaxoniteCoreWebAdmin/wwwroot/css/sax-data.css +++ b/SaxoniteCoreWebAdmin/wwwroot/css/sax-data.css @@ -67,6 +67,11 @@ text-align: right; } +.sax-panel-filter .sax-content .sax-value +{ + padding-top: 2px; +} + .sax-panel-filter .sax-content input[type="text"], .sax-panel-filter .sax-content select { diff --git a/SaxoniteCoreWebAdmin/wwwroot/css/sax-form.css b/SaxoniteCoreWebAdmin/wwwroot/css/sax-form.css index a0a2def..52fa0e2 100644 --- a/SaxoniteCoreWebAdmin/wwwroot/css/sax-form.css +++ b/SaxoniteCoreWebAdmin/wwwroot/css/sax-form.css @@ -199,8 +199,8 @@ .sax-form .sax-form-control .sax-message { display: none; - margin-top: 8px; - padding-left: 16px; + margin-top: 4px; + padding-left: 24px; font-size: 1.00rem; background-position: left top; background-repeat: no-repeat; @@ -208,6 +208,7 @@ .sax-form .sax-form-control.sax-error .sax-message { + min-height: 18px; display: block; color: #e3120b; background-image: url("../img/icon/error-18.png"); diff --git a/SaxoniteCoreWebAdmin/wwwroot/js/sax-home.js b/SaxoniteCoreWebAdmin/wwwroot/js/sax-home.js index e1ab125..c2ee1a3 100644 --- a/SaxoniteCoreWebAdmin/wwwroot/js/sax-home.js +++ b/SaxoniteCoreWebAdmin/wwwroot/js/sax-home.js @@ -95,7 +95,7 @@ var items = response.items; if (!items.length) return $msgs.append($('
' + sax.msg.dbSchemaValid + '
')).fadeIn(500); - sax.debug(ah.getDbSchemaTemplate()); + //sax.debug(ah.getDbSchemaTemplate()); for (let itemIdx = 0; itemIdx < items.length; itemIdx++) $items.append(ah.populateDbSchemaItem(ah.getDbSchemaTemplate(), items[itemIdx])); $items.slideDown(750); diff --git a/SaxoniteCoreWebAdmin/wwwroot/js/sax-org-dnl.js b/SaxoniteCoreWebAdmin/wwwroot/js/sax-org-dnl.js index 18e3fec..f03747f 100644 --- a/SaxoniteCoreWebAdmin/wwwroot/js/sax-org-dnl.js +++ b/SaxoniteCoreWebAdmin/wwwroot/js/sax-org-dnl.js @@ -21,22 +21,22 @@ od.downloadOrgData = function () { - sax.debug("downloadOrgData"); + //sax.debug("downloadOrgData"); $('.FilterOrganisation', $frm.orgDnl).val($('.FilterOrganisation', $frm.orgFlt).val()); $('.FilterOrganisationCategory', $frm.orgDnl).val($('.FilterOrganisationCategory', $frm.orgFlt).val()); - sax.debug($('.FilterOrganisationSportId', $frm.orgFlt)); - sax.debug($('.FilterOrganisationSportId', $frm.orgFlt).val()); + //sax.debug($('.FilterOrganisationSportId', $frm.orgFlt)); + //sax.debug($('.FilterOrganisationSportId', $frm.orgFlt).val()); $('.FilterOrganisationSportId', $frm.orgDnl).val($('.FilterOrganisationSportId', $frm.orgFlt).val()); $('.FilterOrganisationRegionId', $frm.orgDnl).val($('.FilterOrganisationRegionId', $frm.orgFlt).val()); $('.FilterOrganisationStatusCategory', $frm.orgDnl).val($('.FilterOrganisationStatusCategory', $frm.orgFlt).val()); - sax.debug($frm.orgDnl); + //sax.debug($frm.orgDnl); if (!$frm.orgDnl.length) return; $frm.orgDnl.prop('target', '_blank').prop('action', '/Organisation/Download').submit(); } od.onDownloadOrgData = function (response) { - sax.debug('onDownloadOrgData', response); + //sax.debug('onDownloadOrgData', response); } //-------------------------------------------------------------- diff --git a/SaxoniteCoreWebAdmin/wwwroot/js/sax-sys-logs.js b/SaxoniteCoreWebAdmin/wwwroot/js/sax-sys-logs.js index c7f0087..9e8b764 100644 --- a/SaxoniteCoreWebAdmin/wwwroot/js/sax-sys-logs.js +++ b/SaxoniteCoreWebAdmin/wwwroot/js/sax-sys-logs.js @@ -89,7 +89,7 @@ $ctrl.cbYears.append($('')); if (sax.data.logYear) $ctrl.cbYears.val(sax.data.logYear); delete sax.data.logYear; - $ctrl.cbYears.trigger('change'); + if ($ctrl.cbYears.val()) $ctrl.cbYears.trigger('change'); } //-------------------------------------------------------------- @@ -112,6 +112,7 @@ sax.refreshControlValues(response.controlValues); $pnl.msgs.hide().empty(); if (!response.success) return; + sax.data.logYear = $ctrl.cbYears.val(); // Months. var items = response.months; if (!items.length) @@ -119,8 +120,9 @@ for (let itemIdx = 0; itemIdx < items.length; itemIdx++) $ctrl.cbMonths.append($('')); if (sax.data.logMonth) $ctrl.cbMonths.val(sax.data.logMonth); + if (!$ctrl.cbMonths.val() && items.length) $ctrl.cbMonths.val(items[0].name); delete sax.data.logMonth; - $ctrl.cbMonths.trigger('change'); + if ($ctrl.cbMonths.val()) $ctrl.cbMonths.trigger('change'); } //-------------------------------------------------------------- @@ -137,13 +139,14 @@ } sl.doRefreshFiles = function (response) { - sax.debug('doRefreshFiles', response); + //sax.debug('doRefreshFiles', response); delete sl.data.awaitingRefreshFilesResponse; sl.clearFiles(); sax.refreshControlValues(response.controlValues); $pnl.msgs.hide().empty(); var $items = $('.sax-panel-item-list', $pnl.results).hide().empty(); if (!response.success) return; + sax.data.logMonth = $ctrl.cbMonths.val(); // Files. var items = response.files; if (!items.length) @@ -152,11 +155,11 @@ $items.append(sl.populateItem(sl.getFileTemplate(), items[itemIdx])); $items.fadeIn(50); } - sl.populateItem = function ($item,item) + sl.populateItem = function ($item, item) { if (!item) return $item; $('.Filename', $item).text(item.name).off('click').on('click', function () { sl.getFile(item.name) }); - $('.Length', $item).text(sax.formatFileSize(item.size,2)); + $('.Length', $item).text(sax.formatFileSize(item.size, 2)); return $item; } sl.getFileTemplate = function () @@ -178,7 +181,7 @@ } sl.doGetFiles = function (response) { - sax.debug('doGetFiles', response); + //sax.debug('doGetFiles', response); delete sl.data.awaitingGetFileResponse; $pnl.msgs.hide().empty(); if (!response.success) return; @@ -207,7 +210,7 @@ var opt = sax.dlgOpts(); opt.buttons[sax.dlg.btn.close] = function () { $(this).dialog('close'); }; - $dlg.file= $('#dlgLogFile').dialog(opt); + $dlg.file = $('#dlgLogFile').dialog(opt); setTimeout(sl.refreshFolders, 250); }); diff --git a/SaxoniteCoreWebOnline/Online/App/SaxApplication_Online.cs b/SaxoniteCoreWebOnline/Online/App/SaxApplication_Online.cs index 7651a1e..c7f385a 100644 --- a/SaxoniteCoreWebOnline/Online/App/SaxApplication_Online.cs +++ b/SaxoniteCoreWebOnline/Online/App/SaxApplication_Online.cs @@ -50,7 +50,7 @@ namespace Saxonite.Net.Core.Web.Online.App } catch (Exception exc) { - SaLogger.Error(GetType().Name + ".CTR " + ExceptionUtil.GetErrorStateMessage(exc)); + SaLogger.Error($"{GetType().Name}.CTR {ExceptionUtil.GetErrorStateMessage(exc)}"); throw; } } diff --git a/SaxoniteCoreWebOnline/Online/Consoles/SaxConsoleHelper_Online.cs b/SaxoniteCoreWebOnline/Online/Consoles/SaxConsoleHelper_Online.cs index a9373a1..abad6b4 100644 --- a/SaxoniteCoreWebOnline/Online/Consoles/SaxConsoleHelper_Online.cs +++ b/SaxoniteCoreWebOnline/Online/Consoles/SaxConsoleHelper_Online.cs @@ -1,4 +1,5 @@ -using Saxonite.Net.Core.Web.Base.Consoles; +using Sarand.Net.Standard.Base.Utils; +using Saxonite.Net.Core.Web.Base.Consoles; using Saxonite.Net.Core.Web.Online.App; using Saxonite.Net.Standard.Base.App; using Saxonite.Net.Standard.Base.Consoles; @@ -43,7 +44,7 @@ namespace Saxonite.Net.Core.Web.Online.Consoles private readonly Dictionary dataCacheConsoles = new Dictionary(); public override SaxDataCacheConsole GetDataCacheConsole(SaxSessionContext sessionContext) { - if (sessionContext == null) throw new NotSupportedException(GetType().Name + ".GetDataCacheConsole Session Context must be specified"); + if (sessionContext == null) throw new NotSupportedException($"{SysUtil.Fn} Session Context must be specified."); SaxDataCacheConsole_Online dataCacheConsole = dataCacheConsoles.GetValueOrDefault(sessionContext.Index, null); if (dataCacheConsole == null) { @@ -57,7 +58,7 @@ namespace Saxonite.Net.Core.Web.Online.Consoles private readonly Dictionary sessionDataConsoles = new Dictionary(); public override SaxSessionDataConsole GetSessionDataConsole(SaxSessionContext sessionContext) { - if (sessionContext == null) throw new NotSupportedException(GetType().Name + ".GetSessionDataConsole Session Context must be specified"); + if (sessionContext == null) throw new NotSupportedException($"{SysUtil.Fn} Session Context must be specified."); SaxSessionDataConsole_Online sessionDataConsole = sessionDataConsoles.GetValueOrDefault(sessionContext.Index, null); if (sessionDataConsole == null) { diff --git a/SaxoniteCoreWebOnline/Online/Controllers/ArticleController-Ajax.cs b/SaxoniteCoreWebOnline/Online/Controllers/ArticleController-Ajax.cs index c8363fa..4b2ae74 100644 --- a/SaxoniteCoreWebOnline/Online/Controllers/ArticleController-Ajax.cs +++ b/SaxoniteCoreWebOnline/Online/Controllers/ArticleController-Ajax.cs @@ -98,7 +98,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers data.RegionIdPrimary = model.GetEncryptedRegionId(article.RegionIdPrimary); data.SportIdPrimary = model.GetEncryptedSportId(article.SportIdPrimary); data.Published = DateUtil.IsValid(article.PublishedAt) ? true : (bool?)null; - data.PublishedInFuture = (data.Published == true && article.PublishedAt.CompareTo(DateTime.Today) >= 0) ? true : (bool?)null; + data.PublishedInFuture = (data.Published == true && article.PublishedAt != null && ((DateTime)article.PublishedAt).CompareTo(DateTime.Today) >= 0) ? true : (bool?)null; data.PublishedOn_YYYYMMDD = DateUtil.Format(article.PublishedAt, "yyyyMMdd"); data.PublishedOn_Calendar = model.FormatDateForForm(article.PublishedAt); @@ -635,7 +635,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers if (model.ArticlePublish) article.PublishedAt = model.GetArticlePublishOn(); else - article.PublishedAt = DateTime.MinValue; + article.PublishedAt = null; } if (model.ArticleStatusCode != null) article.Status = model.ArticleStatus; diff --git a/SaxoniteCoreWebOnline/Online/Controllers/SaxController_Online.cs b/SaxoniteCoreWebOnline/Online/Controllers/SaxController_Online.cs index bbf1e64..25a251d 100644 --- a/SaxoniteCoreWebOnline/Online/Controllers/SaxController_Online.cs +++ b/SaxoniteCoreWebOnline/Online/Controllers/SaxController_Online.cs @@ -21,7 +21,7 @@ using System.Web; namespace Saxonite.Net.Core.Web.Online.Controllers { //======================================================================= - public class SaxController_Online : SaxController_Base + public class SaxController_Online : SaxController_Web { //------------------------------------------------------------------- // Data members. @@ -78,7 +78,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers userAccount.KeepLoggedIn = keepLoggedIn; userAccount.LastLoginAt = DateTime.Now; userAccount.InvalidLoginCount = 0; - userAccount.LastInvalidLoginAt = DateTime.MinValue; + //userAccount.LastInvalidLoginAt = null; if (!AccountMgr.UpdateUserAccount(userAccount, DbUpdateInfo)) { SaLogger.Warn(fn + " Failed to update account for " + userAccount.EmailAddress + ": " + AccountMgr.ErrorStateMessage); @@ -227,7 +227,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers if (StringUtil.IsEmpty(GetRequestCookie(KeepLoggedIn.CookieName))) return; // Clear cookie by setting expiry date in the past. SetResponseCookie(KeepLoggedIn.CookieName, "", DateTime.Today.AddDays(-7), true); - SaLogger.Info(GetType().Name + ".ClearKeepLoggedInCookie 'Keep Logged In' cookie cleared."); + SaLogger.Info($"{SysUtil.Fn} 'Keep Logged In' cookie cleared."); } //------------------------------------------------------------------- @@ -276,7 +276,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers NameValueCollection linkParams = DecryptParameters(encryptedParams, KeepLoggedIn.Base64IV, KeepLoggedIn.Base64Key); keepLoggedInParams.UserAccountId = new SysId(StringUtil.ToInt(linkParams.Get(ParamName_KeepLoggedIn_UserAccountId))); } - if (DebugMode) SaLogger.Info(GetType().Name + ".ExtractKeepLoggedInParams UserAccountId: " + SysId.ToString(keepLoggedInParams.UserAccountId)); + if (DebugMode) SaLogger.Info($"{SysUtil.Fn} UserAccountId: {SysId.ToString(keepLoggedInParams.UserAccountId)}"); return keepLoggedInParams; } diff --git a/SaxoniteCoreWebOnline/wwwroot/css/sax-form.css b/SaxoniteCoreWebOnline/wwwroot/css/sax-form.css index a1de06b..39a80ae 100644 --- a/SaxoniteCoreWebOnline/wwwroot/css/sax-form.css +++ b/SaxoniteCoreWebOnline/wwwroot/css/sax-form.css @@ -215,7 +215,7 @@ display: none; margin-top: 4px; padding-left: 24px; - font-size: 1.00Rem; + font-size: 1.00rem; background-position: left top; background-repeat: no-repeat; } diff --git a/SaxoniteStandardBase/Base/App/Sax-Config.cs b/SaxoniteStandardBase/Base/App/Sax-Config.cs index 207f1f3..0d7b12f 100644 --- a/SaxoniteStandardBase/Base/App/Sax-Config.cs +++ b/SaxoniteStandardBase/Base/App/Sax-Config.cs @@ -176,7 +176,7 @@ namespace Saxonite.Net.Standard.Base.App public static class UsgaGolfDataLookup { public static bool Enabled { get; set; } = SacsSystem.DebugMode ? true : true; - public static int MinsBetweenExecution { get; set; } = SacsSystem.DebugMode ? 12 : 20; + public static int MinsBetweenExecution { get; set; } = SacsSystem.DebugMode ? 8 : 20; public static int HoursBetweenCountryLookup { get; set; } = SacsSystem.DebugMode ? 24 : 24 * 5; } } diff --git a/SaxoniteStandardBase/Base/App/Sax-Version.cs b/SaxoniteStandardBase/Base/App/Sax-Version.cs index 0b8d804..cf03a37 100644 --- a/SaxoniteStandardBase/Base/App/Sax-Version.cs +++ b/SaxoniteStandardBase/Base/App/Sax-Version.cs @@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App //------------------------------------------------------------------- public static class Version { - private static String version { get; } = "1.2.11.4"; + private static String version { get; } = "1.2.11.5"; // Retrieve version. public static String GetFullVersion () { return version; } public static String GetAppVersion () diff --git a/SaxoniteStandardBase/Base/App/SaxDbDfn_Core.cs b/SaxoniteStandardBase/Base/App/SaxDbDfn_Core.cs index 33196bf..57a730d 100644 --- a/SaxoniteStandardBase/Base/App/SaxDbDfn_Core.cs +++ b/SaxoniteStandardBase/Base/App/SaxDbDfn_Core.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Base.App { diff --git a/SaxoniteStandardBase/Base/App/SaxDbDfn_Reference.cs b/SaxoniteStandardBase/Base/App/SaxDbDfn_Reference.cs index a25f43e..d2afc21 100644 --- a/SaxoniteStandardBase/Base/App/SaxDbDfn_Reference.cs +++ b/SaxoniteStandardBase/Base/App/SaxDbDfn_Reference.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Base.App { @@ -52,8 +52,12 @@ namespace Saxonite.Base.App UsgaCourse_Address1, UsgaCourse_Address2, UsgaCourse_City, + UsgaCourse_PostalCode, + UsgaCourse_Latitude, + UsgaCourse_Longitude, UsgaCourse_Email, UsgaCourse_Telephone, + UsgaCourse_MarkersData, UsgaCourse_Notes, UsgaCourse_Flags, UsgaCourse_Status, @@ -67,6 +71,14 @@ namespace Saxonite.Base.App UsgaFacility_ProvinceId, UsgaFacility_FacilityId, UsgaFacility_FacilityName, + UsgaFacility_Address1, + UsgaFacility_Address2, + UsgaFacility_City, + UsgaFacility_PostalCode, + UsgaFacility_Latitude, + UsgaFacility_Longitude, + UsgaFacility_Email, + UsgaFacility_Telephone, UsgaFacility_Notes, UsgaFacility_Flags, UsgaFacility_Status, @@ -117,7 +129,7 @@ namespace Saxonite.Base.App //------------------------------------------------------------------- // Data members. private static readonly int tableCount = 5; - private static readonly int columnCount = 83; + private static readonly int columnCount = 95; private static ulong maxTextLen = 0; //------------------------------------------------------------------- @@ -341,8 +353,12 @@ namespace Saxonite.Base.App 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,"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), @@ -356,6 +372,14 @@ namespace Saxonite.Base.App new ColumnDfn(3,"ProvinceId",5,-5,false,19), new ColumnDfn(3,"FacilityId",5,-5,false,19), new ColumnDfn(3,"FacilityName",0,-9,false,200), + new ColumnDfn(3,"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), diff --git a/SaxoniteStandardBase/Base/App/SaxDbDfn_Support.cs b/SaxoniteStandardBase/Base/App/SaxDbDfn_Support.cs index 93fd5ce..79e45c3 100644 --- a/SaxoniteStandardBase/Base/App/SaxDbDfn_Support.cs +++ b/SaxoniteStandardBase/Base/App/SaxDbDfn_Support.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:56 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Base.App { diff --git a/SaxoniteStandardBase/Base/App/SaxInternals.cs b/SaxoniteStandardBase/Base/App/SaxInternals.cs index d32031c..957a0d9 100644 --- a/SaxoniteStandardBase/Base/App/SaxInternals.cs +++ b/SaxoniteStandardBase/Base/App/SaxInternals.cs @@ -201,7 +201,7 @@ namespace Saxonite.Net.Standard.Base.App foreach (SaxRegion.Data regionData in regions) regionCache[regionData.Id] = regionData.Clone(); regionCacheFullyPopulated = true; - //if (DebugMode) SaLogger.Debug(GetType().Name + ".PopulateRegionCache(regions) Regions populated: " + regionCache.Count); + //if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}(regions) Regions populated: {regionCache.Count}."); } public void RefreshRegionCache() { @@ -217,7 +217,7 @@ namespace Saxonite.Net.Standard.Base.App region.Dispose(); } regionCacheFullyPopulated = true; - SaLogger.Debug(GetType().Name + ".RefreshRegionCache() Regions queried: " + regionsQueried + ". Regions in cache: " + regionCache.Count + ". Elapsed: " + DateUtil.FormatNumberOfSeconds((DateTime.Now - startedAt).TotalSeconds)); + SaLogger.Debug($"{SysUtil.Fn} Regions queried: {regionsQueried}. Regions in cache: {regionCache.Count}. Elapsed: {DateUtil.FormatNumberOfSeconds((DateTime.Now - startedAt).TotalSeconds)}."); } private void QueryRegionsToCache(List regionsIds) { @@ -236,7 +236,7 @@ namespace Saxonite.Net.Standard.Base.App regionCache[region.Id] = region.GetData(); region.Dispose(); } - SaLogger.Debug(GetType().Name + ".QueryRegionsToCache(regionIds) Regions queried: " + regionsQueried + ". Regions in cache: " + regionCache.Count + ". Elapsed: " + DateUtil.FormatNumberOfSeconds((DateTime.Now - startedAt).TotalSeconds)); + 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) @@ -269,7 +269,7 @@ namespace Saxonite.Net.Standard.Base.App foreach (SaxSport.Data sportData in sports) sportCache[sportData.Id] = sportData.Clone(); sportCacheFullyPopulated = true; - //if (DebugMode) SaLogger.Debug(GetType().Name + ".PopulateSportCache(sports) Sports populated: " + sportCache.Count); + //if (DebugMode) SaLogger.Debug($"{SysUtil.Fn}(sports) Sports populated: {sportCache.Count}."); } public void RefreshSportCache() { @@ -285,7 +285,7 @@ namespace Saxonite.Net.Standard.Base.App sport.Dispose(); } sportCacheFullyPopulated = true; - SaLogger.Debug(GetType().Name + ".RefreshSportCache() Sports queried: " + sportsQueried + ". Sports in cache: " + sportCache.Count + ". Elapsed: " + DateUtil.FormatNumberOfSeconds((DateTime.Now - startedAt).TotalSeconds)); + SaLogger.Debug($"{SysUtil.Fn} Sports queried: {sportsQueried}. Sports in cache: {sportCache.Count}. Elapsed: {DateUtil.FormatNumberOfSeconds((DateTime.Now - startedAt).TotalSeconds)}."); } private void QuerySportsToCache(List sportsIds) { @@ -304,7 +304,7 @@ namespace Saxonite.Net.Standard.Base.App sportCache[sport.Id] = sport.GetData(); sport.Dispose(); } - SaLogger.Debug(GetType().Name + ".QuerySportsToCache(sportIds) Sports queried: " + sportsQueried + ". Sports in cache: " + sportCache.Count + ". Elapsed: " + DateUtil.FormatNumberOfSeconds((DateTime.Now - startedAt).TotalSeconds)); + 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) diff --git a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaCountry.cs b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaCountry.cs index b9aa0c1..af705f6 100644 --- a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaCountry.cs +++ b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaCountry.cs @@ -165,6 +165,12 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference //------------------------------------------------------------------- // Flags - positions 1-16 available. + public const byte Flag_Priority = 0x01; + public bool Priority + { + get { return GetFlag(Flag_Priority); } + set { SetFlag(Flag_Priority, value); } + } //------------------------------------------------------------------- // A s s o c i a t e d D a t a @@ -176,10 +182,10 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference // List parameters. public enum StatusCat { - Any, + NotDeleted = 0, ActiveOnly, InactiveOnly, - NotDeleted, + Any, DeletedOnly, } /// diff --git a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaCourse.cs b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaCourse.cs index 4c0a394..8bd0628 100644 --- a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaCourse.cs +++ b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaCourse.cs @@ -35,6 +35,7 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference Address1, Address2, City, + PostalCode, Email, Telephone, // Associated data. @@ -61,8 +62,12 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference public String Address1 { get; set; } = String.Empty; public String Address2 { get; set; } = String.Empty; public String City { get; set; } = String.Empty; + public String PostalCode { get; set; } = String.Empty; + public Decimal? Latitude { get; set; } = null; + public Decimal? Longitude { get; set; } = null; public String Email { get; set; } = String.Empty; public String Telephone { get; set; } = String.Empty; + public String MarkersData { get; set; } = String.Empty; } //------------------------------------------------------------------- @@ -122,6 +127,21 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference get { return data.City; } set { CheckChanged(data.City, value); data.City = value; } } + public String PostalCode + { + get { return data.PostalCode; } + set { CheckChanged(data.PostalCode, value); data.PostalCode = value; } + } + public decimal? Latitude + { + get { return data.Latitude; } + set { CheckChangedNullable(data.Latitude, value); data.Latitude = value; } + } + public decimal? Longitude + { + get { return data.Longitude; } + set { CheckChangedNullable(data.Longitude, value); data.Longitude = value; } + } public String Email { get { return data.Email; } @@ -132,6 +152,11 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference get { return data.Telephone; } set { CheckChanged(data.Telephone, value); data.Telephone = value; } } + public String MarkersData + { + get { return data.MarkersData; } + set { CheckChanged(data.MarkersData, value); data.MarkersData = value; } + } // Population. internal void PopulateFrom(Data data) { @@ -144,8 +169,12 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference Address1 = data.Address1; Address2 = data.Address2; City = data.City; + PostalCode = data.PostalCode; + Latitude = data.Latitude; + Longitude = data.Longitude; Email = data.Email; Telephone = data.Telephone; + MarkersData = data.MarkersData; base.PopulateFrom(data); } public Data Clone() @@ -170,8 +199,12 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference public ValidValue Address1 { get; set; } = ValidValue.Valid; public ValidValue Address2 { get; set; } = ValidValue.Valid; public ValidValue City { get; set; } = ValidValue.Valid; + public ValidValue PostalCode { get; set; } = ValidValue.Valid; + public ValidValue Latitude { get; set; } = ValidValue.Valid; + public ValidValue Longitude { get; set; } = ValidValue.Valid; public ValidValue Email { get; set; } = ValidValue.Valid; public ValidValue Telephone { get; set; } = ValidValue.Valid; + public ValidValue MarkersData { get; set; } = ValidValue.Valid; } //------------------------------------------------------------------- @@ -268,6 +301,21 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference get { return data.City; } set { data.City = value; } } + public String PostalCode + { + get { return data.PostalCode; } + set { data.PostalCode = value; } + } + public decimal? Latitude + { + get { return data.Latitude; } + set { data.Latitude = value; } + } + public decimal? Longitude + { + get { return data.Longitude; } + set { data.Longitude = value; } + } public String Email { get { return data.Email; } @@ -278,9 +326,20 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference get { return data.Telephone; } set { data.Telephone = value; } } + public String MarkersData + { + get { return data.MarkersData; } + set { data.MarkersData = value; } + } //------------------------------------------------------------------- // Flags - positions 1-16 available. + public const byte Flag_Priority = 0x01; + public bool Priority + { + get { return GetFlag(Flag_Priority); } + set { SetFlag(Flag_Priority, value); } + } //------------------------------------------------------------------- // A s s o c i a t e d D a t a @@ -292,10 +351,10 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference // List parameters. public enum StatusCat { - Any, + NotDeleted = 0, ActiveOnly, InactiveOnly, - NotDeleted, + Any, DeletedOnly, } /// diff --git a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaFacility.cs b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaFacility.cs index dfc2ce3..e3ea1fa 100644 --- a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaFacility.cs +++ b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaFacility.cs @@ -27,6 +27,12 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference Province_Name, FacilityId, FacilityName, + Address1, + Address2, + City, + PostalCode, + Email, + Telephone, // Associated data. // Common. Notes, @@ -45,6 +51,14 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference public SysId ProvinceId { get; set; } public SysId FacilityId { get; set; } public String FacilityName { get; set; } = String.Empty; + public String Address1 { get; set; } = String.Empty; + public String Address2 { get; set; } = String.Empty; + public String City { get; set; } = String.Empty; + public String PostalCode { get; set; } = String.Empty; + public Decimal? Latitude { get; set; } = null; + public Decimal? Longitude { get; set; } = null; + public String Email { get; set; } = String.Empty; + public String Telephone { get; set; } = String.Empty; } //------------------------------------------------------------------- @@ -74,12 +88,60 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference get { return data.FacilityName; } set { CheckChanged(data.FacilityName, value); data.FacilityName = value; } } + public String Address1 + { + get { return data.Address1; } + set { CheckChanged(data.Address1, value); data.Address1 = value; } + } + public String Address2 + { + get { return data.Address2; } + set { CheckChanged(data.Address2, value); data.Address2 = value; } + } + public String City + { + get { return data.City; } + set { CheckChanged(data.City, value); data.City = value; } + } + public String PostalCode + { + get { return data.PostalCode; } + set { CheckChanged(data.PostalCode, value); data.PostalCode = value; } + } + public decimal? Latitude + { + get { return data.Latitude; } + set { CheckChangedNullable(data.Latitude, value); data.Latitude = value; } + } + public decimal? Longitude + { + get { return data.Longitude; } + set { CheckChangedNullable(data.Longitude, value); data.Longitude = value; } + } + public String Email + { + get { return data.Email; } + set { CheckChanged(data.Email, value); data.Email = value; } + } + public String Telephone + { + get { return data.Telephone; } + set { CheckChanged(data.Telephone, value); data.Telephone = value; } + } // Population. internal void PopulateFrom(Data data) { ProvinceId = data.ProvinceId; FacilityId = data.FacilityId; FacilityName = data.FacilityName; + Address1 = data.Address1; + Address2 = data.Address2; + City = data.City; + PostalCode = data.PostalCode; + Latitude = data.Latitude; + Longitude = data.Longitude; + Email = data.Email; + Telephone = data.Telephone; base.PopulateFrom(data); } public Data Clone() @@ -98,6 +160,14 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference public ValidValue ProvinceId { get; set; } = ValidValue.Valid; public ValidValue FacilityId { get; set; } = ValidValue.Valid; public ValidValue FacilityName { get; set; } = ValidValue.Valid; + public ValidValue Address1 { get; set; } = ValidValue.Valid; + public ValidValue Address2 { get; set; } = ValidValue.Valid; + public ValidValue City { get; set; } = ValidValue.Valid; + public ValidValue PostalCode { get; set; } = ValidValue.Valid; + public ValidValue Latitude { get; set; } = ValidValue.Valid; + public ValidValue Longitude { get; set; } = ValidValue.Valid; + public ValidValue Email { get; set; } = ValidValue.Valid; + public ValidValue Telephone { get; set; } = ValidValue.Valid; } //------------------------------------------------------------------- @@ -164,6 +234,46 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference get { return data.FacilityName; } set { data.FacilityName = value; } } + public String Address1 + { + get { return data.Address1; } + set { data.Address1 = value; } + } + public String Address2 + { + get { return data.Address2; } + set { data.Address2 = value; } + } + public String City + { + get { return data.City; } + set { data.City = value; } + } + public String PostalCode + { + get { return data.PostalCode; } + set { data.PostalCode = value; } + } + public decimal? Latitude + { + get { return data.Latitude; } + set { data.Latitude = value; } + } + public decimal? Longitude + { + get { return data.Longitude; } + set { data.Longitude = value; } + } + public String Email + { + get { return data.Email; } + set { data.Email = value; } + } + public String Telephone + { + get { return data.Telephone; } + set { data.Telephone = value; } + } //------------------------------------------------------------------- // Flags - positions 1-16 available. @@ -178,10 +288,10 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference // List parameters. public enum StatusCat { - Any, + NotDeleted = 0, ActiveOnly, InactiveOnly, - NotDeleted, + Any, DeletedOnly, } /// diff --git a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaMarker.cs b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaMarker.cs index 9487c2c..6799802 100644 --- a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaMarker.cs +++ b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaMarker.cs @@ -308,10 +308,10 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference // List parameters. public enum StatusCat { - Any, + NotDeleted = 0, ActiveOnly, InactiveOnly, - NotDeleted, + Any, DeletedOnly, } /// diff --git a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaProvince.cs b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaProvince.cs index 87b1f2c..adba697 100644 --- a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaProvince.cs +++ b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaProvince.cs @@ -179,6 +179,12 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference //------------------------------------------------------------------- // Flags - positions 1-16 available. + public const byte Flag_Priority = 0x01; + public bool Priority + { + get { return GetFlag(Flag_Priority); } + set { SetFlag(Flag_Priority, value); } + } //------------------------------------------------------------------- // A s s o c i a t e d D a t a @@ -190,10 +196,10 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference // List parameters. public enum StatusCat { - Any, + NotDeleted = 0, ActiveOnly, InactiveOnly, - NotDeleted, + Any, DeletedOnly, } /// diff --git a/SaxoniteStandardBase/Base/Bus/SaxActivityIndex.cs b/SaxoniteStandardBase/Base/Bus/SaxActivityIndex.cs index 679db8e..588539b 100644 --- a/SaxoniteStandardBase/Base/Bus/SaxActivityIndex.cs +++ b/SaxoniteStandardBase/Base/Bus/SaxActivityIndex.cs @@ -71,7 +71,7 @@ namespace Saxonite.Net.Standard.Base.Bus public SysId SportId { get; set; } public SysId RegionId { get; set; } public DateTime EffectiveOn { get; set; } - public DateTime ExpiresOn { get; set; } + public DateTime? ExpiresOn { get; set; } = null; } //------------------------------------------------------------------- @@ -121,14 +121,14 @@ namespace Saxonite.Net.Standard.Base.Bus data.EffectiveOn = value.Date; } } - public DateTime ExpiresOn + public DateTime? ExpiresOn { get { return data.ExpiresOn; } set { // Values are restricted to whole date, ie. no time. - CheckChanged(data.ExpiresOn, value.Date); - data.ExpiresOn = value.Date; + CheckChangedNullable(data.ExpiresOn, value?.Date); + data.ExpiresOn = value?.Date; } } // Population. @@ -262,7 +262,7 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.EffectiveOn; } set { data.EffectiveOn = value; } } - public DateTime ExpiresOn + public DateTime? ExpiresOn { get { return data.ExpiresOn; } set { data.ExpiresOn = value; } diff --git a/SaxoniteStandardBase/Base/Bus/SaxArticle.cs b/SaxoniteStandardBase/Base/Bus/SaxArticle.cs index fa003b9..034c766 100644 --- a/SaxoniteStandardBase/Base/Bus/SaxArticle.cs +++ b/SaxoniteStandardBase/Base/Bus/SaxArticle.cs @@ -68,7 +68,7 @@ namespace Saxonite.Net.Standard.Base.Bus public SysId SportIdPrimary { get; set; } public SysId RegionIdPrimary { get; set; } public String BodyData { get; set; } = String.Empty; - public DateTime PublishedAt { get; set; } + public DateTime? PublishedAt { get; set; } = null; } //------------------------------------------------------------------- @@ -123,10 +123,10 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.BodyData; } set { CheckChanged(data.BodyData, value); data.BodyData = value; } } - public DateTime PublishedAt + public DateTime? PublishedAt { get { return data.PublishedAt; } - set { CheckChanged(data.PublishedAt, value); data.PublishedAt = value; } + set { CheckChangedNullable(data.PublishedAt, value); data.PublishedAt = value; } } // Population. internal void PopulateFrom(Data data) @@ -260,7 +260,7 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.BodyData; } set { data.BodyData = value; } } - public DateTime PublishedAt + public DateTime? PublishedAt { get { return data.PublishedAt; } set { data.PublishedAt = value; } diff --git a/SaxoniteStandardBase/Base/Bus/SaxItemAddress.cs b/SaxoniteStandardBase/Base/Bus/SaxItemAddress.cs index 04de28f..53d05b8 100644 --- a/SaxoniteStandardBase/Base/Bus/SaxItemAddress.cs +++ b/SaxoniteStandardBase/Base/Bus/SaxItemAddress.cs @@ -73,13 +73,13 @@ namespace Saxonite.Net.Standard.Base.Bus public String PhoneMain { get; set; } // Location. public String LocationSource { get; set; } - public DateTime LocationStoredAt { get; set; } + public DateTime? LocationStoredAt { get; set; } = null; public bool LocationUpdateRequired { get; set; } public String LocationData { get; set; } public String LocationFormattedAddress { get; set; } - public Decimal LocationLatitude { get; set; } - public Decimal LocationLongitude { get; set; } - public Decimal LocationAltitude { get; set; } + public Decimal? LocationLatitude { get; set; } = null; + public Decimal? LocationLongitude { get; set; } = null; + public Decimal? LocationAltitude { get; set; } = null; } //------------------------------------------------------------------- @@ -166,10 +166,10 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.LocationSource; } set { CheckChanged(data.LocationSource, value); data.LocationSource = value; } } - public DateTime LocationStoredAt + public DateTime? LocationStoredAt { get { return data.LocationStoredAt; } - set { CheckChanged(data.LocationStoredAt, value); data.LocationStoredAt = value; } + set { CheckChangedNullable(data.LocationStoredAt, value); data.LocationStoredAt = value; } } public bool LocationUpdateRequired { @@ -186,20 +186,20 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.LocationFormattedAddress; } set { CheckChanged(data.LocationFormattedAddress, value); data.LocationFormattedAddress = value; } } - public Decimal LocationLatitude + public Decimal? LocationLatitude { get { return data.LocationLatitude; } - set { CheckChanged(data.LocationLatitude, value); data.LocationLatitude = value; } + set { CheckChangedNullable(data.LocationLatitude, value); data.LocationLatitude = value; } } - public Decimal LocationLongitude + public Decimal? LocationLongitude { get { return data.LocationLongitude; } - set { CheckChanged(data.LocationLongitude, value); data.LocationLongitude = value; } + set { CheckChangedNullable(data.LocationLongitude, value); data.LocationLongitude = value; } } - public Decimal LocationAltitude + public Decimal? LocationAltitude { get { return data.LocationAltitude; } - set { CheckChanged(data.LocationAltitude, value); data.LocationAltitude = value; } + set { CheckChangedNullable(data.LocationAltitude, value); data.LocationAltitude = value; } } // Population. internal void PopulateFrom(Data data) @@ -393,7 +393,7 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.LocationSource; } set { data.LocationSource = value; } } - public DateTime LocationStoredAt + public DateTime? LocationStoredAt { get { return data.LocationStoredAt; } set { data.LocationStoredAt = value; } @@ -413,17 +413,17 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.LocationFormattedAddress; } set { data.LocationFormattedAddress = value; } } - public Decimal LocationLatitude + public Decimal? LocationLatitude { get { return data.LocationLatitude; } set { data.LocationLatitude = value; } } - public Decimal LocationLongitude + public Decimal? LocationLongitude { get { return data.LocationLongitude; } set { data.LocationLongitude = value; } } - public Decimal LocationAltitude + public Decimal? LocationAltitude { get { return data.LocationAltitude; } set { data.LocationAltitude = value; } diff --git a/SaxoniteStandardBase/Base/Bus/SaxOrganisationEvent.cs b/SaxoniteStandardBase/Base/Bus/SaxOrganisationEvent.cs index a1fcf63..484f34c 100644 --- a/SaxoniteStandardBase/Base/Bus/SaxOrganisationEvent.cs +++ b/SaxoniteStandardBase/Base/Bus/SaxOrganisationEvent.cs @@ -62,8 +62,8 @@ namespace Saxonite.Net.Standard.Base.Bus public String Summary { get; set; } = String.Empty; public String Details { get; set; } = String.Empty; public String EventData { get; set; } = String.Empty; - public DateTime PublishedAt { get; set; } - public DateTime ExpiresAt { get; set; } + public DateTime? PublishedAt { get; set; } = null; + public DateTime? ExpiresAt { get; set; } = null; } //------------------------------------------------------------------- @@ -118,15 +118,15 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.EventData; } set { CheckChanged(data.EventData, value); data.EventData = value; } } - public DateTime PublishedAt + public DateTime? PublishedAt { get { return data.PublishedAt; } - set { CheckChanged(data.PublishedAt, value); data.PublishedAt = value; } + set { CheckChangedNullable(data.PublishedAt, value); data.PublishedAt = value; } } - public DateTime ExpiresAt + public DateTime? ExpiresAt { get { return data.ExpiresAt; } - set { CheckChanged(data.ExpiresAt, value); data.ExpiresAt = value; } + set { CheckChangedNullable(data.ExpiresAt, value); data.ExpiresAt = value; } } // Population. internal void PopulateFrom(Data data) @@ -259,12 +259,12 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.EventData; } set { data.EventData = value; } } - public DateTime PublishedAt + public DateTime? PublishedAt { get { return data.PublishedAt; } set { data.PublishedAt = value; } } - public DateTime ExpiresAt + public DateTime? ExpiresAt { get { return data.ExpiresAt; } set { data.ExpiresAt = value; } diff --git a/SaxoniteStandardBase/Base/Bus/SaxOrganisationOpportunity.cs b/SaxoniteStandardBase/Base/Bus/SaxOrganisationOpportunity.cs index ca28064..9d432a7 100644 --- a/SaxoniteStandardBase/Base/Bus/SaxOrganisationOpportunity.cs +++ b/SaxoniteStandardBase/Base/Bus/SaxOrganisationOpportunity.cs @@ -59,8 +59,8 @@ namespace Saxonite.Net.Standard.Base.Bus public String Position { get; set; } = String.Empty; public String Outline { get; set; } = String.Empty; public String OpportunityData { get; set; } = String.Empty; - public DateTime PublishedAt { get; set; } - public DateTime ExpiresAt { get; set; } + public DateTime? PublishedAt { get; set; } = null; + public DateTime? ExpiresAt { get; set; } = null; } //------------------------------------------------------------------- @@ -110,15 +110,15 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.OpportunityData; } set { CheckChanged(data.OpportunityData, value); data.OpportunityData = value; } } - public DateTime PublishedAt + public DateTime? PublishedAt { get { return data.PublishedAt; } - set { CheckChanged(data.PublishedAt, value); data.PublishedAt = value; } + set { CheckChangedNullable(data.PublishedAt, value); data.PublishedAt = value; } } - public DateTime ExpiresAt + public DateTime? ExpiresAt { get { return data.ExpiresAt; } - set { CheckChanged(data.ExpiresAt, value); data.ExpiresAt = value; } + set { CheckChangedNullable(data.ExpiresAt, value); data.ExpiresAt = value; } } // Population. internal void PopulateFrom(Data data) @@ -244,12 +244,12 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.OpportunityData; } set { data.OpportunityData = value; } } - public DateTime PublishedAt + public DateTime? PublishedAt { get { return data.PublishedAt; } set { data.PublishedAt = value; } } - public DateTime ExpiresAt + public DateTime? ExpiresAt { get { return data.ExpiresAt; } set { data.ExpiresAt = value; } diff --git a/SaxoniteStandardBase/Base/Bus/SaxRegion.cs b/SaxoniteStandardBase/Base/Bus/SaxRegion.cs index 32d4205..8e6a51f 100644 --- a/SaxoniteStandardBase/Base/Bus/SaxRegion.cs +++ b/SaxoniteStandardBase/Base/Bus/SaxRegion.cs @@ -46,8 +46,8 @@ namespace Saxonite.Net.Standard.Base.Bus public Sax.RegionType RegionType { get; set; } = Sax.RegionType.Unknown; public String CountryIso2Code { get; set; } = String.Empty; public String Name { get; set; } = String.Empty; - public Decimal Latitude { get; set; } - public Decimal Longitude { get; set; } + public Decimal? Latitude { get; set; } = null; + public Decimal? Longitude { get; set; } = null; public SysId RegionIdParent { get; set; } } @@ -78,15 +78,15 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.Name; } set { CheckChanged(data.Name, value); data.Name = value; } } - public Decimal Latitude + public Decimal? Latitude { get { return data.Latitude; } - set { CheckChanged(data.Latitude, value); data.Latitude = value; } + set { CheckChangedNullable(data.Latitude, value); data.Latitude = value; } } - public Decimal Longitude + public Decimal? Longitude { get { return data.Longitude; } - set { CheckChanged(data.Longitude, value); data.Longitude = value; } + set { CheckChangedNullable(data.Longitude, value); data.Longitude = value; } } public SysId RegionIdParent { @@ -227,12 +227,12 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.Name; } set { data.Name = value; } } - public Decimal Latitude + public Decimal? Latitude { get { return data.Latitude; } set { data.Latitude = value; } } - public Decimal Longitude + public Decimal? Longitude { get { return data.Longitude; } set { data.Longitude = value; } diff --git a/SaxoniteStandardBase/Base/Bus/SaxUserAccount.cs b/SaxoniteStandardBase/Base/Bus/SaxUserAccount.cs index eee7faf..f92b110 100644 --- a/SaxoniteStandardBase/Base/Bus/SaxUserAccount.cs +++ b/SaxoniteStandardBase/Base/Bus/SaxUserAccount.cs @@ -79,19 +79,19 @@ namespace Saxonite.Net.Standard.Base.Bus public String PhoneMobile { get; set; } = String.Empty; public Sax.Gender Gender { get; set; } public String GenderOther { get; set; } - public byte DateOfBirthDay { get; set; } - public byte DateOfBirthMonth { get; set; } - public short DateOfBirthYear { get; set; } + public byte? DateOfBirthDay { get; set; } = null; + public byte? DateOfBirthMonth { get; set; } = null; + public short? DateOfBirthYear { get; set; } = null; public SysId RegionIdCountry { get; set; } public SysId RegionIdProvince { get; set; } // Security. public String PasswordHashed { get; set; } = String.Empty; public List PasswordHistory { get; } = new List(); public String PasswordToken { get; set; } = String.Empty; - public DateTime PasswordChangedAt { get; set; } = DateTime.MinValue; + public DateTime? PasswordChangedAt { get; set; } = null; // Login. - public DateTime LastLoginAt { get; set; } = DateTime.MinValue; - public DateTime LastInvalidLoginAt { get; set; } = DateTime.MinValue; + public DateTime? LastLoginAt { get; set; } = null; + public DateTime? LastInvalidLoginAt { get; set; } = null; public short InvalidLoginCount { get; set; } } @@ -157,20 +157,20 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.GenderOther; } set { CheckChanged(data.GenderOther, value); data.GenderOther = value; } } - public byte DateOfBirthDay + public byte? DateOfBirthDay { get { return data.DateOfBirthDay; } - set { CheckChanged(data.DateOfBirthDay, value); data.DateOfBirthDay = value; } + set { if ((value??0) < 1) value = null; CheckChangedNullable(data.DateOfBirthDay, value); data.DateOfBirthDay = value; } } - public byte DateOfBirthMonth + public byte? DateOfBirthMonth { get { return data.DateOfBirthMonth; } - set { CheckChanged(data.DateOfBirthMonth, value); data.DateOfBirthMonth = value; } + set { if ((value ?? 0) < 1) value = null; CheckChangedNullable(data.DateOfBirthMonth, value); data.DateOfBirthMonth = value; } } - public short DateOfBirthYear + public short? DateOfBirthYear { get { return data.DateOfBirthYear; } - set { CheckChanged(data.DateOfBirthYear, value); data.DateOfBirthYear = value; } + set { if ((value ?? 0) < 1) value = null; CheckChangedNullable(data.DateOfBirthYear, value); data.DateOfBirthYear = value; } } public SysId RegionIdCountry { @@ -203,21 +203,21 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.PasswordToken; } set { CheckChanged(data.PasswordToken, value); data.PasswordToken = value; } } - public DateTime PasswordChangedAt + public DateTime? PasswordChangedAt { get { return data.PasswordChangedAt; } - set { CheckChanged(data.PasswordChangedAt, value); data.PasswordChangedAt = value; } + set { CheckChangedNullable(data.PasswordChangedAt, value); data.PasswordChangedAt = value; } } // Login. - public DateTime LastLoginAt + public DateTime? LastLoginAt { get { return data.LastLoginAt; } - set { CheckChanged(data.LastLoginAt, value); data.LastLoginAt = value; } + set { CheckChangedNullable(data.LastLoginAt, value); data.LastLoginAt = value; } } - public DateTime LastInvalidLoginAt + public DateTime? LastInvalidLoginAt { get { return data.LastInvalidLoginAt; } - set { CheckChanged(data.LastInvalidLoginAt, value); data.LastInvalidLoginAt = value; } + set { CheckChangedNullable(data.LastInvalidLoginAt, value); data.LastInvalidLoginAt = value; } } public short InvalidLoginCount { @@ -406,17 +406,17 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.GenderOther; } set { data.GenderOther = value; } } - public byte DateOfBirthDay + public byte? DateOfBirthDay { get { return data.DateOfBirthDay; } set { data.DateOfBirthDay = value; } } - public byte DateOfBirthMonth + public byte? DateOfBirthMonth { get { return data.DateOfBirthMonth; } set { data.DateOfBirthMonth = value; } } - public short DateOfBirthYear + public short? DateOfBirthYear { get { return data.DateOfBirthYear; } set { data.DateOfBirthYear = value; } @@ -448,19 +448,19 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.PasswordToken; } set { data.PasswordToken = value; } } - public DateTime PasswordChangedAt + public DateTime ?PasswordChangedAt { get { return data.PasswordChangedAt; } set { data.PasswordChangedAt = value; } } // Login. - public DateTime LastLoginAt + public DateTime? LastLoginAt { get { return data.LastLoginAt; } set { data.LastLoginAt = value; } } - public DateTime LastInvalidLoginAt + public DateTime? LastInvalidLoginAt { get { return data.LastInvalidLoginAt; } set { data.LastInvalidLoginAt = value; } diff --git a/SaxoniteStandardBase/Base/Bus/SaxUserActivity.cs b/SaxoniteStandardBase/Base/Bus/SaxUserActivity.cs index 53cce1b..f704c56 100644 --- a/SaxoniteStandardBase/Base/Bus/SaxUserActivity.cs +++ b/SaxoniteStandardBase/Base/Bus/SaxUserActivity.cs @@ -56,12 +56,12 @@ namespace Saxonite.Net.Standard.Base.Bus public ItemId ItemId { get; set; } = new ItemId(); public bool CurrentlyListed {get; set; } public DateTime ListedAtFirst { get; set; } - public DateTime ListedAtLast { get; set; } - public DateTime ViewedAtFirst { get; set; } - public DateTime ViewedAtLast { get; set; } + public DateTime? ListedAtLast { get; set; } = null; + public DateTime? ViewedAtFirst { get; set; } = null; + public DateTime? ViewedAtLast { get; set; } = null; public Sax.ActivityReaction Reaction { get; set; } - public DateTime ReactedAtFirst { get; set; } - public DateTime ReactedAtLast { get; set; } + public DateTime? ReactedAtFirst { get; set; } = null; + public DateTime? ReactedAtLast { get; set; } = null; public String UserActivityData { get; set; } } @@ -97,35 +97,35 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.ListedAtFirst; } set { CheckChanged(data.ListedAtFirst, value); data.ListedAtFirst = value; } } - public DateTime ListedAtLast + public DateTime? ListedAtLast { get { return data.ListedAtLast; } - set { CheckChanged(data.ListedAtLast, value); data.ListedAtLast = value; } + set { CheckChangedNullable(data.ListedAtLast, value); data.ListedAtLast = value; } } - public DateTime ViewedAtFirst + public DateTime? ViewedAtFirst { get { return data.ViewedAtFirst; } - set { CheckChanged(data.ViewedAtFirst, value); data.ViewedAtFirst = value; } + set { CheckChangedNullable(data.ViewedAtFirst, value); data.ViewedAtFirst = value; } } - public DateTime ViewedAtLast + public DateTime? ViewedAtLast { get { return data.ViewedAtLast; } - set { CheckChanged(data.ViewedAtLast, value); data.ViewedAtLast = value; } + set { CheckChangedNullable(data.ViewedAtLast, value); data.ViewedAtLast = value; } } public Sax.ActivityReaction Reaction { get { return data.Reaction; } set { CheckChanged((int)data.Reaction, (int)value); data.Reaction = value; } } - public DateTime ReactedAtFirst + public DateTime? ReactedAtFirst { get { return data.ReactedAtFirst; } - set { CheckChanged(data.ReactedAtFirst, value); data.ReactedAtFirst = value; } + set { CheckChangedNullable(data.ReactedAtFirst, value); data.ReactedAtFirst = value; } } - public DateTime ReactedAtLast + public DateTime? ReactedAtLast { get { return data.ReactedAtLast; } - set { CheckChanged(data.ReactedAtLast, value); data.ReactedAtLast = value; } + set { CheckChangedNullable(data.ReactedAtLast, value); data.ReactedAtLast = value; } } public String UserActivityData { @@ -248,17 +248,17 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.ListedAtFirst; } set { data.ListedAtFirst = value; } } - public DateTime ListedAtLast + public DateTime? ListedAtLast { get { return data.ListedAtLast; } set { data.ListedAtLast = value; } } - public DateTime ViewedAtFirst + public DateTime? ViewedAtFirst { get { return data.ViewedAtFirst; } set { data.ViewedAtFirst = value; } } - public DateTime ViewedAtLast + public DateTime? ViewedAtLast { get { return data.ViewedAtLast; } set { data.ViewedAtLast = value; } @@ -268,12 +268,12 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.Reaction; } set { data.Reaction = value; } } - public DateTime ReactedAtFirst + public DateTime? ReactedAtFirst { get { return data.ReactedAtFirst; } set { data.ReactedAtFirst = value; } } - public DateTime ReactedAtLast + public DateTime? ReactedAtLast { get { return data.ReactedAtLast; } set { data.ReactedAtLast = value; } diff --git a/SaxoniteStandardBase/Base/Bus/SaxUserEligibility.cs b/SaxoniteStandardBase/Base/Bus/SaxUserEligibility.cs index a851b0b..15a19d8 100644 --- a/SaxoniteStandardBase/Base/Bus/SaxUserEligibility.cs +++ b/SaxoniteStandardBase/Base/Bus/SaxUserEligibility.cs @@ -58,7 +58,7 @@ namespace Saxonite.Net.Standard.Base.Bus public SysId RegionId { get; set; } public String Info { get; set; } public Sax.EligibilityType EligibilityType { get; set; } - public DateTime ExpiresOn { get; set; } = DateTime.MinValue; + public DateTime? ExpiresOn { get; set; } = null; } //------------------------------------------------------------------- @@ -93,10 +93,10 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.Info; } set { CheckChanged(data.Info, value); data.Info = value; } } - public DateTime ExpiresOn + public DateTime? ExpiresOn { get { return data.ExpiresOn; } - set { CheckChanged(data.ExpiresOn, value); data.ExpiresOn = value; } + set { CheckChangedNullable(data.ExpiresOn, value); data.ExpiresOn = value; } } // Population. internal void PopulateFrom(Data data) @@ -254,7 +254,7 @@ namespace Saxonite.Net.Standard.Base.Bus set { data.Info = value; } } - public DateTime ExpiresOn + public DateTime? ExpiresOn { get { return data.ExpiresOn; } set { data.ExpiresOn = value; } diff --git a/SaxoniteStandardBase/Base/Bus/SaxUserRole.cs b/SaxoniteStandardBase/Base/Bus/SaxUserRole.cs index 1540a4a..72d2b0d 100644 --- a/SaxoniteStandardBase/Base/Bus/SaxUserRole.cs +++ b/SaxoniteStandardBase/Base/Bus/SaxUserRole.cs @@ -51,9 +51,9 @@ namespace Saxonite.Net.Standard.Base.Bus public SysId UserAccountId { get; set; } public Sax.UserRole UserRole { get; set; } // Login. - public DateTime LastLoginAt { get; set; } = DateTime.MinValue; - public DateTime LastInvalidLoginAt { get; set; } = DateTime.MinValue; - public short InvalidLoginCount { get; set; } + public DateTime? LastLoginAt { get; set; } = null; + public DateTime? LastInvalidLoginAt { get; set; } = null; + public short? InvalidLoginCount { get; set; } = null; } //------------------------------------------------------------------- @@ -79,20 +79,20 @@ namespace Saxonite.Net.Standard.Base.Bus set { CheckChanged((int)data.UserRole, (int)value); data.UserRole = value; } } // Login. - public DateTime LastLoginAt + public DateTime? LastLoginAt { get { return data.LastLoginAt; } - set { CheckChanged(data.LastLoginAt, value); data.LastLoginAt = value; } + set { CheckChangedNullable(data.LastLoginAt, value); data.LastLoginAt = value; } } - public DateTime LastInvalidLoginAt + public DateTime? LastInvalidLoginAt { get { return data.LastInvalidLoginAt; } - set { CheckChanged(data.LastInvalidLoginAt, value); data.LastInvalidLoginAt = value; } + set { CheckChangedNullable(data.LastInvalidLoginAt, value); data.LastInvalidLoginAt = value; } } - public short InvalidLoginCount + public short? InvalidLoginCount { get { return data.InvalidLoginCount; } - set { CheckChanged(data.InvalidLoginCount, value); data.InvalidLoginCount = value; } + set { CheckChangedNullable(data.InvalidLoginCount, value); data.InvalidLoginCount = value; } } // Population. internal void PopulateFrom(Data data) @@ -199,17 +199,17 @@ namespace Saxonite.Net.Standard.Base.Bus } // Login - Admin application for System Admin role. - public DateTime LastLoginAt + public DateTime? LastLoginAt { get { return data.LastLoginAt; } set { data.LastLoginAt = value; } } - public DateTime LastInvalidLoginAt + public DateTime? LastInvalidLoginAt { get { return data.LastInvalidLoginAt; } set { data.LastInvalidLoginAt = value; } } - public short InvalidLoginCount + public short? InvalidLoginCount { get { return data.InvalidLoginCount; } set { data.InvalidLoginCount = value; } diff --git a/SaxoniteStandardBase/Base/Bus/SaxUserSportExperience.cs b/SaxoniteStandardBase/Base/Bus/SaxUserSportExperience.cs index 99e15f6..77b7d99 100644 --- a/SaxoniteStandardBase/Base/Bus/SaxUserSportExperience.cs +++ b/SaxoniteStandardBase/Base/Bus/SaxUserSportExperience.cs @@ -60,7 +60,7 @@ namespace Saxonite.Net.Standard.Base.Bus { public SysId UserSportId { get; set; } public DateTime PeriodFrom { get; set; } - public DateTime PeriodTo { get; set; } + public DateTime? PeriodTo { get; set; } public SysId OrganisationId { get; set; } public String OrganisationName { get; set; } public String Summary { get; set; } @@ -96,10 +96,10 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.PeriodFrom; } set { CheckChanged(data.PeriodFrom, value); data.PeriodFrom = value; } } - public DateTime PeriodTo + public DateTime? PeriodTo { get { return data.PeriodTo; } - set { CheckChanged(data.PeriodTo, value); data.PeriodTo = value; } + set { CheckChangedNullable(data.PeriodTo, value); data.PeriodTo = value; } } public SysId OrganisationId { @@ -277,7 +277,7 @@ namespace Saxonite.Net.Standard.Base.Bus get { return data.PeriodFrom; } set { data.PeriodFrom = value; } } - public DateTime PeriodTo + public DateTime? PeriodTo { get { return data.PeriodTo; } set { data.PeriodTo = value; } diff --git a/SaxoniteStandardBase/Base/Consoles/SaxActivityConsole.cs b/SaxoniteStandardBase/Base/Consoles/SaxActivityConsole.cs index aff363a..f186596 100644 --- a/SaxoniteStandardBase/Base/Consoles/SaxActivityConsole.cs +++ b/SaxoniteStandardBase/Base/Consoles/SaxActivityConsole.cs @@ -165,7 +165,7 @@ namespace Saxonite.Net.Standard.Base.Consoles indexData.OrganisationIdOwner = article.OrganisationId; indexData.SportIds.Add(article.SportIdPrimary); indexData.RegionIds.Add(article.RegionIdPrimary); - indexData.EffectiveOn = DateUtil.OnInvalid(article.PublishedAt.Date, article.CreateStamp.On.Date); + indexData.EffectiveOn = DateUtil.OnInvalid(article.PublishedAt?.Date, article.CreateStamp.On.Date); return StoreActivityIndexData(indexData, dbUpdateInfo); } return ClearActivityIndex(article.GetItemId(), dbUpdateInfo); @@ -193,8 +193,8 @@ namespace Saxonite.Net.Standard.Base.Consoles indexData.OrganisationIdOwner = organisationEvent.OrganisationId; indexData.SportIds.Add(organisationEvent.SportIdPrimary); indexData.RegionIds.Add(organisationEvent.RegionIdCountry); - indexData.EffectiveOn = DateUtil.OnInvalid(organisationEvent.PublishedAt.Date, organisationEvent.CreateStamp.On.Date); - indexData.ExpiresOn = DateUtil.OnInvalid(organisationEvent.ExpiresAt.Date, DateUtil.IncrementDate(indexData.EffectiveOn, 7)); + indexData.EffectiveOn = DateUtil.OnInvalid(organisationEvent.PublishedAt?.Date, organisationEvent.CreateStamp.On.Date); + indexData.ExpiresOn = DateUtil.OnInvalid(organisationEvent.ExpiresAt?.Date, DateUtil.IncrementDate(indexData.EffectiveOn, 7)); return StoreActivityIndexData(indexData, dbUpdateInfo); } public bool ClearActivityIndex(SaxOrganisationEvent organisationEvent, DbUpdateInfo dbUpdateInfo) @@ -220,8 +220,8 @@ namespace Saxonite.Net.Standard.Base.Consoles indexData.OrganisationIdOwner = opportunity.OrganisationId; indexData.SportIds.Add(opportunity.SportIdPrimary); indexData.RegionIds.Add(opportunity.RegionIdPrimary); - indexData.EffectiveOn = DateUtil.OnInvalid(opportunity.PublishedAt.Date, opportunity.CreateStamp.On.Date); - indexData.ExpiresOn = DateUtil.OnInvalid(opportunity.ExpiresAt.Date, DateUtil.IncrementDate(indexData.EffectiveOn, 28)); + indexData.EffectiveOn = DateUtil.OnInvalid(opportunity.PublishedAt?.Date, opportunity.CreateStamp.On.Date); + indexData.ExpiresOn = DateUtil.OnInvalid(opportunity.ExpiresAt?.Date, DateUtil.IncrementDate(indexData.EffectiveOn, 28)); return StoreActivityIndexData(indexData, dbUpdateInfo); } public bool ClearActivityIndex(SaxOrganisationOpportunity opportunity, DbUpdateInfo dbUpdateInfo) @@ -274,7 +274,7 @@ namespace Saxonite.Net.Standard.Base.Consoles public SysId SportId { get; } public SysId RegionId { get; } public DateTime EffectiveOn { get; } - public DateTime ExpiresOn { get; } + public DateTime? ExpiresOn { get; } public bool IsValid() { if (!ItemId.IsValid(ItemId)) return false; diff --git a/SaxoniteStandardBase/Base/Mgr/Reference/SaxReferenceGolfMgr-UsgaCourse.cs b/SaxoniteStandardBase/Base/Mgr/Reference/SaxReferenceGolfMgr-UsgaCourse.cs index 82ce798..b5a52ec 100644 --- a/SaxoniteStandardBase/Base/Mgr/Reference/SaxReferenceGolfMgr-UsgaCourse.cs +++ b/SaxoniteStandardBase/Base/Mgr/Reference/SaxReferenceGolfMgr-UsgaCourse.cs @@ -109,6 +109,12 @@ namespace Saxonite.Net.Standard.Base.Mgr.Reference errField.City = SacsHierarchyItem.ValidValue.Invalid; return false; } + // Postal Code. + if (errField.PostalCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PostalCode, "postal code", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_PostalCode))) + { + errField.PostalCode = SacsHierarchyItem.ValidValue.Invalid; + return false; + } // Email. if (errField.Email != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Email, "email", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Email))) { @@ -184,14 +190,15 @@ namespace Saxonite.Net.Standard.Base.Mgr.Reference public SysId FacilityId { get; set; } public SysId CourseId { get; set; } public SysId LegacyCrpCourseId { get; set; } - public string Caption { get; set; } - public string CourseName { get; set; } - public string FullName { get; set; } - public string Address1 { get; set; } - public string Address2 { get; set; } - public string City { get; set; } - public string Email { get; set; } - public string Telephone { get; set; } + public string Caption { get; set; } = null; + public string CourseName { get; set; } = null; + public string FullName { get; set; } = null; + public string Address1 { get; set; } = null; + public string Address2 { get; set; } = null; + public string City { get; set; } = null; + public string PostalCode { get; set; } = null; + public string Email { get; set; } = null; + public string Telephone { get; set; } = null; } /// /// Bulk update USGA Courses. diff --git a/SaxoniteStandardBase/Base/Mgr/Reference/SaxReferenceGolfMgr-UsgaFacility.cs b/SaxoniteStandardBase/Base/Mgr/Reference/SaxReferenceGolfMgr-UsgaFacility.cs index 90cfb5f..37fc73a 100644 --- a/SaxoniteStandardBase/Base/Mgr/Reference/SaxReferenceGolfMgr-UsgaFacility.cs +++ b/SaxoniteStandardBase/Base/Mgr/Reference/SaxReferenceGolfMgr-UsgaFacility.cs @@ -142,6 +142,12 @@ namespace Saxonite.Net.Standard.Base.Mgr.Reference public String ProvinceCode { get; set; } public SysId FacilityId { get; set; } public String FacilityName { get; set; } = null; + public string Address1 { get; set; } = null; + public string Address2 { get; set; } = null; + public string City { get; set; } = null; + public string PostalCode { get; set; } = null; + public string Email { get; set; } = null; + public string Telephone { get; set; } = null; } /// /// Bulk update USGA Facilities. diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/ActivityFeedback_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/ActivityFeedback_Db.cs index 5ce4c17..16bd66a 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/ActivityFeedback_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/ActivityFeedback_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -50,6 +50,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core "ItemType", "ItemId", }; + protected static List fieldsNullable { get; } = new List() + { + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/ActivityIndex_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/ActivityIndex_Db.cs index 0493c41..b5ed5ba 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/ActivityIndex_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/ActivityIndex_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -23,10 +23,10 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnDataInt64 _ItemId { get; } = new ColumnDataInt64("ItemId"); public ColumnDataInt32 _SportId { get; } = new ColumnDataInt32("SportId"); public ColumnDataInt32 _RegionId { get; } = new ColumnDataInt32("RegionId"); - public ColumnDataInt32 _UserAccountIdOwner { get; } = new ColumnDataInt32("UserAccountIdOwner"); - public ColumnDataInt32 _OrganisationIdOwner { get; } = new ColumnDataInt32("OrganisationIdOwner"); + public ColumnDataInt32Nullable _UserAccountIdOwner { get; } = new ColumnDataInt32Nullable("UserAccountIdOwner"); + public ColumnDataInt32Nullable _OrganisationIdOwner { get; } = new ColumnDataInt32Nullable("OrganisationIdOwner"); public ColumnDataDateTime _EffectiveOn { get; } = new ColumnDataDateTime("EffectiveOn"); - public ColumnDataDateTime _ExpiresOn { get; } = new ColumnDataDateTime("ExpiresOn"); + public ColumnDataDateTimeNullable _ExpiresOn { get; } = new ColumnDataDateTimeNullable("ExpiresOn"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); public ColumnDataString _Status { get; } = new ColumnDataString("Status"); @@ -70,6 +70,12 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core "SportId", "RegionId", }; + protected static List fieldsNullable { get; } = new List() + { + "UserAccountIdOwner", + "OrganisationIdOwner", + "ExpiresOn", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -97,10 +103,10 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public Int64 _ItemId { get { return Cols._ItemId.Value; } set { Cols._ItemId.Value = value; } } public Int32 _SportId { get { return Cols._SportId.Value; } set { Cols._SportId.Value = value; } } public Int32 _RegionId { get { return Cols._RegionId.Value; } set { Cols._RegionId.Value = value; } } - public Int32 _UserAccountIdOwner { get { return Cols._UserAccountIdOwner.Value; } set { Cols._UserAccountIdOwner.Value = value; } } - public Int32 _OrganisationIdOwner { get { return Cols._OrganisationIdOwner.Value; } set { Cols._OrganisationIdOwner.Value = value; } } + public Int32? _UserAccountIdOwner { get { return Cols._UserAccountIdOwner.Value; } set { Cols._UserAccountIdOwner.Value = value; } } + public Int32? _OrganisationIdOwner { get { return Cols._OrganisationIdOwner.Value; } set { Cols._OrganisationIdOwner.Value = value; } } public DateTime _EffectiveOn { get { return Cols._EffectiveOn.Value; } set { Cols._EffectiveOn.Value = value; } } - public DateTime _ExpiresOn { get { return Cols._ExpiresOn.Value; } set { Cols._ExpiresOn.Value = value; } } + public DateTime? _ExpiresOn { get { return Cols._ExpiresOn.Value; } set { Cols._ExpiresOn.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } } @@ -135,10 +141,10 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core _ItemId = GetFieldInt64(dbDataReader, "ItemId", _ItemId); _SportId = GetFieldInt32(dbDataReader, "SportId", _SportId); _RegionId = GetFieldInt32(dbDataReader, "RegionId", _RegionId); - _UserAccountIdOwner = GetFieldInt32(dbDataReader, "UserAccountIdOwner", _UserAccountIdOwner); - _OrganisationIdOwner = GetFieldInt32(dbDataReader, "OrganisationIdOwner", _OrganisationIdOwner); + _UserAccountIdOwner = GetFieldInt32Nullable(dbDataReader, "UserAccountIdOwner", _UserAccountIdOwner); + _OrganisationIdOwner = GetFieldInt32Nullable(dbDataReader, "OrganisationIdOwner", _OrganisationIdOwner); _EffectiveOn = GetFieldDateTime(dbDataReader, "EffectiveOn", _EffectiveOn); - _ExpiresOn = GetFieldDateTime(dbDataReader, "ExpiresOn", _ExpiresOn); + _ExpiresOn = GetFieldDateTimeNullable(dbDataReader, "ExpiresOn", _ExpiresOn); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); _Status = GetFieldString(dbDataReader, "Status", _Status); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/Article_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/Article_Db.cs index 5e7ab2c..d0d90b1 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/Article_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/Article_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -26,9 +26,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnDataInt32 _RegionIdPrimary { get; } = new ColumnDataInt32("RegionIdPrimary"); public ColumnDataString _Headline { get; } = new ColumnDataString("Headline"); public ColumnDataString _Summary { get; } = new ColumnDataString("Summary"); - public ColumnDataInt32 _ItemImageIdThumbnail { get; } = new ColumnDataInt32("ItemImageIdThumbnail"); + public ColumnDataInt32Nullable _ItemImageIdThumbnail { get; } = new ColumnDataInt32Nullable("ItemImageIdThumbnail"); public ColumnDataString _BodyData { get; } = new ColumnDataString("BodyData"); - public ColumnDataDateTime _PublishedAt { get; } = new ColumnDataDateTime("PublishedAt"); + public ColumnDataDateTimeNullable _PublishedAt { get; } = new ColumnDataDateTimeNullable("PublishedAt"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); public ColumnDataString _Status { get; } = new ColumnDataString("Status"); @@ -72,6 +72,11 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "ItemImageIdThumbnail", + "PublishedAt", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -102,9 +107,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public Int32 _RegionIdPrimary { get { return Cols._RegionIdPrimary.Value; } set { Cols._RegionIdPrimary.Value = value; } } public String _Headline { get { return Cols._Headline.Value; } set { Cols._Headline.Value = value; } } public String _Summary { get { return Cols._Summary.Value; } set { Cols._Summary.Value = value; } } - public Int32 _ItemImageIdThumbnail { get { return Cols._ItemImageIdThumbnail.Value; } set { Cols._ItemImageIdThumbnail.Value = value; } } + public Int32? _ItemImageIdThumbnail { get { return Cols._ItemImageIdThumbnail.Value; } set { Cols._ItemImageIdThumbnail.Value = value; } } public String _BodyData { get { return Cols._BodyData.Value; } set { Cols._BodyData.Value = value; } } - public DateTime _PublishedAt { get { return Cols._PublishedAt.Value; } set { Cols._PublishedAt.Value = value; } } + public DateTime? _PublishedAt { get { return Cols._PublishedAt.Value; } set { Cols._PublishedAt.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } } @@ -142,9 +147,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core _RegionIdPrimary = GetFieldInt32(dbDataReader, "RegionIdPrimary", _RegionIdPrimary); _Headline = GetFieldString(dbDataReader, "Headline", _Headline); _Summary = GetFieldString(dbDataReader, "Summary", _Summary); - _ItemImageIdThumbnail = GetFieldInt32(dbDataReader, "ItemImageIdThumbnail", _ItemImageIdThumbnail); + _ItemImageIdThumbnail = GetFieldInt32Nullable(dbDataReader, "ItemImageIdThumbnail", _ItemImageIdThumbnail); _BodyData = GetFieldString(dbDataReader, "BodyData", _BodyData); - _PublishedAt = GetFieldDateTime(dbDataReader, "PublishedAt", _PublishedAt); + _PublishedAt = GetFieldDateTimeNullable(dbDataReader, "PublishedAt", _PublishedAt); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); _Status = GetFieldString(dbDataReader, "Status", _Status); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/ItemAddress_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/ItemAddress_Db.cs index 0931ae8..a1477d1 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/ItemAddress_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/ItemAddress_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -35,13 +35,13 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnDataString _PostalCode { get; } = new ColumnDataString("PostalCode"); public ColumnDataString _PhoneMain { get; } = new ColumnDataString("PhoneMain"); public ColumnDataString _LocationSource { get; } = new ColumnDataString("LocationSource"); - public ColumnDataDateTime _LocationStoredAt { get; } = new ColumnDataDateTime("LocationStoredAt"); + public ColumnDataDateTimeNullable _LocationStoredAt { get; } = new ColumnDataDateTimeNullable("LocationStoredAt"); public ColumnDataBoolean _LocationUpdateRequired { get; } = new ColumnDataBoolean("LocationUpdateRequired"); public ColumnDataString _LocationData { get; } = new ColumnDataString("LocationData"); public ColumnDataString _LocationFormattedAddress { get; } = new ColumnDataString("LocationFormattedAddress"); - public ColumnDataDecimal _LocationLatitude { get; } = new ColumnDataDecimal("LocationLatitude"); - public ColumnDataDecimal _LocationLongitude { get; } = new ColumnDataDecimal("LocationLongitude"); - public ColumnDataDecimal _LocationAltitude { get; } = new ColumnDataDecimal("LocationAltitude"); + public ColumnDataDecimalNullable _LocationLatitude { get; } = new ColumnDataDecimalNullable("LocationLatitude"); + public ColumnDataDecimalNullable _LocationLongitude { get; } = new ColumnDataDecimalNullable("LocationLongitude"); + public ColumnDataDecimalNullable _LocationAltitude { get; } = new ColumnDataDecimalNullable("LocationAltitude"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); public ColumnDataString _Status { get; } = new ColumnDataString("Status"); @@ -98,6 +98,13 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "LocationStoredAt", + "LocationLatitude", + "LocationLongitude", + "LocationAltitude", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -137,13 +144,13 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public String _PostalCode { get { return Cols._PostalCode.Value; } set { Cols._PostalCode.Value = value; } } public String _PhoneMain { get { return Cols._PhoneMain.Value; } set { Cols._PhoneMain.Value = value; } } public String _LocationSource { get { return Cols._LocationSource.Value; } set { Cols._LocationSource.Value = value; } } - public DateTime _LocationStoredAt { get { return Cols._LocationStoredAt.Value; } set { Cols._LocationStoredAt.Value = value; } } + public DateTime? _LocationStoredAt { get { return Cols._LocationStoredAt.Value; } set { Cols._LocationStoredAt.Value = value; } } public Boolean _LocationUpdateRequired { get { return Cols._LocationUpdateRequired.Value; } set { Cols._LocationUpdateRequired.Value = value; } } public String _LocationData { get { return Cols._LocationData.Value; } set { Cols._LocationData.Value = value; } } public String _LocationFormattedAddress { get { return Cols._LocationFormattedAddress.Value; } set { Cols._LocationFormattedAddress.Value = value; } } - public Decimal _LocationLatitude { get { return Cols._LocationLatitude.Value; } set { Cols._LocationLatitude.Value = value; } } - public Decimal _LocationLongitude { get { return Cols._LocationLongitude.Value; } set { Cols._LocationLongitude.Value = value; } } - public Decimal _LocationAltitude { get { return Cols._LocationAltitude.Value; } set { Cols._LocationAltitude.Value = value; } } + public Decimal? _LocationLatitude { get { return Cols._LocationLatitude.Value; } set { Cols._LocationLatitude.Value = value; } } + public Decimal? _LocationLongitude { get { return Cols._LocationLongitude.Value; } set { Cols._LocationLongitude.Value = value; } } + public Decimal? _LocationAltitude { get { return Cols._LocationAltitude.Value; } set { Cols._LocationAltitude.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } } @@ -190,13 +197,13 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core _PostalCode = GetFieldString(dbDataReader, "PostalCode", _PostalCode); _PhoneMain = GetFieldString(dbDataReader, "PhoneMain", _PhoneMain); _LocationSource = GetFieldString(dbDataReader, "LocationSource", _LocationSource); - _LocationStoredAt = GetFieldDateTime(dbDataReader, "LocationStoredAt", _LocationStoredAt); + _LocationStoredAt = GetFieldDateTimeNullable(dbDataReader, "LocationStoredAt", _LocationStoredAt); _LocationUpdateRequired = GetFieldBoolean(dbDataReader, "LocationUpdateRequired", _LocationUpdateRequired); _LocationData = GetFieldString(dbDataReader, "LocationData", _LocationData); _LocationFormattedAddress = GetFieldString(dbDataReader, "LocationFormattedAddress", _LocationFormattedAddress); - _LocationLatitude = GetFieldDecimal(dbDataReader, "LocationLatitude", _LocationLatitude); - _LocationLongitude = GetFieldDecimal(dbDataReader, "LocationLongitude", _LocationLongitude); - _LocationAltitude = GetFieldDecimal(dbDataReader, "LocationAltitude", _LocationAltitude); + _LocationLatitude = GetFieldDecimalNullable(dbDataReader, "LocationLatitude", _LocationLatitude); + _LocationLongitude = GetFieldDecimalNullable(dbDataReader, "LocationLongitude", _LocationLongitude); + _LocationAltitude = GetFieldDecimalNullable(dbDataReader, "LocationAltitude", _LocationAltitude); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); _Status = GetFieldString(dbDataReader, "Status", _Status); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/ItemAssociation_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/ItemAssociation_Db.cs index 3db21d6..bd6ba5c 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/ItemAssociation_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/ItemAssociation_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -64,6 +64,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/ItemImage_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/ItemImage_Db.cs index 70e604d..e643346 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/ItemImage_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/ItemImage_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -78,6 +78,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/ItemSport_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/ItemSport_Db.cs index 760f7f6..81cc64a 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/ItemSport_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/ItemSport_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -62,6 +62,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/OrganisationEvent_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/OrganisationEvent_Db.cs index 419a1ba..f4d002e 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/OrganisationEvent_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/OrganisationEvent_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -28,8 +28,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnDataString _Summary { get; } = new ColumnDataString("Summary"); public ColumnDataString _Details { get; } = new ColumnDataString("Details"); public ColumnDataString _EventData { get; } = new ColumnDataString("EventData"); - public ColumnDataDateTime _PublishedAt { get; } = new ColumnDataDateTime("PublishedAt"); - public ColumnDataDateTime _ExpiresAt { get; } = new ColumnDataDateTime("ExpiresAt"); + public ColumnDataDateTimeNullable _PublishedAt { get; } = new ColumnDataDateTimeNullable("PublishedAt"); + public ColumnDataDateTimeNullable _ExpiresAt { get; } = new ColumnDataDateTimeNullable("ExpiresAt"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); public ColumnDataString _Status { get; } = new ColumnDataString("Status"); @@ -74,6 +74,11 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "PublishedAt", + "ExpiresAt", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -106,8 +111,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public String _Summary { get { return Cols._Summary.Value; } set { Cols._Summary.Value = value; } } public String _Details { get { return Cols._Details.Value; } set { Cols._Details.Value = value; } } public String _EventData { get { return Cols._EventData.Value; } set { Cols._EventData.Value = value; } } - public DateTime _PublishedAt { get { return Cols._PublishedAt.Value; } set { Cols._PublishedAt.Value = value; } } - public DateTime _ExpiresAt { get { return Cols._ExpiresAt.Value; } set { Cols._ExpiresAt.Value = value; } } + public DateTime? _PublishedAt { get { return Cols._PublishedAt.Value; } set { Cols._PublishedAt.Value = value; } } + public DateTime? _ExpiresAt { get { return Cols._ExpiresAt.Value; } set { Cols._ExpiresAt.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } } @@ -147,8 +152,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core _Summary = GetFieldString(dbDataReader, "Summary", _Summary); _Details = GetFieldString(dbDataReader, "Details", _Details); _EventData = GetFieldString(dbDataReader, "EventData", _EventData); - _PublishedAt = GetFieldDateTime(dbDataReader, "PublishedAt", _PublishedAt); - _ExpiresAt = GetFieldDateTime(dbDataReader, "ExpiresAt", _ExpiresAt); + _PublishedAt = GetFieldDateTimeNullable(dbDataReader, "PublishedAt", _PublishedAt); + _ExpiresAt = GetFieldDateTimeNullable(dbDataReader, "ExpiresAt", _ExpiresAt); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); _Status = GetFieldString(dbDataReader, "Status", _Status); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/OrganisationOpportunity_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/OrganisationOpportunity_Db.cs index a9e81bc..7413448 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/OrganisationOpportunity_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/OrganisationOpportunity_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -27,8 +27,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnDataString _Position { get; } = new ColumnDataString("Position"); public ColumnDataString _Outline { get; } = new ColumnDataString("Outline"); public ColumnDataString _OpportunityData { get; } = new ColumnDataString("OpportunityData"); - public ColumnDataDateTime _PublishedAt { get; } = new ColumnDataDateTime("PublishedAt"); - public ColumnDataDateTime _ExpiresAt { get; } = new ColumnDataDateTime("ExpiresAt"); + public ColumnDataDateTimeNullable _PublishedAt { get; } = new ColumnDataDateTimeNullable("PublishedAt"); + public ColumnDataDateTimeNullable _ExpiresAt { get; } = new ColumnDataDateTimeNullable("ExpiresAt"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); public ColumnDataString _Status { get; } = new ColumnDataString("Status"); @@ -72,6 +72,11 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "PublishedAt", + "ExpiresAt", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -103,8 +108,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public String _Position { get { return Cols._Position.Value; } set { Cols._Position.Value = value; } } public String _Outline { get { return Cols._Outline.Value; } set { Cols._Outline.Value = value; } } public String _OpportunityData { get { return Cols._OpportunityData.Value; } set { Cols._OpportunityData.Value = value; } } - public DateTime _PublishedAt { get { return Cols._PublishedAt.Value; } set { Cols._PublishedAt.Value = value; } } - public DateTime _ExpiresAt { get { return Cols._ExpiresAt.Value; } set { Cols._ExpiresAt.Value = value; } } + public DateTime? _PublishedAt { get { return Cols._PublishedAt.Value; } set { Cols._PublishedAt.Value = value; } } + public DateTime? _ExpiresAt { get { return Cols._ExpiresAt.Value; } set { Cols._ExpiresAt.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } } @@ -143,8 +148,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core _Position = GetFieldString(dbDataReader, "Position", _Position); _Outline = GetFieldString(dbDataReader, "Outline", _Outline); _OpportunityData = GetFieldString(dbDataReader, "OpportunityData", _OpportunityData); - _PublishedAt = GetFieldDateTime(dbDataReader, "PublishedAt", _PublishedAt); - _ExpiresAt = GetFieldDateTime(dbDataReader, "ExpiresAt", _ExpiresAt); + _PublishedAt = GetFieldDateTimeNullable(dbDataReader, "PublishedAt", _PublishedAt); + _ExpiresAt = GetFieldDateTimeNullable(dbDataReader, "ExpiresAt", _ExpiresAt); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); _Status = GetFieldString(dbDataReader, "Status", _Status); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/Organisation_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/Organisation_Db.cs index dbeaa2d..1c67841 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/Organisation_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/Organisation_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -23,8 +23,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnDataString _Name { get; } = new ColumnDataString("Name"); public ColumnDataString _OrganisationType { get; } = new ColumnDataString("OrganisationType"); public ColumnDataString _OrganisationCategory { get; } = new ColumnDataString("OrganisationCategory"); - public ColumnDataInt32 _SportIdPrimary { get; } = new ColumnDataInt32("SportIdPrimary"); - public ColumnDataInt32 _RegionIdPrimary { get; } = new ColumnDataInt32("RegionIdPrimary"); + public ColumnDataInt32Nullable _SportIdPrimary { get; } = new ColumnDataInt32Nullable("SportIdPrimary"); + public ColumnDataInt32Nullable _RegionIdPrimary { get; } = new ColumnDataInt32Nullable("RegionIdPrimary"); public ColumnDataString _About { get; } = new ColumnDataString("About"); public ColumnDataString _Facilities { get; } = new ColumnDataString("Facilities"); public ColumnDataString _ContactData { get; } = new ColumnDataString("ContactData"); @@ -72,6 +72,14 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "SportIdPrimary", + "RegionIdPrimary", + "About", + "Facilities", + "ContactData", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -99,8 +107,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public String _Name { get { return Cols._Name.Value; } set { Cols._Name.Value = value; } } public String _OrganisationType { get { return Cols._OrganisationType.Value; } set { Cols._OrganisationType.Value = value; } } public String _OrganisationCategory { get { return Cols._OrganisationCategory.Value; } set { Cols._OrganisationCategory.Value = value; } } - public Int32 _SportIdPrimary { get { return Cols._SportIdPrimary.Value; } set { Cols._SportIdPrimary.Value = value; } } - public Int32 _RegionIdPrimary { get { return Cols._RegionIdPrimary.Value; } set { Cols._RegionIdPrimary.Value = value; } } + public Int32? _SportIdPrimary { get { return Cols._SportIdPrimary.Value; } set { Cols._SportIdPrimary.Value = value; } } + public Int32? _RegionIdPrimary { get { return Cols._RegionIdPrimary.Value; } set { Cols._RegionIdPrimary.Value = value; } } public String _About { get { return Cols._About.Value; } set { Cols._About.Value = value; } } public String _Facilities { get { return Cols._Facilities.Value; } set { Cols._Facilities.Value = value; } } public String _ContactData { get { return Cols._ContactData.Value; } set { Cols._ContactData.Value = value; } } @@ -139,8 +147,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core _Name = GetFieldString(dbDataReader, "Name", _Name); _OrganisationType = GetFieldString(dbDataReader, "OrganisationType", _OrganisationType); _OrganisationCategory = GetFieldString(dbDataReader, "OrganisationCategory", _OrganisationCategory); - _SportIdPrimary = GetFieldInt32(dbDataReader, "SportIdPrimary", _SportIdPrimary); - _RegionIdPrimary = GetFieldInt32(dbDataReader, "RegionIdPrimary", _RegionIdPrimary); + _SportIdPrimary = GetFieldInt32Nullable(dbDataReader, "SportIdPrimary", _SportIdPrimary); + _RegionIdPrimary = GetFieldInt32Nullable(dbDataReader, "RegionIdPrimary", _RegionIdPrimary); _About = GetFieldString(dbDataReader, "About", _About); _Facilities = GetFieldString(dbDataReader, "Facilities", _Facilities); _ContactData = GetFieldString(dbDataReader, "ContactData", _ContactData); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/Region_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/Region_Db.cs index 5b4909e..d96e39d 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/Region_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/Region_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -23,8 +23,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnDataInt16 _RegionType { get; } = new ColumnDataInt16("RegionType"); public ColumnDataString _CountryIso2Code { get; } = new ColumnDataString("CountryIso2Code"); public ColumnDataString _Name { get; } = new ColumnDataString("Name"); - public ColumnDataDecimal _Latitude { get; } = new ColumnDataDecimal("Latitude"); - public ColumnDataDecimal _Longitude { get; } = new ColumnDataDecimal("Longitude"); + public ColumnDataDecimalNullable _Latitude { get; } = new ColumnDataDecimalNullable("Latitude"); + public ColumnDataDecimalNullable _Longitude { get; } = new ColumnDataDecimalNullable("Longitude"); public ColumnDataInt32 _RegionIdParent { get; } = new ColumnDataInt32("RegionIdParent"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); @@ -66,6 +66,11 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "Latitude", + "Longitude", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -93,8 +98,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public Int16 _RegionType { get { return Cols._RegionType.Value; } set { Cols._RegionType.Value = value; } } public String _CountryIso2Code { get { return Cols._CountryIso2Code.Value; } set { Cols._CountryIso2Code.Value = value; } } public String _Name { get { return Cols._Name.Value; } set { Cols._Name.Value = value; } } - public Decimal _Latitude { get { return Cols._Latitude.Value; } set { Cols._Latitude.Value = value; } } - public Decimal _Longitude { get { return Cols._Longitude.Value; } set { Cols._Longitude.Value = value; } } + public Decimal? _Latitude { get { return Cols._Latitude.Value; } set { Cols._Latitude.Value = value; } } + public Decimal? _Longitude { get { return Cols._Longitude.Value; } set { Cols._Longitude.Value = value; } } public Int32 _RegionIdParent { get { return Cols._RegionIdParent.Value; } set { Cols._RegionIdParent.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } @@ -130,8 +135,8 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core _RegionType = GetFieldInt16(dbDataReader, "RegionType", _RegionType); _CountryIso2Code = GetFieldString(dbDataReader, "CountryIso2Code", _CountryIso2Code); _Name = GetFieldString(dbDataReader, "Name", _Name); - _Latitude = GetFieldDecimal(dbDataReader, "Latitude", _Latitude); - _Longitude = GetFieldDecimal(dbDataReader, "Longitude", _Longitude); + _Latitude = GetFieldDecimalNullable(dbDataReader, "Latitude", _Latitude); + _Longitude = GetFieldDecimalNullable(dbDataReader, "Longitude", _Longitude); _RegionIdParent = GetFieldInt32(dbDataReader, "RegionIdParent", _RegionIdParent); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/Sport_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/Sport_Db.cs index 7b996c8..630614b 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/Sport_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/Sport_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -20,9 +20,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public class ColumnsData { public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id", true); - public ColumnDataInt32 _SportIdParent { get; } = new ColumnDataInt32("SportIdParent"); + public ColumnDataInt32Nullable _SportIdParent { get; } = new ColumnDataInt32Nullable("SportIdParent"); public ColumnDataString _Name { get; } = new ColumnDataString("Name"); - public ColumnDataInt16 _SpecialityLabel { get; } = new ColumnDataInt16("SpecialityLabel"); + public ColumnDataInt16Nullable _SpecialityLabel { get; } = new ColumnDataInt16Nullable("SpecialityLabel"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); public ColumnDataString _Status { get; } = new ColumnDataString("Status"); @@ -60,6 +60,11 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "SportIdParent", + "SpecialityLabel", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -84,9 +89,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core // Columns. public ColumnsData Cols { get; } = new ColumnsData(); public Int32 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } } - public Int32 _SportIdParent { get { return Cols._SportIdParent.Value; } set { Cols._SportIdParent.Value = value; } } + public Int32? _SportIdParent { get { return Cols._SportIdParent.Value; } set { Cols._SportIdParent.Value = value; } } public String _Name { get { return Cols._Name.Value; } set { Cols._Name.Value = value; } } - public Int16 _SpecialityLabel { get { return Cols._SpecialityLabel.Value; } set { Cols._SpecialityLabel.Value = value; } } + public Int16? _SpecialityLabel { get { return Cols._SpecialityLabel.Value; } set { Cols._SpecialityLabel.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } } @@ -118,9 +123,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public override void PopulateFrom (DbDataReader dbDataReader) { _Id = GetFieldInt32(dbDataReader, "Id", _Id); - _SportIdParent = GetFieldInt32(dbDataReader, "SportIdParent", _SportIdParent); + _SportIdParent = GetFieldInt32Nullable(dbDataReader, "SportIdParent", _SportIdParent); _Name = GetFieldString(dbDataReader, "Name", _Name); - _SpecialityLabel = GetFieldInt16(dbDataReader, "SpecialityLabel", _SpecialityLabel); + _SpecialityLabel = GetFieldInt16Nullable(dbDataReader, "SpecialityLabel", _SpecialityLabel); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); _Status = GetFieldString(dbDataReader, "Status", _Status); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/UserAccount_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/UserAccount_Db.cs index bf011ab..ef7799c 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/UserAccount_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/UserAccount_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -29,20 +29,20 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnDataString _PhoneMain { get; } = new ColumnDataString("PhoneMain"); public ColumnDataString _PhoneMobile { get; } = new ColumnDataString("PhoneMobile"); public ColumnDataString _PhoneAlt { get; } = new ColumnDataString("PhoneAlt"); - public ColumnDataByte _Gender { get; } = new ColumnDataByte("Gender"); + public ColumnDataByteNullable _Gender { get; } = new ColumnDataByteNullable("Gender"); public ColumnDataString _GenderOther { get; } = new ColumnDataString("GenderOther"); - public ColumnDataByte _DateOfBirthDay { get; } = new ColumnDataByte("DateOfBirthDay"); - public ColumnDataByte _DateOfBirthMonth { get; } = new ColumnDataByte("DateOfBirthMonth"); - public ColumnDataInt16 _DateOfBirthYear { get; } = new ColumnDataInt16("DateOfBirthYear"); - public ColumnDataInt32 _RegionIdCountry { get; } = new ColumnDataInt32("RegionIdCountry"); - public ColumnDataInt32 _RegionIdProvince { get; } = new ColumnDataInt32("RegionIdProvince"); + public ColumnDataByteNullable _DateOfBirthDay { get; } = new ColumnDataByteNullable("DateOfBirthDay"); + public ColumnDataByteNullable _DateOfBirthMonth { get; } = new ColumnDataByteNullable("DateOfBirthMonth"); + public ColumnDataInt16Nullable _DateOfBirthYear { get; } = new ColumnDataInt16Nullable("DateOfBirthYear"); + public ColumnDataInt32Nullable _RegionIdCountry { get; } = new ColumnDataInt32Nullable("RegionIdCountry"); + public ColumnDataInt32Nullable _RegionIdProvince { get; } = new ColumnDataInt32Nullable("RegionIdProvince"); public ColumnDataString _JournalistData { get; } = new ColumnDataString("JournalistData"); public ColumnDataString _PasswordToken { get; } = new ColumnDataString("PasswordToken"); public ColumnDataString _PasswordHashed { get; } = new ColumnDataString("PasswordHashed"); public ColumnDataString _PasswordHistory { get; } = new ColumnDataString("PasswordHistory"); - public ColumnDataDateTime _PasswordChangedAt { get; } = new ColumnDataDateTime("PasswordChangedAt"); - public ColumnDataDateTime _LastLoginAt { get; } = new ColumnDataDateTime("LastLoginAt"); - public ColumnDataDateTime _LastInvalidLoginAt { get; } = new ColumnDataDateTime("LastInvalidLoginAt"); + public ColumnDataDateTimeNullable _PasswordChangedAt { get; } = new ColumnDataDateTimeNullable("PasswordChangedAt"); + public ColumnDataDateTimeNullable _LastLoginAt { get; } = new ColumnDataDateTimeNullable("LastLoginAt"); + public ColumnDataDateTimeNullable _LastInvalidLoginAt { get; } = new ColumnDataDateTimeNullable("LastInvalidLoginAt"); public ColumnDataInt16 _InvalidLoginCount { get; } = new ColumnDataInt16("InvalidLoginCount"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); @@ -102,6 +102,22 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "About", + "Gender", + "GenderOther", + "DateOfBirthDay", + "DateOfBirthMonth", + "DateOfBirthYear", + "RegionIdCountry", + "RegionIdProvince", + "JournalistData", + "PasswordToken", + "PasswordChangedAt", + "LastLoginAt", + "LastInvalidLoginAt", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -135,20 +151,20 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public String _PhoneMain { get { return Cols._PhoneMain.Value; } set { Cols._PhoneMain.Value = value; } } public String _PhoneMobile { get { return Cols._PhoneMobile.Value; } set { Cols._PhoneMobile.Value = value; } } public String _PhoneAlt { get { return Cols._PhoneAlt.Value; } set { Cols._PhoneAlt.Value = value; } } - public Byte _Gender { get { return Cols._Gender.Value; } set { Cols._Gender.Value = value; } } + public Byte? _Gender { get { return Cols._Gender.Value; } set { Cols._Gender.Value = value; } } public String _GenderOther { get { return Cols._GenderOther.Value; } set { Cols._GenderOther.Value = value; } } - public Byte _DateOfBirthDay { get { return Cols._DateOfBirthDay.Value; } set { Cols._DateOfBirthDay.Value = value; } } - public Byte _DateOfBirthMonth { get { return Cols._DateOfBirthMonth.Value; } set { Cols._DateOfBirthMonth.Value = value; } } - public Int16 _DateOfBirthYear { get { return Cols._DateOfBirthYear.Value; } set { Cols._DateOfBirthYear.Value = value; } } - public Int32 _RegionIdCountry { get { return Cols._RegionIdCountry.Value; } set { Cols._RegionIdCountry.Value = value; } } - public Int32 _RegionIdProvince { get { return Cols._RegionIdProvince.Value; } set { Cols._RegionIdProvince.Value = value; } } + public Byte? _DateOfBirthDay { get { return Cols._DateOfBirthDay.Value; } set { Cols._DateOfBirthDay.Value = value; } } + public Byte? _DateOfBirthMonth { get { return Cols._DateOfBirthMonth.Value; } set { Cols._DateOfBirthMonth.Value = value; } } + public Int16? _DateOfBirthYear { get { return Cols._DateOfBirthYear.Value; } set { Cols._DateOfBirthYear.Value = value; } } + public Int32? _RegionIdCountry { get { return Cols._RegionIdCountry.Value; } set { Cols._RegionIdCountry.Value = value; } } + public Int32? _RegionIdProvince { get { return Cols._RegionIdProvince.Value; } set { Cols._RegionIdProvince.Value = value; } } public String _JournalistData { get { return Cols._JournalistData.Value; } set { Cols._JournalistData.Value = value; } } public String _PasswordToken { get { return Cols._PasswordToken.Value; } set { Cols._PasswordToken.Value = value; } } public String _PasswordHashed { get { return Cols._PasswordHashed.Value; } set { Cols._PasswordHashed.Value = value; } } public String _PasswordHistory { get { return Cols._PasswordHistory.Value; } set { Cols._PasswordHistory.Value = value; } } - public DateTime _PasswordChangedAt { get { return Cols._PasswordChangedAt.Value; } set { Cols._PasswordChangedAt.Value = value; } } - public DateTime _LastLoginAt { get { return Cols._LastLoginAt.Value; } set { Cols._LastLoginAt.Value = value; } } - public DateTime _LastInvalidLoginAt { get { return Cols._LastInvalidLoginAt.Value; } set { Cols._LastInvalidLoginAt.Value = value; } } + public DateTime? _PasswordChangedAt { get { return Cols._PasswordChangedAt.Value; } set { Cols._PasswordChangedAt.Value = value; } } + public DateTime? _LastLoginAt { get { return Cols._LastLoginAt.Value; } set { Cols._LastLoginAt.Value = value; } } + public DateTime? _LastInvalidLoginAt { get { return Cols._LastInvalidLoginAt.Value; } set { Cols._LastInvalidLoginAt.Value = value; } } public Int16 _InvalidLoginCount { get { return Cols._InvalidLoginCount.Value; } set { Cols._InvalidLoginCount.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } @@ -190,20 +206,20 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core _PhoneMain = GetFieldString(dbDataReader, "PhoneMain", _PhoneMain); _PhoneMobile = GetFieldString(dbDataReader, "PhoneMobile", _PhoneMobile); _PhoneAlt = GetFieldString(dbDataReader, "PhoneAlt", _PhoneAlt); - _Gender = GetFieldByte(dbDataReader, "Gender", _Gender); + _Gender = GetFieldByteNullable(dbDataReader, "Gender", _Gender); _GenderOther = GetFieldString(dbDataReader, "GenderOther", _GenderOther); - _DateOfBirthDay = GetFieldByte(dbDataReader, "DateOfBirthDay", _DateOfBirthDay); - _DateOfBirthMonth = GetFieldByte(dbDataReader, "DateOfBirthMonth", _DateOfBirthMonth); - _DateOfBirthYear = GetFieldInt16(dbDataReader, "DateOfBirthYear", _DateOfBirthYear); - _RegionIdCountry = GetFieldInt32(dbDataReader, "RegionIdCountry", _RegionIdCountry); - _RegionIdProvince = GetFieldInt32(dbDataReader, "RegionIdProvince", _RegionIdProvince); + _DateOfBirthDay = GetFieldByteNullable(dbDataReader, "DateOfBirthDay", _DateOfBirthDay); + _DateOfBirthMonth = GetFieldByteNullable(dbDataReader, "DateOfBirthMonth", _DateOfBirthMonth); + _DateOfBirthYear = GetFieldInt16Nullable(dbDataReader, "DateOfBirthYear", _DateOfBirthYear); + _RegionIdCountry = GetFieldInt32Nullable(dbDataReader, "RegionIdCountry", _RegionIdCountry); + _RegionIdProvince = GetFieldInt32Nullable(dbDataReader, "RegionIdProvince", _RegionIdProvince); _JournalistData = GetFieldString(dbDataReader, "JournalistData", _JournalistData); _PasswordToken = GetFieldString(dbDataReader, "PasswordToken", _PasswordToken); _PasswordHashed = GetFieldString(dbDataReader, "PasswordHashed", _PasswordHashed); _PasswordHistory = GetFieldString(dbDataReader, "PasswordHistory", _PasswordHistory); - _PasswordChangedAt = GetFieldDateTime(dbDataReader, "PasswordChangedAt", _PasswordChangedAt); - _LastLoginAt = GetFieldDateTime(dbDataReader, "LastLoginAt", _LastLoginAt); - _LastInvalidLoginAt = GetFieldDateTime(dbDataReader, "LastInvalidLoginAt", _LastInvalidLoginAt); + _PasswordChangedAt = GetFieldDateTimeNullable(dbDataReader, "PasswordChangedAt", _PasswordChangedAt); + _LastLoginAt = GetFieldDateTimeNullable(dbDataReader, "LastLoginAt", _LastLoginAt); + _LastInvalidLoginAt = GetFieldDateTimeNullable(dbDataReader, "LastInvalidLoginAt", _LastInvalidLoginAt); _InvalidLoginCount = GetFieldInt16(dbDataReader, "InvalidLoginCount", _InvalidLoginCount); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/UserActivity_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/UserActivity_Db.cs index ae4d495..8f7bc14 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/UserActivity_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/UserActivity_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -25,12 +25,12 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnDataInt64 _ItemId { get; } = new ColumnDataInt64("ItemId"); public ColumnDataBoolean _CurrentlyListed { get; } = new ColumnDataBoolean("CurrentlyListed"); public ColumnDataDateTime _ListedAtFirst { get; } = new ColumnDataDateTime("ListedAtFirst"); - public ColumnDataDateTime _ListedAtLast { get; } = new ColumnDataDateTime("ListedAtLast"); - public ColumnDataDateTime _ViewedAtFirst { get; } = new ColumnDataDateTime("ViewedAtFirst"); - public ColumnDataDateTime _ViewedAtLast { get; } = new ColumnDataDateTime("ViewedAtLast"); + public ColumnDataDateTimeNullable _ListedAtLast { get; } = new ColumnDataDateTimeNullable("ListedAtLast"); + public ColumnDataDateTimeNullable _ViewedAtFirst { get; } = new ColumnDataDateTimeNullable("ViewedAtFirst"); + public ColumnDataDateTimeNullable _ViewedAtLast { get; } = new ColumnDataDateTimeNullable("ViewedAtLast"); public ColumnDataInt16 _Reaction { get; } = new ColumnDataInt16("Reaction"); - public ColumnDataDateTime _ReactedAtFirst { get; } = new ColumnDataDateTime("ReactedAtFirst"); - public ColumnDataDateTime _ReactedAtLast { get; } = new ColumnDataDateTime("ReactedAtLast"); + public ColumnDataDateTimeNullable _ReactedAtFirst { get; } = new ColumnDataDateTimeNullable("ReactedAtFirst"); + public ColumnDataDateTimeNullable _ReactedAtLast { get; } = new ColumnDataDateTimeNullable("ReactedAtLast"); public ColumnDataString _UserActivityData { get; } = new ColumnDataString("UserActivityData"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); @@ -78,6 +78,14 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "ListedAtLast", + "ViewedAtFirst", + "ViewedAtLast", + "ReactedAtFirst", + "ReactedAtLast", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -107,12 +115,12 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public Int64 _ItemId { get { return Cols._ItemId.Value; } set { Cols._ItemId.Value = value; } } public Boolean _CurrentlyListed { get { return Cols._CurrentlyListed.Value; } set { Cols._CurrentlyListed.Value = value; } } public DateTime _ListedAtFirst { get { return Cols._ListedAtFirst.Value; } set { Cols._ListedAtFirst.Value = value; } } - public DateTime _ListedAtLast { get { return Cols._ListedAtLast.Value; } set { Cols._ListedAtLast.Value = value; } } - public DateTime _ViewedAtFirst { get { return Cols._ViewedAtFirst.Value; } set { Cols._ViewedAtFirst.Value = value; } } - public DateTime _ViewedAtLast { get { return Cols._ViewedAtLast.Value; } set { Cols._ViewedAtLast.Value = value; } } + public DateTime? _ListedAtLast { get { return Cols._ListedAtLast.Value; } set { Cols._ListedAtLast.Value = value; } } + public DateTime? _ViewedAtFirst { get { return Cols._ViewedAtFirst.Value; } set { Cols._ViewedAtFirst.Value = value; } } + public DateTime? _ViewedAtLast { get { return Cols._ViewedAtLast.Value; } set { Cols._ViewedAtLast.Value = value; } } public Int16 _Reaction { get { return Cols._Reaction.Value; } set { Cols._Reaction.Value = value; } } - public DateTime _ReactedAtFirst { get { return Cols._ReactedAtFirst.Value; } set { Cols._ReactedAtFirst.Value = value; } } - public DateTime _ReactedAtLast { get { return Cols._ReactedAtLast.Value; } set { Cols._ReactedAtLast.Value = value; } } + public DateTime? _ReactedAtFirst { get { return Cols._ReactedAtFirst.Value; } set { Cols._ReactedAtFirst.Value = value; } } + public DateTime? _ReactedAtLast { get { return Cols._ReactedAtLast.Value; } set { Cols._ReactedAtLast.Value = value; } } public String _UserActivityData { get { return Cols._UserActivityData.Value; } set { Cols._UserActivityData.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } @@ -150,12 +158,12 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core _ItemId = GetFieldInt64(dbDataReader, "ItemId", _ItemId); _CurrentlyListed = GetFieldBoolean(dbDataReader, "CurrentlyListed", _CurrentlyListed); _ListedAtFirst = GetFieldDateTime(dbDataReader, "ListedAtFirst", _ListedAtFirst); - _ListedAtLast = GetFieldDateTime(dbDataReader, "ListedAtLast", _ListedAtLast); - _ViewedAtFirst = GetFieldDateTime(dbDataReader, "ViewedAtFirst", _ViewedAtFirst); - _ViewedAtLast = GetFieldDateTime(dbDataReader, "ViewedAtLast", _ViewedAtLast); + _ListedAtLast = GetFieldDateTimeNullable(dbDataReader, "ListedAtLast", _ListedAtLast); + _ViewedAtFirst = GetFieldDateTimeNullable(dbDataReader, "ViewedAtFirst", _ViewedAtFirst); + _ViewedAtLast = GetFieldDateTimeNullable(dbDataReader, "ViewedAtLast", _ViewedAtLast); _Reaction = GetFieldInt16(dbDataReader, "Reaction", _Reaction); - _ReactedAtFirst = GetFieldDateTime(dbDataReader, "ReactedAtFirst", _ReactedAtFirst); - _ReactedAtLast = GetFieldDateTime(dbDataReader, "ReactedAtLast", _ReactedAtLast); + _ReactedAtFirst = GetFieldDateTimeNullable(dbDataReader, "ReactedAtFirst", _ReactedAtFirst); + _ReactedAtLast = GetFieldDateTimeNullable(dbDataReader, "ReactedAtLast", _ReactedAtLast); _UserActivityData = GetFieldString(dbDataReader, "UserActivityData", _UserActivityData); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/UserConfig_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/UserConfig_Db.cs index d39f08c..082277d 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/UserConfig_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/UserConfig_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -21,7 +21,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { public ColumnDataInt64 _Id { get; } = new ColumnDataInt64("Id", true); public ColumnDataInt32 _UserAccountId { get; } = new ColumnDataInt32("UserAccountId"); - public ColumnDataInt16 _ConfigType { get; } = new ColumnDataInt16("ConfigType"); + public ColumnDataInt16Nullable _ConfigType { get; } = new ColumnDataInt16Nullable("ConfigType"); public ColumnDataString _ConfigData { get; } = new ColumnDataString("ConfigData"); public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn"); public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn"); @@ -46,6 +46,10 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "ConfigType", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -71,7 +75,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnsData Cols { get; } = new ColumnsData(); public Int64 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } } public Int32 _UserAccountId { get { return Cols._UserAccountId.Value; } set { Cols._UserAccountId.Value = value; } } - public Int16 _ConfigType { get { return Cols._ConfigType.Value; } set { Cols._ConfigType.Value = value; } } + public Int16? _ConfigType { get { return Cols._ConfigType.Value; } set { Cols._ConfigType.Value = value; } } public String _ConfigData { get { return Cols._ConfigData.Value; } set { Cols._ConfigData.Value = value; } } public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } } public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } } @@ -98,7 +102,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { _Id = GetFieldInt64(dbDataReader, "Id", _Id); _UserAccountId = GetFieldInt32(dbDataReader, "UserAccountId", _UserAccountId); - _ConfigType = GetFieldInt16(dbDataReader, "ConfigType", _ConfigType); + _ConfigType = GetFieldInt16Nullable(dbDataReader, "ConfigType", _ConfigType); _ConfigData = GetFieldString(dbDataReader, "ConfigData", _ConfigData); _CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn); _UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/UserEligibility_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/UserEligibility_Db.cs index 824b160..89ed6b2 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/UserEligibility_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/UserEligibility_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -21,10 +21,10 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { public ColumnDataInt64 _Id { get; } = new ColumnDataInt64("Id", true); public ColumnDataInt32 _UserAccountId { get; } = new ColumnDataInt32("UserAccountId"); - public ColumnDataInt32 _RegionId { get; } = new ColumnDataInt32("RegionId"); + public ColumnDataInt32Nullable _RegionId { get; } = new ColumnDataInt32Nullable("RegionId"); public ColumnDataInt16 _EligibilityType { get; } = new ColumnDataInt16("EligibilityType"); public ColumnDataString _Info { get; } = new ColumnDataString("Info"); - public ColumnDataDateTime _ExpiresOn { get; } = new ColumnDataDateTime("ExpiresOn"); + public ColumnDataDateTimeNullable _ExpiresOn { get; } = new ColumnDataDateTimeNullable("ExpiresOn"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); public ColumnDataString _Status { get; } = new ColumnDataString("Status"); @@ -64,6 +64,11 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "RegionId", + "ExpiresOn", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -89,10 +94,10 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnsData Cols { get; } = new ColumnsData(); public Int64 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } } public Int32 _UserAccountId { get { return Cols._UserAccountId.Value; } set { Cols._UserAccountId.Value = value; } } - public Int32 _RegionId { get { return Cols._RegionId.Value; } set { Cols._RegionId.Value = value; } } + public Int32? _RegionId { get { return Cols._RegionId.Value; } set { Cols._RegionId.Value = value; } } public Int16 _EligibilityType { get { return Cols._EligibilityType.Value; } set { Cols._EligibilityType.Value = value; } } public String _Info { get { return Cols._Info.Value; } set { Cols._Info.Value = value; } } - public DateTime _ExpiresOn { get { return Cols._ExpiresOn.Value; } set { Cols._ExpiresOn.Value = value; } } + public DateTime? _ExpiresOn { get { return Cols._ExpiresOn.Value; } set { Cols._ExpiresOn.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } } @@ -125,10 +130,10 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { _Id = GetFieldInt64(dbDataReader, "Id", _Id); _UserAccountId = GetFieldInt32(dbDataReader, "UserAccountId", _UserAccountId); - _RegionId = GetFieldInt32(dbDataReader, "RegionId", _RegionId); + _RegionId = GetFieldInt32Nullable(dbDataReader, "RegionId", _RegionId); _EligibilityType = GetFieldInt16(dbDataReader, "EligibilityType", _EligibilityType); _Info = GetFieldString(dbDataReader, "Info", _Info); - _ExpiresOn = GetFieldDateTime(dbDataReader, "ExpiresOn", _ExpiresOn); + _ExpiresOn = GetFieldDateTimeNullable(dbDataReader, "ExpiresOn", _ExpiresOn); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); _Status = GetFieldString(dbDataReader, "Status", _Status); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/UserOnline_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/UserOnline_Db.cs index 8ded0fa..87a2533 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/UserOnline_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/UserOnline_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -37,6 +37,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "UserAccountId", }; + protected static List fieldsNullable { get; } = new List() + { + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/UserOrganisation_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/UserOrganisation_Db.cs index 8feb0a8..efa0add 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/UserOrganisation_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/UserOrganisation_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -64,6 +64,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/UserRole_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/UserRole_Db.cs index 0b33fc9..e83636c 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/UserRole_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/UserRole_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -22,9 +22,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnDataInt64 _Id { get; } = new ColumnDataInt64("Id", true); public ColumnDataInt32 _UserAccountId { get; } = new ColumnDataInt32("UserAccountId"); public ColumnDataString _UserRoleCode { get; } = new ColumnDataString("UserRoleCode"); - public ColumnDataDateTime _LastLoginAt { get; } = new ColumnDataDateTime("LastLoginAt"); - public ColumnDataDateTime _LastInvalidLoginAt { get; } = new ColumnDataDateTime("LastInvalidLoginAt"); - public ColumnDataInt16 _InvalidLoginCount { get; } = new ColumnDataInt16("InvalidLoginCount"); + public ColumnDataDateTimeNullable _LastLoginAt { get; } = new ColumnDataDateTimeNullable("LastLoginAt"); + public ColumnDataDateTimeNullable _LastInvalidLoginAt { get; } = new ColumnDataDateTimeNullable("LastInvalidLoginAt"); + public ColumnDataInt16Nullable _InvalidLoginCount { get; } = new ColumnDataInt16Nullable("InvalidLoginCount"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); public ColumnDataString _Status { get; } = new ColumnDataString("Status"); @@ -64,6 +64,12 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "LastLoginAt", + "LastInvalidLoginAt", + "InvalidLoginCount", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -90,9 +96,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public Int64 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } } public Int32 _UserAccountId { get { return Cols._UserAccountId.Value; } set { Cols._UserAccountId.Value = value; } } public String _UserRoleCode { get { return Cols._UserRoleCode.Value; } set { Cols._UserRoleCode.Value = value; } } - public DateTime _LastLoginAt { get { return Cols._LastLoginAt.Value; } set { Cols._LastLoginAt.Value = value; } } - public DateTime _LastInvalidLoginAt { get { return Cols._LastInvalidLoginAt.Value; } set { Cols._LastInvalidLoginAt.Value = value; } } - public Int16 _InvalidLoginCount { get { return Cols._InvalidLoginCount.Value; } set { Cols._InvalidLoginCount.Value = value; } } + public DateTime? _LastLoginAt { get { return Cols._LastLoginAt.Value; } set { Cols._LastLoginAt.Value = value; } } + public DateTime? _LastInvalidLoginAt { get { return Cols._LastInvalidLoginAt.Value; } set { Cols._LastInvalidLoginAt.Value = value; } } + public Int16? _InvalidLoginCount { get { return Cols._InvalidLoginCount.Value; } set { Cols._InvalidLoginCount.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } } @@ -126,9 +132,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core _Id = GetFieldInt64(dbDataReader, "Id", _Id); _UserAccountId = GetFieldInt32(dbDataReader, "UserAccountId", _UserAccountId); _UserRoleCode = GetFieldString(dbDataReader, "UserRoleCode", _UserRoleCode); - _LastLoginAt = GetFieldDateTime(dbDataReader, "LastLoginAt", _LastLoginAt); - _LastInvalidLoginAt = GetFieldDateTime(dbDataReader, "LastInvalidLoginAt", _LastInvalidLoginAt); - _InvalidLoginCount = GetFieldInt16(dbDataReader, "InvalidLoginCount", _InvalidLoginCount); + _LastLoginAt = GetFieldDateTimeNullable(dbDataReader, "LastLoginAt", _LastLoginAt); + _LastInvalidLoginAt = GetFieldDateTimeNullable(dbDataReader, "LastInvalidLoginAt", _LastInvalidLoginAt); + _InvalidLoginCount = GetFieldInt16Nullable(dbDataReader, "InvalidLoginCount", _InvalidLoginCount); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); _Status = GetFieldString(dbDataReader, "Status", _Status); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/UserSession_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/UserSession_Db.cs index 2ea5cdd..a46f0ae 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/UserSession_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/UserSession_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -45,6 +45,11 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "UserAccountId", }; + protected static List fieldsNullable { get; } = new List() + { + "ActivityIndexIds", + "UserSessionData", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/UserSportExperience_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/UserSportExperience_Db.cs index 906ad73..5078d89 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/UserSportExperience_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/UserSportExperience_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -22,7 +22,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnDataInt64 _Id { get; } = new ColumnDataInt64("Id", true); public ColumnDataInt64 _UserSportId { get; } = new ColumnDataInt64("UserSportId"); public ColumnDataDateTime _PeriodFrom { get; } = new ColumnDataDateTime("PeriodFrom"); - public ColumnDataDateTime _PeriodTo { get; } = new ColumnDataDateTime("PeriodTo"); + public ColumnDataDateTimeNullable _PeriodTo { get; } = new ColumnDataDateTimeNullable("PeriodTo"); public ColumnDataInt32 _OrganisationId { get; } = new ColumnDataInt32("OrganisationId"); public ColumnDataString _OrganisationName { get; } = new ColumnDataString("OrganisationName"); public ColumnDataString _Summary { get; } = new ColumnDataString("Summary"); @@ -82,6 +82,11 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "PeriodTo", + "Awards", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -108,7 +113,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public Int64 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } } public Int64 _UserSportId { get { return Cols._UserSportId.Value; } set { Cols._UserSportId.Value = value; } } public DateTime _PeriodFrom { get { return Cols._PeriodFrom.Value; } set { Cols._PeriodFrom.Value = value; } } - public DateTime _PeriodTo { get { return Cols._PeriodTo.Value; } set { Cols._PeriodTo.Value = value; } } + public DateTime? _PeriodTo { get { return Cols._PeriodTo.Value; } set { Cols._PeriodTo.Value = value; } } public Int32 _OrganisationId { get { return Cols._OrganisationId.Value; } set { Cols._OrganisationId.Value = value; } } public String _OrganisationName { get { return Cols._OrganisationName.Value; } set { Cols._OrganisationName.Value = value; } } public String _Summary { get { return Cols._Summary.Value; } set { Cols._Summary.Value = value; } } @@ -153,7 +158,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core _Id = GetFieldInt64(dbDataReader, "Id", _Id); _UserSportId = GetFieldInt64(dbDataReader, "UserSportId", _UserSportId); _PeriodFrom = GetFieldDateTime(dbDataReader, "PeriodFrom", _PeriodFrom); - _PeriodTo = GetFieldDateTime(dbDataReader, "PeriodTo", _PeriodTo); + _PeriodTo = GetFieldDateTimeNullable(dbDataReader, "PeriodTo", _PeriodTo); _OrganisationId = GetFieldInt32(dbDataReader, "OrganisationId", _OrganisationId); _OrganisationName = GetFieldString(dbDataReader, "OrganisationName", _OrganisationName); _Summary = GetFieldString(dbDataReader, "Summary", _Summary); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Core/UserSport_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Core/UserSport_Db.cs index ac823dd..a757f80 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Core/UserSport_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Core/UserSport_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Core { @@ -24,9 +24,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public ColumnDataInt32 _SportId { get; } = new ColumnDataInt32("SportId"); public ColumnDataString _About { get; } = new ColumnDataString("About"); public ColumnDataString _ContactsData { get; } = new ColumnDataString("ContactsData"); - public ColumnDataInt16 _Participating { get; } = new ColumnDataInt16("Participating"); - public ColumnDataInt16 _Preparing { get; } = new ColumnDataInt16("Preparing"); - public ColumnDataInt16 _Officiating { get; } = new ColumnDataInt16("Officiating"); + public ColumnDataInt16Nullable _Participating { get; } = new ColumnDataInt16Nullable("Participating"); + public ColumnDataInt16Nullable _Preparing { get; } = new ColumnDataInt16Nullable("Preparing"); + public ColumnDataInt16Nullable _Officiating { get; } = new ColumnDataInt16Nullable("Officiating"); public ColumnDataString _UserSportData { get; } = new ColumnDataString("UserSportData"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); @@ -70,6 +70,15 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "About", + "ContactsData", + "Participating", + "Preparing", + "Officiating", + "UserSportData", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -98,9 +107,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core public Int32 _SportId { get { return Cols._SportId.Value; } set { Cols._SportId.Value = value; } } public String _About { get { return Cols._About.Value; } set { Cols._About.Value = value; } } public String _ContactsData { get { return Cols._ContactsData.Value; } set { Cols._ContactsData.Value = value; } } - public Int16 _Participating { get { return Cols._Participating.Value; } set { Cols._Participating.Value = value; } } - public Int16 _Preparing { get { return Cols._Preparing.Value; } set { Cols._Preparing.Value = value; } } - public Int16 _Officiating { get { return Cols._Officiating.Value; } set { Cols._Officiating.Value = value; } } + public Int16? _Participating { get { return Cols._Participating.Value; } set { Cols._Participating.Value = value; } } + public Int16? _Preparing { get { return Cols._Preparing.Value; } set { Cols._Preparing.Value = value; } } + public Int16? _Officiating { get { return Cols._Officiating.Value; } set { Cols._Officiating.Value = value; } } public String _UserSportData { get { return Cols._UserSportData.Value; } set { Cols._UserSportData.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } @@ -137,9 +146,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Core _SportId = GetFieldInt32(dbDataReader, "SportId", _SportId); _About = GetFieldString(dbDataReader, "About", _About); _ContactsData = GetFieldString(dbDataReader, "ContactsData", _ContactsData); - _Participating = GetFieldInt16(dbDataReader, "Participating", _Participating); - _Preparing = GetFieldInt16(dbDataReader, "Preparing", _Preparing); - _Officiating = GetFieldInt16(dbDataReader, "Officiating", _Officiating); + _Participating = GetFieldInt16Nullable(dbDataReader, "Participating", _Participating); + _Preparing = GetFieldInt16Nullable(dbDataReader, "Preparing", _Preparing); + _Officiating = GetFieldInt16Nullable(dbDataReader, "Officiating", _Officiating); _UserSportData = GetFieldString(dbDataReader, "UserSportData", _UserSportData); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaCountry_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaCountry_Db.cs index 75fd680..b608b3e 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaCountry_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaCountry_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Reference { @@ -60,6 +60,10 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "EntCountryCode", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", diff --git a/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaCourse_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaCourse_Db.cs index dc330bc..8845b3c 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaCourse_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaCourse_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Reference { @@ -29,8 +29,12 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference public ColumnDataString _Address1 { get; } = new ColumnDataString("Address1"); public ColumnDataString _Address2 { get; } = new ColumnDataString("Address2"); public ColumnDataString _City { get; } = new ColumnDataString("City"); + public ColumnDataString _PostalCode { get; } = new ColumnDataString("PostalCode"); + public ColumnDataDecimalNullable _Latitude { get; } = new ColumnDataDecimalNullable("Latitude"); + public ColumnDataDecimalNullable _Longitude { get; } = new ColumnDataDecimalNullable("Longitude"); public ColumnDataString _Email { get; } = new ColumnDataString("Email"); public ColumnDataString _Telephone { get; } = new ColumnDataString("Telephone"); + public ColumnDataString _MarkersData { get; } = new ColumnDataString("MarkersData"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); public ColumnDataString _Status { get; } = new ColumnDataString("Status"); @@ -56,8 +60,12 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference "Address1", "Address2", "City", + "PostalCode", + "Latitude", + "Longitude", "Email", "Telephone", + "MarkersData", "Notes", "Flags", "Status", @@ -76,6 +84,11 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "Latitude", + "Longitude", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -109,8 +122,12 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference public String _Address1 { get { return Cols._Address1.Value; } set { Cols._Address1.Value = value; } } public String _Address2 { get { return Cols._Address2.Value; } set { Cols._Address2.Value = value; } } public String _City { get { return Cols._City.Value; } set { Cols._City.Value = value; } } + public String _PostalCode { get { return Cols._PostalCode.Value; } set { Cols._PostalCode.Value = value; } } + public Decimal? _Latitude { get { return Cols._Latitude.Value; } set { Cols._Latitude.Value = value; } } + public Decimal? _Longitude { get { return Cols._Longitude.Value; } set { Cols._Longitude.Value = value; } } public String _Email { get { return Cols._Email.Value; } set { Cols._Email.Value = value; } } public String _Telephone { get { return Cols._Telephone.Value; } set { Cols._Telephone.Value = value; } } + public String _MarkersData { get { return Cols._MarkersData.Value; } set { Cols._MarkersData.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } } @@ -151,8 +168,12 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference _Address1 = GetFieldString(dbDataReader, "Address1", _Address1); _Address2 = GetFieldString(dbDataReader, "Address2", _Address2); _City = GetFieldString(dbDataReader, "City", _City); + _PostalCode = GetFieldString(dbDataReader, "PostalCode", _PostalCode); + _Latitude = GetFieldDecimalNullable(dbDataReader, "Latitude", _Latitude); + _Longitude = GetFieldDecimalNullable(dbDataReader, "Longitude", _Longitude); _Email = GetFieldString(dbDataReader, "Email", _Email); _Telephone = GetFieldString(dbDataReader, "Telephone", _Telephone); + _MarkersData = GetFieldString(dbDataReader, "MarkersData", _MarkersData); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); _Status = GetFieldString(dbDataReader, "Status", _Status); @@ -192,8 +213,12 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference if (columnNames.ContainsCI("Address1")) AddCommandParameter(dbCommand, "@Address1", _Address1); if (columnNames.ContainsCI("Address2")) AddCommandParameter(dbCommand, "@Address2", _Address2); if (columnNames.ContainsCI("City")) AddCommandParameter(dbCommand, "@City", _City); + if (columnNames.ContainsCI("PostalCode")) AddCommandParameter(dbCommand, "@PostalCode", _PostalCode); + if (columnNames.ContainsCI("Latitude")) AddCommandParameter(dbCommand, "@Latitude", _Latitude); + if (columnNames.ContainsCI("Longitude")) AddCommandParameter(dbCommand, "@Longitude", _Longitude); if (columnNames.ContainsCI("Email")) AddCommandParameter(dbCommand, "@Email", _Email); if (columnNames.ContainsCI("Telephone")) AddCommandParameter(dbCommand, "@Telephone", _Telephone); + if (columnNames.ContainsCI("MarkersData")) AddCommandParameter(dbCommand, "@MarkersData", _MarkersData); if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes); if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags); if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status); @@ -248,8 +273,12 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference if (columnNames.ContainsCI("Address1")) AddCommandParameter(dbCommand, "@Address1", _Address1); if (columnNames.ContainsCI("Address2")) AddCommandParameter(dbCommand, "@Address2", _Address2); if (columnNames.ContainsCI("City")) AddCommandParameter(dbCommand, "@City", _City); + if (columnNames.ContainsCI("PostalCode")) AddCommandParameter(dbCommand, "@PostalCode", _PostalCode); + if (columnNames.ContainsCI("Latitude")) AddCommandParameter(dbCommand, "@Latitude", _Latitude); + if (columnNames.ContainsCI("Longitude")) AddCommandParameter(dbCommand, "@Longitude", _Longitude); if (columnNames.ContainsCI("Email")) AddCommandParameter(dbCommand, "@Email", _Email); if (columnNames.ContainsCI("Telephone")) AddCommandParameter(dbCommand, "@Telephone", _Telephone); + if (columnNames.ContainsCI("MarkersData")) AddCommandParameter(dbCommand, "@MarkersData", _MarkersData); if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes); if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags); if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaFacility_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaFacility_Db.cs index 735d35e..bcc9ddb 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaFacility_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaFacility_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Reference { @@ -23,6 +23,14 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference public ColumnDataInt64 _ProvinceId { get; } = new ColumnDataInt64("ProvinceId"); public ColumnDataInt64 _FacilityId { get; } = new ColumnDataInt64("FacilityId"); public ColumnDataString _FacilityName { get; } = new ColumnDataString("FacilityName"); + public ColumnDataString _Address1 { get; } = new ColumnDataString("Address1"); + public ColumnDataString _Address2 { get; } = new ColumnDataString("Address2"); + public ColumnDataString _City { get; } = new ColumnDataString("City"); + public ColumnDataString _PostalCode { get; } = new ColumnDataString("PostalCode"); + public ColumnDataDecimalNullable _Latitude { get; } = new ColumnDataDecimalNullable("Latitude"); + public ColumnDataDecimalNullable _Longitude { get; } = new ColumnDataDecimalNullable("Longitude"); + public ColumnDataString _Email { get; } = new ColumnDataString("Email"); + public ColumnDataString _Telephone { get; } = new ColumnDataString("Telephone"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags"); public ColumnDataString _Status { get; } = new ColumnDataString("Status"); @@ -42,6 +50,14 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference "ProvinceId", "FacilityId", "FacilityName", + "Address1", + "Address2", + "City", + "PostalCode", + "Latitude", + "Longitude", + "Email", + "Telephone", "Notes", "Flags", "Status", @@ -60,6 +76,11 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "Latitude", + "Longitude", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -87,6 +108,14 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference public Int64 _ProvinceId { get { return Cols._ProvinceId.Value; } set { Cols._ProvinceId.Value = value; } } public Int64 _FacilityId { get { return Cols._FacilityId.Value; } set { Cols._FacilityId.Value = value; } } public String _FacilityName { get { return Cols._FacilityName.Value; } set { Cols._FacilityName.Value = value; } } + public String _Address1 { get { return Cols._Address1.Value; } set { Cols._Address1.Value = value; } } + public String _Address2 { get { return Cols._Address2.Value; } set { Cols._Address2.Value = value; } } + public String _City { get { return Cols._City.Value; } set { Cols._City.Value = value; } } + public String _PostalCode { get { return Cols._PostalCode.Value; } set { Cols._PostalCode.Value = value; } } + public Decimal? _Latitude { get { return Cols._Latitude.Value; } set { Cols._Latitude.Value = value; } } + public Decimal? _Longitude { get { return Cols._Longitude.Value; } set { Cols._Longitude.Value = value; } } + public String _Email { get { return Cols._Email.Value; } set { Cols._Email.Value = value; } } + public String _Telephone { get { return Cols._Telephone.Value; } set { Cols._Telephone.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } } public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } } @@ -121,6 +150,14 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference _ProvinceId = GetFieldInt64(dbDataReader, "ProvinceId", _ProvinceId); _FacilityId = GetFieldInt64(dbDataReader, "FacilityId", _FacilityId); _FacilityName = GetFieldString(dbDataReader, "FacilityName", _FacilityName); + _Address1 = GetFieldString(dbDataReader, "Address1", _Address1); + _Address2 = GetFieldString(dbDataReader, "Address2", _Address2); + _City = GetFieldString(dbDataReader, "City", _City); + _PostalCode = GetFieldString(dbDataReader, "PostalCode", _PostalCode); + _Latitude = GetFieldDecimalNullable(dbDataReader, "Latitude", _Latitude); + _Longitude = GetFieldDecimalNullable(dbDataReader, "Longitude", _Longitude); + _Email = GetFieldString(dbDataReader, "Email", _Email); + _Telephone = GetFieldString(dbDataReader, "Telephone", _Telephone); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); _Flags = GetFieldInt16(dbDataReader, "Flags", _Flags); _Status = GetFieldString(dbDataReader, "Status", _Status); @@ -154,6 +191,14 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference if (columnNames.ContainsCI("ProvinceId")) AddCommandParameter(dbCommand, "@ProvinceId", _ProvinceId); if (columnNames.ContainsCI("FacilityId")) AddCommandParameter(dbCommand, "@FacilityId", _FacilityId); if (columnNames.ContainsCI("FacilityName")) AddCommandParameter(dbCommand, "@FacilityName", _FacilityName); + if (columnNames.ContainsCI("Address1")) AddCommandParameter(dbCommand, "@Address1", _Address1); + if (columnNames.ContainsCI("Address2")) AddCommandParameter(dbCommand, "@Address2", _Address2); + if (columnNames.ContainsCI("City")) AddCommandParameter(dbCommand, "@City", _City); + if (columnNames.ContainsCI("PostalCode")) AddCommandParameter(dbCommand, "@PostalCode", _PostalCode); + if (columnNames.ContainsCI("Latitude")) AddCommandParameter(dbCommand, "@Latitude", _Latitude); + if (columnNames.ContainsCI("Longitude")) AddCommandParameter(dbCommand, "@Longitude", _Longitude); + if (columnNames.ContainsCI("Email")) AddCommandParameter(dbCommand, "@Email", _Email); + if (columnNames.ContainsCI("Telephone")) AddCommandParameter(dbCommand, "@Telephone", _Telephone); if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes); if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags); if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status); @@ -202,6 +247,14 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference if (columnNames.ContainsCI("ProvinceId")) AddCommandParameter(dbCommand, "@ProvinceId", _ProvinceId); if (columnNames.ContainsCI("FacilityId")) AddCommandParameter(dbCommand, "@FacilityId", _FacilityId); if (columnNames.ContainsCI("FacilityName")) AddCommandParameter(dbCommand, "@FacilityName", _FacilityName); + if (columnNames.ContainsCI("Address1")) AddCommandParameter(dbCommand, "@Address1", _Address1); + if (columnNames.ContainsCI("Address2")) AddCommandParameter(dbCommand, "@Address2", _Address2); + if (columnNames.ContainsCI("City")) AddCommandParameter(dbCommand, "@City", _City); + if (columnNames.ContainsCI("PostalCode")) AddCommandParameter(dbCommand, "@PostalCode", _PostalCode); + if (columnNames.ContainsCI("Latitude")) AddCommandParameter(dbCommand, "@Latitude", _Latitude); + if (columnNames.ContainsCI("Longitude")) AddCommandParameter(dbCommand, "@Longitude", _Longitude); + if (columnNames.ContainsCI("Email")) AddCommandParameter(dbCommand, "@Email", _Email); + if (columnNames.ContainsCI("Telephone")) AddCommandParameter(dbCommand, "@Telephone", _Telephone); if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes); if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags); if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaMarker_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaMarker_Db.cs index 1baa3cc..4ed5a0f 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaMarker_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaMarker_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Reference { @@ -78,6 +78,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", diff --git a/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaProvince_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaProvince_Db.cs index 8c32ff0..c557c15 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaProvince_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Reference/Golf_UsgaProvince_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:55 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Reference { @@ -62,6 +62,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Reference { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", diff --git a/SaxoniteStandardDbas/Dbas/Internal/Support/UserReportComment_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Support/UserReportComment_Db.cs index 4832924..0d20dfa 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Support/UserReportComment_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Support/UserReportComment_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:56 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Support { @@ -21,7 +21,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Support { public ColumnDataInt64 _Id { get; } = new ColumnDataInt64("Id", true); public ColumnDataInt64 _UserReportId { get; } = new ColumnDataInt64("UserReportId"); - public ColumnDataDateTime _RecordedAt { get; } = new ColumnDataDateTime("RecordedAt"); + public ColumnDataDateTimeNullable _RecordedAt { get; } = new ColumnDataDateTimeNullable("RecordedAt"); public ColumnDataInt32 _UserAccountId { get; } = new ColumnDataInt32("UserAccountId"); public ColumnDataString _CommentData { get; } = new ColumnDataString("CommentData"); public ColumnDataString _Notes { get; } = new ColumnDataString("Notes"); @@ -62,6 +62,10 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Support { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + "RecordedAt", + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", @@ -87,7 +91,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Support public ColumnsData Cols { get; } = new ColumnsData(); public Int64 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } } public Int64 _UserReportId { get { return Cols._UserReportId.Value; } set { Cols._UserReportId.Value = value; } } - public DateTime _RecordedAt { get { return Cols._RecordedAt.Value; } set { Cols._RecordedAt.Value = value; } } + public DateTime? _RecordedAt { get { return Cols._RecordedAt.Value; } set { Cols._RecordedAt.Value = value; } } public Int32 _UserAccountId { get { return Cols._UserAccountId.Value; } set { Cols._UserAccountId.Value = value; } } public String _CommentData { get { return Cols._CommentData.Value; } set { Cols._CommentData.Value = value; } } public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } } @@ -122,7 +126,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Support { _Id = GetFieldInt64(dbDataReader, "Id", _Id); _UserReportId = GetFieldInt64(dbDataReader, "UserReportId", _UserReportId); - _RecordedAt = GetFieldDateTime(dbDataReader, "RecordedAt", _RecordedAt); + _RecordedAt = GetFieldDateTimeNullable(dbDataReader, "RecordedAt", _RecordedAt); _UserAccountId = GetFieldInt32(dbDataReader, "UserAccountId", _UserAccountId); _CommentData = GetFieldString(dbDataReader, "CommentData", _CommentData); _Notes = GetFieldString(dbDataReader, "Notes", _Notes); diff --git a/SaxoniteStandardDbas/Dbas/Internal/Support/UserReport_Db.cs b/SaxoniteStandardDbas/Dbas/Internal/Support/UserReport_Db.cs index dbde2c0..cc9a48a 100644 --- a/SaxoniteStandardDbas/Dbas/Internal/Support/UserReport_Db.cs +++ b/SaxoniteStandardDbas/Dbas/Internal/Support/UserReport_Db.cs @@ -9,7 +9,7 @@ using System.Data.Common; using System.Linq; //--------------------------------------------------------------------------- -// Code generated by Sarand Database Utilities Wed 22-May-2024 12:21:56 +// Code generated by Sarand Database Utilities Thu 13-Jun-2024 12:44:40 //--------------------------------------------------------------------------- namespace Saxonite.Net.Standard.Dbas.Internal.Support { @@ -66,6 +66,9 @@ namespace Saxonite.Net.Standard.Dbas.Internal.Support { "Id", }; + protected static List fieldsNullable { get; } = new List() + { + }; protected static List fieldsIgnoreOnUpdate { get; } = new List() { "CreateOn", diff --git a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCountry.cs b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCountry.cs index 82228eb..147ee68 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCountry.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCountry.cs @@ -82,7 +82,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUsgaCountry\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return usgaCountry; @@ -398,14 +398,17 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference public override List GetUsgaCountryQueryFilter(SaxGolfUsgaCountry.Params prm) { List filter = new List(); + String col_Id = SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_Id, aliasUsgaCountry); // Item Ids. - String idsIncluded = prm.IdsIncluded.Concat(","); - if (!idsIncluded.IsEmpty()) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_Id, aliasUsgaCountry) + " IN (" + idsIncluded + ")"); - String idsExcluded = prm.IdsExcluded.Concat(","); - if (!idsExcluded.IsEmpty()) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_Id, aliasUsgaCountry) + " NOT IN (" + idsExcluded + ")"); + if (prm.IdsIncluded.HasValidIds()) + filter.Add($"{col_Id} IN ({prm.IdsIncluded.Concat(",")})"); + if (prm.IdsExcluded.HasValidIds() ) + filter.Add($"{col_Id} NOT IN ({prm.IdsExcluded.Concat(",")})"); + + // Country code. + if (!StringUtil.IsBlank(prm.CountryCodeFull)) + filter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryCode, aliasUsgaCountry)}='{DbQuery.FormatForCondition(prm.CountryCodeFull)}'"); if (!StringUtil.IsBlank(prm.CountryFilter)) { @@ -416,21 +419,21 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference foreach (String filterWord in filterWords) { List articleFilter = new List(); - articleFilter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryCode, aliasUsgaCountry) + " Like '%" + DbQuery.FormatForLike(filterWord, true) + "%'"); - articleFilter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryName, aliasUsgaCountry) + " Like '%" + DbQuery.FormatForLike(filterWord, true) + "%'"); + articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryCode, aliasUsgaCountry)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryName, aliasUsgaCountry)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); filter.Add(articleFilter.Concat(" OR ", "(", ")")); } } // Name. if (!StringUtil.IsEmpty(prm.CountryNameFull)) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryName, aliasUsgaCountry) + "='" + DbQuery.FormatForCondition(prm.CountryNameFull) + "'"); + filter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryName, aliasUsgaCountry)}='{DbQuery.FormatForCondition(prm.CountryNameFull)}'"); if (!StringUtil.IsEmpty(prm.CountryNamePartial)) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryName, aliasUsgaCountry) + " LIKE '%" + DbQuery.FormatForLike(prm.CountryNamePartial) + "%'"); + filter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryName, aliasUsgaCountry)} LIKE '%{DbQuery.FormatForLike(prm.CountryNamePartial)}%'"); // Notes. if (!StringUtil.IsEmpty(prm.NotesPartial)) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_Notes, aliasUsgaCountry) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'"); + filter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_Notes, aliasUsgaCountry)} LIKE '%{DbQuery.FormatForLike(prm.NotesPartial)}%'"); // Status. if (prm.StatusCat != SaxGolfUsgaCountry.StatusCat.Any) @@ -442,13 +445,13 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference internal static String GetUsgaCountryStatusCatFilterCondition(SaxGolfUsgaCountry.StatusCat statusCat) { if (statusCat == SaxGolfUsgaCountry.StatusCat.ActiveOnly) - return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'"; + return $"='{SacsSystem.GetStatusCode(SaStatus.Active)}'"; if (statusCat == SaxGolfUsgaCountry.StatusCat.InactiveOnly) - return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'"; + return $"='{SacsSystem.GetStatusCode(SaStatus.Inactive)}'"; if (statusCat == SaxGolfUsgaCountry.StatusCat.NotDeleted) - return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'"; + return $"!='{SacsSystem.GetStatusCode(SaStatus.Deleted)}'"; if (statusCat == SaxGolfUsgaCountry.StatusCat.DeletedOnly) - return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'"; + return $"='{SacsSystem.GetStatusCode(SaStatus.Deleted)}'"; return ""; } // Item sort columns. @@ -502,6 +505,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference // Item list. public override List GetUsgaCountryList(SaxGolfUsgaCountry.Params prm) { + ClearErrorState(); List userRoles = new List(); DbQuery qry = new DbQuery(ReferenceDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaCountry), aliasUsgaCountry); @@ -529,7 +533,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUsgaCountryList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userRoles; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCourse.cs b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCourse.cs index d037e4d..7b53e2a 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCourse.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCourse.cs @@ -83,7 +83,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUsgaCourse\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return usgaCourse; @@ -222,8 +222,12 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference dbUsgaCourse._Address1 = usgaCourse.Address1; dbUsgaCourse._Address2 = usgaCourse.Address2; dbUsgaCourse._City = usgaCourse.City; + dbUsgaCourse._PostalCode = usgaCourse.PostalCode; + dbUsgaCourse._Latitude = usgaCourse.Latitude; + dbUsgaCourse._Longitude = usgaCourse.Longitude; dbUsgaCourse._Email = usgaCourse.Email; dbUsgaCourse._Telephone = usgaCourse.Telephone; + dbUsgaCourse._MarkersData = usgaCourse.MarkersData; // Common. dbUsgaCourse._Notes = usgaCourse.Notes; dbUsgaCourse._Status = SacsSystem.GetStatusCode(usgaCourse.Status); @@ -250,8 +254,12 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference usgaCourse.Address1 = dbUsgaCourse._Address1; usgaCourse.Address2 = dbUsgaCourse._Address2; usgaCourse.City = dbUsgaCourse._City; + usgaCourse.PostalCode = dbUsgaCourse._PostalCode; + usgaCourse.Latitude = dbUsgaCourse._Latitude; + usgaCourse.Longitude = dbUsgaCourse._Longitude; usgaCourse.Email = dbUsgaCourse._Email; usgaCourse.Telephone = dbUsgaCourse._Telephone; + usgaCourse.MarkersData = dbUsgaCourse._MarkersData; // Common. usgaCourse.Notes = dbUsgaCourse._Notes; usgaCourse.Status = SacsSystem.GetStatusForCode(dbUsgaCourse._Status); @@ -304,10 +312,10 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference query.Add($"Into {SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaCourse)} uCrs"); query.Add("Using"); query.Add("("); - query.Add("Select dFty.Id FacilityId, dCrs.CourseId, dCrs.LegacyCrpCourseId, dCrs.Caption, dCrs.CourseName, dCrs.FullName, dCrs.Address1, dCrs.Address2, dCrs.City, dCrs.Email, dCrs.Telephone"); + query.Add("Select dFty.Id FacilityId, dCrs.CourseId, dCrs.LegacyCrpCourseId, dCrs.Caption, dCrs.CourseName, dCrs.FullName, dCrs.Address1, dCrs.Address2, dCrs.City, dCrs.PostalCode, dCrs.Email, dCrs.Telephone"); query.Add("From"); query.Add("("); - query.Add("Select 0 FacilityId, 0 CourseId, 0 LegacyCrpCourseId, '' Caption, '' CourseName, '' FullName, '' Address1, '' Address2, '' City, '' Email, '' Telephone"); + query.Add("Select 0 FacilityId, 0 CourseId, 0 LegacyCrpCourseId, '' Caption, '' CourseName, '' FullName, '' Address1, '' Address2, '' City, '' PostalCode, '' Email, '' Telephone"); foreach (UsgaCourseData course in coursesToUpdate.ExtractRange(0, batchSize)) query.Add($"Union Select {course.FacilityId}, {course.CourseId}, " + (SysId.IsValid(course.LegacyCrpCourseId) ? $"{course.LegacyCrpCourseId}" : "Null") + "," + @@ -317,13 +325,14 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference (course.Address1 != null ? $"'{DbQuery.FormatForCondition(course.Address1)}'" : "Null") + "," + (course.Address2 != null ? $"'{DbQuery.FormatForCondition(course.Address2)}'" : "Null") + "," + (course.City != null ? $"'{DbQuery.FormatForCondition(course.City)}'" : "Null") + "," + + (course.PostalCode != null ? $"'{DbQuery.FormatForCondition(course.PostalCode)}'" : "Null") + "," + (course.Email != null ? $"'{DbQuery.FormatForCondition(course.Email)}'" : "Null") + "," + (course.Telephone != null ? $"'{DbQuery.FormatForCondition(course.Telephone)}'" : "Null")); query.Add(") dCrs"); query.Add($"Inner Join {SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaFacility)} dFty On dFty.FacilityId=dCrs.FacilityId"); query.Add(") dCrs"); query.Add("On uCrs.FacilityId=dCrs.FacilityId And uCrs.CourseId=dCrs.CourseId"); - query.Add("When Matched And ((dCrs.LegacyCrpCourseId Is Not Null And uCrs.LegacyCrpCourseId!=dCrs.LegacyCrpCourseId) Or (dCrs.Caption Is Not Null And uCrs.Caption!=dCrs.Caption) Or (dCrs.CourseName Is Not Null And uCrs.CourseName!=dCrs.CourseName) Or (dCrs.FullName Is Not Null And uCrs.FullName!=dCrs.FullName) Or (dCrs.Address1 Is Not Null And uCrs.Address1!=dCrs.Address1) Or (dCrs.Address2 Is Not Null And uCrs.Address2!=dCrs.Address2) Or (dCrs.City Is Not Null And uCrs.City!=dCrs.City) Or (dCrs.Email Is Not Null And uCrs.Email!=dCrs.Email) Or (dCrs.Telephone Is Not Null And uCrs.Telephone!=dCrs.Telephone) Or uCrs.Status!=@statusActive)"); + query.Add("When Matched And ((dCrs.LegacyCrpCourseId Is Not Null And uCrs.LegacyCrpCourseId!=dCrs.LegacyCrpCourseId) Or (dCrs.Caption Is Not Null And uCrs.Caption!=dCrs.Caption) Or (dCrs.CourseName Is Not Null And uCrs.CourseName!=dCrs.CourseName) Or (dCrs.FullName Is Not Null And uCrs.FullName!=dCrs.FullName) Or (dCrs.Address1 Is Not Null And uCrs.Address1!=dCrs.Address1) Or (dCrs.Address2 Is Not Null And uCrs.Address2!=dCrs.Address2) Or (dCrs.City Is Not Null And uCrs.City!=dCrs.City) Or (dCrs.PostalCode Is Not Null And uCrs.PostalCode!=dCrs.PostalCode) Or (dCrs.Email Is Not Null And uCrs.Email!=dCrs.Email) Or (dCrs.Telephone Is Not Null And uCrs.Telephone!=dCrs.Telephone) Or uCrs.Status!=@statusActive)"); query.Add("Then Update Set"); query.Add(" LegacyCrpCourseId=Coalesce(dCrs.LegacyCrpCourseId,uCrs.LegacyCrpCourseId),"); query.Add(" Caption=Coalesce(dCrs.Caption,uCrs.Caption),"); @@ -332,6 +341,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference query.Add(" Address1=Coalesce(dCrs.Address1,uCrs.Address1),"); query.Add(" Address2=Coalesce(dCrs.Address2,uCrs.Address2),"); query.Add(" City=Coalesce(dCrs.City,uCrs.City),"); + query.Add(" PostalCode=Coalesce(dCrs.PostalCode,uCrs.PostalCode),"); query.Add(" Email=Coalesce(dCrs.Email,uCrs.Email),"); query.Add(" Telephone=Coalesce(dCrs.Telephone,uCrs.Telephone),"); query.Add(" Status=@statusActive,"); @@ -339,8 +349,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference query.Add(" UpdateBy=@updateBy,"); query.Add(" UpdateHost=@updateHost"); query.Add("When Not Matched And Len(Coalesce(dCrs.Caption,''))>0"); - query.Add("Then Insert (FacilityId,CourseId,LegacyCrpCourseId,Caption,CourseName,FullName,Address1,Address2,City,Email,Telephone,Notes,Flags,Status,CreateOn,CreateBy,CreateHost,UpdateOn,UpdateBy,UpdateHost)"); - query.Add($"Values (dCrs.FacilityId,dCrs.CourseId,Coalesce(dCrs.LegacyCrpCourseId,0),dCrs.Caption,Coalesce(dCrs.CourseName,''),Coalesce(dCrs.FullName,''),Coalesce(dCrs.Address1,''),Coalesce(dCrs.Address2,''),Coalesce(dCrs.City,''),Coalesce(dCrs.Email,''),Coalesce(dCrs.Telephone,''),'',0,@statusActive,@updateOn,@updateBy,@updateHost,@updateOn,@updateBy,@updateHost)"); + query.Add("Then Insert (FacilityId,CourseId,LegacyCrpCourseId,Caption,CourseName,FullName,Address1,Address2,City,PostalCode,Email,Telephone,MarkersData,Notes,Flags,Status,CreateOn,CreateBy,CreateHost,UpdateOn,UpdateBy,UpdateHost)"); + query.Add($"Values (dCrs.FacilityId,dCrs.CourseId,Coalesce(dCrs.LegacyCrpCourseId,0),dCrs.Caption,Coalesce(dCrs.CourseName,''),Coalesce(dCrs.FullName,''),Coalesce(dCrs.Address1,''),Coalesce(dCrs.Address2,''),Coalesce(dCrs.City,''),Coalesce(dCrs.PostalCode,''),Coalesce(dCrs.Email,''),Coalesce(dCrs.Telephone,''),'','',0,@statusActive,@updateOn,@updateBy,@updateHost,@updateOn,@updateBy,@updateHost)"); query.Add(";"); //SaLogger.Info($"{SysUtil.Fn} Bulk USGA Course update query:\n\t{query.Concat("\n\t")}"); @@ -482,29 +492,32 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference public override List GetUsgaCourseQueryFilter(SaxGolfUsgaCourse.Params prm) { List filter = new List(); + String col_Id = SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Id, aliasUsgaCourse); + String col_FacilityId = SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_FacilityId, aliasUsgaCourse); // Item Ids. - String idsIncluded = prm.IdsIncluded.Concat(","); - if (!idsIncluded.IsEmpty()) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Id, aliasUsgaCourse) + " IN (" + idsIncluded + ")"); - String idsExcluded = prm.IdsExcluded.Concat(","); - if (!idsExcluded.IsEmpty()) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Id, aliasUsgaCourse) + " NOT IN (" + idsExcluded + ")"); + if (prm.IdsIncluded.HasValidIds()) + filter.Add($"{col_Id} IN ({prm.IdsIncluded.Concat(",")})"); + if (prm.IdsExcluded.HasValidIds()) + filter.Add($"{col_Id} NOT IN ({prm.IdsExcluded.Concat(",")})"); // Provinces. - String provinceIdsIncluded = prm.ProvinceIdsIncluded.Concat(","); - if (!provinceIdsIncluded.IsEmpty()) + if (prm.ProvinceIdsIncluded.HasValidIds()) { + String provinceIdsIncluded = prm.ProvinceIdsIncluded.Concat(","); if (StringUtil.IsBlank(prm.Alias_Province)) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_FacilityId, aliasUsgaCourse) + " IN (SELECT Id FROM " + SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaFacility) + " WHERE ProvinceId IN (" + provinceIdsIncluded + "))"); + filter.Add($"{col_FacilityId} IN (SELECT Id FROM {SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaFacility)} WHERE ProvinceId IN ({provinceIdsIncluded}))"); else - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Id, prm.Alias_Province) + " IN (" + provinceIdsIncluded + ")"); + filter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Id, prm.Alias_Province)} IN ({provinceIdsIncluded})"); } // Facilities. - String facilityIdsIncluded = prm.FacilityIdsIncluded.Concat(","); - if (!facilityIdsIncluded.IsEmpty()) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_FacilityId, aliasUsgaCourse) + " IN (" + facilityIdsIncluded + ")"); + if (prm.FacilityIdsIncluded.HasValidIds()) + filter.Add($"{col_FacilityId} IN ({prm.FacilityIdsIncluded.Concat(",")})"); + + // Course Ids. + if (prm.CourseIdsIncluded.HasValidIds()) + filter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_CourseId, aliasUsgaCourse)} IN ({prm.CourseIdsIncluded.Concat(",")})"); if (!StringUtil.IsBlank(prm.CourseFilter)) { @@ -604,6 +617,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference // Item list. public override List GetUsgaCourseList(SaxGolfUsgaCourse.Params prm) { + ClearErrorState(); List userRoles = new List(); DbQuery qry = new DbQuery(ReferenceDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaCourse), aliasUsgaCourse); @@ -631,7 +645,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUsgaCourseList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userRoles; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaFacility.cs b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaFacility.cs index 3cad375..4d9a561 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaFacility.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaFacility.cs @@ -83,7 +83,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUsgaFacility\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return usgaFacility; @@ -216,6 +216,14 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference dbUsgaFacility._ProvinceId = SysId.ToInt(usgaFacility.ProvinceId); dbUsgaFacility._FacilityId = SysId.ToLong(usgaFacility.FacilityId); dbUsgaFacility._FacilityName = usgaFacility.FacilityName; + dbUsgaFacility._Address1 = usgaFacility.Address1; + dbUsgaFacility._Address2 = usgaFacility.Address2; + dbUsgaFacility._City = usgaFacility.City; + dbUsgaFacility._PostalCode = usgaFacility.PostalCode; + dbUsgaFacility._Latitude = usgaFacility.Latitude; + dbUsgaFacility._Longitude = usgaFacility.Longitude; + dbUsgaFacility._Email = usgaFacility.Email; + dbUsgaFacility._Telephone = usgaFacility.Telephone; // Common. dbUsgaFacility._Notes = usgaFacility.Notes; dbUsgaFacility._Status = SacsSystem.GetStatusCode(usgaFacility.Status); @@ -236,6 +244,14 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference usgaFacility.ProvinceId = new SysId(dbUsgaFacility._ProvinceId); usgaFacility.FacilityId = new SysId(dbUsgaFacility._FacilityId); usgaFacility.FacilityName = dbUsgaFacility._FacilityName; + usgaFacility.Address1 = dbUsgaFacility._Address1; + usgaFacility.Address2 = dbUsgaFacility._Address2; + usgaFacility.City = dbUsgaFacility._City; + usgaFacility.PostalCode = dbUsgaFacility._PostalCode; + usgaFacility.Latitude = dbUsgaFacility._Latitude; + usgaFacility.Longitude = dbUsgaFacility._Longitude; + usgaFacility.Email = dbUsgaFacility._Email; + usgaFacility.Telephone = dbUsgaFacility._Telephone; // Common. usgaFacility.Notes = dbUsgaFacility._Notes; usgaFacility.Status = SacsSystem.GetStatusForCode(dbUsgaFacility._Status); @@ -266,6 +282,11 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference if (!IsValidValue(facility.ProvinceCode, "province", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceCode), true)) return false; if (!SysId.IsValid(facility.FacilityId)) return SetErrorState("Facility Id must be supplied"); if (facility.FacilityName != null && !IsValidValue(facility.FacilityName, "name", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_FacilityName))) return false; + if (facility.Address1 != null && !IsValidValue(facility.Address1, "address 1", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_Address1))) return false; + if (facility.Address2 != null && !IsValidValue(facility.Address2, "address 2", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_Address2))) return false; + if (facility.City != null && !IsValidValue(facility.City, "city", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_City))) return false; + if (facility.Email != null && !IsValidValue(facility.Email, "email", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_Email))) return false; + if (facility.Telephone != null && !IsValidValue(facility.Telephone, "telephone", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_Telephone))) return false; facilitiesToUpdate.Add(facility); } int MaxBulkUpdateBatchSize = 64; @@ -281,26 +302,39 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference query.Add($"Into {SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaFacility)} uFty"); query.Add("Using"); query.Add("("); - query.Add("Select dPrv.Id ProvinceId, dFty.ProvinceCode, dFty.FacilityId, dFty.FacilityName"); + query.Add("Select dPrv.Id ProvinceId, dFty.ProvinceCode, dFty.FacilityId, dFty.FacilityName, dFty.Address1, dFty.Address2, dFty.City, dFty.PostalCode, dFty.Email, dFty.Telephone"); query.Add("From"); query.Add("("); - query.Add("Select '' ProvinceCode, '' FacilityId, '' FacilityName"); + query.Add("Select '' ProvinceCode, '' FacilityId, '' FacilityName, '' Address1, '' Address2, '' City, '' PostalCode, '' Email, '' Telephone"); foreach (UsgaFacilityData facility in facilitiesToUpdate.ExtractRange(0, batchSize)) - query.Add($"Union Select '{DbQuery.FormatForCondition(facility.ProvinceCode)}', {SysId.ToString(facility.FacilityId)}, " + (facility.FacilityName != null ? $"'{DbQuery.FormatForCondition(facility.FacilityName)}'" : "Null")); + query.Add($"Union Select '{DbQuery.FormatForCondition(facility.ProvinceCode)}', {SysId.ToString(facility.FacilityId)}, " + + (facility.FacilityName != null ? $"'{DbQuery.FormatForCondition(facility.FacilityName)}'" : "Null") + "," + + (facility.Address1 != null ? $"'{DbQuery.FormatForCondition(facility.Address1)}'" : "Null") + "," + + (facility.Address2 != null ? $"'{DbQuery.FormatForCondition(facility.Address2)}'" : "Null") + "," + + (facility.City != null ? $"'{DbQuery.FormatForCondition(facility.City)}'" : "Null") + "," + + (facility.PostalCode != null ? $"'{DbQuery.FormatForCondition(facility.PostalCode)}'" : "Null") + "," + + (facility.Email != null ? $"'{DbQuery.FormatForCondition(facility.Email)}'" : "Null") + "," + + (facility.Telephone != null ? $"'{DbQuery.FormatForCondition(facility.Telephone)}'" : "Null")); query.Add(") dFty"); query.Add($"Inner Join {SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaProvince)} dPrv On dPrv.ProvinceCode=dFty.ProvinceCode"); query.Add(") dFty"); query.Add("On uFty.ProvinceId=dFty.ProvinceId And uFty.FacilityId=dFty.FacilityId"); - query.Add("When Matched And ((dFty.FacilityName Is Not Null And uFty.FacilityName!=dFty.FacilityName) Or uFty.Status!=@statusActive)"); + query.Add("When Matched And ((dFty.FacilityName Is Not Null And uFty.FacilityName!=dFty.FacilityName) Or (dFty.Address1 Is Not Null And uFty.Address1!=dFty.Address1) Or (dFty.Address2 Is Not Null And uFty.Address2!=dFty.Address2) Or (dFty.City Is Not Null And uFty.City!=dFty.City) Or (dFty.PostalCode Is Not Null And uFty.PostalCode!=dFty.PostalCode) Or (dFty.Email Is Not Null And uFty.Email!=dFty.Email) Or (dFty.Telephone Is Not Null And uFty.Telephone!=dFty.Telephone) Or uFty.Status!=@statusActive)"); query.Add("Then Update Set"); query.Add(" FacilityName=Coalesce(dFty.FacilityName,uFty.FacilityName),"); + query.Add(" Address1=Coalesce(dFty.Address1,uFty.Address1),"); + query.Add(" Address2=Coalesce(dFty.Address2,uFty.Address2),"); + query.Add(" City=Coalesce(dFty.City,uFty.City),"); + query.Add(" PostalCode=Coalesce(dFty.PostalCode,uFty.PostalCode),"); + query.Add(" Email=Coalesce(dFty.Email,uFty.Email),"); + query.Add(" Telephone=Coalesce(dFty.Telephone,uFty.Telephone),"); query.Add(" Status=@statusActive,"); query.Add(" UpdateOn=@updateOn,"); query.Add(" UpdateBy=@updateBy,"); query.Add(" UpdateHost=@updateHost"); query.Add("When Not Matched And Len(IsNull(dFty.FacilityName,''))>0"); - query.Add("Then Insert (ProvinceId,FacilityId,FacilityName,Notes,Flags,Status,CreateOn,CreateBy,CreateHost,UpdateOn,UpdateBy,UpdateHost)"); - query.Add($"Values (dFty.ProvinceId,dFty.FacilityId,dFty.FacilityName,'',0,@statusActive,@updateOn,@updateBy,@updateHost,@updateOn,@updateBy,@updateHost)"); + query.Add("Then Insert (ProvinceId,FacilityId,FacilityName,Address1,Address2,City,PostalCode,Email,Telephone,Notes,Flags,Status,CreateOn,CreateBy,CreateHost,UpdateOn,UpdateBy,UpdateHost)"); + query.Add($"Values (dFty.ProvinceId,dFty.FacilityId,dFty.FacilityName,Coalesce(dFty.Address1,''),Coalesce(dFty.Address2,''),Coalesce(dFty.City,''),Coalesce(dFty.PostalCode,''),Coalesce(dFty.Email,''),Coalesce(dFty.Telephone,''),'',0,@statusActive,@updateOn,@updateBy,@updateHost,@updateOn,@updateBy,@updateHost)"); query.Add(";"); //SaLogger.Info($"{SysUtil.Fn} Bulk USGA Facility update query:\n\t{query.Concat("\n\t")}"); @@ -522,6 +556,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference // Item list. public override List GetUsgaFacilityList(SaxGolfUsgaFacility.Params prm) { + ClearErrorState(); List userRoles = new List(); DbQuery qry = new DbQuery(ReferenceDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaFacility), aliasUsgaFacility); @@ -549,7 +584,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUsgaFacilityList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userRoles; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaMarker.cs b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaMarker.cs index b564853..91deb1d 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaMarker.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaMarker.cs @@ -83,7 +83,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUsgaMarker\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return usgaMarker; @@ -282,7 +282,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference // Validate marker properties. // Course and Marker Codes are mandatory, other values only validated if non-null. if (!SysId.IsValid(marker.CourseId)) return SetErrorState("Course Id must be supplied"); - if (!SysId.IsValid(marker.MarkerId)) return SetErrorState("Marker Id must be supplied"); + // 9 hole markers missing Id: if (!SysId.IsValid(marker.MarkerId)) return SetErrorState("Marker Id must be supplied"); if (marker.Caption != null && !IsValidValue(marker.HolesCaption, "caption", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_HolesCaption))) return false; if (marker.Holes < 1) return SetErrorState("Holes must be supplied"); if (marker.HolesCaption != null && !IsValidValue(marker.HolesCaption, "full name", (long)SaxDbDfn_Reference.GetColTextLen(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_HolesCaption))) return false; @@ -311,7 +311,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference query.Add("("); query.Add("Select 0 CourseId, 0 MarkerId, '' Caption, 0 Holes, '' HolesCaption, '' Tee, '' Gender, 0 SlopeRating, 0 Par, 0 CourseRating, 0 BogeyRating, 0 Length"); foreach (UsgaMarkerData marker in markersToUpdate.ExtractRange(0, batchSize)) - query.Add($"Union Select {marker.CourseId},{marker.MarkerId}," + + query.Add($"Union Select {marker.CourseId},{StringUtil.OnBlank(SysId.ToString(marker.MarkerId),"0")}," + (marker.Caption != null ? $"'{DbQuery.FormatForCondition(marker.Caption)}'" : "Null") + "," + $"{marker.Holes}," + (marker.HolesCaption != null ? $"'{DbQuery.FormatForCondition(marker.HolesCaption)}'" : "Null") + "," + @@ -598,6 +598,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference // Item list. public override List GetUsgaMarkerList(SaxGolfUsgaMarker.Params prm) { + ClearErrorState(); List userRoles = new List(); DbQuery qry = new DbQuery(ReferenceDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaMarker), aliasUsgaMarker); @@ -625,7 +626,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUsgaMarkerList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userRoles; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaProvince.cs b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaProvince.cs index fa7d8f5..626cfb9 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaProvince.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaProvince.cs @@ -83,7 +83,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUsgaProvince\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return usgaProvince; @@ -418,19 +418,21 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference public override List GetUsgaProvinceQueryFilter(SaxGolfUsgaProvince.Params prm) { List filter = new List(); + String col_Id = SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Id, aliasUsgaProvince); // Item Ids. - String idsIncluded = prm.IdsIncluded.Concat(","); - if (!idsIncluded.IsEmpty()) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Id, aliasUsgaProvince) + " IN (" + idsIncluded + ")"); - String idsExcluded = prm.IdsExcluded.Concat(","); - if (!idsExcluded.IsEmpty()) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Id, aliasUsgaProvince) + " NOT IN (" + idsExcluded + ")"); + if (prm.IdsIncluded.HasValidIds()) + filter.Add($"{col_Id} IN ({prm.IdsIncluded.Concat(",")})"); + if (prm.IdsExcluded.HasValidIds()) + filter.Add($"{col_Id} NOT IN ({prm.IdsExcluded.Concat(",")})"); // Countries. - String countryIdsIncluded = prm.CountryIdsIncluded.Concat(","); - if (!countryIdsIncluded.IsEmpty()) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_CountryId, aliasUsgaProvince) + " IN (" + countryIdsIncluded + ")"); + if (prm.CountryIdsIncluded.HasValidIds()) + filter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_CountryId, aliasUsgaProvince)} IN ({prm.CountryIdsIncluded.Concat(",")})"); + + // Province code. + if (!StringUtil.IsEmpty(prm.ProvinceCodeFull)) + filter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceCode, aliasUsgaProvince)}='{DbQuery.FormatForCondition(prm.ProvinceCodeFull)}'"); if (!StringUtil.IsBlank(prm.ProvinceFilter)) { @@ -441,21 +443,21 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference foreach (String filterWord in filterWords) { List articleFilter = new List(); - articleFilter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceCode, aliasUsgaProvince) + " Like '%" + DbQuery.FormatForLike(filterWord, true) + "%'"); - articleFilter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceName, aliasUsgaProvince) + " Like '%" + DbQuery.FormatForLike(filterWord, true) + "%'"); + articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceCode, aliasUsgaProvince)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceName, aliasUsgaProvince)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); filter.Add(articleFilter.Concat(" OR ", "(", ")")); } } // Name. if (!StringUtil.IsEmpty(prm.ProvinceNameFull)) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceName, aliasUsgaProvince) + "='" + DbQuery.FormatForCondition(prm.ProvinceNameFull) + "'"); + filter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceName, aliasUsgaProvince)}='{DbQuery.FormatForCondition(prm.ProvinceNameFull)}'"); if (!StringUtil.IsEmpty(prm.ProvinceNamePartial)) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceName, aliasUsgaProvince) + " LIKE '%" + DbQuery.FormatForLike(prm.ProvinceNamePartial) + "%'"); + filter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceName, aliasUsgaProvince)} LIKE '%{DbQuery.FormatForLike(prm.ProvinceNamePartial)}%'"); // Notes. if (!StringUtil.IsEmpty(prm.NotesPartial)) - filter.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Notes, aliasUsgaProvince) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'"); + filter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Notes, aliasUsgaProvince)} LIKE '%{DbQuery.FormatForLike(prm.NotesPartial)}%'"); // Status. if (prm.StatusCat != SaxGolfUsgaProvince.StatusCat.Any) @@ -467,13 +469,13 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference internal static String GetUsgaProvinceStatusCatFilterCondition(SaxGolfUsgaProvince.StatusCat statusCat) { if (statusCat == SaxGolfUsgaProvince.StatusCat.ActiveOnly) - return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'"; + return $"='{SacsSystem.GetStatusCode(SaStatus.Active)}'"; if (statusCat == SaxGolfUsgaProvince.StatusCat.InactiveOnly) - return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'"; + return $"='{SacsSystem.GetStatusCode(SaStatus.Inactive)}'"; if (statusCat == SaxGolfUsgaProvince.StatusCat.NotDeleted) - return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'"; + return $"!='{SacsSystem.GetStatusCode(SaStatus.Deleted)}'"; if (statusCat == SaxGolfUsgaProvince.StatusCat.DeletedOnly) - return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'"; + return $"='{SacsSystem.GetStatusCode(SaStatus.Deleted)}'"; return ""; } // Item sort columns. @@ -527,6 +529,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference // Item list. public override List GetUsgaProvinceList(SaxGolfUsgaProvince.Params prm) { + ClearErrorState(); List userRoles = new List(); DbQuery qry = new DbQuery(ReferenceDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaProvince), aliasUsgaProvince); @@ -554,7 +557,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUsgaProvinceList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userRoles; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-Organisation.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-Organisation.cs index 123d176..9c1a089 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-Organisation.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-Organisation.cs @@ -82,7 +82,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetOrganisation\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return organisation; @@ -240,8 +240,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr organisation.Name = dbOrganisation._Name; organisation.OrganisationType = (Sax.OrganisationType)OrganisationTypeCodes.GetTypeForCode(dbOrganisation._OrganisationType); organisation.OrganisationCategory = (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(dbOrganisation._OrganisationCategory); - organisation.SportIdPrimary = new SysId(dbOrganisation._SportIdPrimary); - organisation.RegionIdPrimary = new SysId(dbOrganisation._RegionIdPrimary); + organisation.SportIdPrimary = new SysId(dbOrganisation._SportIdPrimary ?? 0); + organisation.RegionIdPrimary = new SysId(dbOrganisation._RegionIdPrimary ?? 0); organisation.About = dbOrganisation._About; organisation.Facilities = dbOrganisation._Facilities; organisation.ContactData = dbOrganisation._ContactData; @@ -553,6 +553,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetOrganisationList(SaxOrganisation.Params prm) { + ClearErrorState(); List userAccounts = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.Organisation), aliasOrganisation); @@ -580,7 +581,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetOrganisationList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userAccounts; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserAccount.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserAccount.cs index 71c9047..ef0272a 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserAccount.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserAccount.cs @@ -82,7 +82,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUserAccount\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userAccount; @@ -263,9 +263,9 @@ namespace Saxonite.Net.Standard.Dbas.Mgr userAccount.Gender = (Sax.Gender)dbUserAccount._Gender; userAccount.DateOfBirthDay = dbUserAccount._DateOfBirthDay; userAccount.DateOfBirthMonth = dbUserAccount._DateOfBirthMonth; - userAccount.DateOfBirthYear = dbUserAccount._DateOfBirthYear; - userAccount.RegionIdCountry = new SysId(dbUserAccount._RegionIdCountry); - userAccount.RegionIdProvince = new SysId(dbUserAccount._RegionIdProvince); + userAccount.DateOfBirthYear = dbUserAccount._DateOfBirthYear ?? 0; + userAccount.RegionIdCountry = new SysId(dbUserAccount._RegionIdCountry ?? 0); + userAccount.RegionIdProvince = new SysId(dbUserAccount._RegionIdProvince ?? 0); // Security. userAccount.PasswordHashed = dbUserAccount._PasswordHashed; userAccount.PasswordToken = dbUserAccount._PasswordToken; @@ -702,6 +702,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetUserAccountList(SaxUserAccount.Params prm) { + ClearErrorState(); List userAccounts = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserAccount), aliasUserAccount); @@ -729,7 +730,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUserAccountList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userAccounts; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserConfig.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserConfig.cs index 40a2d07..225833f 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserConfig.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserConfig.cs @@ -82,7 +82,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUserConfig\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userConfig; @@ -381,6 +381,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetUserConfigList(SaxUserConfig.Params prm) { + ClearErrorState(); List userConfigs = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserConfig), aliasUserConfig); @@ -408,7 +409,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUserConfigList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userConfigs; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserEligibility.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserEligibility.cs index eeace16..fa9df6c 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserEligibility.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserEligibility.cs @@ -49,7 +49,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr private SaxUserEligibility_Dbas CreateUserEligibility(UserEligibility_Db dbUserEligibility) { ClearErrorState(); - SaxUserEligibility_Dbas userEligibility = new SaxUserEligibility_Dbas(CoreDatabase, new SysId(dbUserEligibility._Id), new SysId(dbUserEligibility._UserAccountId), new SysId(dbUserEligibility._RegionId), (Sax.EligibilityType)dbUserEligibility._EligibilityType, (ushort)dbUserEligibility._Flags); + SaxUserEligibility_Dbas userEligibility = new SaxUserEligibility_Dbas(CoreDatabase, new SysId(dbUserEligibility._Id), new SysId(dbUserEligibility._UserAccountId), new SysId(dbUserEligibility._RegionId ?? 0), (Sax.EligibilityType)dbUserEligibility._EligibilityType, (ushort)dbUserEligibility._Flags); PopulateFrom(dbUserEligibility, userEligibility); return userEligibility; } @@ -86,7 +86,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUserEligibility\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userEligibility; @@ -504,6 +504,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetUserEligibilityList(SaxUserEligibility.Params prm) { + ClearErrorState(); List userEligibilitys = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserEligibility), aliasUserEligibility); @@ -531,7 +532,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUserEligibilityList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userEligibilitys; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserOnline.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserOnline.cs index 7f018a9..786db46 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserOnline.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserOnline.cs @@ -123,7 +123,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUserOnline\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userOnline; @@ -461,6 +461,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetUserOnlineList(SaxUserOnline.Params prm) { + ClearErrorState(); List userOnlines = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserOnline), aliasUserOnline); @@ -488,7 +489,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUserOnlineList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userOnlines; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserOrganisation.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserOrganisation.cs index 9261e88..96c6b13 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserOrganisation.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserOrganisation.cs @@ -84,7 +84,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUserOrganisation\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userOrganisation; @@ -610,6 +610,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetUserOrganisationList(SaxUserOrganisation.Params prm) { + ClearErrorState(); List userOrganisations = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserOrganisation), aliasUserOrganisation); @@ -637,7 +638,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUserOrganisationList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userOrganisations; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserRole.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserRole.cs index bf8f10e..b70f951 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserRole.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserRole.cs @@ -83,7 +83,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUserRole\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userRole; @@ -474,6 +474,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetUserRoleList(SaxUserRole.Params prm) { + ClearErrorState(); List userRoles = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserRole), aliasUserRole); @@ -501,7 +502,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUserRoleList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userRoles; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSession.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSession.cs index 366ede8..e245b0e 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSession.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSession.cs @@ -80,7 +80,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUserSession\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userSession; @@ -373,6 +373,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetUserSessionList(SaxUserSession.Params prm) { + ClearErrorState(); List userSessions = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserSession), aliasUserSession); @@ -400,7 +401,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUserSessionList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userSessions; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSport.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSport.cs index 9d65ba1..ab9cd1d 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSport.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSport.cs @@ -83,7 +83,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUserSport\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userSport; @@ -496,6 +496,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetUserSportList(SaxUserSport.Params prm) { + ClearErrorState(); List userSports = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserSport), aliasUserSport); @@ -523,7 +524,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUserSportList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userSports; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSportExperience.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSportExperience.cs index 4686d63..1e09fa8 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSportExperience.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxAccountMgr_Dbas-UserSportExperience.cs @@ -84,7 +84,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUserSportExperience\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userSportExperience; @@ -515,6 +515,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetUserSportExperienceList(SaxUserSportExperience.Params prm) { + ClearErrorState(); List userSportExperiences = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserSportExperience), aliasUserSportExperience); @@ -542,7 +543,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUserSportExperienceList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userSportExperiences; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-ActivityFeedback.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-ActivityFeedback.cs index 47bc50e..17e6b5f 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-ActivityFeedback.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-ActivityFeedback.cs @@ -82,7 +82,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetActivityFeedback\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return activityFeedback; @@ -400,6 +400,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetActivityFeedbackList(SaxActivityFeedback.Params prm) { + ClearErrorState(); List userActivitys = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ActivityFeedback), aliasActivityFeedback); @@ -427,7 +428,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetActivityFeedbackList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userActivitys; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-ActivityIndex.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-ActivityIndex.cs index 77713da..d91bd1f 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-ActivityIndex.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-ActivityIndex.cs @@ -84,7 +84,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetActivityIndex\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return activityIndex; @@ -232,8 +232,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr //activityIndex.ItemId = new ItemId(dbActivityIndex._ItemType, new SysId(dbActivityIndex._ItemId); //activityIndex.SportId = new SysId(dbActivityIndex._SportId); //activityIndex.RegionId = new SysId(dbActivityIndex._RegionId); - activityIndex.UserAccountIdOwner = new SysId(dbActivityIndex._UserAccountIdOwner); - activityIndex.OrganisationIdOwner = new SysId(dbActivityIndex._OrganisationIdOwner); + activityIndex.UserAccountIdOwner = new SysId(dbActivityIndex._UserAccountIdOwner ?? 0); + activityIndex.OrganisationIdOwner = new SysId(dbActivityIndex._OrganisationIdOwner ?? 0); activityIndex.EffectiveOn = dbActivityIndex._EffectiveOn; activityIndex.ExpiresOn = dbActivityIndex._ExpiresOn; activityIndex.Notes = dbActivityIndex._Notes; @@ -546,6 +546,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetActivityIndexList(SaxActivityIndex.Params prm) { + ClearErrorState(); List userActivitys = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ActivityIndex), aliasActivityIndex); @@ -573,7 +574,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetActivityIndexList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userActivitys; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-Article.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-Article.cs index 04c314d..5716e1d 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-Article.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-Article.cs @@ -84,7 +84,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetArticle\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return article; @@ -245,7 +245,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr article.RegionIdPrimary = new SysId(dbArticle._RegionIdPrimary); article.Headline = dbArticle._Headline; article.Summary = dbArticle._Summary; - article.ItemImageIdThumbnail = new SysId(dbArticle._ItemImageIdThumbnail); + article.ItemImageIdThumbnail = new SysId(dbArticle._ItemImageIdThumbnail ?? 0); article.BodyData = dbArticle._BodyData; article.PublishedAt = dbArticle._PublishedAt; article.Notes = dbArticle._Notes; @@ -571,6 +571,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetArticleList(SaxArticle.Params prm) { + ClearErrorState(); List userActivitys = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.Article), aliasArticle); @@ -598,7 +599,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetArticleList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userActivitys; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-OrganisationEvent.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-OrganisationEvent.cs index 4fe7af6..46d65f9 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-OrganisationEvent.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-OrganisationEvent.cs @@ -84,7 +84,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetOrganisationEvent\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return organisationEvent; @@ -559,6 +559,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetOrganisationEventList(SaxOrganisationEvent.Params prm) { + ClearErrorState(); List userActivitys = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.OrganisationEvent), aliasOrganisationEvent); @@ -586,7 +587,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetOrganisationEventList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userActivitys; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-OrganisationOpportunity.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-OrganisationOpportunity.cs index fff2368..c48d556 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-OrganisationOpportunity.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-OrganisationOpportunity.cs @@ -84,7 +84,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetOrganisationOpportunity\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return organisationOpportunity; @@ -553,6 +553,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetOrganisationOpportunityList(SaxOrganisationOpportunity.Params prm) { + ClearErrorState(); List userActivitys = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.OrganisationOpportunity), aliasOrganisationOpportunity); @@ -580,7 +581,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetOrganisationOpportunityList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userActivitys; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-UserActivity.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-UserActivity.cs index 2abf745..1338f94 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-UserActivity.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxActivityMgr_Dbas-UserActivity.cs @@ -83,7 +83,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUserActivity\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userActivity; @@ -171,7 +171,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr return !HasErrorState(); } - private bool UpdateActivityFeedback (SaxUserActivity userActivity, SaxUserActivity userActivity_Previous, DbUpdateInfo dbUpdateInfo) + private bool UpdateActivityFeedback(SaxUserActivity userActivity, SaxUserActivity userActivity_Previous, DbUpdateInfo dbUpdateInfo) { // Calculate changes in feedback for this user activity compared to the previous instance. // User activity status - deleted are ignored. @@ -523,6 +523,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetUserActivityList(SaxUserActivity.Params prm) { + ClearErrorState(); List userActivitys = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserActivity), aliasUserActivity); @@ -550,7 +551,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUserActivityList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userActivitys; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemAddress.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemAddress.cs index 63ce95f..d30557a 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemAddress.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemAddress.cs @@ -85,7 +85,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetItemAddress\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return itemAddress; @@ -265,7 +265,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr itemAddress.RegionIdProvince = new SysId(dbItemAddress._RegionIdProvince); itemAddress.Country = dbItemAddress._Country; itemAddress.RegionIdCountry = new SysId(dbItemAddress._RegionIdCountry); - itemAddress.PostalCode= dbItemAddress._PostalCode; + itemAddress.PostalCode = dbItemAddress._PostalCode; // Location. itemAddress.LocationSource = dbItemAddress._LocationSource; itemAddress.LocationStoredAt = dbItemAddress._LocationStoredAt; @@ -540,6 +540,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetItemAddressList(SaxItemAddress.Params prm) { + ClearErrorState(); List itemAddresss = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemAddress), aliasItemAddress); @@ -567,7 +568,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetItemAddressList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return itemAddresss; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemAssociation.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemAssociation.cs index 392a895..14c7abf 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemAssociation.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemAssociation.cs @@ -85,7 +85,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetItemAssociation\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return itemAssociation; @@ -544,6 +544,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetItemAssociationList(SaxItemAssociation.Params prm) { + ClearErrorState(); List itemAssociations = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemAssociation), aliasItemAssociation); @@ -571,7 +572,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetItemAssociationList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return itemAssociations; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemImage.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemImage.cs index 4a910f1..5624ca0 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemImage.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemImage.cs @@ -84,7 +84,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetItemImage\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return itemImage; @@ -492,6 +492,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetItemImageList(SaxItemImage.Params prm) { + ClearErrorState(); List itemImages = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemImage), aliasItemImage); @@ -519,7 +520,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetItemImageList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return itemImages; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemSport.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemSport.cs index 7f72c7f..f42ec80 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemSport.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxItemDataMgr_Dbas-ItemSport.cs @@ -83,7 +83,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetItemSport\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return itemSport; @@ -452,6 +452,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetItemSportList(SaxItemSport.Params prm) { + ClearErrorState(); List itemSports = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemSport), aliasItemSport); @@ -479,7 +480,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetItemSportList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return itemSports; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxReferenceMgr_Dbas-Region.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxReferenceMgr_Dbas-Region.cs index 87c794e..947e82d 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxReferenceMgr_Dbas-Region.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxReferenceMgr_Dbas-Region.cs @@ -83,7 +83,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetRegion\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return region; @@ -480,6 +480,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetRegionList(SaxRegion.Params prm) { + ClearErrorState(); List userReferences = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.Region), aliasRegion); @@ -507,7 +508,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetRegionList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userReferences; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/SaxReferenceMgr_Dbas-Sport.cs b/SaxoniteStandardDbas/Dbas/Mgr/SaxReferenceMgr_Dbas-Sport.cs index 130ae96..ec2f4e2 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/SaxReferenceMgr_Dbas-Sport.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/SaxReferenceMgr_Dbas-Sport.cs @@ -82,7 +82,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetSport\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return sport; @@ -232,7 +232,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr private void PopulateFrom(Sport_Db dbSport, SaxSport sport) { //sport.Id = new SysId(dbSport._Id); - sport.SportIdParent = new SysId(dbSport._SportIdParent); + sport.SportIdParent = new SysId(dbSport._SportIdParent ?? 0); sport.Name = dbSport._Name; sport.SpecialityLabel = (Sax.SportSpecialityLabel)dbSport._SpecialityLabel; // Common properties. @@ -450,6 +450,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr // Item list. public override List GetSportList(SaxSport.Params prm) { + ClearErrorState(); List userReferences = new List(); DbQuery qry = new DbQuery(CoreDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.Sport), aliasSport); @@ -477,7 +478,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetSportList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userReferences; diff --git a/SaxoniteStandardDbas/Dbas/Mgr/Support/SaxSupportMgr_Dbas-UserReport.cs b/SaxoniteStandardDbas/Dbas/Mgr/Support/SaxSupportMgr_Dbas-UserReport.cs index 9f90763..0d2e867 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/Support/SaxSupportMgr_Dbas-UserReport.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/Support/SaxSupportMgr_Dbas-UserReport.cs @@ -83,7 +83,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Support catch (Exception exc) { SetErrorState("Database query exception"); - SaLogger.Warn(GetType().Name + ".GetUserReport\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userReport; @@ -472,6 +472,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Support // Item list. public override List GetUserReportList(SaxUserReport.Params prm) { + ClearErrorState(); List userRoles = new List(); DbQuery qry = new DbQuery(SupportDatabase.DbmsType); qry.Tables.Add(SaxDbDfn_Support.GetTableName(SaxDbDfn_Support.TableIdx.UserReport), aliasUserReport); @@ -499,7 +500,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Support } catch (Exception exc) { - SaLogger.Warn(GetType().Name + ".GetUserReportList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc)); + SetErrorState("Database query exception"); + SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}"); } } return userRoles; diff --git a/SaxoniteStandardDbas/Resources/Database/SaxDbDfn_Reference.xml b/SaxoniteStandardDbas/Resources/Database/SaxDbDfn_Reference.xml index 972f647..fb3602d 100644 --- a/SaxoniteStandardDbas/Resources/Database/SaxDbDfn_Reference.xml +++ b/SaxoniteStandardDbas/Resources/Database/SaxDbDfn_Reference.xml @@ -238,8 +238,8 @@ false false false - 0 - 0 + 2 + 98 false @@ -450,6 +450,57 @@ golf UsgaCourse
11 + PostalCode + VarChar + + -9 + nvarchar + false + 20 + 40 + 0 + NoNulls + false + + + + golf + UsgaCourse
+ 12 + Latitude + Decimal + + 3 + decimal + false + 9 + 11 + 6 + Nullable + true + +
+ + golf + UsgaCourse
+ 13 + Longitude + Decimal + + 3 + decimal + false + 9 + 11 + 6 + Nullable + true + +
+ + golf + UsgaCourse
+ 14 Email VarChar @@ -466,7 +517,7 @@ golf UsgaCourse
- 12 + 15 Telephone VarChar @@ -483,7 +534,24 @@ golf UsgaCourse
- 13 + 16 + MarkersData + VarChar + + -9 + nvarchar + false + 0 + 0 + 0 + NoNulls + false + +
+ + golf + UsgaCourse
+ 17 Notes VarChar @@ -500,7 +568,7 @@ golf UsgaCourse
- 14 + 18 Flags SmallInt @@ -517,7 +585,7 @@ golf UsgaCourse
- 15 + 19 Status VarChar @@ -534,7 +602,7 @@ golf UsgaCourse
- 16 + 20 CreateOn DateTime @@ -551,7 +619,7 @@ golf UsgaCourse
- 17 + 21 CreateBy Int @@ -568,7 +636,7 @@ golf UsgaCourse
- 18 + 22 CreateHost VarChar @@ -585,7 +653,7 @@ golf UsgaCourse
- 19 + 23 UpdateOn DateTime @@ -602,7 +670,7 @@ golf UsgaCourse
- 20 + 24 UpdateBy Int @@ -619,7 +687,7 @@ golf UsgaCourse
- 21 + 25 UpdateHost VarChar @@ -644,8 +712,8 @@ false false false - 0 - 0 + 15 + 182 false @@ -774,6 +842,142 @@ golf UsgaFacility
5 + Address1 + VarChar + + -9 + nvarchar + false + 200 + 400 + 0 + NoNulls + false + +
+ + golf + UsgaFacility
+ 6 + Address2 + VarChar + + -9 + nvarchar + false + 200 + 400 + 0 + NoNulls + false + +
+ + golf + UsgaFacility
+ 7 + City + VarChar + + -9 + nvarchar + false + 200 + 400 + 0 + NoNulls + false + +
+ + golf + UsgaFacility
+ 8 + PostalCode + VarChar + + -9 + nvarchar + false + 20 + 40 + 0 + NoNulls + false + +
+ + golf + UsgaFacility
+ 9 + Latitude + Decimal + + 3 + decimal + false + 9 + 11 + 6 + Nullable + true + +
+ + golf + UsgaFacility
+ 10 + Longitude + Decimal + + 3 + decimal + false + 9 + 11 + 6 + Nullable + true + +
+ + golf + UsgaFacility
+ 11 + Email + VarChar + + -9 + nvarchar + false + 200 + 400 + 0 + NoNulls + false + +
+ + golf + UsgaFacility
+ 12 + Telephone + VarChar + + -9 + nvarchar + false + 200 + 400 + 0 + NoNulls + false + +
+ + golf + UsgaFacility
+ 13 Notes VarChar @@ -790,7 +994,7 @@ golf UsgaFacility
- 6 + 14 Flags SmallInt @@ -807,7 +1011,7 @@ golf UsgaFacility
- 7 + 15 Status VarChar @@ -824,7 +1028,7 @@ golf UsgaFacility
- 8 + 16 CreateOn DateTime @@ -841,7 +1045,7 @@ golf UsgaFacility
- 9 + 17 CreateBy Int @@ -858,7 +1062,7 @@ golf UsgaFacility
- 10 + 18 CreateHost VarChar @@ -875,7 +1079,7 @@ golf UsgaFacility
- 11 + 19 UpdateOn DateTime @@ -892,7 +1096,7 @@ golf UsgaFacility
- 12 + 20 UpdateBy Int @@ -909,7 +1113,7 @@ golf UsgaFacility
- 13 + 21 UpdateHost VarChar @@ -934,8 +1138,8 @@ false false false - 0 - 0 + 4 + 144 false @@ -1377,8 +1581,8 @@ false false false - 0 - 0 + 2 + 91 false @@ -1644,8 +1848,8 @@ false false false - 0 - 0 + 13 + 913 false diff --git a/SaxoniteWebApi/Api/App/SaxApplication_Api.cs b/SaxoniteWebApi/Api/App/SaxApplication_Api.cs index 100787e..bc91b09 100644 --- a/SaxoniteWebApi/Api/App/SaxApplication_Api.cs +++ b/SaxoniteWebApi/Api/App/SaxApplication_Api.cs @@ -61,7 +61,7 @@ namespace Saxonite.Web.Api.App } catch (Exception exc) { - SaLogger.Error(GetType().Name + ".CTR " + ExceptionUtil.GetErrorStateMessage(exc)); + SaLogger.Error($"GetType().Name.CTR {ExceptionUtil.GetErrorStateMessage(exc)}"); throw; } } @@ -137,6 +137,7 @@ namespace Saxonite.Web.Api.App //------------------------------------------------------------------- private void TestApi() { +#pragma warning disable CS0162 // Allows you to bypass "AuthenticationException: The remote certificate is invalid according to the validation procedure." error. Don't to do this in production code... //ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; }; diff --git a/SaxoniteWebApi/Api/Consoles/SaxConsoleHelper_Api.cs b/SaxoniteWebApi/Api/Consoles/SaxConsoleHelper_Api.cs index e60a846..02925bd 100644 --- a/SaxoniteWebApi/Api/Consoles/SaxConsoleHelper_Api.cs +++ b/SaxoniteWebApi/Api/Consoles/SaxConsoleHelper_Api.cs @@ -1,4 +1,6 @@ -using Saxonite.Net.Core.Web.Base.Consoles; +using Sarand.Net.Standard.Base.Core; +using Sarand.Net.Standard.Base.Utils; +using Saxonite.Net.Core.Web.Base.Consoles; using Saxonite.Net.Standard.Base.App; using Saxonite.Net.Standard.Base.Consoles; using Saxonite.Web.Api.App; @@ -23,9 +25,10 @@ namespace Saxonite.Web.Api.Consoles if (disposing) { // Clear process consoles. - foreach (SaxProcessConsole_Api processConsole in processConsoles.Values) + foreach (SaxProcessConsole_Api? processConsole in processConsoles.Values) { - processConsole.Dispose(); + if (processConsole != null) + processConsole.Dispose(); } processConsoles.Clear(); } @@ -51,11 +54,11 @@ namespace Saxonite.Web.Api.Consoles //------------------------------------------------------------------- // Process console. - private Dictionary processConsoles { get; } = new Dictionary(); + private Dictionary processConsoles { get; } = new Dictionary(); public SaxProcessConsole GetProcessConsole(SaxSessionContext sessionContext) { - if (sessionContext == null) throw new NotSupportedException(GetType().Name + ".GetProcessConsole Session Context must be specified"); - SaxProcessConsole_Api processConsole = processConsoles.GetValueOrDefault(sessionContext.Index, null); + if (sessionContext == null) throw new NotSupportedException($"{SysUtil.Fn} Session Context must be specified."); + SaxProcessConsole_Api? processConsole = processConsoles.GetValueOrDefault(sessionContext.Index, null); if (processConsole == null) { processConsole = processConsoles[sessionContext.Index] = new SaxProcessConsole_Api(sessionContext); diff --git a/SaxoniteWebApi/Api/Consoles/SaxProcessConsole_Api.cs b/SaxoniteWebApi/Api/Consoles/SaxProcessConsole_Api.cs index 9bb4b7b..58555de 100644 --- a/SaxoniteWebApi/Api/Consoles/SaxProcessConsole_Api.cs +++ b/SaxoniteWebApi/Api/Consoles/SaxProcessConsole_Api.cs @@ -1,4 +1,5 @@ using Sarand.Net.Standard.Base.Procs; +using Sarand.Net.Standard.Base.Utils; using Saxonite.Net.Standard.Base.App; using Saxonite.Net.Standard.Base.Consoles; using Saxonite.Web.Api.Procs; @@ -55,14 +56,14 @@ namespace Saxonite.Web.Api.Consoles // Processes. //------------------------------------------------------------------- - public SaxProcess_Api GetProcess(ProcessType processType) + public SaxProcess_Api? GetProcess(ProcessType processType) { - return processes.GetValueOrDefault(processType, null)?.Process; + return DictionaryUtil.GetValue(processes,processType, null)?.Process; } public bool IsProcessing(ProcessType processType) { - SaxProcess_Api process = GetProcess(processType); + SaxProcess_Api? process = GetProcess(processType); if (process != null) if (process.Processing) return true; return false; @@ -76,7 +77,7 @@ namespace Saxonite.Web.Api.Consoles /// public bool ClearProcess(ProcessType processType) { - SaxProcess_Api process = GetProcess(processType); + SaxProcess_Api? process = GetProcess(processType); if (process != null) { if (process.Processing) diff --git a/SaxoniteWebApi/Api/Controllers/GolfController.cs b/SaxoniteWebApi/Api/Controllers/GolfController.cs new file mode 100644 index 0000000..eac476e --- /dev/null +++ b/SaxoniteWebApi/Api/Controllers/GolfController.cs @@ -0,0 +1,115 @@ +using Microsoft.AspNetCore.Mvc; +using Sarand.Net.Standard.Base.App; +using Sarand.Net.Standard.Base.Bus; +using Sarand.Net.Standard.Base.Utils; +using Saxonite.Net.Standard.Base.App; +using Saxonite.Net.Standard.Base.Bus.Reference; +using Saxonite.Net.Standard.Base.Mgr.Reference; +using Saxonite.Web.Api.App; +using static Sarand.Net.Standard.Base.Helpers.SacsHttpClientHelper; +using static Saxonite.Net.Standard.Base.App.Sax.Config.Online; + +namespace Saxonite.Web.Api.Controllers +{ + //======================================================================= + [ApiController] + public class GolfController : SwapiControllerBase + { + //------------------------------------------------------------------- + // Construction. + public GolfController() + { + } + + //------------------------------------------------------------------- + // USGA Countries. + + public class RequestData_UsgaCountries + { + public String? Search { get; set; } + public SaxGolfUsgaCountry.StatusCat? Status { get; set; } + } + public class ResponseData_UsgaCountries : ApiResponse_Data + { + public class UsgaCountriesData + { + public long? Id { get; set; } + public String? Code { get; set; } + public String? Name { get; set; } + } + public List UsgaCountries { get; } = new List(); + } + [HttpPost] + [Route("[controller]/UsgaCountries")] + public ResponseData_UsgaCountries GetUsgaCountries_Post(RequestData_UsgaCountries requestData) + { + ResponseData_UsgaCountries responseData = new ResponseData_UsgaCountries(); + + SaxGolfUsgaCountry.Params prmCountries = new SaxGolfUsgaCountry.Params(); + prmCountries.CountryFilter = requestData.Search; + prmCountries.StatusCat = requestData.Status ?? SaxGolfUsgaCountry.StatusCat.NotDeleted; + foreach (SaxGolfUsgaCountry usgaCountry in ReferenceGolfMgr.GetUsgaCountryList(prmCountries)) + { + ResponseData_UsgaCountries.UsgaCountriesData countryData = new ResponseData_UsgaCountries.UsgaCountriesData(); + countryData.Id = SysId.ToLong(usgaCountry.Id); + if (!StringUtil.IsBlank(usgaCountry.CountryCode)) + countryData.Code = usgaCountry.CountryCode; + if (!StringUtil.IsBlank(usgaCountry.CountryName)) + countryData.Name = usgaCountry.CountryName; + responseData.UsgaCountries.Add(countryData); + } + + return responseData; + } + + //------------------------------------------------------------------- + // USGA Provinces. + + public class RequestData_UsgaProvinces + { + public String? CountryId { get; set; } + public String? Search { get; set; } + public SaxGolfUsgaProvince.StatusCat? Status { get; set; } + } + public class ResponseData_UsgaProvinces : ApiResponse_Data + { + public class UsgaProvincesData + { + public long? Id { get; set; } + public String? Code { get; set; } + public String? Name { get; set; } + } + public List UsgaProvinces { get; } = new List(); + } + [HttpPost] + [Route("[controller]/UsgaProvinces")] + public ResponseData_UsgaProvinces GetUsgaProvinces_Post(RequestData_UsgaProvinces requestData) + { + ResponseData_UsgaProvinces responseData = new ResponseData_UsgaProvinces(); + + SysId countryId = StringUtil.ToSysId(requestData.CountryId); + if (SysId.IsValid(countryId)) + { + SaxGolfUsgaProvince.Params prmProvinces = new SaxGolfUsgaProvince.Params(); + prmProvinces.CountryIdsIncluded.Add(countryId); + prmProvinces.ProvinceFilter = requestData.Search; + prmProvinces.StatusCat = requestData.Status ?? SaxGolfUsgaProvince.StatusCat.NotDeleted; + foreach (SaxGolfUsgaProvince usgaProvince in ReferenceGolfMgr.GetUsgaProvinceList(prmProvinces)) + { + ResponseData_UsgaProvinces.UsgaProvincesData provinceData = new ResponseData_UsgaProvinces.UsgaProvincesData(); + provinceData.Id = SysId.ToLong(usgaProvince.Id); + if (!StringUtil.IsBlank(usgaProvince.ProvinceCode)) + provinceData.Code = usgaProvince.ProvinceCode; + if (!StringUtil.IsBlank(usgaProvince.ProvinceName)) + provinceData.Name = usgaProvince.ProvinceName; + responseData.UsgaProvinces.Add(provinceData); + } + } + + return responseData; + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaxoniteWebApi/Api/Controllers/SwapiControllerBase.cs b/SaxoniteWebApi/Api/Controllers/SwapiControllerBase.cs index 50c86a5..68e8c2a 100644 --- a/SaxoniteWebApi/Api/Controllers/SwapiControllerBase.cs +++ b/SaxoniteWebApi/Api/Controllers/SwapiControllerBase.cs @@ -1,13 +1,16 @@ using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; using Sacs.Web.Components; using Sarand.Net.Standard.Base.App; using Sarand.Net.Standard.Base.Core; using Sarand.Net.Standard.Base.Utils; +using Saxonite.Net.Core.Web.Base.Controllers; +using Saxonite.Net.Standard.Base.App; namespace Saxonite.Web.Api.Controllers { //======================================================================= - public class SwapiControllerBase : ControllerBase + public class SwapiControllerBase : SaxController_Base { //------------------------------------------------------------------- // Definitions. @@ -130,7 +133,7 @@ namespace Saxonite.Web.Api.Controllers //------------------------------------------------------------------- // Construction. - protected SwapiControllerBase() + protected SwapiControllerBase() : base(null) { } diff --git a/SaxoniteWebApi/Api/Controllers/SystemController.cs b/SaxoniteWebApi/Api/Controllers/SystemController.cs index a20296d..fb6e743 100644 --- a/SaxoniteWebApi/Api/Controllers/SystemController.cs +++ b/SaxoniteWebApi/Api/Controllers/SystemController.cs @@ -1,5 +1,7 @@ using Microsoft.AspNetCore.Mvc; +using Sarand.Net.Standard.Base.App; using Saxonite.Net.Standard.Base.App; +using Saxonite.Web.Api.App; using static Sarand.Net.Standard.Base.Helpers.SacsHttpClientHelper; namespace Saxonite.Web.Api.Controllers @@ -15,7 +17,7 @@ namespace Saxonite.Web.Api.Controllers } //------------------------------------------------------------------- - // Start session. + // Version. public class RequestData_Version { @@ -39,6 +41,41 @@ namespace Saxonite.Web.Api.Controllers return responseData; } + //------------------------------------------------------------------- + // Config. + + public class RequestData_Config + { + } + public class ResponseData_Config : ApiResponse_Data + { + public class ConfigData + { + public String? Version { get; set; } + public String? Environment { get; set; } + public String? LogFolder { get; set; } + public String? EmailContext { get; set; } + } + public ConfigData Config { get; } = new ConfigData(); + } + [HttpGet] + [Route("[controller]/Config")] + public ResponseData_Config GetConfig_Get() + { + return GetConfig_Post(new RequestData_Config()); + } + [HttpPost] + [Route("[controller]/Config")] + public ResponseData_Config GetConfig_Post(RequestData_Config requestData) + { + ResponseData_Config responseData = new ResponseData_Config(); + responseData.Config.Version = Sax.Version.GetFullVersion(); + responseData.Config.Environment = SaxApplication_Api.AppInstance?.EnvironmentName; + responseData.Config.LogFolder = SaLogger.LogFolder; + responseData.Config.EmailContext = SaxApplication_Api.AppInstance?.EmailConfig.Context; + return responseData; + } + //------------------------------------------------------------------- } //======================================================================= diff --git a/SaxoniteWebApi/Program.cs b/SaxoniteWebApi/Program.cs index 60a7db0..eecb35b 100644 --- a/SaxoniteWebApi/Program.cs +++ b/SaxoniteWebApi/Program.cs @@ -14,7 +14,11 @@ using System.Text.Json.Serialization; }); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); - builder.Services.AddSwaggerGen(); + builder.Services.AddSwaggerGen(options => + { + // Ref. https://stackoverflow.com/questions/46071513/swagger-error-conflicting-schemaids-duplicate-schemaids-detected-for-types-a-a + options.CustomSchemaIds(type => type?.ToString().Replace("+", ".")); + }); var app = builder.Build();