Portal signin via Control Instance

This commit is contained in:
Andy Howard
2024-10-29 08:40:47 +00:00
parent bf6bb966bc
commit c5ee285e27
467 changed files with 25771 additions and 3347 deletions
@@ -49,9 +49,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Construction.
public SbmSysParamCache(ISbmUserContext userContext)
public SbmSysParamCache(ISbmUserContext_Core userContext, SysId affiliateIdUser)
{
this.UserContext = userContext;
this.AffiliateIdUser = affiliateIdUser;
}
protected override void Dispose(bool disposing)
@@ -63,8 +64,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
//-------------------------------------------------------------------
// Properties.
public ISbmUserContext UserContext { get; }
public SysId AffiliateIdUser { get { return UserContext.User.AffiliateId; } }
public ISbmUserContext_Core UserContext { get; }
public SysId AffiliateIdUser { get; }
public bool Modified { get; private set; }
//-------------------------------------------------------------------
@@ -108,7 +109,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
/// <summary>Retrieve the value for the user parameter.</summary>
public String GetUserParamValue(String name, SysId affiliateIdTarget = null, SysId associationId = null)
{
if (!SysId.IsValid(UserContext.User.AffiliateId)) return "";
if (!SysId.IsValid(AffiliateIdUser)) return "";
return GetParam(name, affiliateIdTarget, associationId)?.Value ?? "";
}
@@ -124,7 +125,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
public bool SetUserParamValue(String name, String value, SysId affiliateIdTarget = null, SysId associationId = null)
{
bool success = false;
if (!SysId.IsValid(UserContext.User.AffiliateId)) return false;
if (!SysId.IsValid(AffiliateIdUser)) return false;
SbmSysParam sysParam = GetParam(name, affiliateIdTarget, associationId);
if (sysParam != null)
{
@@ -146,7 +147,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
return userSysParams.Find
(item => item.Category == Sbm.SysParamCategory.UserParam &&
item.Name.EqualsCI(name) &&
item.AffiliateIdOwner.Equals(UserContext.User.AffiliateId) &&
item.AffiliateIdOwner.Equals(AffiliateIdUser) &&
SysId.ToInt(item.AffiliateIdTarget) == SysId.ToInt(affiliateIdTarget) &&
SysId.ToInt(item.AssociationId) == SysId.ToInt(associationId));
}
@@ -159,14 +160,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
using (SbmAccountMgr accountMgr = CreateAccountMgr())
{
// Retrieve a matching parameter from the database.
sysParam = accountMgr.GetSysParam(Sbm.SysParamCategory.UserParam, name, UserContext.User.AffiliateId, affiliateIdTarget, associationId);
sysParam = accountMgr.GetSysParam(Sbm.SysParamCategory.UserParam, name, AffiliateIdUser, affiliateIdTarget, associationId);
if (sysParam == null)
{
// Parameter not found - create a new one.
sysParam = accountMgr.CreateSysParam(Sbm.SysParamCategory.UserParam, name);
if (sysParam != null)
{
sysParam.AffiliateIdOwner = UserContext.User.AffiliateId;
sysParam.AffiliateIdOwner = AffiliateIdUser;
sysParam.AffiliateIdTarget = affiliateIdTarget;
sysParam.AssociationId = associationId;
}