This commit is contained in:
2022-02-16 10:47:45 +00:00
parent 5d15b28456
commit 4a394d3ff7
75 changed files with 3127 additions and 691 deletions
+18 -5
View File
@@ -53,7 +53,16 @@ namespace Saxonite.Net.Standard.Base.App
public static String Name { get; } = "Saxonite.Online.Session";
public static bool HttpOnly { get; } = true;
public static TimeSpan IdleTimeout { get; } = SacsSystem.DebugMode ? TimeSpan.FromMinutes(5) : TimeSpan.FromMinutes(60);
public static long RememberMeTimeoutMilis { get; } = (long)(SacsSystem.DebugMode ? TimeSpan.FromMinutes(2) : TimeSpan.FromMinutes(10)).TotalMilliseconds;
public static long RememberMeTimeoutMilis { get; } = (long)(SacsSystem.DebugMode ? TimeSpan.FromMinutes(1) : TimeSpan.FromMinutes(15)).TotalMilliseconds;
}
public static class DataCommit
{
public static class IntervalSecs
{
public static int Initial { get; } = SacsSystem.DebugMode ? 10 : 10;
public static int DataWaiting { get; } = SacsSystem.DebugMode ? 1 : 2;
public static int NoDataWaiting { get; } = SacsSystem.DebugMode ? 5 : 10;
}
}
}
public static class DataCache
@@ -61,19 +70,23 @@ namespace Saxonite.Net.Standard.Base.App
public static class RefreshIntervalSecs
{
public static int Initial { get; } = SacsSystem.DebugMode ? 2 : 5;
public static int Periodic { get; } = SacsSystem.DebugMode ? 60 : 1800;
public static int Periodic { get; } = SacsSystem.DebugMode ? 120 : 1800;
}
}
public static class Articles
{
public static ushort PublishMaxDaysAhead { get; } = 14;
}
public static class Search
{
public static class Users
{
public static ushort PageLengthDefault { get; } = 12;
public static ushort PageLengthDefault { get; } = 8;
public static ushort PageLengthMax { get; } = 20;
}
public static class Organisations
{
public static ushort PageLengthDefault { get; } = 12;
public static ushort PageLengthDefault { get; } = 8;
public static ushort PageLengthMax { get; } = 20;
}
}
@@ -88,7 +101,7 @@ namespace Saxonite.Net.Standard.Base.App
public static String Name { get; } = "Saxonite.Admin.Session";
public static bool HttpOnly { get; } = true;
public static TimeSpan IdleTimeout { get; } = SacsSystem.DebugMode ? TimeSpan.FromMinutes(5) : TimeSpan.FromMinutes(15);
public static long KeepLoggedInTimeoutMillis { get; } = (long)(SacsSystem.DebugMode ? TimeSpan.FromMinutes(2) : TimeSpan.FromMinutes(10)).TotalMilliseconds;
public static long KeepLoggedInTimeoutMillis { get; } = (long)(SacsSystem.DebugMode ? TimeSpan.FromMinutes(1) : TimeSpan.FromMinutes(5)).TotalMilliseconds;
}
}
}
+6 -1
View File
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
//-------------------------------------------------------------------
public static class Version
{
private static String version { get; } = "1.2.2";
private static String version { get; } = "1.2.3.1";
// Retrieve version.
public static String GetFullVersion () { return version; }
public static String GetAppVersion ()
@@ -40,6 +40,11 @@ namespace Saxonite.Net.Standard.Base.App
//-------------------------------------------------------------------
// Version history.
//-------------------------------------------------------------------
// 1.2.3 16-Feb-2022 User online activity.
// - Record user last online.
// - Online Organisation category select - remove Partner/Other.
// - Online Article edit - clear publication on add, future publication.
// - Admin Users - region selection.
// 1.2.2 8-Dec-2021 Online Activities.
// - Organisation Events.
// 1.2.1 20-Nov-2021 Online Profile.
+1
View File
@@ -218,6 +218,7 @@ namespace Saxonite.Net.Standard.Base.App
/* Do not change the names/codes - tied to database. */
Association,
Club,
Society,
Education,
Syndicate,
/// <summary>Commercial partner</summary>
+51 -45
View File
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Wed 8-Dec-2021 14:16:53
// Code generated by Sarand Database Utilities Sat 15-Jan-2022 16:34:34
//---------------------------------------------------------------------------
namespace Saxonite.Base.App
{
@@ -29,6 +29,7 @@ namespace Saxonite.Base.App
Sport,
UserAccount,
UserActivity,
UserOnline,
UserOrganisation,
UserRole,
UserSession,
@@ -280,6 +281,8 @@ namespace Saxonite.Base.App
UserActivity_UpdateOn,
UserActivity_UpdateBy,
UserActivity_UpdateHost,
UserOnline_UserAccountId,
UserOnline_OnlineAt,
UserOrganisation_Id,
UserOrganisation_UserAccountId,
UserOrganisation_OrganisationId,
@@ -356,8 +359,8 @@ namespace Saxonite.Base.App
//-------------------------------------------------------------------
// Data members.
private static readonly int tableCount = 17;
private static readonly int columnCount = 311;
private static readonly int tableCount = 18;
private static readonly int columnCount = 313;
private static ulong maxTextLen = 0;
//-------------------------------------------------------------------
@@ -515,6 +518,7 @@ namespace Saxonite.Base.App
"Sport",
"UserAccount",
"UserActivity",
"UserOnline",
"UserOrganisation",
"UserRole",
"UserSession",
@@ -785,24 +789,14 @@ namespace Saxonite.Base.App
new ColumnDfn(12,"UpdateOn",9,93,false,23),
new ColumnDfn(12,"UpdateBy",4,4,false,10),
new ColumnDfn(12,"UpdateHost",0,12,false,100),
new ColumnDfn(13,"Id",5,-5,true,19),
new ColumnDfn(13,"UserAccountId",4,4,false,10),
new ColumnDfn(13,"OrganisationId",4,4,false,10),
new ColumnDfn(13,"OrganisationRoleCodes",0,12,false,256),
new ColumnDfn(13,"OrganisationRoleCount",2,-6,false,3),
new ColumnDfn(13,"AdminComment",0,-9,false,2000),
new ColumnDfn(13,"Notes",0,-9,false,2000),
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(13,"OnlineAt",9,93,false,16),
new ColumnDfn(14,"Id",5,-5,true,19),
new ColumnDfn(14,"UserAccountId",4,4,false,10),
new ColumnDfn(14,"UserRoleCode",0,12,false,16),
new ColumnDfn(14,"OrganisationId",4,4,false,10),
new ColumnDfn(14,"OrganisationRoleCodes",0,12,false,256),
new ColumnDfn(14,"OrganisationRoleCount",2,-6,false,3),
new ColumnDfn(14,"AdminComment",0,-9,false,2000),
new ColumnDfn(14,"Notes",0,-9,false,2000),
new ColumnDfn(14,"Flags",3,5,false,5),
new ColumnDfn(14,"Status",0,12,false,3),
@@ -812,42 +806,31 @@ namespace Saxonite.Base.App
new ColumnDfn(14,"UpdateOn",9,93,false,23),
new ColumnDfn(14,"UpdateBy",4,4,false,10),
new ColumnDfn(14,"UpdateHost",0,12,false,100),
new ColumnDfn(15,"Id",5,-5,true,19),
new ColumnDfn(15,"UserAccountId",4,4,false,10),
new ColumnDfn(15,"ActivityIndexIds",0,-9,false,0),
new ColumnDfn(15,"UserSessionData",0,-9,false,0),
new ColumnDfn(15,"UserRoleCode",0,12,false,16),
new ColumnDfn(15,"Notes",0,-9,false,2000),
new ColumnDfn(15,"Flags",3,5,false,5),
new ColumnDfn(15,"Status",0,12,false,3),
new ColumnDfn(15,"CreateOn",9,93,false,23),
new ColumnDfn(15,"CreateBy",4,4,false,10),
new ColumnDfn(15,"CreateHost",0,12,false,100),
new ColumnDfn(15,"UpdateOn",9,93,false,23),
new ColumnDfn(16,"Id",5,-5,true,19),
new ColumnDfn(15,"UpdateBy",4,4,false,10),
new ColumnDfn(15,"UpdateHost",0,12,false,100),
new ColumnDfn(16,"UserAccountId",4,4,false,10),
new ColumnDfn(16,"SportId",4,4,false,10),
new ColumnDfn(16,"About",0,-9,false,2000),
new ColumnDfn(16,"Participation",3,5,false,5),
new ColumnDfn(16,"Officiating",3,5,false,5),
new ColumnDfn(16,"UserSportData",0,-9,false,0),
new ColumnDfn(16,"Notes",0,-9,false,2000),
new ColumnDfn(16,"ActivityIndexIds",0,-9,false,0),
new ColumnDfn(16,"UserSessionData",0,-9,false,0),
new ColumnDfn(16,"Flags",3,5,false,5),
new ColumnDfn(16,"Status",0,12,false,3),
new ColumnDfn(16,"CreateOn",9,93,false,23),
new ColumnDfn(16,"CreateBy",4,4,false,10),
new ColumnDfn(16,"CreateHost",0,12,false,100),
new ColumnDfn(16,"UpdateOn",9,93,false,23),
new ColumnDfn(16,"UpdateBy",4,4,false,10),
new ColumnDfn(16,"UpdateHost",0,12,false,100),
new ColumnDfn(17,"Id",5,-5,true,19),
new ColumnDfn(17,"UserSportId",5,-5,false,19),
new ColumnDfn(17,"PeriodFrom",9,93,false,16),
new ColumnDfn(17,"PeriodTo",9,93,false,16),
new ColumnDfn(17,"OrganisationId",4,4,false,10),
new ColumnDfn(17,"OrganisationName",0,-9,false,200),
new ColumnDfn(17,"Summary",0,-9,false,2000),
new ColumnDfn(17,"Team",0,-9,false,64),
new ColumnDfn(17,"League",0,-9,false,64),
new ColumnDfn(17,"Speciality",0,-9,false,64),
new ColumnDfn(17,"SpecialitiesOther",0,-9,false,1000),
new ColumnDfn(17,"RegionIdNation",4,4,false,10),
new ColumnDfn(17,"RegionIdProvince",4,4,false,10),
new ColumnDfn(17,"UserSportExperienceData",0,-9,false,0),
new ColumnDfn(17,"UserAccountId",4,4,false,10),
new ColumnDfn(17,"SportId",4,4,false,10),
new ColumnDfn(17,"About",0,-9,false,2000),
new ColumnDfn(17,"Participation",3,5,false,5),
new ColumnDfn(17,"Officiating",3,5,false,5),
new ColumnDfn(17,"UserSportData",0,-9,false,0),
new ColumnDfn(17,"Notes",0,-9,false,2000),
new ColumnDfn(17,"Flags",3,5,false,5),
new ColumnDfn(17,"Status",0,12,false,3),
@@ -857,6 +840,29 @@ namespace Saxonite.Base.App
new ColumnDfn(17,"UpdateOn",9,93,false,23),
new ColumnDfn(17,"UpdateBy",4,4,false,10),
new ColumnDfn(17,"UpdateHost",0,12,false,100),
new ColumnDfn(18,"Id",5,-5,true,19),
new ColumnDfn(18,"UserSportId",5,-5,false,19),
new ColumnDfn(18,"PeriodFrom",9,93,false,16),
new ColumnDfn(18,"PeriodTo",9,93,false,16),
new ColumnDfn(18,"OrganisationId",4,4,false,10),
new ColumnDfn(18,"OrganisationName",0,-9,false,200),
new ColumnDfn(18,"Summary",0,-9,false,2000),
new ColumnDfn(18,"Team",0,-9,false,64),
new ColumnDfn(18,"League",0,-9,false,64),
new ColumnDfn(18,"Speciality",0,-9,false,64),
new ColumnDfn(18,"SpecialitiesOther",0,-9,false,1000),
new ColumnDfn(18,"RegionIdNation",4,4,false,10),
new ColumnDfn(18,"RegionIdProvince",4,4,false,10),
new ColumnDfn(18,"UserSportExperienceData",0,-9,false,0),
new ColumnDfn(18,"Notes",0,-9,false,2000),
new ColumnDfn(18,"Flags",3,5,false,5),
new ColumnDfn(18,"Status",0,12,false,3),
new ColumnDfn(18,"CreateOn",9,93,false,23),
new ColumnDfn(18,"CreateBy",4,4,false,10),
new ColumnDfn(18,"CreateHost",0,12,false,100),
new ColumnDfn(18,"UpdateOn",9,93,false,23),
new ColumnDfn(18,"UpdateBy",4,4,false,10),
new ColumnDfn(18,"UpdateHost",0,12,false,100),
};
//-------------------------------------------------------------------
@@ -76,6 +76,7 @@ namespace Saxonite.Net.Standard.Base.App
//-------------------------------------------------------------------
// Properties.
public bool DebugMode { get; } = SacsSystem.DebugMode;
public SaxSystem System { get; }
public SaxSessionContext SessionContext { get; }
public ISacsDatabase CoreDatabase { get { return SaxGlobals.App.GetCoreDatabase(SessionContext); } }
@@ -113,6 +114,7 @@ namespace Saxonite.Net.Standard.Base.App
// Consoles.
public SaxConsoleHelper ConsoleHelper { get { return SaxGlobals.App.ConsoleHelper; } }
public SaxDataCacheConsole DataCacheConsole { get { return SaxGlobals.ConsoleHelper.GetDataCacheConsole(SessionContext); } }
public SaxSessionDataConsole SessionDataConsole { get { return SaxGlobals.ConsoleHelper.GetSessionDataConsole(SessionContext); } }
public SaxActivityConsole ActivityConsole { get { if (con.activityConsole == null) con.activityConsole = ConsoleHelper.CreateActivityConsole(SessionContext); return con.activityConsole; } }
public SaxEmailConsole EmailConsole { get { if (con.emailConsole == null) con.emailConsole = ConsoleHelper.CreateEmailConsole(SessionContext); return con.emailConsole; } }
@@ -166,7 +168,7 @@ namespace Saxonite.Net.Standard.Base.App
foreach (SaxRegion.Data regionData in regions)
regionCache[regionData.Id] = regionData.Clone();
regionCacheFullyPopulated = true;
SaLogger.Debug(GetType().Name + ".PopulateRegionCache(regions) Regions populated: " + regionCache.Count);
//if (DebugMode) SaLogger.Debug(GetType().Name + ".PopulateRegionCache(regions) Regions populated: " + regionCache.Count);
}
public void RefreshRegionCache()
{
@@ -234,7 +236,7 @@ namespace Saxonite.Net.Standard.Base.App
foreach (SaxSport.Data sportData in sports)
sportCache[sportData.Id] = sportData.Clone();
sportCacheFullyPopulated = true;
SaLogger.Debug(GetType().Name + ".PopulateSportCache(sports) Sports populated: " + sportCache.Count);
//if (DebugMode) SaLogger.Debug(GetType().Name + ".PopulateSportCache(sports) Sports populated: " + sportCache.Count);
}
public void RefreshSportCache()
{
@@ -137,6 +137,7 @@ namespace Saxonite.Net.Standard.Base.App
// Organisation categories.
organisationCategoryCodes.Add(Sax.OrganisationCategory.Association, "ASC", "Association");
organisationCategoryCodes.Add(Sax.OrganisationCategory.Club, "CLB", "Club");
organisationCategoryCodes.Add(Sax.OrganisationCategory.Society, "SOC", "Society");
organisationCategoryCodes.Add(Sax.OrganisationCategory.Education, "EDU", "Education");
organisationCategoryCodes.Add(Sax.OrganisationCategory.Syndicate, "SYN", "Syndicate");
organisationCategoryCodes.Add(Sax.OrganisationCategory.Partner, "PRT", "Partner");
@@ -267,6 +267,7 @@ namespace Saxonite.Net.Standard.Base.Bus
public String NameFull { get; set; }
public String NamePartial { get; set; }
public Sax.OrganisationCategory OrganisationCategory { get; set; } = Sax.OrganisationCategory.Unknown;
public List<Sax.OrganisationCategory> OrganisationCategoriesExcluded { get; } = new List<Sax.OrganisationCategory>();
public Sax.OrganisationType OrganisationType { get; set; } = Sax.OrganisationType.Unknown;
/// <summary>Partial match on a number of fields, including name, sport, address, etc.</summary>
public String OrganisationFilter { get; set; }
@@ -496,7 +496,7 @@ namespace Saxonite.Net.Standard.Base.Bus
public String NamePartial { get; set; }
/// <summary>Exact match on various user account properties including name, email etc.</summary>
public String UserFilter { get; set; }
/// <summary>Partial match on various user account properties including name, countries etc. Not to be use din Online application!</summary>
/// <summary>Partial match on various user account properties including name, countries etc. Not to be used in Online application!</summary>
public String UserFilterPartial { get; set; }
public List<SysId> SportIdsIncluded { get; } = new List<SysId>();
public List<SysId> RegionIdsIncluded { get; } = new List<SysId>();
@@ -0,0 +1,170 @@
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
{
//=======================================================================
// UserRole.
//=======================================================================
public abstract class SaxUserOnline : SacsHierarchyItem
{
//-------------------------------------------------------------------
// Columns.
public enum Column
{
Pos,
UserAccountId,
OnlineOn,
OnlineAt,
// User properties.
EmailAddress,
Title, FirstName, LastName,
LastLoginAt,
}
//-------------------------------------------------------------------
/// <summary>Properties other than common.</summary>
public class DataProperties
{
public SysId UserAccountId { get; set; }
public DateTime OnlineAt { get; set; }
}
//-------------------------------------------------------------------
// Data.
public new class Data : SacsHierarchyItem.Data
{
// Data members.
private readonly DataProperties data = new DataProperties();
// Construction.
public Data()
{
}
// Properties.
public SysId UserAccountId
{
get { return data.UserAccountId; }
set { CheckChanged(data.UserAccountId, value); data.UserAccountId = value; }
}
public DateTime OnlineAt
{
get { return data.OnlineAt; }
set { CheckChanged(data.OnlineAt, value); data.OnlineAt = value; }
}
// Population.
internal void PopulateFrom(Data data)
{
UserAccountId = data.UserAccountId;
OnlineAt = data.OnlineAt;
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 OnlineAt { get; set; } = ValidValue.Valid;
}
//-------------------------------------------------------------------
// Data members.
private readonly Data data = new Data();
//-------------------------------------------------------------------
// Construction.
protected SaxUserOnline(SysId userAccountId) : base()
{
base.SetData(data);
UserAccountId = userAccountId;
}
//-------------------------------------------------------------------
// Utilities.
//-------------------------------------------------------------------
// 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(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
throw new NotSupportedException(fn + " User Account Id cannot be changed");
this.data.PopulateFrom(data);
}
/// <summary>User Account Id. NB Can only be set where previously invalid.</summary>
public SysId UserAccountId
{
get { return data.UserAccountId; }
set
{
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
throw new NotSupportedException("UserRole.UserAccountId cannot be changed");
data.UserAccountId = value;
}
}
/// <summary>Online At - last time user was active Online.</summary>
public DateTime OnlineAt
{
get { return data.OnlineAt; }
set { data.OnlineAt = 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.
/// <summary>
/// Item list parameters.
/// </summary>
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
public DateTime OnlineOnFrom { get; set; }
public DateTime OnlineOnTo { get; set; }
/// <summary>Exact match on various user account properties including name, email etc.</summary>
public String UserFilter { get; set; }
/// <summary>Partial match on various user account properties including name, email etc. Not to be used in Online application!</summary>
public String UserFilterPartial { get; set; }
// User Account filters.
public List<SysId> SportIdsIncluded { get; } = new List<SysId>();
public List<SysId> RegionIdsIncluded { get; } = new List<SysId>();
// Table aliases - blank if not linked.
public String Alias_UserAccount { get; set; }
public String Alias_UserSport { get; set; }
}
//-------------------------------------------------------------------
}
//=======================================================================
// Item list extension methods.
public static class SaxUserOnlineList
{
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -18,6 +18,10 @@ namespace Saxonite.Net.Standard.Base.Consoles
// Data cache console.
public abstract SaxDataCacheConsole GetDataCacheConsole(SaxSessionContext sessionContext);
//-------------------------------------------------------------------
// Session data console.
public abstract SaxSessionDataConsole GetSessionDataConsole(SaxSessionContext sessionContext);
//-------------------------------------------------------------------
// Activity console.
public abstract SaxActivityConsole CreateActivityConsole(SaxSessionContext sessionContext);
@@ -0,0 +1,56 @@
using Sarand.Net.Standard.Base.Bus;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Saxonite.Net.Standard.Base.Consoles
{
//=======================================================================
// Some session data is stored to the database but, to avoid potential
// performance issues in action execution, the data to store is cached and
// periodically committed in batches.
//=======================================================================
public abstract class SaxSessionDataConsole : SaErrorStateItem
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Data members.
private SaxInternals internals = null;
//-------------------------------------------------------------------
// Construction.
protected SaxSessionDataConsole(SaxSessionContext sessionContext)
{
SessionContext = sessionContext;
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (internals != null) internals.Dispose(); internals = null;
}
}
//-------------------------------------------------------------------
// Properties.
protected SaxSessionContext SessionContext { get; }
protected SaxInternals Internals { get { if (internals == null) internals = new SaxInternals(SessionContext); return internals; } }
//-------------------------------------------------------------------
// User activity.
//-------------------------------------------------------------------
// Record latest user active time.
public abstract bool RecordUserActive(SysId userAccountId, DateTime activeAt);
//-------------------------------------------------------------------
// Data commit.
//-------------------------------------------------------------------
public abstract DateTime LastDataCommit();
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,120 @@
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.App;
using Saxonite.Net.Standard.Base.Bus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Saxonite.Net.Standard.Base.Mgr
{
//=======================================================================
partial class SaxAccountMgr
{
//*******************************************************************
// Account Mgr - User Online
//*******************************************************************
// Utilities.
public abstract bool CommitUsersOnline(IEnumerable <SaxUserOnline.DataProperties> usersOnline);
//-------------------------------------------------------------------
// Create item.
public abstract SaxUserOnline CreateUserOnline(SysId userAccountId);
//-------------------------------------------------------------------
// Item exists.
public bool UserOnlineExistsByUserAccountId(SysId userAccountId)
{
ClearErrorState();
if (!SysId.IsValid(userAccountId)) return false;
SaxUserOnline.Params prmUserOnline = new SaxUserOnline.Params();
prmUserOnline.UserAccountIdsIncluded.Add(userAccountId);
return GetUserOnlineCount(prmUserOnline) == 1;
}
//-------------------------------------------------------------------
// Retrieve individual items.
public abstract SaxUserOnline GetUserOnline(SaxUserOnline.Params prmUserOnline);
public SaxUserOnline GetUserOnlineByUserAccountId(SysId userAccountId)
{
ClearErrorState();
if (!SysId.IsValid(userAccountId)) return null;
SaxUserOnline.Params prmUserOnline = new SaxUserOnline.Params();
prmUserOnline.UserAccountIdsIncluded.Add(userAccountId);
return GetUserOnline(prmUserOnline);
}
//-------------------------------------------------------------------
// Validate item data.
public bool IsValidUserOnline(SaxUserOnline userRole)
{
ClearErrorState();
if (userRole == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
return IsValidUserOnlineData(userRole.GetData(), new SaxUserOnline.ErrField());
}
public virtual bool IsValidUserOnlineData(SaxUserOnline.Data data, SaxUserOnline.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");
}
// Online at.
if (errField.OnlineAt != SacsHierarchyItem.ValidValue.Ignore && !DateUtil.IsValid(data.OnlineAt))
{
errField.OnlineAt = SacsHierarchyItem.ValidValue.Invalid;
return SetErrorState("last online time must be specified");
}
//---------------------------------------------------------------
return true;
}
//-------------------------------------------------------------------
// Item database interface.
public abstract bool InsertUserOnline(SaxUserOnline userRole, DbUpdateInfo dbUpdateInfo);
public abstract bool UpdateUserOnline(SaxUserOnline userRole, DbUpdateInfo dbUpdateInfo);
public virtual bool UserOnlineCanBeDeleted(SaxUserOnline userRole)
{
ClearErrorState();
return true;
}
public abstract bool DeleteUserOnline(SaxUserOnline userRole, DbUpdateInfo dbUpdateInfo);
//-------------------------------------------------------------------
// Item list.
public abstract ColumnDfn GetUserOnlineColumnDfn(SaxUserOnline.Column columnId, String caption = "", int width = 0);
public abstract List<String> GetUserOnlineQueryFilter(SaxUserOnline.Params prmUserOnline);
public abstract long GetUserOnlineCount(SaxUserOnline.Params prmUserOnline);
public abstract List<SaxUserOnline> GetUserOnlineList(SaxUserOnline.Params prmUserOnline);
public abstract DbResultSet ExecuteUserOnlineQuery(List<ColumnDfn> columns, SaxUserOnline.Params prmUserOnline);
//-------------------------------------------------------------------
/// <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 GetUserOnlineDataValue(ColumnDfn column, NamedValue.Map values)
{
DataValue value = new DataValue();
switch ((SaxUserOnline.Column)column.Id)
{
//-----------------------------------------------------------
//-----------------------------------------------------------
}
return value;
}
//-------------------------------------------------------------------
}
//=======================================================================
}