171 lines
5.5 KiB
C#
171 lines
5.5 KiB
C#
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
|
|
{
|
|
//-------------------------------------------------------------------
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
|
|
//=======================================================================
|
|
}
|