3.0.1.4 Fix pre-login crash in GetCurrencyDecimals()

This commit is contained in:
Andy Howard
2025-03-02 21:19:06 +00:00
parent 6e23b091cf
commit b9701aff88
4 changed files with 17 additions and 3 deletions
+2 -1
View File
@@ -15,7 +15,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
public static class Version
{
private static String version { get; } = "3.0.1.3";
private static String version { get; } = "3.0.1.4";
// Retrieve version.
public static String GetFullVersion() { return version; }
public static String GetAppVersion()
@@ -41,6 +41,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
// 3.0.1.1 19-Feb-25 Portal tidy.
// 3.0.1.2 26-Feb-25 Requirements & tidy.
// 3.0.1.3 02-Mar-25 Requirements.
// 3.0.1.4 02-Mar-25 Fix pre-login crash on GetCurrencyDecimals().
//-------------------------------------------------------------------
// 3.0.0 Jul-2021 Initial demo test version.
// 02-Feb-25 Initial live deployment.
@@ -116,7 +116,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
if (rfd.Currencies != null) return;
SaCurrency.Params prmCurrency = new SaCurrency.Params();
prmCurrency.StatusCat = SaCurrency.StatusCat.Any;
rfd.Currencies = ReferenceDataConsole.GetCurrencyList(prmCurrency).ToDictionary(currency => currency.Id, currency => currency);
rfd.Currencies = ReferenceDataConsole?.GetCurrencyList(prmCurrency).ToDictionary(currency => currency.Id, currency => currency) ?? null;
}
public List<SaCurrency> GetCurrencies()
{
@@ -89,6 +89,19 @@ namespace Sarand.BusinessMgr.Web.Portal.Components
}
}
public bool HasInternals() { return mbr.internalsSupplied != null || mbr.internals != null; }
/// <summary>
/// Get Currency Decimals.
/// <br/>- NB Prior to login, Internals are invalid as no database selected.
/// <br/>- Hence check for Session Data abnd default value if not initialised.
/// </summary>
/// <returns></returns>
public ushort GetCurrentCurrencyDecimals()
{
if (SessionData_Portal == null)
return SbmInternals.CurrencyDecimalsDefault;
return Internals.GetCurrentCurrencyDecimals();
}
/// <summary>Retrieve internals. Public method to avoid access by ModelBinder.</summary>
public SbmInternals GetInternals() { return Internals; }
/// <summary>Internals supplied from aother component, eg. the Controller.</summary>
@@ -89,7 +89,7 @@
sbm.msg.dataNoneFound = '@Localiser.GetJavascriptText("msg.data.noneFound")';
sbm.maxProfileImageSize = 2 * 10 ** 6;
sbm.sessionCookieName = '@Model.SessionCookieName';
sbm.data.decimalsCurrency = @Model.GetInternals().GetCurrentCurrencyDecimals();
sbm.data.decimalsCurrency = @Model.GetCurrentCurrencyDecimals();
sbm.awaitingLogin = @awaitingLogin;
sbm.keepLoggedIn = @keepLoggedIn;
sbm.keepLoggedInDelay = @(Sbm.Config.Control.Session.Cookie.KeepLoggedInTimeoutMillis);