Add project files.
This commit is contained in:
@@ -0,0 +1,214 @@
|
||||
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
|
||||
{
|
||||
//=======================================================================
|
||||
// ItemSport.
|
||||
//=======================================================================
|
||||
public abstract class SaxItemSport : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
// Item.
|
||||
ItemType,
|
||||
ItemType_Code,
|
||||
ItemType_Desc,
|
||||
ItemId,
|
||||
Item_Caption,
|
||||
// Sport.
|
||||
SportId,
|
||||
Sport_Name,
|
||||
// Associated data.
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Desc,
|
||||
Status_Ind,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public ItemId ItemId { get; set; }
|
||||
public SysId SportId { get; set; }
|
||||
public String ItemSportData { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Properties.
|
||||
public ItemId ItemId
|
||||
{
|
||||
get { return data.ItemId; }
|
||||
set { CheckChanged(data.ItemId, value); data.ItemId = value; }
|
||||
}
|
||||
public SysId SportId
|
||||
{
|
||||
get { return data.SportId; }
|
||||
set { CheckChanged(data.SportId, value); data.SportId = value; }
|
||||
}
|
||||
public String ItemSportData
|
||||
{
|
||||
get { return data.ItemSportData; }
|
||||
set { CheckChanged(data.ItemSportData, value); data.ItemSportData = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
ItemId = data.ItemId;
|
||||
SportId = data.SportId;
|
||||
ItemSportData = data.ItemSportData;
|
||||
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 ItemId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SportId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ItemSportData { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxItemSport(SysId id, ItemId itemId, SysId sportId) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
ItemId = itemId;
|
||||
SportId = sportId;
|
||||
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.ItemSport, 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 (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");
|
||||
if (SysId.IsValid(SportId) && SysId.ToInt(SportId) != SysId.ToInt(data.SportId))
|
||||
throw new NotSupportedException(fn + " Sport Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public ItemId ItemId
|
||||
{
|
||||
get { return data.ItemId; }
|
||||
protected set { data.ItemId = value; }
|
||||
}
|
||||
public SysId SportId
|
||||
{
|
||||
get { return data.SportId; }
|
||||
protected set { data.SportId = value; }
|
||||
}
|
||||
public String ItemSportData
|
||||
{
|
||||
get { return data.ItemSportData; }
|
||||
set { data.ItemSportData = 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<ItemId> ItemIdsIncluded { get; } = new List<ItemId>();
|
||||
public List<SysId> SportIdsIncluded { get; } = new List<SysId>();
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
public static class SaxItemSportList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
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
|
||||
{
|
||||
//=======================================================================
|
||||
// JournalistArticle.
|
||||
//=======================================================================
|
||||
public abstract class SaxJournalistArticle : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
// Journalist.
|
||||
UserAccountIdJournalist,
|
||||
Journalist_DisplayName,
|
||||
Journalist_Title,
|
||||
Journalist_FirstName,
|
||||
Journalist_LastName,
|
||||
// Region.
|
||||
RegionIdPrimary,
|
||||
Region_Name,
|
||||
// Sport.
|
||||
SportIdPrimary,
|
||||
Sport_Name,
|
||||
// Article.
|
||||
Headline,
|
||||
Summary,
|
||||
PublishedAt_Date,
|
||||
PublishedAt_DateTime,
|
||||
// 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 UserAccountIdJournalist { get; set; }
|
||||
public SysId RegionIdPrimary { get; set; }
|
||||
public SysId SportIdPrimary { get; set; }
|
||||
public String Headline { get; set; } = String.Empty;
|
||||
public String Summary { get; set; } = String.Empty;
|
||||
public String BodyData { get; set; } = String.Empty;
|
||||
public DateTime PublishedAt { 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 UserAccountIdJournalist
|
||||
{
|
||||
get { return data.UserAccountIdJournalist; }
|
||||
set { CheckChanged(data.UserAccountIdJournalist, value); data.UserAccountIdJournalist = value; }
|
||||
}
|
||||
public SysId RegionIdPrimary
|
||||
{
|
||||
get { return data.RegionIdPrimary; }
|
||||
set { CheckChanged(data.RegionIdPrimary, value); data.RegionIdPrimary = value; }
|
||||
}
|
||||
public SysId SportIdPrimary
|
||||
{
|
||||
get { return data.SportIdPrimary; }
|
||||
set { CheckChanged(data.SportIdPrimary, value); data.SportIdPrimary = value; }
|
||||
}
|
||||
public String Headline
|
||||
{
|
||||
get { return data.Headline; }
|
||||
set { CheckChanged(data.Headline, value); data.Headline = value; }
|
||||
}
|
||||
public String Summary
|
||||
{
|
||||
get { return data.Summary; }
|
||||
set { CheckChanged(data.Summary, value); data.Summary = value; }
|
||||
}
|
||||
public String BodyData
|
||||
{
|
||||
get { return data.BodyData; }
|
||||
set { CheckChanged(data.BodyData, value); data.BodyData = value; }
|
||||
}
|
||||
public DateTime PublishedAt
|
||||
{
|
||||
get { return data.PublishedAt; }
|
||||
set { CheckChanged(data.PublishedAt, value); data.PublishedAt = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
UserAccountIdJournalist = data.UserAccountIdJournalist;
|
||||
RegionIdPrimary = data.RegionIdPrimary;
|
||||
SportIdPrimary = data.SportIdPrimary;
|
||||
Headline = data.Headline;
|
||||
Summary = data.Summary;
|
||||
BodyData = data.BodyData;
|
||||
PublishedAt = data.PublishedAt;
|
||||
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 UserAccountIdJournalist { get; set; } = ValidValue.Valid;
|
||||
public ValidValue RegionIdPrimary { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SportIdPrimary { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Headline { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Summary { get; set; } = ValidValue.Valid;
|
||||
public ValidValue BodyData { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PublishedAt { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxJournalistArticle(SysId id, SysId UserAccountIdJournalist) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
this.UserAccountIdJournalist = UserAccountIdJournalist;
|
||||
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.JournalistArticle, 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(UserAccountIdJournalist) && SysId.ToInt(UserAccountIdJournalist) != SysId.ToInt(data.UserAccountIdJournalist))
|
||||
throw new NotSupportedException(fn + " UserAccountIdJournalist cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public SysId UserAccountIdJournalist
|
||||
{
|
||||
get { return data.UserAccountIdJournalist; }
|
||||
protected set { data.UserAccountIdJournalist = value; }
|
||||
}
|
||||
public SysId RegionIdPrimary
|
||||
{
|
||||
get { return data.RegionIdPrimary; }
|
||||
set { data.RegionIdPrimary = value; }
|
||||
}
|
||||
public String Headline
|
||||
{
|
||||
get { return data.Headline; }
|
||||
set { data.Headline = value; }
|
||||
}
|
||||
public String Summary
|
||||
{
|
||||
get { return data.Summary; }
|
||||
set { data.Summary = value; }
|
||||
}
|
||||
public SysId SportIdPrimary
|
||||
{
|
||||
get { return data.SportIdPrimary; }
|
||||
set { data.SportIdPrimary = value; }
|
||||
}
|
||||
public DateTime PublishedAt
|
||||
{
|
||||
get { return data.PublishedAt; }
|
||||
set { data.PublishedAt = value; }
|
||||
}
|
||||
public String BodyData
|
||||
{
|
||||
get { return data.BodyData; }
|
||||
set { data.BodyData = 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> UserAccountIdsJournalistIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> RegionIdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> SportIdsIncluded { get; set; } = new List<SysId>();
|
||||
public String HeadlinePartial { get; set; }
|
||||
public String SummaryPartial { get; set; }
|
||||
/// <summary>General filter value - headline, summary, sport, body etc. </summary>
|
||||
public String ArticleFilter { get; set; }
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
public static class SaxJournalistArticleList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
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
|
||||
{
|
||||
//=======================================================================
|
||||
// Organisation.
|
||||
//=======================================================================
|
||||
public abstract class SaxOrganisation : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
Name,
|
||||
OrganisationType,
|
||||
OrganisationType_Desc,
|
||||
OrganisationCategory,
|
||||
OrganisationCategory_Desc,
|
||||
PhoneMain,
|
||||
PhoneAlt,
|
||||
// Associated data.
|
||||
/// <summary>Number of users with an active interest in the organisation.</summary>
|
||||
User_Count,
|
||||
/// <summary>Number of users who are 'members' of the organisation.</summary>
|
||||
Member_Count,
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Desc,
|
||||
Status_Ind,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public String Name { get; set; } = String.Empty;
|
||||
public Sax.OrganisationType OrganisationType { get; set; }
|
||||
public Sax.OrganisationCategory OrganisationCategory { get; set; }
|
||||
public String PhoneMain { get; set; } = String.Empty;
|
||||
public String PhoneAlt { get; set; } = String.Empty;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data ()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Properties.
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { CheckChanged(data.Name, value); data.Name = value; }
|
||||
}
|
||||
public Sax.OrganisationType OrganisationType
|
||||
{
|
||||
get { return data.OrganisationType; }
|
||||
set { CheckChangedEnum(data.OrganisationType, value); data.OrganisationType = value; }
|
||||
}
|
||||
public Sax.OrganisationCategory OrganisationCategory
|
||||
{
|
||||
get { return data.OrganisationCategory; }
|
||||
set { CheckChangedEnum(data.OrganisationCategory, value); data.OrganisationCategory = value; }
|
||||
}
|
||||
public String PhoneMain
|
||||
{
|
||||
get { return data.PhoneMain; }
|
||||
set { CheckChanged(data.PhoneMain, value); data.PhoneMain = value; }
|
||||
}
|
||||
public String PhoneAlt
|
||||
{
|
||||
get { return data.PhoneAlt; }
|
||||
set { CheckChanged(data.PhoneAlt, value); data.PhoneAlt = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom (Data data)
|
||||
{
|
||||
Name = data.Name;
|
||||
OrganisationType = data.OrganisationType;
|
||||
OrganisationCategory = data.OrganisationCategory;
|
||||
PhoneMain = data.PhoneMain;
|
||||
PhoneAlt = data.PhoneAlt;
|
||||
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 Name { get; set; } = ValidValue.Valid;
|
||||
public ValidValue OrganisationType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue OrganisationCategory { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PhoneMain { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PhoneAlt { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxOrganisation (SysId id) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> validStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Active,
|
||||
SaStatus.OnHold,
|
||||
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.OnHold) return DataValue.TriStateType.Amber;
|
||||
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.Organisation, 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");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { data.Name = value; }
|
||||
}
|
||||
public Sax.OrganisationType OrganisationType
|
||||
{
|
||||
get { return data.OrganisationType; }
|
||||
set { data.OrganisationType = value; }
|
||||
}
|
||||
public Sax.OrganisationCategory OrganisationCategory
|
||||
{
|
||||
get { return data.OrganisationCategory; }
|
||||
set { data.OrganisationCategory = value; }
|
||||
}
|
||||
public String PhoneMain
|
||||
{
|
||||
get { return data.PhoneMain; }
|
||||
set { data.PhoneMain = value; }
|
||||
}
|
||||
public String PhoneAlt
|
||||
{
|
||||
get { return data.PhoneAlt; }
|
||||
set { data.PhoneAlt = 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 String NameFull { get; set; }
|
||||
public String NamePartial { get; set; }
|
||||
/// <summary>Partial match on a number of fields, including name, sport, address, etc.</summary>
|
||||
public String OrganisationFilter { get; set; }
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
public static class SaxOrganisationList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
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
|
||||
{
|
||||
//=======================================================================
|
||||
// Region.
|
||||
//=======================================================================
|
||||
public abstract class SaxRegion : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
RegionType,
|
||||
RegionType_Desc,
|
||||
CountryIso2Code,
|
||||
Name,
|
||||
// Parent region.
|
||||
RegionIdParent,
|
||||
Parent_Name,
|
||||
Parent_RegionType,
|
||||
Parent_RegionType_Desc,
|
||||
// Associated data.
|
||||
ChildRegionCount,
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Desc,
|
||||
Status_Ind,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public Sax.RegionType RegionType { get; set; } = Sax.RegionType.Unknown;
|
||||
public String CountryIso2Code { get; set; } = String.Empty;
|
||||
public String Name { get; set; } = String.Empty;
|
||||
public Decimal Latitude { get; set; }
|
||||
public Decimal Longitude { get; set; }
|
||||
public SysId RegionIdParent { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Properties.
|
||||
public Sax.RegionType RegionType
|
||||
{
|
||||
get { return data.RegionType; }
|
||||
set { CheckChangedEnum(data.RegionType, value); data.RegionType = value; }
|
||||
}
|
||||
public String CountryIso2Code
|
||||
{
|
||||
get { return data.CountryIso2Code; }
|
||||
set { CheckChanged(data.CountryIso2Code, value); data.CountryIso2Code = value; }
|
||||
}
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { CheckChanged(data.Name, value); data.Name = value; }
|
||||
}
|
||||
public Decimal Latitude
|
||||
{
|
||||
get { return data.Latitude; }
|
||||
set { CheckChanged(data.Latitude, value); data.Latitude = value; }
|
||||
}
|
||||
public Decimal Longitude
|
||||
{
|
||||
get { return data.Longitude; }
|
||||
set { CheckChanged(data.Longitude, value); data.Longitude = value; }
|
||||
}
|
||||
public SysId RegionIdParent
|
||||
{
|
||||
get { return data.RegionIdParent; }
|
||||
set { CheckChanged(data.RegionIdParent, value); data.RegionIdParent = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
RegionType = data.RegionType;
|
||||
CountryIso2Code = data.CountryIso2Code;
|
||||
Name = data.Name;
|
||||
Latitude = data.Latitude;
|
||||
Longitude = data.Longitude;
|
||||
RegionIdParent = data.RegionIdParent;
|
||||
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 RegionType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue CountryIso2Code { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Name { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Latitude { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Longitude { get; set; } = ValidValue.Valid;
|
||||
public ValidValue RegionIdParent { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxRegion(SysId id) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
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.Region, Id);
|
||||
}
|
||||
public static List<Sax.RegionType> GetValidParentRegionTypes(Sax.RegionType regionType)
|
||||
{
|
||||
List<Sax.RegionType> parentRegionTypes = new List<Sax.RegionType>();
|
||||
switch (regionType)
|
||||
{
|
||||
case Sax.RegionType.Continent:
|
||||
break;
|
||||
case Sax.RegionType.SubContinent:
|
||||
parentRegionTypes.Add(Sax.RegionType.Continent);
|
||||
break;
|
||||
case Sax.RegionType.Country:
|
||||
parentRegionTypes.Add(Sax.RegionType.Continent);
|
||||
parentRegionTypes.Add(Sax.RegionType.SubContinent);
|
||||
break;
|
||||
}
|
||||
return parentRegionTypes;
|
||||
}
|
||||
public static bool IsValidParentRegionType(Sax.RegionType regionType, Sax.RegionType parentRegionType)
|
||||
{
|
||||
return GetValidParentRegionTypes(regionType).Contains(parentRegionType);
|
||||
}
|
||||
public bool IsValidParentRegionType(Sax.RegionType parentRegionType)
|
||||
{
|
||||
return IsValidParentRegionType(RegionType, parentRegionType);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public Sax.RegionType RegionType
|
||||
{
|
||||
get { return data.RegionType; }
|
||||
set { data.RegionType = value; }
|
||||
}
|
||||
public String CountryIso2Code
|
||||
{
|
||||
get { return data.CountryIso2Code; }
|
||||
set { data.CountryIso2Code = value; }
|
||||
}
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { data.Name = value; }
|
||||
}
|
||||
public Decimal Latitude
|
||||
{
|
||||
get { return data.Latitude; }
|
||||
set { data.Latitude = value; }
|
||||
}
|
||||
public Decimal Longitude
|
||||
{
|
||||
get { return data.Longitude; }
|
||||
set { data.Longitude = value; }
|
||||
}
|
||||
public SysId RegionIdParent
|
||||
{
|
||||
get { return data.RegionIdParent; }
|
||||
set { data.RegionIdParent = 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> IncludedParentRegionIds { get; } = new List<SysId>();
|
||||
public Sax.RegionType RegionType { get; set; }
|
||||
public List<String> CountryIso2CodesIncluded { get; } = new List<String>();
|
||||
public List<String> CountryIso2CodesExcluded { get; } = new List<String>();
|
||||
/// <summary>Generic filter - partial region name, iso2 code or other matching value (tbd).</summary>
|
||||
public String RegionFilter { get; set; }
|
||||
public String NameFull { get; set; }
|
||||
public String NamePartial { get; set; }
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
public static class SaxRegionList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
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
|
||||
{
|
||||
//=======================================================================
|
||||
// Sport.
|
||||
//=======================================================================
|
||||
public abstract class SaxSport : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
Name,
|
||||
// Associated data.
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Desc,
|
||||
Status_Ind,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public String Name { get; set; } = String.Empty;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data ()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Properties.
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { CheckChanged(data.Name, value); data.Name = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom (Data data)
|
||||
{
|
||||
Name = data.Name;
|
||||
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 Name { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxSport (SysId id) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
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.Sport, 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");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { data.Name = 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> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
/// <summary>Generic filter - partial sport name, or other matching value (tbd).</summary>
|
||||
public String SportFilter { get; set; }
|
||||
public String NameFull { get; set; }
|
||||
public String NamePartial { get; set; }
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
public static class SaxSportList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,422 @@
|
||||
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;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SaxUserAccount : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
EmailAddress,
|
||||
Title,
|
||||
FirstName,
|
||||
Initials,
|
||||
LastName,
|
||||
PhoneMain,
|
||||
PhoneMobile,
|
||||
DateOfBirth,
|
||||
// Security.
|
||||
PasswordToken,
|
||||
PasswordChangedOn,
|
||||
PasswordChangedAt,
|
||||
// Login.
|
||||
LastLoginOn,
|
||||
LastLoginAt,
|
||||
LastInvalidLoginOn,
|
||||
LastInvalidLoginAt,
|
||||
InvalidLoginCount,
|
||||
// Associated data.
|
||||
UserRoleCount,
|
||||
SystemAdminUser,
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Desc,
|
||||
Status_Ind,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public String EmailAddress { get; set; } = String.Empty;
|
||||
public String Title { get; set; } = String.Empty;
|
||||
public String FirstName { get; set; } = String.Empty;
|
||||
public String Initials { get; set; } = String.Empty;
|
||||
public String LastName { get; set; } = String.Empty;
|
||||
public String PhoneMain { get; set; } = String.Empty;
|
||||
public String PhoneMobile { get; set; } = String.Empty;
|
||||
public DateTime DateOfBirth { get; set; }
|
||||
// Security.
|
||||
public String PasswordHashed { get; set; } = String.Empty;
|
||||
public List<String> PasswordHistory { get; } = new List<string>();
|
||||
public String PasswordToken { get; set; } = String.Empty;
|
||||
public DateTime PasswordChangedAt { get; set; } = DateTime.MinValue;
|
||||
// Login.
|
||||
public DateTime LastLoginAt { get; set; } = DateTime.MinValue;
|
||||
public DateTime LastInvalidLoginAt { get; set; } = DateTime.MinValue;
|
||||
public short InvalidLoginCount { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
// Properties.
|
||||
public String EmailAddress
|
||||
{
|
||||
get { return data.EmailAddress; }
|
||||
set { CheckChanged(data.EmailAddress, value); data.EmailAddress = value; }
|
||||
}
|
||||
public String Title
|
||||
{
|
||||
get { return data.Title; }
|
||||
set { CheckChanged(data.Title, value); data.Title = value; }
|
||||
}
|
||||
public String FirstName
|
||||
{
|
||||
get { return data.FirstName; }
|
||||
set { CheckChanged(data.FirstName, value); data.FirstName = value; }
|
||||
}
|
||||
public String Initials
|
||||
{
|
||||
get { return data.Initials; }
|
||||
set { CheckChanged(data.Initials, value); data.Initials = value; }
|
||||
}
|
||||
public String LastName
|
||||
{
|
||||
get { return data.LastName; }
|
||||
set { CheckChanged(data.LastName, value); data.LastName = value; }
|
||||
}
|
||||
public String PhoneMain
|
||||
{
|
||||
get { return data.PhoneMain; }
|
||||
set { CheckChanged(data.PhoneMain, value); data.PhoneMain = value; }
|
||||
}
|
||||
public String PhoneMobile
|
||||
{
|
||||
get { return data.PhoneMobile; }
|
||||
set { CheckChanged(data.PhoneMobile, value); data.PhoneMobile = value; }
|
||||
}
|
||||
public DateTime DateOfBirth
|
||||
{
|
||||
get { return data.DateOfBirth; }
|
||||
set { CheckChanged(data.DateOfBirth, value); data.DateOfBirth = value; }
|
||||
}
|
||||
// Security.
|
||||
public String PasswordHashed
|
||||
{
|
||||
get { return data.PasswordHashed; }
|
||||
set { CheckChanged(data.PasswordHashed, value); data.PasswordHashed = value; }
|
||||
}
|
||||
public List<String> PasswordHistory
|
||||
{
|
||||
get { return data.PasswordHistory; }
|
||||
set
|
||||
{
|
||||
CheckChanged(data.PasswordHistory, value);
|
||||
data.PasswordHistory.Clear();
|
||||
data.PasswordHistory.AddRange((value ?? new List<String>()).FindAll(item => !StringUtil.IsEmpty(StringUtil.TrimAll(item))));
|
||||
}
|
||||
}
|
||||
public String PasswordToken
|
||||
{
|
||||
get { return data.PasswordToken; }
|
||||
set { CheckChanged(data.PasswordToken, value); data.PasswordToken = value; }
|
||||
}
|
||||
public DateTime PasswordChangedAt
|
||||
{
|
||||
get { return data.PasswordChangedAt; }
|
||||
set { CheckChanged(data.PasswordChangedAt, value); data.PasswordChangedAt = value; }
|
||||
}
|
||||
// Login.
|
||||
public DateTime LastLoginAt
|
||||
{
|
||||
get { return data.LastLoginAt; }
|
||||
set { CheckChanged(data.LastLoginAt, value); data.LastLoginAt = value; }
|
||||
}
|
||||
public DateTime LastInvalidLoginAt
|
||||
{
|
||||
get { return data.LastInvalidLoginAt; }
|
||||
set { CheckChanged(data.LastInvalidLoginAt, value); data.LastInvalidLoginAt = value; }
|
||||
}
|
||||
public short InvalidLoginCount
|
||||
{
|
||||
get { return data.InvalidLoginCount; }
|
||||
set { CheckChanged(data.InvalidLoginCount, value); data.InvalidLoginCount = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
EmailAddress = data.EmailAddress;
|
||||
Title = data.Title;
|
||||
FirstName = data.FirstName;
|
||||
Initials = data.Initials;
|
||||
LastName = data.LastName;
|
||||
PhoneMain = data.PhoneMain;
|
||||
PhoneMobile = data.PhoneMobile;
|
||||
DateOfBirth = data.DateOfBirth;
|
||||
// Security.
|
||||
PasswordHashed = data.PasswordHashed;
|
||||
PasswordHistory = data.PasswordHistory;
|
||||
PasswordToken = data.PasswordToken;
|
||||
PasswordChangedAt = data.PasswordChangedAt;
|
||||
// Login.
|
||||
LastLoginAt = data.LastLoginAt;
|
||||
LastInvalidLoginAt = data.LastInvalidLoginAt;
|
||||
InvalidLoginCount = data.InvalidLoginCount;
|
||||
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 EmailAddress { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Title { get; set; } = ValidValue.Valid;
|
||||
public ValidValue FirstName { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Initials { get; set; } = ValidValue.Valid;
|
||||
public ValidValue LastName { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PhoneMain { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PhoneMobile { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DateOfBirth { get; set; } = ValidValue.Valid;
|
||||
// Security.
|
||||
public ValidValue Password { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PasswordHistory { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PasswordToken { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PasswordChanged { get; set; } = ValidValue.Valid;
|
||||
// Login.
|
||||
public ValidValue LastLogin { get; set; } = ValidValue.Valid;
|
||||
public ValidValue LastInvalidLogin { get; set; } = ValidValue.Valid;
|
||||
public ValidValue InvalidLoginCount { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
public static readonly String UserRoleDelim = ",";
|
||||
public static readonly String PasswordHistoryDelim = ",";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxUserAccount(SysId id) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> validStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Awaiting,
|
||||
SaStatus.Active,
|
||||
SaStatus.Inactive,
|
||||
SaStatus.Deleted,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Awaiting; } }
|
||||
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.Awaiting) return DataValue.TriStateType.Amber;
|
||||
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.UserAccount, Id);
|
||||
}
|
||||
public static String GetDisplayName(SaxUserAccount userAccount)
|
||||
{
|
||||
return GetDisplayName(userAccount.Title, userAccount.FirstName, userAccount.LastName);
|
||||
}
|
||||
public static String GetDisplayName(String title, String firstName, String lastName)
|
||||
{
|
||||
return StringUtil.TrimAll(StringUtil.EmptyOnNull(title) + " " + StringUtil.EmptyOnNull(firstName) + " " + StringUtil.EmptyOnNull(lastName));
|
||||
}
|
||||
public String GetDisplayName()
|
||||
{
|
||||
return GetDisplayName(this);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public String EmailAddress
|
||||
{
|
||||
get { return data.EmailAddress; }
|
||||
set { data.EmailAddress = value; }
|
||||
}
|
||||
public String Title
|
||||
{
|
||||
get { return data.Title; }
|
||||
set { data.Title = value; }
|
||||
}
|
||||
public String FirstName
|
||||
{
|
||||
get { return data.FirstName; }
|
||||
set { data.FirstName = value; }
|
||||
}
|
||||
public String Initials
|
||||
{
|
||||
get { return data.Initials; }
|
||||
set { data.Initials = value; }
|
||||
}
|
||||
public String LastName
|
||||
{
|
||||
get { return data.LastName; }
|
||||
set { data.LastName = value; }
|
||||
}
|
||||
public String PhoneMain
|
||||
{
|
||||
get { return data.PhoneMain; }
|
||||
set { data.PhoneMain = value; }
|
||||
}
|
||||
public String PhoneMobile
|
||||
{
|
||||
get { return data.PhoneMobile; }
|
||||
set { data.PhoneMobile = value; }
|
||||
}
|
||||
public DateTime DateOfBirth
|
||||
{
|
||||
get { return data.DateOfBirth; }
|
||||
set { data.DateOfBirth = value; }
|
||||
}
|
||||
|
||||
// Security.
|
||||
public String PasswordHashed
|
||||
{
|
||||
get { return data.PasswordHashed; }
|
||||
set { data.PasswordHashed = value; }
|
||||
}
|
||||
public List<String> PasswordHistory
|
||||
{
|
||||
get { return data.PasswordHistory; }
|
||||
set { data.PasswordHistory = value; }
|
||||
}
|
||||
public String PasswordToken
|
||||
{
|
||||
get { return data.PasswordToken; }
|
||||
set { data.PasswordToken = value; }
|
||||
}
|
||||
public DateTime PasswordChangedAt
|
||||
{
|
||||
get { return data.PasswordChangedAt; }
|
||||
set { data.PasswordChangedAt = value; }
|
||||
}
|
||||
|
||||
// Login.
|
||||
public DateTime LastLoginAt
|
||||
{
|
||||
get { return data.LastLoginAt; }
|
||||
set { data.LastLoginAt = value; }
|
||||
}
|
||||
public DateTime LastInvalidLoginAt
|
||||
{
|
||||
get { return data.LastInvalidLoginAt; }
|
||||
set { data.LastInvalidLoginAt = value; }
|
||||
}
|
||||
public short InvalidLoginCount
|
||||
{
|
||||
get { return data.InvalidLoginCount; }
|
||||
set { data.InvalidLoginCount = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags - positions 1-16 available.
|
||||
public Byte Flag_KeepLoggedIn_Admin { get; } = 0x1;
|
||||
public Byte Flag_KeepLoggedIn_Online { get; } = 0x2;
|
||||
public bool KeepLoggedIn_Admin
|
||||
{
|
||||
get { return GetFlag(Flag_KeepLoggedIn_Admin); }
|
||||
set { SetFlag(Flag_KeepLoggedIn_Admin, value); }
|
||||
}
|
||||
public bool KeepLoggedIn_Online
|
||||
{
|
||||
get { return GetFlag(Flag_KeepLoggedIn_Online); }
|
||||
set { SetFlag(Flag_KeepLoggedIn_Online, value); }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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 String EmailAddress { get; set; }
|
||||
public String NamePartial { get; set; }
|
||||
/// <summary>Partial match on various user account properties including name.</summary>
|
||||
public String UserAccountFilter { get; set; }
|
||||
public List<Sax.UserRole> ActiveRoles { get; } = new List<Sax.UserRole>();
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
public static class SaxUserAccountList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
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;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
// UserOrganisation.
|
||||
//=======================================================================
|
||||
public abstract class SaxUserOrganisation : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
UserAccountId,
|
||||
OrganisationId,
|
||||
OrganisationRoleCount,
|
||||
OrganisationRoleCodes,
|
||||
OrganisationRoleDescs,
|
||||
// User.
|
||||
User_EmailAddress,
|
||||
User_DisplayName,
|
||||
User_Title,
|
||||
User_FirstName,
|
||||
User_LastName,
|
||||
// Associated data.
|
||||
Organisation_Name,
|
||||
Organisation_Region_Name,
|
||||
Organisation_Sport_Name,
|
||||
// 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 SysId OrganisationId { get; set; }
|
||||
public List<Sax.OrganisationRole> OrganisationRoles { get; } = new List<Sax.OrganisationRole>();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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 SysId OrganisationId
|
||||
{
|
||||
get { return data.OrganisationId; }
|
||||
set { CheckChanged(data.OrganisationId, value); data.OrganisationId = value; }
|
||||
}
|
||||
public List<Sax.OrganisationRole> OrganisationRoles
|
||||
{
|
||||
get { return data.OrganisationRoles; }
|
||||
set { CheckChanged(data.OrganisationRoles, value); data.OrganisationRoles.Clear(); data.OrganisationRoles.AddRange(value); }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
UserAccountId = data.UserAccountId;
|
||||
OrganisationId = data.OrganisationId;
|
||||
OrganisationRoles = data.OrganisationRoles;
|
||||
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 OrganisationId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue OrganisationRoles { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
public static readonly String UserOrgnisationRoleDelim = ",";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxUserOrganisation(SysId id, SysId userAccountId, SysId organisationId) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
UserAccountId = userAccountId;
|
||||
OrganisationId = organisationId;
|
||||
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.UserOrganisation, Id);
|
||||
}
|
||||
public static List<Sax.OrganisationRole> GetOrganisationRolesFromCodes(String organisationRoleCodes)
|
||||
{
|
||||
return GetOrganisationRolesFromCodes(StringListUtil.Split(organisationRoleCodes, UserOrgnisationRoleDelim, true, true, true));
|
||||
}
|
||||
public static List<Sax.OrganisationRole> GetOrganisationRolesFromCodes(List<String> organisationRoleCodes)
|
||||
{
|
||||
List<Sax.OrganisationRole> organisationRoles = new List<Sax.OrganisationRole>();
|
||||
List<TypeCodeDesc> roles = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationRole);
|
||||
foreach (String organisationRoleCode in organisationRoleCodes)
|
||||
{
|
||||
Sax.OrganisationRole organisationRole = (Sax.OrganisationRole)roles.GetTypeForCode(organisationRoleCode);
|
||||
if (organisationRole == 0)
|
||||
organisationRole = EnumUtil.ParseEnum(organisationRoleCode, Sax.OrganisationRole.Unknown);
|
||||
if (organisationRole > 0)
|
||||
organisationRoles.Add(organisationRole);
|
||||
}
|
||||
return organisationRoles;
|
||||
}
|
||||
public List<String> GetOrganisationRoleCodes()
|
||||
{
|
||||
List<String> organisationRoleCodes = new List<string>();
|
||||
List<TypeCodeDesc> roles = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationRole);
|
||||
foreach (Sax.OrganisationRole organisationRole in OrganisationRoles)
|
||||
organisationRoleCodes.Add(roles.GetCodeForType(organisationRole));
|
||||
return organisationRoleCodes;
|
||||
}
|
||||
public String GetOrganisationRoleCodesData()
|
||||
{
|
||||
return GetOrganisationRoleCodes().Concat(UserOrgnisationRoleDelim);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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 (SysId.IsValid(OrganisationId) && SysId.ToInt(OrganisationId) != SysId.ToInt(data.OrganisationId))
|
||||
throw new NotSupportedException(fn + " Organisation 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("UserOrganisation.UserAccountId cannot be changed");
|
||||
data.UserAccountId = value;
|
||||
}
|
||||
}
|
||||
/// <summary>Organisation Id. NB Can only be set where previously invalid.</summary>
|
||||
public SysId OrganisationId
|
||||
{
|
||||
get { return data.OrganisationId; }
|
||||
set
|
||||
{
|
||||
if (SysId.IsValid(OrganisationId) && SysId.ToInt(OrganisationId) != SysId.ToInt(data.OrganisationId))
|
||||
throw new NotSupportedException("UserOrganisation.OrganisationId cannot be changed");
|
||||
data.OrganisationId = value;
|
||||
}
|
||||
}
|
||||
/// <summary>Prganisation Roles.</summary>
|
||||
public List<Sax.OrganisationRole> OrganisationRoles
|
||||
{
|
||||
get { return data.OrganisationRoles; }
|
||||
set { data.OrganisationRoles = 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<SysId> OrganisationIdsIncluded { get; } = new List<SysId>();
|
||||
/// <summary>Set true to restruct to User Organisations with at least one Organisation Role.</summary>
|
||||
public bool OrganisationMembersOnly { get; set; }
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
public static class SaxUserOrganisationList
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
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 SaxUserRole : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
UserAccountId,
|
||||
UserRole,
|
||||
UserRole_Desc,
|
||||
// User.
|
||||
User_EmailAddress,
|
||||
User_DisplayName,
|
||||
User_Title,
|
||||
User_FirstName,
|
||||
User_LastName,
|
||||
// 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 Sax.UserRole UserRole { 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 Sax.UserRole UserRole
|
||||
{
|
||||
get { return data.UserRole; }
|
||||
set { CheckChanged((int)data.UserRole, (int)value); data.UserRole = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
UserAccountId = data.UserAccountId;
|
||||
UserRole = data.UserRole;
|
||||
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 UserRole { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxUserRole(SysId id, SysId userAccountId, Sax.UserRole userRole) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
UserAccountId = userAccountId;
|
||||
UserRole = userRole;
|
||||
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.UserRole, 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 (UserRole == 0 && (int)UserRole != (int)UserRole)
|
||||
throw new NotSupportedException(fn + " User Role 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>User Role. Can only be populated on construction.</summary>
|
||||
public Sax.UserRole UserRole
|
||||
{
|
||||
get { return data.UserRole; }
|
||||
protected set { data.UserRole = 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<Sax.UserRole> UserRolesIncluded { get; } = new List<Sax.UserRole>();
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
public static class SaxUserRoleList
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Retrieve the first entry in the list matching the specified role.</summary>
|
||||
public static SaxUserRole GetUserRoleByRole(this List<SaxUserRole> values, Sax.UserRole userRole)
|
||||
{
|
||||
return values.Find(item => item.UserRole == userRole);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Retrieve the first entry in the list matching the specified role.</summary>
|
||||
public static List<SaxUserRole> GetUserRolesByStatus(this List<SaxUserRole> values, SaStatus status)
|
||||
{
|
||||
return values.FindAll(item => item.Status == status);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user