3.0.0.3 Control Repository Schema & Logs.
This commit is contained in:
@@ -155,7 +155,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create Affiliate.
|
||||
// Create Item.
|
||||
public override SbmAffiliate CreateAffiliate(Sbm.AffiliateType affiliateType)
|
||||
{
|
||||
return new SbmAffiliate_Dbas(null, affiliateType, 0);
|
||||
@@ -169,7 +169,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Affiliate.
|
||||
// Get Item.
|
||||
public override SbmAffiliate GetAffiliate(SbmAffiliate.Params prm)
|
||||
{
|
||||
return GetAffiliate(GetAffiliateQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
@@ -206,6 +206,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Affiliate properties.
|
||||
public override String GetAffiliateName(SysId affiliateId)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -280,7 +281,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item properties.
|
||||
// Validate Item properties.
|
||||
public override bool IsValidAffiliateData(SbmAffiliate.Data data, SbmAffiliate.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -666,16 +667,27 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
public override List<string> GetAffiliateQueryFilter(SbmAffiliate.Params prm)
|
||||
{
|
||||
List<String> filter = new List<String>();
|
||||
|
||||
// Item Id.
|
||||
String colAffiliate_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_Id, aliasAffiliate);
|
||||
String colAffiliate_Type = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_Type, aliasAffiliate);
|
||||
String colAffiliate_UserId = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_UserId, aliasAffiliate);
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Demo application restrictions - when user logged in.
|
||||
if (SysId.IsValid(UserContext.UserAffiliateId) && SessionConsole.HideOtherUserContacts())
|
||||
{
|
||||
// Exclude Individual contacts with User Id other than the logged in user.
|
||||
// NB Keep logic in line with corresponding Affiliate method (SbmAccountMgr_Dbas.GetAssociationQueryFilter).
|
||||
filter.Add($"{colAffiliate_Id} Not In (Select Id From {SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Affiliate)} Where Id!={UserContext.UserAffiliateId} And Type={(int)Sbm.AffiliateType.Individual} And UserId>0)");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Item Id.
|
||||
if (prm.IdsIncluded.HasValidIds())
|
||||
filter.Add($"{colAffiliate_Id} IN ({prm.IdsIncluded.Concat(",")})");
|
||||
if (prm.IdsExcluded.HasValidIds())
|
||||
filter.Add($"{colAffiliate_Id} NOT IN ({prm.IdsExcluded.Concat(",")})");
|
||||
|
||||
// Type.
|
||||
String colAffiliate_Type = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_Type, aliasAffiliate);
|
||||
// Affiliate type - Individual.
|
||||
if (prm.AffiliateType == Sbm.AffiliateType.AnyOrganisation)
|
||||
filter.Add($"{colAffiliate_Type} Not In ({(int)Sbm.AffiliateType.Individual}, {(int)Sbm.AffiliateType.ContactGroup})");
|
||||
@@ -687,9 +699,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
filter.Add($"{colAffiliate_Type}={(int)prm.AffiliateType}");
|
||||
|
||||
// Parent Id.
|
||||
String colAffiliate_AffIdParent = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_AffIdParent, aliasAffiliate);
|
||||
if (SysId.IsValid(prm.AffiliateIdParent))
|
||||
{
|
||||
String colAffiliate_AffIdParent = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_AffIdParent, aliasAffiliate);
|
||||
filter.Add($"{colAffiliate_AffIdParent}={SysId.ToString(prm.AffiliateIdParent)}");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common columns.
|
||||
@@ -725,7 +739,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
searchValueFilter.Add(colAffiliate_Notes + " LIKE '%" + searchValue + "%'");
|
||||
searchFilter.Add(searchValueFilter.Concat(" OR ", "(", ")"));
|
||||
}
|
||||
filter.AddRange(searchFilter);
|
||||
if (searchFilter.Any()) filter.AddRange(searchFilter);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
@@ -894,7 +908,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// User Id.
|
||||
String colAffiliate_UserId = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Affiliate_UserId, aliasAffiliate);
|
||||
if (SysId.IsValid(prm.UserId))
|
||||
filter.Add($"{colAffiliate_UserId}={SysId.ToString(prm.UserId)}");
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Association.
|
||||
// Get Item.
|
||||
public override SbmAssociation GetAssociation(SbmAssociation.Params prm)
|
||||
{
|
||||
return GetAssociation(GetAssociationQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
@@ -77,6 +77,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item properties.
|
||||
public override SysId GetAssociationAffIdTarget(SysId associationId)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -127,7 +128,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate Association.
|
||||
// Validate Item.
|
||||
public override bool IsValidAssociationData(SbmAssociation.Data data, SbmAssociation.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -145,7 +146,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert Association.
|
||||
// Insert Item.
|
||||
public override bool InsertAssociation(SbmAssociation association, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -175,7 +176,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update Association.
|
||||
// Update Item.
|
||||
public override bool UpdateAssociation(SbmAssociation association, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -213,7 +214,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Delete Association.
|
||||
// Delete Item.
|
||||
public override bool AssociationCanBeDeleted(SbmAssociation association)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -511,7 +512,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Column definitions.
|
||||
// Item Column definitions.
|
||||
private static readonly String aliasAssociation = "aAssoc";
|
||||
// Association Owner contact.
|
||||
private static string aliasAssociation_Affiliate_Owner = "Asn_AffOwn";
|
||||
@@ -556,7 +557,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
col.MaxLength = (int)Internals.GetColTextLen(dbCol);
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Getting prmAssociation column definition.
|
||||
// Item column definition.
|
||||
public override ColumnDfn GetAssociationColumnDfn(SbmAssociation.Column column, string caption = "", int width = 0)
|
||||
{
|
||||
ColumnDfn columnDfn = new ColumnDfn((int)column, caption, width);
|
||||
@@ -1120,10 +1121,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
public override List<string> GetAssociationQueryFilter(SbmAssociation.Params prm)
|
||||
{
|
||||
List<String> filter = new List<String>();
|
||||
String colAssociation_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Id, aliasAssociation);
|
||||
String colAssociation_AffIdOwner = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdOwner, aliasAssociation);
|
||||
String colAssociation_AffIdTarget = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdTarget, aliasAssociation);
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Demo application restrictions - when user logged in.
|
||||
if (SysId.IsValid(UserContext.UserAffiliateId) && SessionConsole.HideOtherUserContacts())
|
||||
{
|
||||
// Exclude Individual contacts with User Id other than the logged in user.
|
||||
// NB Keep logic in line with corresponding Affiliate method (SbmAccountMgr_Dbas.GetAffiliateQueryFilter).
|
||||
filter.Add($"{colAssociation_AffIdTarget} Not In (Select Id From {SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Affiliate)} Where Id!={UserContext.UserAffiliateId} And Type={(int)Sbm.AffiliateType.Individual} And UserId>0)");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Association Id.
|
||||
String colAssociation_Id = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_Id, aliasAssociation);
|
||||
if (prm.IdsIncluded.HasValidIds())
|
||||
filter.Add($"{colAssociation_Id} IN ({prm.IdsIncluded.Concat(",")})");
|
||||
if (prm.IdsExcluded.HasValidIds())
|
||||
@@ -1138,12 +1150,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Owner affiliate.
|
||||
String colAssociation_AffIdOwner = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdOwner, aliasAssociation);
|
||||
if (SysId.IsValid(prm.AffiliateIdOwner))
|
||||
filter.Add($"{colAssociation_AffIdOwner}={prm.AffiliateIdOwner}");
|
||||
|
||||
// Target Affiliate.
|
||||
String colAssociation_AffIdTarget = SbmDbDfn.GetColumnNameQual(SbmDbDfn.ColumnIdx.Association_AffIdTarget, aliasAssociation);
|
||||
if (SysId.IsValid(prm.AffiliateIdTarget))
|
||||
filter.Add($"{colAssociation_AffIdTarget}={prm.AffiliateIdTarget}");
|
||||
|
||||
@@ -1151,7 +1161,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Dbas.Mgr
|
||||
// Contact Group.
|
||||
if (SysId.IsValid(prm.AffiliateIdContactGroup))
|
||||
{
|
||||
//Association must also be a member of this contact group.
|
||||
// Association must also be a member of this contact group.
|
||||
String aliasAssocContactGroup = "aAssConGrp";
|
||||
DbQuery queryAssocContactGroup = new DbQuery(Database.DbmsType);
|
||||
queryAssocContactGroup.Tables.Add(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Association), aliasAssocContactGroup);
|
||||
|
||||
Reference in New Issue
Block a user