v1.0.8.0
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.0.7.0";
|
||||
private static String version { get; } = "1.0.8.0";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
@@ -40,6 +40,9 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Version history.
|
||||
//-------------------------------------------------------------------
|
||||
// 1.0.8 15-Jun-2021 Online Article Content
|
||||
// - Journalist Articles now have styled content.
|
||||
// - Online home page click through activity for details.
|
||||
// 1.0.7 8-Jun-2021 Online Activities & Profile
|
||||
// - Style Online Activities by type.
|
||||
// - Profile Contact Image upload.
|
||||
|
||||
@@ -88,6 +88,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public enum CodeType
|
||||
{
|
||||
YesNo,
|
||||
DataItemType,
|
||||
SportParticipation,
|
||||
SportOfficiating,
|
||||
RegionType,
|
||||
@@ -98,7 +99,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
OrganisationCategory,
|
||||
OrganisationRole,
|
||||
OpportunityType,
|
||||
DataItemType,
|
||||
ActivityReaction,
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -117,6 +118,15 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
Dev
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Yes or No option.</summary>
|
||||
public enum YesNo
|
||||
{
|
||||
Unknown = 0,
|
||||
Yes,
|
||||
No
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public enum DataItemType
|
||||
{
|
||||
@@ -133,6 +143,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
Organisation = 120,
|
||||
// Activty data.
|
||||
ActivityIndex = 200,
|
||||
UserActivity = 202,
|
||||
JournalistArticle = 210,
|
||||
OrganisationOpportunity = 220,
|
||||
OrganisationEvent = 225,
|
||||
@@ -193,15 +204,6 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
Interested = 900,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Yes or No option.</summary>
|
||||
public enum YesNo
|
||||
{
|
||||
Unknown = 0,
|
||||
Yes,
|
||||
No
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Titles - for Contact details.</summary>
|
||||
public enum Title
|
||||
@@ -284,6 +286,17 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
Board,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Activity Reaction</summary>
|
||||
public enum ActivityReaction
|
||||
{
|
||||
Unknown = 0,
|
||||
/* Do not change the values or codes - tied to database. */
|
||||
Good = 400,
|
||||
VeryGood = 600,
|
||||
Exceptional = 800,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Fri 4-Jun-2021 17:09:14
|
||||
// Code generated by Sarand Database Utilities Tue 8-Jun-2021 19:08:09
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
@@ -26,6 +26,7 @@ namespace Saxonite.Base.App
|
||||
Region,
|
||||
Sport,
|
||||
UserAccount,
|
||||
UserActivity,
|
||||
UserOrganisation,
|
||||
UserRole,
|
||||
UserSession,
|
||||
@@ -194,6 +195,21 @@ namespace Saxonite.Base.App
|
||||
UserAccount_UpdateOn,
|
||||
UserAccount_UpdateBy,
|
||||
UserAccount_UpdateHost,
|
||||
UserActivity_Id,
|
||||
UserActivity_UserAccountId,
|
||||
UserActivity_ItemType,
|
||||
UserActivity_ItemId,
|
||||
UserActivity_Reaction,
|
||||
UserActivity_UserActivityData,
|
||||
UserActivity_Notes,
|
||||
UserActivity_Flags,
|
||||
UserActivity_Status,
|
||||
UserActivity_CreateOn,
|
||||
UserActivity_CreateBy,
|
||||
UserActivity_CreateHost,
|
||||
UserActivity_UpdateOn,
|
||||
UserActivity_UpdateBy,
|
||||
UserActivity_UpdateHost,
|
||||
UserOrganisation_Id,
|
||||
UserOrganisation_UserAccountId,
|
||||
UserOrganisation_OrganisationId,
|
||||
@@ -245,8 +261,8 @@ namespace Saxonite.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 13;
|
||||
private static readonly int columnCount = 204;
|
||||
private static readonly int tableCount = 14;
|
||||
private static readonly int columnCount = 219;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -401,6 +417,7 @@ namespace Saxonite.Base.App
|
||||
"Region",
|
||||
"Sport",
|
||||
"UserAccount",
|
||||
"UserActivity",
|
||||
"UserOrganisation",
|
||||
"UserRole",
|
||||
"UserSession",
|
||||
@@ -590,9 +607,10 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(9,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(10,"Id",5,-5,true,19),
|
||||
new ColumnDfn(10,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(10,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(10,"OrganisationRoleCodes",0,12,false,256),
|
||||
new ColumnDfn(10,"OrganisationRoleCount",2,-6,false,3),
|
||||
new ColumnDfn(10,"ItemType",3,5,false,5),
|
||||
new ColumnDfn(10,"ItemId",5,-5,false,19),
|
||||
new ColumnDfn(10,"Reaction",3,5,false,5),
|
||||
new ColumnDfn(10,"UserActivityData",0,-9,false,0),
|
||||
new ColumnDfn(10,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(10,"Flags",3,5,false,5),
|
||||
new ColumnDfn(10,"Status",0,12,false,3),
|
||||
@@ -604,7 +622,9 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(10,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(11,"Id",5,-5,true,19),
|
||||
new ColumnDfn(11,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(11,"UserRoleCode",0,12,false,16),
|
||||
new ColumnDfn(11,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(11,"OrganisationRoleCodes",0,12,false,256),
|
||||
new ColumnDfn(11,"OrganisationRoleCount",2,-6,false,3),
|
||||
new ColumnDfn(11,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(11,"Flags",3,5,false,5),
|
||||
new ColumnDfn(11,"Status",0,12,false,3),
|
||||
@@ -614,27 +634,39 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(11,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(11,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(11,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(12,"Id",5,-5,true,19),
|
||||
new ColumnDfn(12,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(12,"ActivityIndexIds",0,-9,false,0),
|
||||
new ColumnDfn(12,"UserSessionData",0,-9,false,0),
|
||||
new ColumnDfn(12,"UserRoleCode",0,12,false,16),
|
||||
new ColumnDfn(12,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(12,"Flags",3,5,false,5),
|
||||
new ColumnDfn(12,"Status",0,12,false,3),
|
||||
new ColumnDfn(12,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(12,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(12,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(12,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(13,"Id",4,4,true,10),
|
||||
new ColumnDfn(12,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(12,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(13,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(13,"SportId",4,4,false,10),
|
||||
new ColumnDfn(13,"Participation",3,5,false,5),
|
||||
new ColumnDfn(13,"Officiating",3,5,false,5),
|
||||
new ColumnDfn(13,"UserSportData",0,-9,false,0),
|
||||
new ColumnDfn(13,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(13,"ActivityIndexIds",0,-9,false,0),
|
||||
new ColumnDfn(13,"UserSessionData",0,-9,false,0),
|
||||
new ColumnDfn(13,"Flags",3,5,false,5),
|
||||
new ColumnDfn(13,"Status",0,12,false,3),
|
||||
new ColumnDfn(13,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(13,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(13,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(13,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(13,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(13,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(14,"Id",4,4,true,10),
|
||||
new ColumnDfn(14,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(14,"SportId",4,4,false,10),
|
||||
new ColumnDfn(14,"Participation",3,5,false,5),
|
||||
new ColumnDfn(14,"Officiating",3,5,false,5),
|
||||
new ColumnDfn(14,"UserSportData",0,-9,false,0),
|
||||
new ColumnDfn(14,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(14,"Flags",3,5,false,5),
|
||||
new ColumnDfn(14,"Status",0,12,false,3),
|
||||
new ColumnDfn(14,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(14,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(14,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(14,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(14,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(14,"UpdateHost",0,12,false,100),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -87,6 +87,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// System codes.
|
||||
private readonly Dictionary<Sax.CodeType, List<TypeCodeDesc>> codeTypes = new Dictionary<Sax.CodeType, List<TypeCodeDesc>>();
|
||||
public List<TypeCodeDesc> DataItemTypeCodes { get { return GetCodesOfType(Sax.CodeType.DataItemType); } }
|
||||
public List<TypeCodeDesc> SportParticipationCodes { get { return GetCodesOfType(Sax.CodeType.SportParticipation); } }
|
||||
public List<TypeCodeDesc> SportOfficiatingCodes { get { return GetCodesOfType(Sax.CodeType.SportOfficiating); } }
|
||||
public List<TypeCodeDesc> RegionTypeCodes { get { return GetCodesOfType(Sax.CodeType.RegionType); } }
|
||||
@@ -95,7 +96,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public List<TypeCodeDesc> OrganisationCategoryCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationCategory); } }
|
||||
public List<TypeCodeDesc> OrganisationRoleCodes { get { return GetCodesOfType(Sax.CodeType.OrganisationRole); } }
|
||||
public List<TypeCodeDesc> OpportunityTypeCodes { get { return GetCodesOfType(Sax.CodeType.OpportunityType); } }
|
||||
public List<TypeCodeDesc> DataItemTypeCodes { get { return GetCodesOfType(Sax.CodeType.DataItemType); } }
|
||||
public List<TypeCodeDesc> ActivityReactionCodes { get { return GetCodesOfType(Sax.CodeType.ActivityReaction); } }
|
||||
public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
|
||||
{
|
||||
if (!codeTypes.ContainsKey(codeType))
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
// Data members.
|
||||
// Code types.
|
||||
private static readonly List<TypeCodeDesc> yesNoCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> dataItemTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> sportParticipationCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> sportOfficiatingCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> regionTypeCodes = new List<TypeCodeDesc>();
|
||||
@@ -25,7 +26,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
private static readonly List<TypeCodeDesc> organisationCategoryCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> organisationRoleCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> opportunityTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> dataItemTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> activityReactionCodes = new List<TypeCodeDesc>();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Static initialisation.</summary>
|
||||
@@ -36,6 +37,27 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
yesNoCodes.Add(Sax.YesNo.Yes, "YES", "Yes");
|
||||
yesNoCodes.Add(Sax.YesNo.No, "NO", "No");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Data item types.
|
||||
// Reference data.
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.Region, "Region", "Region");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.Sport, "Sport", "Sport");
|
||||
// Accounts.
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.UserAccount, "UserAccount", "User Account");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.UserRole, "UserRole", "User Role");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.UserOrganisation, "UserOrganisation", "User Organisation");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.UserSport, "UserSport", "User Sport");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.Organisation, "Organisation", "Organisation");
|
||||
// Activty data.
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.ActivityIndex, "ActivityIndex", "Activity Index");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.UserActivity, "UserActivity", "User Activity");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.JournalistArticle, "JournalistArticle", "Journalist Article");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.OrganisationOpportunity, "OrganisationOpportunity", "Organisation Opportunity");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.OrganisationEvent, "OrganisationEvent", "Organisation Event");
|
||||
// Item link components.
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.ItemSport, "ItemSport", "Item Sport");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.ItemImage, "ItemImage", "Item Image");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Sport participation.
|
||||
sportParticipationCodes.Add(Sax.SportParticipation.Professional, "PRO", "Professional");
|
||||
@@ -111,23 +133,10 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
opportunityTypeCodes.Add(Sax.OpportunityType.Board, "BRD", "Board");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Data item types.
|
||||
// Reference data.
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.Region, "Region", "Region");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.Sport, "Sport", "Sport");
|
||||
// Accounts.
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.UserAccount, "UserAccount", "User Account");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.UserRole, "UserRole", "User Role");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.UserOrganisation, "UserOrganisation", "User Organisation");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.UserSport, "UserSport", "User Sport");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.Organisation, "Organisation", "Organisation");
|
||||
// Activty data.
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.ActivityIndex, "ActivityIndex", "Activity Index");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.JournalistArticle, "JournalistArticle", "Journalist Article");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.OrganisationOpportunity, "OrganisationOpportunity", "Organisation Opportunity");
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.OrganisationEvent, "OrganisationEvent", "Organisation Event");
|
||||
// Item link components.
|
||||
dataItemTypeCodes.Add(Sax.DataItemType.ItemSport, "ItemSport", "ItemSport");
|
||||
// Opportunity types.
|
||||
activityReactionCodes.Add(Sax.ActivityReaction.Good, "Good", "Good");
|
||||
activityReactionCodes.Add(Sax.ActivityReaction.VeryGood, "VeryGood", "Very Good");
|
||||
activityReactionCodes.Add(Sax.ActivityReaction.Exceptional, "Exceptional", "Exceptional");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
{
|
||||
case Sax.CodeType.YesNo:
|
||||
return new List<TypeCodeDesc>(yesNoCodes);
|
||||
case Sax.CodeType.DataItemType:
|
||||
return new List<TypeCodeDesc>(dataItemTypeCodes);
|
||||
case Sax.CodeType.SportParticipation:
|
||||
return new List<TypeCodeDesc>(sportParticipationCodes);
|
||||
case Sax.CodeType.SportOfficiating:
|
||||
@@ -58,8 +60,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
return new List<TypeCodeDesc>(organisationRoleCodes);
|
||||
case Sax.CodeType.OpportunityType:
|
||||
return new List<TypeCodeDesc>(opportunityTypeCodes);
|
||||
case Sax.CodeType.DataItemType:
|
||||
return new List<TypeCodeDesc>(dataItemTypeCodes);
|
||||
case Sax.CodeType.ActivityReaction:
|
||||
return new List<TypeCodeDesc>(activityReactionCodes);
|
||||
|
||||
default:
|
||||
throw new NotSupportedException(nameof(SaxSystem) + ".GetCodesOfType Unexpected code type: " + systemCode.ToString());
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
// Journalist Article - Content data.
|
||||
//=======================================================================
|
||||
partial class SaxJournalistArticle
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
private static readonly String ElementName_Content = "content";
|
||||
private static readonly String ElementName_Segments = "segments";
|
||||
private static readonly String ElementName_Segment = "segment";
|
||||
private static readonly String ElementName_Body = "body";
|
||||
private static readonly String ElementName_Html= "html";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Article content.</summary>
|
||||
public class ContentData
|
||||
{
|
||||
public class SegmentData
|
||||
{
|
||||
public class BodyData
|
||||
{
|
||||
public String Html { get; set; } = String.Empty;
|
||||
}
|
||||
public BodyData Body { get; } = new BodyData();
|
||||
// Validate.
|
||||
public bool IsValid()
|
||||
{
|
||||
if (!StringUtil.IsEmpty(Body.Html)) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public List<SegmentData> Segments { get; } = new List<SegmentData>();
|
||||
// Add segment.
|
||||
public SegmentData AddSegment()
|
||||
{
|
||||
SegmentData segment = new SegmentData();
|
||||
Segments.Add(segment);
|
||||
return segment;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Convert serialised data from database to Content.
|
||||
/// </summary>
|
||||
public static ContentData ExtractContent(String contentData)
|
||||
{
|
||||
String fn = typeof(ContentData).FullName + ".ExtractContent";
|
||||
ContentData content = new ContentData();
|
||||
|
||||
try
|
||||
{
|
||||
// Load XML data.
|
||||
XDocument doc = XDocument.Parse(contentData);
|
||||
XElement rootElement = doc.Root;
|
||||
foreach (XElement rootChildElement in rootElement.GetChildElements())
|
||||
{
|
||||
String rootChildElementName = rootChildElement.GetLocalName();
|
||||
if (rootChildElementName.EqualsCI(ElementName_Segments))
|
||||
{
|
||||
// Content segments.
|
||||
XElement segmentsElement = rootChildElement;
|
||||
foreach (XElement segmentsChildElement in segmentsElement.GetChildElements())
|
||||
{
|
||||
String segmentsChildElementName = segmentsChildElement.GetLocalName();
|
||||
if (segmentsChildElementName.EqualsCI(ElementName_Segment))
|
||||
{
|
||||
// Content segment.
|
||||
ContentData.SegmentData segment = new ContentData.SegmentData();
|
||||
XElement segmentElement = segmentsChildElement;
|
||||
foreach (XElement segmentChildElement in segmentElement.GetChildElements())
|
||||
{
|
||||
String segmentChildElementName = segmentChildElement.GetLocalName();
|
||||
if (segmentChildElementName.EqualsCI(ElementName_Body))
|
||||
{
|
||||
// Content segment body.
|
||||
XElement bodyElement = segmentChildElement;
|
||||
foreach (XElement bodyChildElement in bodyElement.GetChildElements())
|
||||
{
|
||||
String bodyChildElementName = bodyChildElement.GetLocalName();
|
||||
if (bodyChildElementName.EqualsCI(ElementName_Html))
|
||||
{
|
||||
// Content segment body HTML.
|
||||
XElement htmlElement = bodyChildElement;
|
||||
segment.Body.Html = htmlElement.Value;
|
||||
}
|
||||
else SaLogger.Warn(fn + " Unexpected 'Segment' child element: " + segmentChildElementName);
|
||||
}
|
||||
}
|
||||
else SaLogger.Warn(fn + " Unexpected 'Segment' child element: " + segmentChildElementName);
|
||||
}
|
||||
// Add this segment to the list.
|
||||
if (segment.IsValid())
|
||||
content.Segments.Add(segment);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Unexpected 'Segments' child element: " + segmentsChildElementName);
|
||||
}
|
||||
}
|
||||
else SaLogger.Warn(fn + " Unexpected 'Root' child element: " + rootChildElementName);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Convert Content to serialised data to store on database.
|
||||
/// </summary>
|
||||
public static String GetContentData(ContentData content)
|
||||
{
|
||||
String fn = typeof(ContentData).FullName + ".GetContentData";
|
||||
|
||||
try
|
||||
{
|
||||
XDocument doc = new XDocument();
|
||||
XElement contentElement = doc.AppendElement(ElementName_Content);
|
||||
XElement segmentsElement = contentElement.AppendElement(ElementName_Segments);
|
||||
foreach (ContentData.SegmentData segment in content.Segments)
|
||||
{
|
||||
if (!segment.IsValid()) continue;
|
||||
XElement segmentElement = segmentsElement.AppendElement(ElementName_Segment);
|
||||
XElement bodyElement = segmentElement.AppendElement(ElementName_Body);
|
||||
if (!StringUtil.IsEmpty(segment.Body.Html))
|
||||
bodyElement.AppendElement(ElementName_Html, segment.Body.Html);
|
||||
}
|
||||
return doc.GetXml();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
//=======================================================================
|
||||
// Journalist Article.
|
||||
//=======================================================================
|
||||
public abstract class SaxJournalistArticle : SacsHierarchyItem
|
||||
public abstract partial class SaxJournalistArticle : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
// UserActivity.
|
||||
//=======================================================================
|
||||
public abstract class SaxUserActivity : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
// User.
|
||||
UserAccountId,
|
||||
User_EmailAddress,
|
||||
User_DisplayName,
|
||||
User_Title,
|
||||
User_FirstName,
|
||||
User_LastName,
|
||||
// Activity.
|
||||
ItemType,
|
||||
ItemType_Code,
|
||||
ItemType_Desc,
|
||||
ItemId,
|
||||
// Associated data.
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Desc,
|
||||
Status_Ind,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public SysId UserAccountId { get; set; }
|
||||
public ItemId ItemId { get; set; }
|
||||
public Sax.ActivityReaction Reaction { get; set; }
|
||||
public String UserActivityData { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Properties.
|
||||
public SysId UserAccountId
|
||||
{
|
||||
get { return data.UserAccountId; }
|
||||
set { CheckChanged(data.UserAccountId, value); data.UserAccountId = value; }
|
||||
}
|
||||
public ItemId ItemId
|
||||
{
|
||||
get { return data.ItemId; }
|
||||
set { CheckChanged(data.ItemId, value); data.ItemId = value; }
|
||||
}
|
||||
public Sax.ActivityReaction Reaction
|
||||
{
|
||||
get { return data.Reaction; }
|
||||
set { CheckChanged((int)data.Reaction, (int)value); data.Reaction = value; }
|
||||
}
|
||||
public String UserActivityData
|
||||
{
|
||||
get { return data.UserActivityData; }
|
||||
set { CheckChanged(data.UserActivityData, value); data.UserActivityData = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
UserAccountId = data.UserAccountId;
|
||||
ItemId = data.ItemId;
|
||||
Reaction = data.Reaction;
|
||||
UserActivityData = data.UserActivityData;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Error field - identify properties with validation error.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
// Identifies the field that has invalid data.
|
||||
public ValidValue UserAccountId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ItemId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Reaction { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UserActivityData { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxUserActivity(SysId id, SysId userAccountId, ItemId itemId) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
UserAccountId = userAccountId;
|
||||
ItemId = itemId;
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> validStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Active,
|
||||
SaStatus.Inactive,
|
||||
SaStatus.Deleted,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(validStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
if (status == SaStatus.Active) return DataValue.TriStateType.Green;
|
||||
if (status == SaStatus.Inactive) return DataValue.TriStateType.Red;
|
||||
if (status == SaStatus.Deleted) return DataValue.TriStateType.Purple;
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
public ItemId GetItemId()
|
||||
{
|
||||
return new ItemId((short)Sax.DataItemType.UserActivity, Id);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
|
||||
throw new NotSupportedException(fn + " User Account Id cannot be changed");
|
||||
if (ItemId.IsValid(ItemId) && ItemId.Type != data.ItemId.Type && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
|
||||
throw new NotSupportedException(fn + " Item Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public SysId UserAccountId
|
||||
{
|
||||
get { return data.UserAccountId; }
|
||||
protected set { data.UserAccountId = value; }
|
||||
}
|
||||
public ItemId ItemId
|
||||
{
|
||||
get { return data.ItemId; }
|
||||
protected set { data.ItemId = value; }
|
||||
}
|
||||
public Sax.ActivityReaction Reaction
|
||||
{
|
||||
get { return data.Reaction; }
|
||||
set { data.Reaction = value; }
|
||||
}
|
||||
public String UserActivityData
|
||||
{
|
||||
get { return data.UserActivityData; }
|
||||
set { data.UserActivityData = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags - positions 1-16 available.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
/// </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
|
||||
public List<ItemId> ItemIdsIncluded { get; } = new List<ItemId>();
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Table aliases - blank if not linked.
|
||||
public String Alias_UserActivity { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list extension methods.
|
||||
public static class SaxUserActivityList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -97,9 +97,9 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
UserAccountId = data.UserAccountId;
|
||||
SportId = data.SportId;
|
||||
Participation = data.Participation;
|
||||
Officiating = data.Officiating;
|
||||
SportId = data.SportId;
|
||||
UserSportData = data.UserSportData;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SaxActivityMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// Activity Mgr - User Activity
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxUserActivity CreateUserActivity(SysId userAccountId, ItemId itemId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxUserActivity GetUserActivity(SaxUserActivity.Params prmUserActivity);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidUserActivity(SaxUserActivity userActivity)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (userActivity == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidUserActivityData(userActivity.GetData(), new SaxUserActivity.ErrField());
|
||||
}
|
||||
public virtual bool IsValidUserActivityData(SaxUserActivity.Data data, SaxUserActivity.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// User Account.
|
||||
if (errField.UserAccountId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.UserAccountId))
|
||||
{
|
||||
errField.UserAccountId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("User Account Id must be specified");
|
||||
}
|
||||
// Item Id.
|
||||
if (errField.ItemId != SacsHierarchyItem.ValidValue.Ignore && !ItemId.IsValid(data.ItemId))
|
||||
{
|
||||
errField.ItemId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item Id must be specified");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.UserActivity_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(data.StatusCode, "status", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.UserActivity_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SaxUserActivity.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Associated data - ignore for existing or deleted items.
|
||||
if (!SysId.IsValid(data.Id) && !data.IsStatusDeleted)
|
||||
{
|
||||
// User must exist.
|
||||
if (errField.UserAccountId != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (SysId.IsValid(data.UserAccountId))
|
||||
{
|
||||
SaxUserAccount.Params prmUserAccount = new SaxUserAccount.Params();
|
||||
prmUserAccount.IdsIncluded.Add(data.UserAccountId);
|
||||
prmUserAccount.StatusCat = SaxUserAccount.StatusCat.NotDeleted;
|
||||
if (AccountMgr.GetUserAccountCount(prmUserAccount) < 1)
|
||||
{
|
||||
errField.UserAccountId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid user specified");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// UserActivity database interface.
|
||||
public abstract bool InsertUserActivity(SaxUserActivity userActivity, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateUserActivity(SaxUserActivity userActivity, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool UserActivityCanBeDeleted(SaxUserActivity userActivity)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteUserActivity(SaxUserActivity userActivity, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// UserActivity list:
|
||||
public abstract ColumnDfn GetUserActivityColumnDfn(SaxUserActivity.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetUserActivityQueryFilter(SaxUserActivity.Params prmUserActivity);
|
||||
public abstract long GetUserActivityCount(SaxUserActivity.Params prmUserActivity);
|
||||
public abstract List<SaxUserActivity> GetUserActivityList(SaxUserActivity.Params prmUserActivity);
|
||||
public abstract DbResultSet ExecuteUserActivityQuery(List<ColumnDfn> columns, SaxUserActivity.Params prmUserActivity);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Extract and format result set data value where specific handling is required.
|
||||
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
|
||||
/// </summary>
|
||||
public virtual DataValue GetUserActivityDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxUserActivity.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// Data item type.
|
||||
case SaxUserActivity.Column.ItemType_Code:
|
||||
{
|
||||
value = new DataValue(DataItemTypeCodes.GetCodeForType(values.GetLong(column.DataName)));
|
||||
}
|
||||
break;
|
||||
case SaxUserActivity.Column.ItemType_Desc:
|
||||
{
|
||||
value = new DataValue(DataItemTypeCodes.GetDescForType(values.GetLong(column.DataName)));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Notes - limit to 200 chars.
|
||||
case SaxUserActivity.Column.Notes:
|
||||
{
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Status.
|
||||
case SaxUserActivity.Column.Status_Desc:
|
||||
case SaxUserActivity.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SaxUserActivity.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||
else if (column.Id == (int)SaxUserActivity.Column.Status_Ind)
|
||||
value = new DataValue(SaxUserActivity.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -66,6 +66,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
public SaxActivityMgr ActivityMgr { get { return Internals.ActivityMgr; } }
|
||||
public SaxItemDataMgr ItemDataMgr { get { return Internals.ItemDataMgr; } }
|
||||
// Application codes.
|
||||
public List<TypeCodeDesc> DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } }
|
||||
public List<TypeCodeDesc> SportParticipationCodes { get { return Internals.SportParticipationCodes; } }
|
||||
public List<TypeCodeDesc> SportOfficiatingCodes { get { return Internals.SportOfficiatingCodes; } }
|
||||
public List<TypeCodeDesc> RegionTypeCodes { get { return Internals.RegionTypeCodes; } }
|
||||
@@ -74,7 +75,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
public List<TypeCodeDesc> OrganisationCategoryCodes { get { return Internals.OrganisationCategoryCodes; } }
|
||||
public List<TypeCodeDesc> OrganisationRoleCodes { get { return Internals.OrganisationRoleCodes; } }
|
||||
public List<TypeCodeDesc> OpportunityTypeCodes { get { return Internals.OpportunityTypeCodes; } }
|
||||
public List<TypeCodeDesc> DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } }
|
||||
public List<TypeCodeDesc> ActivityReactionCodes { get { return Internals.ActivityReactionCodes; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user