3.0.0.7 Transactions
This commit is contained in:
@@ -72,8 +72,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
applicationParams.Add("Environment", EnvironmentName);
|
||||
applicationParams.Add("Control database", AppConfig.ControlDatabase.Location);
|
||||
applicationParams.Add("Application root", SbmSystem.ApplicationFolder);
|
||||
if (!StringUtil.IsEmpty(AppConfig.Documents.RootFolder))
|
||||
applicationParams.Add("Documents root", AppConfig.Documents.RootFolder);
|
||||
//if (!StringUtil.IsEmpty(AppConfig.Documents.RootFolder)) applicationParams.Add("Documents root", AppConfig.Documents.RootFolder);
|
||||
applicationParams.Add("Email context", AppConfig.Email.Context + (!StringUtil.IsEmpty(EmailConfig.SMTP.Server) ? " [" + EmailConfig.SMTP.Server + "]" : ""));
|
||||
SaLogger.Info(fn + " Application start." + applicationParams.Select(item => StringUtil.PadRight(item.Item1 + ":", 20, ' ') + item.Item2).Concat("", "\n\t"), true);
|
||||
}
|
||||
|
||||
@@ -153,6 +153,10 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
else if (itemParam.Context.EqualsCI(ParamContext_TransactionReferencePrefix))
|
||||
{
|
||||
// Transaction Reference Prefix.
|
||||
Sbm.TransactionType transactionType = EnumUtil.ParseEnum(itemParam.Name, Sbm.TransactionType.Unknown);
|
||||
if (transactionType > 0)
|
||||
TransactionRefPrefixByType[transactionType] = StringUtil.TrimWhitespace(itemParam.Value);
|
||||
else SaLogger.Debug($"{SysUtil.Fn} Unrecognised Transaction Type: '{itemParam.Name}'. Context: {itemParam.Context}.");
|
||||
}
|
||||
else if (itemParam.Context.EqualsCI(ParamContext_StockControl))
|
||||
{
|
||||
@@ -241,6 +245,9 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Transactions.
|
||||
|
||||
// Supported Transaction types.
|
||||
private readonly HashSet<Sbm.TransactionType> TransactionTypes_Allowed = new HashSet<Sbm.TransactionType>();
|
||||
private readonly HashSet<Sbm.TransactionType> TransactionTypes_Disallowed = new HashSet<Sbm.TransactionType>();
|
||||
@@ -251,6 +258,22 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// Transaction reference sequence length.
|
||||
private readonly Dictionary<Sbm.TransactionType, int> TransactionRefSeqLengthByType = new Dictionary<Sbm.TransactionType, int>();
|
||||
public override int GetTransactionRefSeqLength(SysId affiliateId_Owner, SysId idAssoc, Sbm.TransactionType transactionType, int defaultResponse)
|
||||
{
|
||||
if (TransactionRefSeqLengthByType.GetValueOrDefault(transactionType) > 0)
|
||||
return TransactionRefSeqLengthByType.GetValueOrDefault(transactionType);
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// Transaction reference prefix by type.
|
||||
private readonly Dictionary<Sbm.TransactionType, String> TransactionRefPrefixByType = new Dictionary<Sbm.TransactionType, string>();
|
||||
public override String GetTransactionRefPrefix(SysId affiliateId_Owner, SysId idAssoc, Sbm.TransactionType transactionType, String defaultResponse)
|
||||
{
|
||||
return StringUtil.OnBlank(TransactionRefPrefixByType.GetValueOrDefault(transactionType), defaultResponse);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Interfaces.
|
||||
|
||||
|
||||
@@ -82,6 +82,18 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// Transaction reference sequence length.
|
||||
public override int GetTransactionRefSeqLength(SysId affiliateId_Owner, SysId idAssoc, Sbm.TransactionType transactionType, int defaultResponse)
|
||||
{
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// Transaction reference prefix by type.
|
||||
public override String GetTransactionRefPrefix(SysId affiliateId_Owner, SysId idAssoc, Sbm.TransactionType transactionType, String defaultResponse)
|
||||
{
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Interfaces.
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Middleware
|
||||
{
|
||||
// Log action.
|
||||
//String rawTarget = context.Features.Get<IHttpRequestFeature>().RawTarget;
|
||||
HashSet<String> pathsToIgnore = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase) { "/Security/Ajax/ScorePassword" };
|
||||
if (SbmSystem.DebugMode && !pathsToIgnore.Contains($"{context.Request.Path}"))
|
||||
HashSet<String> pathsToIgnore = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase) { "/Security/Ajax/ScorePassword", "/Security/Ajax/KeepLoggedIn" };
|
||||
if (SbmSystem.DebugMode && !context.Request.Method.EqualsCI("GET") && !pathsToIgnore.Contains($"{context.Request.Path}"))
|
||||
SaLogger.Debug($"{SysUtil.Fn} Action: '{Regex.Replace($"{context.Request.Path}", "^/", "")}'. Method: {context.Request.Method}.");
|
||||
|
||||
// Intercept POST requests and apply anti-forgery test.
|
||||
|
||||
Reference in New Issue
Block a user