v1.1.5.1
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.1.4.1";
|
||||
private static String version { get; } = "1.1.5.1";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
@@ -40,9 +40,11 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Version history.
|
||||
//-------------------------------------------------------------------
|
||||
// 1.1.5 19-Aug-2021 Profile Sport Experience.
|
||||
// - Online Profile Sport Experience.
|
||||
// 1.1.4 9-Aug-2021 Organisation Articles.
|
||||
// - Journalist Article renamed Article and Organisation Id added.
|
||||
// - Online Organisation Articles.
|
||||
// - Online Organisation Articles. Contact Gender & DOB.
|
||||
// - Admin Send Emails for User.
|
||||
// 1.1.3 23-Jul-2021 Online Members.
|
||||
// - Online Members.
|
||||
|
||||
@@ -142,6 +142,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
UserRole = 101,
|
||||
UserOrganisation = 102,
|
||||
UserSport = 103,
|
||||
UserSportExperience = 104,
|
||||
Organisation = 120,
|
||||
// Activty data.
|
||||
ActivityIndex = 200,
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 11-Aug-2021 17:31:26
|
||||
// Code generated by Sarand Database Utilities Thu 19-Aug-2021 17:19:49
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
@@ -32,6 +32,7 @@ namespace Saxonite.Base.App
|
||||
UserRole,
|
||||
UserSession,
|
||||
UserSport,
|
||||
UserSportExperience,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -304,12 +305,35 @@ namespace Saxonite.Base.App
|
||||
UserSport_UpdateOn,
|
||||
UserSport_UpdateBy,
|
||||
UserSport_UpdateHost,
|
||||
UserSportExperience_Id,
|
||||
UserSportExperience_UserSportId,
|
||||
UserSportExperience_PeriodFrom,
|
||||
UserSportExperience_PeriodTo,
|
||||
UserSportExperience_OrganisationId,
|
||||
UserSportExperience_OrganisationName,
|
||||
UserSportExperience_Summary,
|
||||
UserSportExperience_Team,
|
||||
UserSportExperience_League,
|
||||
UserSportExperience_Speciality,
|
||||
UserSportExperience_SpecialitiesOther,
|
||||
UserSportExperience_RegionIdNation,
|
||||
UserSportExperience_RegionIdProvince,
|
||||
UserSportExperience_UserSportExperienceData,
|
||||
UserSportExperience_Notes,
|
||||
UserSportExperience_Flags,
|
||||
UserSportExperience_Status,
|
||||
UserSportExperience_CreateOn,
|
||||
UserSportExperience_CreateBy,
|
||||
UserSportExperience_CreateHost,
|
||||
UserSportExperience_UpdateOn,
|
||||
UserSportExperience_UpdateBy,
|
||||
UserSportExperience_UpdateHost,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 15;
|
||||
private static readonly int columnCount = 265;
|
||||
private static readonly int tableCount = 16;
|
||||
private static readonly int columnCount = 288;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -470,6 +494,7 @@ namespace Saxonite.Base.App
|
||||
"UserRole",
|
||||
"UserSession",
|
||||
"UserSport",
|
||||
"UserSportExperience",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -746,7 +771,7 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(14,"Flags",3,5,false,5),
|
||||
new ColumnDfn(14,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(14,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(15,"Id",4,4,true,10),
|
||||
new ColumnDfn(15,"Id",5,-5,true,19),
|
||||
new ColumnDfn(15,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(15,"SportId",4,4,false,10),
|
||||
new ColumnDfn(15,"Participation",3,5,false,5),
|
||||
@@ -761,6 +786,29 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(15,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(15,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(15,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(16,"Id",5,-5,true,19),
|
||||
new ColumnDfn(16,"UserSportId",5,-5,false,19),
|
||||
new ColumnDfn(16,"PeriodFrom",9,93,false,16),
|
||||
new ColumnDfn(16,"PeriodTo",9,93,false,16),
|
||||
new ColumnDfn(16,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(16,"OrganisationName",0,-9,false,200),
|
||||
new ColumnDfn(16,"Summary",0,-9,false,2000),
|
||||
new ColumnDfn(16,"Team",0,-9,false,64),
|
||||
new ColumnDfn(16,"League",0,-9,false,64),
|
||||
new ColumnDfn(16,"Speciality",0,-9,false,64),
|
||||
new ColumnDfn(16,"SpecialitiesOther",0,-9,false,1000),
|
||||
new ColumnDfn(16,"RegionIdNation",4,4,false,10),
|
||||
new ColumnDfn(16,"RegionIdProvince",4,4,false,10),
|
||||
new ColumnDfn(16,"UserSportExperienceData",0,-9,false,0),
|
||||
new ColumnDfn(16,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(16,"Flags",3,5,false,5),
|
||||
new ColumnDfn(16,"Status",0,12,false,3),
|
||||
new ColumnDfn(16,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(16,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(16,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(16,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(16,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(16,"UpdateHost",0,12,false,100),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -201,23 +201,29 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// User & Organisation combination must be unique.
|
||||
if (errField.UserAccountId != SacsHierarchyItem.ValidValue.Ignore && errField.OrganisationId != SacsHierarchyItem.ValidValue.Ignore)
|
||||
// Associated data - ignore for deleted items.
|
||||
if (!data.IsStatusDeleted)
|
||||
{
|
||||
if (SysId.IsValid(data.UserAccountId) && SysId.IsValid(data.OrganisationId))
|
||||
|
||||
// User & Organisation combination must be unique.
|
||||
if (errField.UserAccountId != SacsHierarchyItem.ValidValue.Ignore && errField.OrganisationId != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||
if (SysId.IsValid(data.Id))
|
||||
prmUserOrganisation.IdsExcluded.Add(data.Id);
|
||||
prmUserOrganisation.UserAccountIdsIncluded.Add(data.UserAccountId);
|
||||
prmUserOrganisation.OrganisationIdsIncluded.Add(data.OrganisationId);
|
||||
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.Any;
|
||||
if (GetUserOrganisationCount(prmUserOrganisation) > 0)
|
||||
if (SysId.IsValid(data.UserAccountId) && SysId.IsValid(data.OrganisationId))
|
||||
{
|
||||
errField.OrganisationId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Organisation must be unique for user");
|
||||
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||
if (SysId.IsValid(data.Id))
|
||||
prmUserOrganisation.IdsExcluded.Add(data.Id);
|
||||
prmUserOrganisation.UserAccountIdsIncluded.Add(data.UserAccountId);
|
||||
prmUserOrganisation.OrganisationIdsIncluded.Add(data.OrganisationId);
|
||||
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.Any;
|
||||
if (GetUserOrganisationCount(prmUserOrganisation) > 0)
|
||||
{
|
||||
errField.OrganisationId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Organisation must be unique for user");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Base.App;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SaxAccountMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// Account Mgr - User Sport Experience
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxUserSportExperience CreateUserSportExperience(SysId userUserId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool UserSportExperienceExistsById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SaxUserSportExperience.Params prmUserSportExperience = new SaxUserSportExperience.Params();
|
||||
prmUserSportExperience.IdsIncluded.Add(id);
|
||||
prmUserSportExperience.StatusCat = SaxUserSportExperience.StatusCat.Any;
|
||||
return GetUserSportExperienceCount(prmUserSportExperience) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxUserSportExperience GetUserSportExperience(SaxUserSportExperience.Params prmUserSportExperience);
|
||||
public SaxUserSportExperience GetUserSportExperienceById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SaxUserSportExperience.Params prmUserSportExperience = new SaxUserSportExperience.Params();
|
||||
prmUserSportExperience.IdsIncluded.Add(id);
|
||||
prmUserSportExperience.StatusCat = SaxUserSportExperience.StatusCat.Any;
|
||||
return GetUserSportExperience(prmUserSportExperience);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidUserSportExperience(SaxUserSportExperience userSportExperience)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (userSportExperience == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidUserSportExperienceData(userSportExperience.GetData(), new SaxUserSportExperience.ErrField());
|
||||
}
|
||||
public virtual bool IsValidUserSportExperienceData(SaxUserSportExperience.Data data, SaxUserSportExperience.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// User Sport.
|
||||
if (errField.UserSportId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.UserSportId))
|
||||
{
|
||||
errField.UserSportId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("User Sport Id must be specified");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Organisation name.
|
||||
if (errField.OrganisationName != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.OrganisationName, "organisation name", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.UserSportExperience_OrganisationName)))
|
||||
{
|
||||
errField.OrganisationName = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Summary.
|
||||
if (errField.Summary != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Summary, "summary", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Summary)))
|
||||
{
|
||||
errField.Summary = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Team.
|
||||
if (errField.Team != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Team, "team", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Team)))
|
||||
{
|
||||
errField.Team = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// League.
|
||||
if (errField.League != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.League, "league", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.UserSportExperience_League)))
|
||||
{
|
||||
errField.League = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Speciality.
|
||||
if (errField.Speciality != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Speciality, "speciality", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Speciality)))
|
||||
{
|
||||
errField.Speciality = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Other specialities.
|
||||
if (errField.SpecialitiesOther != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.GetSpecialitiesOther().ToList().Concat(SaxUserSportExperience.SpecialitiesOtherDelim), "other specialities", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.UserSportExperience_SpecialitiesOther)))
|
||||
{
|
||||
errField.Speciality = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Regions.
|
||||
if (errField.RegionIdNation != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
}
|
||||
if (errField.RegionIdProvince != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(data.StatusCode, "status", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.UserSportExperience_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SaxUserSportExperience.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Associated data - ignore for deleted items.
|
||||
if (!data.IsStatusDeleted)
|
||||
{
|
||||
|
||||
// User Sport must be valid.
|
||||
if (errField.UserSportId != SacsHierarchyItem.ValidValue.Ignore && errField.UserSportId != SacsHierarchyItem.ValidValue.Invalid)
|
||||
{
|
||||
if (SysId.IsValid(data.UserSportId))
|
||||
{
|
||||
if (!UserSportExistsById(data.UserSportId))
|
||||
{
|
||||
errField.UserSportId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("User Sport does not exist");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Regions.
|
||||
if (errField.RegionIdNation != SacsHierarchyItem.ValidValue.Ignore && errField.RegionIdNation != SacsHierarchyItem.ValidValue.Invalid && SysId.IsValid(data.RegionIdNation))
|
||||
{
|
||||
if (!ReferenceMgr.RegionExistsById(data.RegionIdNation))
|
||||
{
|
||||
errField.RegionIdNation = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid 'Nation' region");
|
||||
}
|
||||
}
|
||||
if (errField.RegionIdProvince != SacsHierarchyItem.ValidValue.Ignore && errField.RegionIdProvince != SacsHierarchyItem.ValidValue.Invalid && SysId.IsValid(data.RegionIdProvince))
|
||||
{
|
||||
if (!ReferenceMgr.RegionExistsById(data.RegionIdProvince))
|
||||
{
|
||||
errField.RegionIdProvince = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid 'Province' region");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item database interface.
|
||||
public abstract bool InsertUserSportExperience(SaxUserSportExperience userSportExperience, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateUserSportExperience(SaxUserSportExperience userSportExperience, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool UserSportExperienceCanBeDeleted(SaxUserSportExperience userSportExperience)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteUserSportExperience(SaxUserSportExperience userSportExperience, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetUserSportExperienceColumnDfn(SaxUserSportExperience.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetUserSportExperienceQueryFilter(SaxUserSportExperience.Params prmUserSportExperience);
|
||||
public abstract long GetUserSportExperienceCount(SaxUserSportExperience.Params prmUserSportExperience);
|
||||
public abstract List<SaxUserSportExperience> GetUserSportExperienceList(SaxUserSportExperience.Params prmUserSportExperience);
|
||||
public abstract DbResultSet ExecuteUserSportExperienceQuery(List<ColumnDfn> columns, SaxUserSportExperience.Params prmUserSportExperience);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Extract and format result set data value where specific handling is required.
|
||||
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
|
||||
/// </summary>
|
||||
public virtual DataValue GetUserSportExperienceDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxUserSportExperience.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// Organisation name.
|
||||
case SaxUserSportExperience.Column.Organisation_Name:
|
||||
{
|
||||
String organisationName = values.GetString(column.DataName).TrimAll();
|
||||
if (StringUtil.IsEmpty(organisationName))
|
||||
organisationName = values.GetString(GetUserSportExperienceColumnDfn(SaxUserSportExperience.Column.OrganisationName).DataName).TrimAll();
|
||||
value = new DataValue(organisationName);
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Notes.
|
||||
case SaxUserSportExperience.Column.Notes:
|
||||
{
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Status.
|
||||
case SaxUserSportExperience.Column.Status_Desc:
|
||||
case SaxUserSportExperience.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SaxUserSportExperience.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||
else if (column.Id == (int)SaxUserSportExperience.Column.Status_Ind)
|
||||
value = new DataValue(SaxUserSportExperience.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user