v1.1.5.1
This commit is contained in:
@@ -0,0 +1,375 @@
|
||||
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.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
// UserSportExperience.
|
||||
//=======================================================================
|
||||
public abstract class SaxUserSportExperience : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
UserSportId,
|
||||
// Period.
|
||||
PeriodFrom,
|
||||
PeriodTo,
|
||||
// Organisation.
|
||||
OrganisationId,
|
||||
OrganisationName,
|
||||
Organisation_Name,
|
||||
// Properties.
|
||||
Summary,
|
||||
Team,
|
||||
League,
|
||||
Speciality,
|
||||
SpecialitiesOther,
|
||||
// Regions.
|
||||
RegionIdNation,
|
||||
Region_Nation_Name,
|
||||
RegionIdProvince,
|
||||
Region_Province_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 UserSportId { get; set; }
|
||||
public DateTime PeriodFrom { get; set; }
|
||||
public DateTime PeriodTo { get; set; }
|
||||
public SysId OrganisationId { get; set; }
|
||||
public String OrganisationName { get; set; }
|
||||
public String Summary { get; set; }
|
||||
public String Team { get; set; }
|
||||
public String League { get; set; }
|
||||
public String Speciality { get; set; }
|
||||
public HashSet<String> SpecialitiesOther { get; } = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
|
||||
public SysId RegionIdNation { get; set; }
|
||||
public SysId RegionIdProvince { get; set; }
|
||||
public String UserSportExperienceData { 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 UserSportId
|
||||
{
|
||||
get { return data.UserSportId; }
|
||||
set { CheckChanged(data.UserSportId, value); data.UserSportId = value; }
|
||||
}
|
||||
public DateTime PeriodFrom
|
||||
{
|
||||
get { return data.PeriodFrom; }
|
||||
set { CheckChanged(data.PeriodFrom, value); data.PeriodFrom = value; }
|
||||
}
|
||||
public DateTime PeriodTo
|
||||
{
|
||||
get { return data.PeriodTo; }
|
||||
set { CheckChanged(data.PeriodTo, value); data.PeriodTo = value; }
|
||||
}
|
||||
public SysId OrganisationId
|
||||
{
|
||||
get { return data.OrganisationId; }
|
||||
set { CheckChanged(data.OrganisationId, value); data.OrganisationId = value; }
|
||||
}
|
||||
public String OrganisationName
|
||||
{
|
||||
get { return data.OrganisationName; }
|
||||
set { CheckChanged(data.OrganisationName, value); data.OrganisationName = value; }
|
||||
}
|
||||
public String Summary
|
||||
{
|
||||
get { return data.Summary; }
|
||||
set { CheckChanged(data.Summary, value); data.Summary = value; }
|
||||
}
|
||||
public String Team
|
||||
{
|
||||
get { return data.Team; }
|
||||
set { CheckChanged(data.Team, value); data.Team = value; }
|
||||
}
|
||||
public String League
|
||||
{
|
||||
get { return data.League; }
|
||||
set { CheckChanged(data.League, value); data.League = value; }
|
||||
}
|
||||
public String Speciality
|
||||
{
|
||||
get { return data.Speciality; }
|
||||
set { CheckChanged(data.Speciality, value); data.Speciality = value; }
|
||||
}
|
||||
public ReadOnlyCollection<String> GetSpecialitiesOther()
|
||||
{
|
||||
return data.SpecialitiesOther.ToList().AsReadOnly();
|
||||
}
|
||||
public List<String> SpecialitiesOther
|
||||
{
|
||||
set
|
||||
{
|
||||
CheckChanged(data.SpecialitiesOther.ToList(), value);
|
||||
data.SpecialitiesOther.Clear();
|
||||
foreach (String speciality in value)
|
||||
{
|
||||
if (StringUtil.IsEmpty(speciality.Trim())) continue;
|
||||
data.SpecialitiesOther.Add(speciality.Trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
public SysId RegionIdNation
|
||||
{
|
||||
get { return data.RegionIdNation; }
|
||||
set { CheckChanged(data.RegionIdNation, value); data.RegionIdNation = value; }
|
||||
}
|
||||
public SysId RegionIdProvince
|
||||
{
|
||||
get { return data.RegionIdProvince; }
|
||||
set { CheckChanged(data.RegionIdProvince, value); data.RegionIdProvince = value; }
|
||||
}
|
||||
public String UserSportExperienceData
|
||||
{
|
||||
get { return data.UserSportExperienceData; }
|
||||
set { CheckChanged(data.UserSportExperienceData, value); data.UserSportExperienceData = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
UserSportId = data.UserSportId;
|
||||
PeriodFrom = data.PeriodFrom;
|
||||
PeriodTo = data.PeriodTo;
|
||||
OrganisationId = data.OrganisationId;
|
||||
Summary = data.Summary;
|
||||
Team = data.Team;
|
||||
League = data.League;
|
||||
Speciality = data.Speciality;
|
||||
SpecialitiesOther = data.GetSpecialitiesOther().ToList();
|
||||
RegionIdNation = data.RegionIdNation;
|
||||
RegionIdProvince = data.RegionIdProvince;
|
||||
UserSportExperienceData = data.UserSportExperienceData;
|
||||
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 UserSportId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PeriodFrom { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PeriodTo { get; set; } = ValidValue.Valid;
|
||||
public ValidValue OrganisationId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue OrganisationName { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Summary { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Team { get; set; } = ValidValue.Valid;
|
||||
public ValidValue League { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Speciality { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SpecialitiesOther { get; set; } = ValidValue.Valid;
|
||||
public ValidValue RegionIdNation { get; set; } = ValidValue.Valid;
|
||||
public ValidValue RegionIdProvince { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UserSportExperienceData { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
public static readonly String SpecialitiesOtherDelim = "\n";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxUserSportExperience(SysId id, SysId userSportId) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
UserSportId = userSportId;
|
||||
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.UserSportExperience, 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(UserSportId) && SysId.ToInt(UserSportId) != SysId.ToInt(data.UserSportId))
|
||||
throw new NotSupportedException(fn + " User Sport Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public SysId UserSportId
|
||||
{
|
||||
get { return data.UserSportId; }
|
||||
protected set { data.UserSportId = value; }
|
||||
}
|
||||
public DateTime PeriodFrom
|
||||
{
|
||||
get { return data.PeriodFrom; }
|
||||
set { data.PeriodFrom = value; }
|
||||
}
|
||||
public DateTime PeriodTo
|
||||
{
|
||||
get { return data.PeriodTo; }
|
||||
set { data.PeriodTo = value; }
|
||||
}
|
||||
public SysId OrganisationId
|
||||
{
|
||||
get { return data.OrganisationId; }
|
||||
set { data.OrganisationId = value; }
|
||||
}
|
||||
public String OrganisationName
|
||||
{
|
||||
get { return data.OrganisationName; }
|
||||
set { data.OrganisationName = value; }
|
||||
}
|
||||
public String Summary
|
||||
{
|
||||
get { return data.Summary; }
|
||||
set { data.Summary = value; }
|
||||
}
|
||||
public String Team
|
||||
{
|
||||
get { return data.Team; }
|
||||
set { data.Team = value; }
|
||||
}
|
||||
public String League
|
||||
{
|
||||
get { return data.League; }
|
||||
set { data.League = value; }
|
||||
}
|
||||
public String Speciality
|
||||
{
|
||||
get { return data.Speciality; }
|
||||
set { data.Speciality = value; }
|
||||
}
|
||||
public ReadOnlyCollection<String> GetSpecialitiesOther()
|
||||
{
|
||||
return data.GetSpecialitiesOther();
|
||||
}
|
||||
public List<String> SpecialitiesOther
|
||||
{
|
||||
set { data.SpecialitiesOther = value; }
|
||||
}
|
||||
public SysId RegionIdNation
|
||||
{
|
||||
get { return data.RegionIdNation; }
|
||||
set { data.RegionIdNation = value; }
|
||||
}
|
||||
public SysId RegionIdProvince
|
||||
{
|
||||
get { return data.RegionIdProvince; }
|
||||
set { data.RegionIdProvince = value; }
|
||||
}
|
||||
public String UserSportExperienceData
|
||||
{
|
||||
get { return data.UserSportExperienceData; }
|
||||
set { data.UserSportExperienceData = 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,
|
||||
ActiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <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> UserSportIdsIncluded { get; } = new List<SysId>();
|
||||
public DateTime PeriodFrom { get; set; }
|
||||
public DateTime PeriodTo { get; set; }
|
||||
public List<SysId> OrganisationIdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> RegionIdsNationIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> RegionIdsProvinceIncluded { get; } = new List<SysId>();
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list extension methods.
|
||||
public static class SaxUserSportExperienceList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user