v1.2.7
This commit is contained in:
@@ -49,10 +49,9 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
private class ActivityData_Web : IndexResults.ActivityData
|
||||
{
|
||||
public ActivityData_Web(ItemId itemId, DateTime effectiveOn) : base(itemId, effectiveOn) { }
|
||||
public void SetOrganisation(SysId organisationId, String organisation) { OrganisationId = organisationId; Organisation = organisation; }
|
||||
public void SetOrganisation(SysId organisationId, String organisation, bool hasLogo) { OrganisationId = organisationId; Organisation = organisation; OrganisationHasLogo = hasLogo; }
|
||||
public void SetAuthor(SysId userAccountId, String author) { UserAccountIdAuthor = userAccountId; Author = author; }
|
||||
public void SetCaption(String caption) { Caption = caption; }
|
||||
public void SetBlurb(String blurb) { Blurb = blurb; }
|
||||
public void SetDetails(String caption, String blurb) { Caption = caption; Blurb = blurb; }
|
||||
public void SetSport(SysId sportId, String sportName) { SportId = sportId; SportName = sportName; }
|
||||
public void SetRegion(SysId regionId, String regionName) { RegionId = regionId; RegionName = regionName; }
|
||||
// User Activity.
|
||||
@@ -77,9 +76,16 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
// Columns to query.
|
||||
ColumnDfn colItemType = Internals.ActivityMgr.GetActivityIndexColumnDfn(SaxActivityIndex.Column.ItemType);
|
||||
ColumnDfn colItemId = Internals.ActivityMgr.GetActivityIndexColumnDfn(SaxActivityIndex.Column.ItemId);
|
||||
// NB Would like to include the Organisation namd and logo count but this involves joing to Organisation and item image
|
||||
// which will make the following query significantly more complex.
|
||||
ColumnDfn colOrganisationId = Internals.ActivityMgr.GetActivityIndexColumnDfn(SaxActivityIndex.Column.OrganisationIdOwner);
|
||||
ColumnDfn colOrganisationName = Internals.ActivityMgr.GetActivityIndexColumnDfn(SaxActivityIndex.Column.OrganisationOwner_Name);
|
||||
ColumnDfn colOrganisationLogoCount = Internals.ActivityMgr.GetActivityIndexColumnDfn(SaxActivityIndex.Column.OrganisationOwner_LogoCount);
|
||||
String colDataNameEffectiveOn = "EffectiveOn";
|
||||
|
||||
// Query the Activity Index.
|
||||
// NB An item may have multiple index entries but these wil only differe by Sport and/or Region.
|
||||
// User, Organisation Effective & Expiry dates wil be the same for all entries for an item.
|
||||
ISacsDatabase db = SaxGlobals.App.GetCoreDatabase(SessionContext);
|
||||
DbQuery query = new DbQuery(db.DbmsType);
|
||||
query.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ActivityIndex, false), alias_ActivityIndex);
|
||||
@@ -203,15 +209,21 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
ColumnDfn colId = Internals.ActivityMgr.GetArticleColumnDfn(SaxArticle.Column.Id);
|
||||
ColumnDfn colOrganisationId = Internals.ActivityMgr.GetArticleColumnDfn(SaxArticle.Column.OrganisationId);
|
||||
ColumnDfn colOrganisation = Internals.ActivityMgr.GetArticleColumnDfn(SaxArticle.Column.Organisation_Name);
|
||||
ColumnDfn colOrganisationLogoCount = Internals.ActivityMgr.GetArticleColumnDfn(SaxArticle.Column.Organisation_LogoCount);
|
||||
ColumnDfn colAuthorId = Internals.ActivityMgr.GetArticleColumnDfn(SaxArticle.Column.UserAccountIdAuthor);
|
||||
ColumnDfn colAuthor = Internals.ActivityMgr.GetArticleColumnDfn(SaxArticle.Column.Author_DisplayName);
|
||||
ColumnDfn colHeadline = Internals.ActivityMgr.GetArticleColumnDfn(SaxArticle.Column.Headline);
|
||||
ColumnDfn colSummary = Internals.ActivityMgr.GetArticleColumnDfn(SaxArticle.Column.Summary);
|
||||
ColumnDfn colItemImageIdThumbnail = Internals.ActivityMgr.GetArticleColumnDfn(SaxArticle.Column.ItemImageIdThumbnail);
|
||||
ColumnDfn colSportId = Internals.ActivityMgr.GetArticleColumnDfn(SaxArticle.Column.SportIdPrimary);
|
||||
ColumnDfn colSportName = Internals.ActivityMgr.GetArticleColumnDfn(SaxArticle.Column.Sport_Name);
|
||||
ColumnDfn colRegionId = Internals.ActivityMgr.GetArticleColumnDfn(SaxArticle.Column.RegionIdPrimary);
|
||||
ColumnDfn colRegionName = Internals.ActivityMgr.GetArticleColumnDfn(SaxArticle.Column.Region_Name);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>() { colId, colOrganisationId, colOrganisation, colAuthor, colAuthorId, colHeadline, colSummary, colSportId, colSportName, colRegionId, colRegionName };
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId, colOrganisationId, colOrganisation, colOrganisationLogoCount, colAuthor, colAuthorId,
|
||||
colHeadline, colSummary, colItemImageIdThumbnail, colSportId, colSportName, colRegionId, colRegionName
|
||||
};
|
||||
|
||||
// Article filter.
|
||||
SaxArticle.Params prmArticle = new SaxArticle.Params();
|
||||
@@ -226,10 +238,12 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
ItemId itemId = new ItemId((short)Sax.DataItemType.Article, new SysId(values.GetLong(colId.DataName)));
|
||||
SysId organisationId = new SysId(values.GetLong(colOrganisationId.DataName));
|
||||
String organisation = values.GetString(colOrganisation.DataName);
|
||||
long organisationLogoCount = values.GetLong(colOrganisationLogoCount.DataName);
|
||||
SysId authorId = new SysId(values.GetLong(colAuthorId.DataName));
|
||||
String author = Internals.ActivityMgr.GetArticleDataValue(colAuthor, values).ToString();
|
||||
String headline = values.GetString(colHeadline.DataName);
|
||||
String summary = values.GetString(colSummary.DataName);
|
||||
SysId itemImageIdThumbnail = new SysId(values.GetLong(colItemImageIdThumbnail.DataName));
|
||||
SysId sportId = new SysId(values.GetLong(colSportId.DataName));
|
||||
String sportName = values.GetString(colSportName.DataName);
|
||||
SysId regionId = new SysId(values.GetLong(colRegionId.DataName));
|
||||
@@ -238,11 +252,10 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
// Populate to corresponding activities.
|
||||
foreach (ActivityData_Web activity in activities.FindAll(item => item.ItemId.Equals(itemId)))
|
||||
{
|
||||
activity.SetOrganisation(organisationId, organisation);
|
||||
activity.SetOrganisation(organisationId, organisation, organisationLogoCount > 0);
|
||||
activity.SetAuthor(authorId, author);
|
||||
activity.SetCaption(headline);
|
||||
activity.SetCaption(headline);
|
||||
activity.SetBlurb(summary);
|
||||
activity.SetDetails(headline, summary);
|
||||
activity.ItemImageIdThumbnail = itemImageIdThumbnail;
|
||||
activity.SetSport(sportId, sportName);
|
||||
activity.SetRegion(regionId, regionName);
|
||||
}
|
||||
@@ -262,6 +275,7 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
ColumnDfn colId = Internals.ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Id);
|
||||
ColumnDfn colOrganisationId = Internals.ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.OrganisationId);
|
||||
ColumnDfn colOrganisation = Internals.ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Organisation_Name);
|
||||
ColumnDfn colOrganisationLogoCount = Internals.ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Organisation_LogoCount);
|
||||
ColumnDfn colEventAt = Internals.ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.EventAt_DateTime);
|
||||
ColumnDfn colSummary = Internals.ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Summary);
|
||||
ColumnDfn colDetails = Internals.ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Details);
|
||||
@@ -269,7 +283,11 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
ColumnDfn colSportName = Internals.ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Sport_Name);
|
||||
ColumnDfn colRegionId = Internals.ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.RegionIdCountry);
|
||||
ColumnDfn colRegionName = Internals.ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Region_Name);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>() { colId, colOrganisationId, colOrganisation, colEventAt, colSummary, colDetails, colSportId, colSportName, colRegionId, colRegionName };
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId, colOrganisationId, colOrganisation, colOrganisationLogoCount,
|
||||
colEventAt, colSummary, colDetails, colSportId, colSportName, colRegionId, colRegionName
|
||||
};
|
||||
|
||||
// Event filter.
|
||||
SaxOrganisationEvent.Params prmEvent = new SaxOrganisationEvent.Params();
|
||||
@@ -284,6 +302,7 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
ItemId itemId = new ItemId((short)Sax.DataItemType.OrganisationEvent, new SysId(values.GetLong(colId.DataName)));
|
||||
SysId organisationId = new SysId(values.GetLong(colOrganisationId.DataName));
|
||||
String organisation = values.GetString(colOrganisation.DataName);
|
||||
long organisationLogoCount = values.GetLong(colOrganisationLogoCount.DataName);
|
||||
DateTime eventAt = values.GetDateTime(colEventAt.DataName);
|
||||
String eventAtDisplay = DateUtil.Format(eventAt, "d-MMM-yy");
|
||||
if (eventAt.Hour > 0 || eventAt.Minute > 0)
|
||||
@@ -298,9 +317,8 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
// Populate to corresponding activities.
|
||||
foreach (ActivityData_Web activity in activities.FindAll(item => item.ItemId.Equals(itemId)))
|
||||
{
|
||||
activity.SetOrganisation(organisationId, organisation);
|
||||
activity.SetCaption(eventAtDisplay);
|
||||
activity.SetBlurb(eventSummary);
|
||||
activity.SetOrganisation(organisationId, organisation, organisationLogoCount > 0);
|
||||
activity.SetDetails(eventAtDisplay, eventSummary);
|
||||
activity.SetSport(sportId, sportName);
|
||||
activity.SetRegion(regionId, regionName);
|
||||
}
|
||||
@@ -320,13 +338,18 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
ColumnDfn colId = Internals.ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Id);
|
||||
ColumnDfn colOrganisationId = Internals.ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.OrganisationId);
|
||||
ColumnDfn colOrganisation = Internals.ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Organisation_Name);
|
||||
ColumnDfn colOrganisationLogoCount = Internals.ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Organisation_LogoCount);
|
||||
ColumnDfn colPosition = Internals.ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Position);
|
||||
ColumnDfn colOutline = Internals.ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Outline);
|
||||
ColumnDfn colSportId = Internals.ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.SportIdPrimary);
|
||||
ColumnDfn colSportName = Internals.ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Sport_Name);
|
||||
ColumnDfn colRegionId = Internals.ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.RegionIdPrimary);
|
||||
ColumnDfn colRegionName = Internals.ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Region_Name);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>() { colId, colOrganisationId, colOrganisation, colPosition, colOutline, colSportId, colSportName, colRegionId, colRegionName };
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId, colOrganisationId, colOrganisation, colOrganisationLogoCount,
|
||||
colPosition, colOutline, colSportId, colSportName, colRegionId, colRegionName
|
||||
};
|
||||
|
||||
// Opportunity filter.
|
||||
SaxOrganisationOpportunity.Params prmOpportunity = new SaxOrganisationOpportunity.Params();
|
||||
@@ -341,6 +364,7 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
ItemId itemId = new ItemId((short)Sax.DataItemType.OrganisationOpportunity, new SysId(values.GetLong(colId.DataName)));
|
||||
SysId organisationId = new SysId(values.GetLong(colOrganisationId.DataName));
|
||||
String organisation = values.GetString(colOrganisation.DataName);
|
||||
long organisationLogoCount = values.GetLong(colOrganisationLogoCount.DataName);
|
||||
String position = values.GetString(colPosition.DataName);
|
||||
String outline = values.GetString(colOutline.DataName);
|
||||
SysId sportId = new SysId(values.GetLong(colSportId.DataName));
|
||||
@@ -351,9 +375,8 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
// Populate to corresponding activities.
|
||||
foreach (ActivityData_Web activity in activities.FindAll(item => item.ItemId.Equals(itemId)))
|
||||
{
|
||||
activity.SetOrganisation(organisationId, organisation);
|
||||
activity.SetCaption(position);
|
||||
activity.SetBlurb(outline);
|
||||
activity.SetOrganisation(organisationId, organisation, organisationLogoCount > 0);
|
||||
activity.SetDetails(position, outline);
|
||||
activity.SetSport(sportId, sportName);
|
||||
activity.SetRegion(regionId, regionName);
|
||||
}
|
||||
@@ -366,6 +389,14 @@ namespace Saxonite.Net.Core.Web.Base.Consoles
|
||||
//-------------------------------------------------------------------
|
||||
protected override bool StoreActivityIndexData(IndexData indexData, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
// Store the Activity Index data for the specified item - Article, Event, Opportunity etc.
|
||||
// An item may have multiple index entries to describe the different
|
||||
// combination of sport and region that they apply to.
|
||||
// NB All entries for the same item must have the same values for:
|
||||
// - Owner User Account Id.
|
||||
// - Owner Organisation Id.
|
||||
// - Effective on date.
|
||||
// - Expires on date.
|
||||
String fn = GetType().Name + ".StoreActivityIndexData";
|
||||
ClearErrorState();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user