v1.0.4.0
This commit is contained in:
@@ -39,8 +39,10 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Version history.
|
||||
// 1.0.4 ?-May-2021 Online Profile Organisation
|
||||
// 1.0.4 20-May-2021 Online profile sports & opportunities
|
||||
// - Admin Organisation Region & Sport.
|
||||
// - Online Profile Sports - simple list with name.
|
||||
// - Online Organisation Opportunities.
|
||||
// 1.0.3 11-May-2021 Admin Organisation Members
|
||||
// - Admin data filters & styling, organisation members.
|
||||
// - Online Profile Organisations - simple list with name.
|
||||
|
||||
@@ -94,6 +94,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
OrganisationType,
|
||||
OrganisationCategory,
|
||||
OrganisationRole,
|
||||
OpportunityType,
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -124,6 +125,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
UserAccount = 100,
|
||||
UserRole = 101,
|
||||
UserOrganisation = 102,
|
||||
UserSport = 103,
|
||||
Organisation = 120,
|
||||
// Activty data.
|
||||
ScheduledEvent = 200,
|
||||
@@ -160,6 +162,18 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
SystemAdmin,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Sport Participation</summary>
|
||||
public enum SportParticipation
|
||||
{
|
||||
Unknown = 0,
|
||||
/* Do not change the values/codes - tied to database. */
|
||||
Regular,
|
||||
Occasional,
|
||||
Spectator,
|
||||
Interested
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Yes or No option.</summary>
|
||||
public enum YesNo
|
||||
@@ -226,6 +240,20 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
OpportunityAdmin,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Opportunity Type</summary>
|
||||
public enum OpportunityType
|
||||
{
|
||||
Unknown = 0,
|
||||
/* Do not change the values or codes - tied to database. */
|
||||
Playing,
|
||||
Official,
|
||||
Coaching,
|
||||
Volunteer,
|
||||
Staff,
|
||||
Board,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Mon 10-May-2021 16:59:32
|
||||
// Code generated by Sarand Database Utilities Thu 20-May-2021 17:19:55
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
@@ -26,6 +26,7 @@ namespace Saxonite.Base.App
|
||||
UserAccount,
|
||||
UserOrganisation,
|
||||
UserRole,
|
||||
UserSport,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -86,6 +87,7 @@ namespace Saxonite.Base.App
|
||||
OrganisationOpportunity_OrganisationId,
|
||||
OrganisationOpportunity_RegionIdPrimary,
|
||||
OrganisationOpportunity_SportIdPrimary,
|
||||
OrganisationOpportunity_OpportunityTypeCode,
|
||||
OrganisationOpportunity_Position,
|
||||
OrganisationOpportunity_Outline,
|
||||
OrganisationOpportunity_OpportunityData,
|
||||
@@ -179,12 +181,25 @@ namespace Saxonite.Base.App
|
||||
UserRole_UpdateOn,
|
||||
UserRole_UpdateBy,
|
||||
UserRole_UpdateHost,
|
||||
UserSport_Id,
|
||||
UserSport_UserAccountId,
|
||||
UserSport_SportId,
|
||||
UserSport_UserSportData,
|
||||
UserSport_Notes,
|
||||
UserSport_Flags,
|
||||
UserSport_Status,
|
||||
UserSport_CreateOn,
|
||||
UserSport_CreateBy,
|
||||
UserSport_CreateHost,
|
||||
UserSport_UpdateOn,
|
||||
UserSport_UpdateBy,
|
||||
UserSport_UpdateHost,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 9;
|
||||
private static readonly int columnCount = 146;
|
||||
private static readonly int tableCount = 10;
|
||||
private static readonly int columnCount = 160;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -339,6 +354,7 @@ namespace Saxonite.Base.App
|
||||
"UserAccount",
|
||||
"UserOrganisation",
|
||||
"UserRole",
|
||||
"UserSport",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -418,6 +434,7 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(4,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(4,"RegionIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(4,"SportIdPrimary",4,4,false,10),
|
||||
new ColumnDfn(4,"OpportunityTypeCode",0,12,false,3),
|
||||
new ColumnDfn(4,"Position",0,-9,false,200),
|
||||
new ColumnDfn(4,"Outline",0,-9,false,2000),
|
||||
new ColumnDfn(4,"OpportunityData",0,-9,false,0),
|
||||
@@ -511,6 +528,19 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(9,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(9,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(9,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(10,"Id",4,4,true,10),
|
||||
new ColumnDfn(10,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(10,"SportId",4,4,false,10),
|
||||
new ColumnDfn(10,"UserSportData",0,-9,false,0),
|
||||
new ColumnDfn(10,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(10,"Flags",3,5,false,5),
|
||||
new ColumnDfn(10,"Status",0,12,false,3),
|
||||
new ColumnDfn(10,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(10,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(10,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(10,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(10,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(10,"UpdateHost",0,12,false,100),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -66,6 +66,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public List<TypeCodeDesc> OrganisationTypes { get { return GetCodesOfType(Sax.CodeType.OrganisationType); } }
|
||||
public List<TypeCodeDesc> OrganisationCategories { get { return GetCodesOfType(Sax.CodeType.OrganisationCategory); } }
|
||||
public List<TypeCodeDesc> OrganisationRoles { get { return GetCodesOfType(Sax.CodeType.OrganisationRole); } }
|
||||
public List<TypeCodeDesc> OpportunityTypes { get { return GetCodesOfType(Sax.CodeType.OpportunityType); } }
|
||||
public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
|
||||
{
|
||||
if (!codeTypes.ContainsKey(codeType))
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
private static readonly List<TypeCodeDesc> organisationTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> organisationCategoryCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> organisationRoleCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> opportunityTypeCodes = new List<TypeCodeDesc>();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Static initialisation.</summary>
|
||||
@@ -62,7 +63,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
organisationTypeCodes.Add(Sax.OrganisationType.PublicSector, "PBS", "Public Sector");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Organisation types.
|
||||
// Organisation categories.
|
||||
organisationCategoryCodes.Add(Sax.OrganisationCategory.Association, "ASC", "Association");
|
||||
organisationCategoryCodes.Add(Sax.OrganisationCategory.Club, "CLB", "Club");
|
||||
organisationCategoryCodes.Add(Sax.OrganisationCategory.Education, "EDU", "Education");
|
||||
@@ -71,12 +72,21 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
organisationCategoryCodes.Add(Sax.OrganisationCategory.Other, "OTH", "Other");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Organisation types.
|
||||
// Organisation roles.
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.Member, "MBR", "Member");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.MemberAdmin, "MBA", "Member Admin");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.ScheduleAdmin, "SCA", "Schedule Admin");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.OpportunityAdmin, "OPA", "Opportunity Admin");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Opportunity types.
|
||||
opportunityTypeCodes.Add(Sax.OpportunityType.Playing, "PLG", "Playing");
|
||||
opportunityTypeCodes.Add(Sax.OpportunityType.Official, "OFL", "Official");
|
||||
opportunityTypeCodes.Add(Sax.OpportunityType.Coaching, "CHG", "Coaching");
|
||||
opportunityTypeCodes.Add(Sax.OpportunityType.Volunteer, "VTR", "Volunteer");
|
||||
opportunityTypeCodes.Add(Sax.OpportunityType.Staff, "STF", "Staff");
|
||||
opportunityTypeCodes.Add(Sax.OpportunityType.Board, "BRD", "Board");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
// Lists are cloned to avoid modifications to the internal static lists.
|
||||
switch (systemCode)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
case Sax.CodeType.YesNo:
|
||||
return new List<TypeCodeDesc>(yesNoCodes);
|
||||
case Sax.CodeType.RegionType:
|
||||
@@ -51,10 +50,12 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
return new List<TypeCodeDesc>(organisationCategoryCodes);
|
||||
case Sax.CodeType.OrganisationRole:
|
||||
return new List<TypeCodeDesc>(organisationRoleCodes);
|
||||
case Sax.CodeType.OpportunityType:
|
||||
return new List<TypeCodeDesc>(opportunityTypeCodes);
|
||||
|
||||
//-----------------------------------------------------------
|
||||
default:
|
||||
throw new NotSupportedException(nameof(SaxSystem) + ".GetCodesOfType Unexpected code type: " + systemCode.ToString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Text;
|
||||
namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
// JournalistArticle.
|
||||
// Journalist Article.
|
||||
//=======================================================================
|
||||
public abstract class SaxJournalistArticle : SacsHierarchyItem
|
||||
{
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
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 Opportunity.
|
||||
//=======================================================================
|
||||
public abstract class SaxOrganisationOpportunity : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
// Organisation.
|
||||
OrganisationId,
|
||||
Organisation_Name,
|
||||
// Region.
|
||||
RegionIdPrimary,
|
||||
Region_Name,
|
||||
// Sport.
|
||||
SportIdPrimary,
|
||||
Sport_Name,
|
||||
// Opportunity.
|
||||
OpportunityTypeCode,
|
||||
OpportunityType_Desc,
|
||||
Position,
|
||||
Outline,
|
||||
PublishedAt_Date,
|
||||
PublishedAt_DateTime,
|
||||
ExpiresAt_Date,
|
||||
ExpiresAt_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 OrganisationId { get; set; }
|
||||
public SysId RegionIdPrimary { get; set; }
|
||||
public SysId SportIdPrimary { get; set; }
|
||||
public Sax.OpportunityType OpportunityType { get; set; }
|
||||
public String Position { get; set; } = String.Empty;
|
||||
public String Outline { get; set; } = String.Empty;
|
||||
public String OpportunityData { get; set; } = String.Empty;
|
||||
public DateTime PublishedAt { get; set; }
|
||||
public DateTime ExpiresAt { 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 OrganisationId
|
||||
{
|
||||
get { return data.OrganisationId; }
|
||||
set { CheckChanged(data.OrganisationId, value); data.OrganisationId = 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 Sax.OpportunityType OpportunityType
|
||||
{
|
||||
get { return data.OpportunityType; }
|
||||
set { CheckChanged((int)data.OpportunityType, (int)value); data.OpportunityType = value; }
|
||||
}
|
||||
public String Position
|
||||
{
|
||||
get { return data.Position; }
|
||||
set { CheckChanged(data.Position, value); data.Position = value; }
|
||||
}
|
||||
public String Outline
|
||||
{
|
||||
get { return data.Outline; }
|
||||
set { CheckChanged(data.Outline, value); data.Outline = value; }
|
||||
}
|
||||
public String OpportunityData
|
||||
{
|
||||
get { return data.OpportunityData; }
|
||||
set { CheckChanged(data.OpportunityData, value); data.OpportunityData = value; }
|
||||
}
|
||||
public DateTime PublishedAt
|
||||
{
|
||||
get { return data.PublishedAt; }
|
||||
set { CheckChanged(data.PublishedAt, value); data.PublishedAt = value; }
|
||||
}
|
||||
public DateTime ExpiresAt
|
||||
{
|
||||
get { return data.ExpiresAt; }
|
||||
set { CheckChanged(data.ExpiresAt, value); data.ExpiresAt = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
OrganisationId = data.OrganisationId;
|
||||
RegionIdPrimary = data.RegionIdPrimary;
|
||||
SportIdPrimary = data.SportIdPrimary;
|
||||
OpportunityType = data.OpportunityType;
|
||||
Position = data.Position;
|
||||
Outline = data.Outline;
|
||||
OpportunityData = data.OpportunityData;
|
||||
PublishedAt = data.PublishedAt;
|
||||
ExpiresAt = data.ExpiresAt;
|
||||
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 OrganisationId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue RegionIdPrimary { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SportIdPrimary { get; set; } = ValidValue.Valid;
|
||||
public ValidValue OpportunityType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Position { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Outline { get; set; } = ValidValue.Valid;
|
||||
public ValidValue OpportunityData { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PublishedAt { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ExpiresAt { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxOrganisationOpportunity(SysId id, SysId OrganisationId) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
this.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.OrganisationOpportunity, 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(OrganisationId) && SysId.ToInt(OrganisationId) != SysId.ToInt(data.OrganisationId))
|
||||
throw new NotSupportedException(fn + " Organisation Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public SysId OrganisationId
|
||||
{
|
||||
get { return data.OrganisationId; }
|
||||
protected set { data.OrganisationId = value; }
|
||||
}
|
||||
public SysId RegionIdPrimary
|
||||
{
|
||||
get { return data.RegionIdPrimary; }
|
||||
set { data.RegionIdPrimary = value; }
|
||||
}
|
||||
public SysId SportIdPrimary
|
||||
{
|
||||
get { return data.SportIdPrimary; }
|
||||
set { data.SportIdPrimary = value; }
|
||||
}
|
||||
public Sax.OpportunityType OpportunityType
|
||||
{
|
||||
get { return data.OpportunityType; }
|
||||
set { data.OpportunityType = value; }
|
||||
}
|
||||
public String Position
|
||||
{
|
||||
get { return data.Position; }
|
||||
set { data.Position = value; }
|
||||
}
|
||||
public String Outline
|
||||
{
|
||||
get { return data.Outline; }
|
||||
set { data.Outline = value; }
|
||||
}
|
||||
public String OpportunityData
|
||||
{
|
||||
get { return data.OpportunityData; }
|
||||
set { data.OpportunityData = value; }
|
||||
}
|
||||
public DateTime PublishedAt
|
||||
{
|
||||
get { return data.PublishedAt; }
|
||||
set { data.PublishedAt = value; }
|
||||
}
|
||||
public DateTime ExpiresAt
|
||||
{
|
||||
get { return data.ExpiresAt; }
|
||||
set { data.ExpiresAt = 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>();
|
||||
/// <summary>Restrict to User Account via User Organisations and Organisations.</summary>
|
||||
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> OrganisationIdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> RegionIdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> SportIdsIncluded { get; set; } = new List<SysId>();
|
||||
public String PositionPartial { get; set; }
|
||||
public String OutlinePartial { get; set; }
|
||||
/// <summary>General filter value - position, outline, sport, body etc. </summary>
|
||||
public String OpportunityFilter { get; set; }
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
|
||||
// Linked table aliases - blank if not linked.
|
||||
public String Alias_Organisation { get; set; }
|
||||
public String Alias_UserOrganisation { get; set; }
|
||||
public String Alias_UserAccount { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
public static class SaxOrganisationOpportunityList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -154,8 +154,8 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> IdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> IdsExcluded { 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; }
|
||||
|
||||
@@ -33,7 +33,9 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
User_LastName,
|
||||
// Associated data.
|
||||
Organisation_Name,
|
||||
Organisation_RegionId,
|
||||
Organisation_Region_Name,
|
||||
Organisation_SportId,
|
||||
Organisation_Sport_Name,
|
||||
// Associated data.
|
||||
// Common.
|
||||
@@ -252,6 +254,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
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 List<Sax.OrganisationRole> OrganisationRoles { get; } = new List<Sax.OrganisationRole>();
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
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
|
||||
{
|
||||
//=======================================================================
|
||||
// UserSport.
|
||||
//=======================================================================
|
||||
public abstract class SaxUserSport : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
// User.
|
||||
UserAccountId,
|
||||
User_EmailAddress,
|
||||
User_DisplayName,
|
||||
User_Title,
|
||||
User_FirstName,
|
||||
User_LastName,
|
||||
// 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 SysId UserAccountId { get; set; }
|
||||
public SysId SportId { get; set; }
|
||||
public String UserSportData { 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 SysId SportId
|
||||
{
|
||||
get { return data.SportId; }
|
||||
set { CheckChanged(data.SportId, value); data.SportId = value; }
|
||||
}
|
||||
public String UserSportData
|
||||
{
|
||||
get { return data.UserSportData; }
|
||||
set { CheckChanged(data.UserSportData, value); data.UserSportData = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
UserAccountId = data.UserAccountId;
|
||||
SportId = data.SportId;
|
||||
UserSportData = data.UserSportData;
|
||||
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 SportId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UserSportData { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxUserSport(SysId id, SysId userAccountId, SysId sportId) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
UserAccountId = userAccountId;
|
||||
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.UserSport, 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 (SysId.IsValid(SportId) && SysId.ToInt(SportId) != SysId.ToInt(data.SportId))
|
||||
throw new NotSupportedException(fn + " Sport Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public SysId UserAccountId
|
||||
{
|
||||
get { return data.UserAccountId; }
|
||||
protected set { data.UserAccountId = value; }
|
||||
}
|
||||
public SysId SportId
|
||||
{
|
||||
get { return data.SportId; }
|
||||
protected set { data.SportId = value; }
|
||||
}
|
||||
public String UserSportData
|
||||
{
|
||||
get { return data.UserSportData; }
|
||||
set { data.UserSportData = 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> SportIdsIncluded { get; } = new List<SysId>();
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
public static class SaxUserSportList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -16,9 +16,46 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
partial class SaxAccountMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// Account Mgr - User Role
|
||||
// Account Mgr - User Organisation
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
/// <summary>
|
||||
/// Is the user a member of the organisation - excluding relationships which just indicate an 'interest'.
|
||||
/// </summary>
|
||||
public bool UserIsOrganisationMember(SysId userAccountId, SysId organisationId, SaxUserOrganisation.StatusCat statusCat = SaxUserOrganisation.StatusCat.ActiveOnly)
|
||||
{
|
||||
if (!SysId.IsValid(userAccountId) || !SysId.IsValid(organisationId)) return false;
|
||||
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||
prmUserOrganisation.UserAccountIdsIncluded.Add(userAccountId);
|
||||
prmUserOrganisation.OrganisationIdsIncluded.Add(organisationId);
|
||||
prmUserOrganisation.OrganisationMembersOnly = true;
|
||||
prmUserOrganisation.StatusCat = statusCat;
|
||||
return GetUserOrganisationCount(prmUserOrganisation) > 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// Does the user have the specified role with the organisation.
|
||||
/// </summary>
|
||||
public bool UserHasOrganisationRole(SysId userAccountId, SysId organisationId, Sax.OrganisationRole organisationRole, SaxUserOrganisation.StatusCat statusCat = SaxUserOrganisation.StatusCat.ActiveOnly)
|
||||
{
|
||||
if (!SysId.IsValid(userAccountId) || !SysId.IsValid(organisationId) || organisationRole <= 0) return false;
|
||||
return GetOrganisationRolesForUser(userAccountId, organisationId, statusCat).Contains(organisationRole);
|
||||
}
|
||||
/// <summary>
|
||||
/// Retrieve the roles that a user has with the organisation.
|
||||
/// </summary>
|
||||
public List<Sax.OrganisationRole> GetOrganisationRolesForUser(SysId userAccountId, SysId organisationId, SaxUserOrganisation.StatusCat statusCat = SaxUserOrganisation.StatusCat.ActiveOnly)
|
||||
{
|
||||
List<Sax.OrganisationRole> organisationRoles = new List<Sax.OrganisationRole>();
|
||||
if (!SysId.IsValid(userAccountId) || !SysId.IsValid(organisationId)) return organisationRoles;
|
||||
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||
prmUserOrganisation.UserAccountIdsIncluded.Add(userAccountId);
|
||||
prmUserOrganisation.OrganisationIdsIncluded.Add(organisationId);
|
||||
prmUserOrganisation.StatusCat = statusCat;
|
||||
using (SaxUserOrganisation userOrganisation = GetUserOrganisation(prmUserOrganisation))
|
||||
if (userOrganisation != null)
|
||||
organisationRoles = userOrganisation.OrganisationRoles;
|
||||
return organisationRoles;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
@@ -158,16 +195,16 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
value = new DataValue(SaxUserAccount.GetDisplayName(userTitle, userFirstName, userLastName));
|
||||
}
|
||||
break;
|
||||
/*
|
||||
//-----------------------------------------------------------
|
||||
// User Role.
|
||||
case SaxUserOrganisation.Column.UserOrganisation_Desc:
|
||||
{
|
||||
String userOrganisationCode = values.GetValue(column.DataName).ToString();
|
||||
value = new DataValue(UserOrganisations.GetDescForCode(userOrganisationCode));
|
||||
}
|
||||
break;
|
||||
*/
|
||||
/*
|
||||
//-----------------------------------------------------------
|
||||
// User Role.
|
||||
case SaxUserOrganisation.Column.UserOrganisation_Desc:
|
||||
{
|
||||
String userOrganisationCode = values.GetValue(column.DataName).ToString();
|
||||
value = new DataValue(UserOrganisations.GetDescForCode(userOrganisationCode));
|
||||
}
|
||||
break;
|
||||
*/
|
||||
//-----------------------------------------------------------
|
||||
// Notes.
|
||||
case SaxUserOrganisation.Column.Notes:
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
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 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
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
public bool UserHasSport(SysId userAccountId, SysId sportId, SaxUserSport.StatusCat statusCat = SaxUserSport.StatusCat.ActiveOnly)
|
||||
{
|
||||
if (!SysId.IsValid(userAccountId) || !SysId.IsValid(sportId)) return false;
|
||||
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||
prmUserSport.UserAccountIdsIncluded.Add(userAccountId);
|
||||
prmUserSport.SportIdsIncluded.Add(sportId);
|
||||
prmUserSport.StatusCat = statusCat;
|
||||
return GetUserSportCount(prmUserSport) > 0;
|
||||
}
|
||||
public List<SaxUserSport> GetSportsForUser(SysId userAccountId, SaxUserSport.StatusCat statusCat = SaxUserSport.StatusCat.ActiveOnly)
|
||||
{
|
||||
if (!SysId.IsValid(userAccountId)) return new List<SaxUserSport>();
|
||||
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||
prmUserSport.UserAccountIdsIncluded.Add(userAccountId);
|
||||
prmUserSport.StatusCat = statusCat;
|
||||
return GetUserSportList(prmUserSport);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxUserSport CreateUserSport(SysId userAccountId, SysId sportId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool UserSportExistsById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||
prmUserSport.IdsIncluded.Add(id);
|
||||
prmUserSport.StatusCat = SaxUserSport.StatusCat.Any;
|
||||
return GetUserSportCount(prmUserSport) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxUserSport GetUserSport(SaxUserSport.Params prmUserSport);
|
||||
public SaxUserSport GetUserSportById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||
prmUserSport.IdsIncluded.Add(id);
|
||||
prmUserSport.StatusCat = SaxUserSport.StatusCat.Any;
|
||||
return GetUserSport(prmUserSport);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidUserSport(SaxUserSport userSport)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (userSport == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidUserSportData(userSport.GetData(), new SaxUserSport.ErrField());
|
||||
}
|
||||
public virtual bool IsValidUserSportData(SaxUserSport.Data data, SaxUserSport.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// User Account.
|
||||
if (errField.UserAccountId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.UserAccountId))
|
||||
{
|
||||
errField.UserAccountId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("User Account Id must be specified");
|
||||
}
|
||||
// Sport.
|
||||
if (errField.SportId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.SportId))
|
||||
{
|
||||
errField.SportId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("User Sport must be specified");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn.GetColTextLen(SaxDbDfn.ColumnIdx.UserSport_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(data.StatusCode, "status", (long)SaxDbDfn.GetColTextLen(SaxDbDfn.ColumnIdx.UserSport_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SaxUserSport.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// User must exist.
|
||||
if (errField.UserAccountId != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (SysId.IsValid(data.UserAccountId))
|
||||
{
|
||||
SaxUserAccount.Params prmUserAccount = new SaxUserAccount.Params();
|
||||
if (SysId.IsValid(data.Id))
|
||||
prmUserAccount.IdsExcluded.Add(data.Id);
|
||||
prmUserAccount.IdsIncluded.Add(data.UserAccountId);
|
||||
prmUserAccount.StatusCat = SaxUserAccount.StatusCat.Any;
|
||||
if (GetUserAccountCount(prmUserAccount) < 1)
|
||||
{
|
||||
errField.UserAccountId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid user specified");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Sport must exist.
|
||||
if (errField.SportId != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (SysId.IsValid(data.SportId))
|
||||
{
|
||||
SaxSport.Params prmSport = new SaxSport.Params();
|
||||
if (SysId.IsValid(data.Id))
|
||||
prmSport.IdsExcluded.Add(data.Id);
|
||||
prmSport.IdsIncluded.Add(data.SportId);
|
||||
prmSport.StatusCat = SaxSport.StatusCat.Any;
|
||||
if (ReferenceMgr.GetSportCount(prmSport) < 1)
|
||||
{
|
||||
errField.SportId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid sport specified");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// User & Sport combination must be unique.
|
||||
if (errField.UserAccountId != SacsHierarchyItem.ValidValue.Ignore && errField.SportId != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (SysId.IsValid(data.UserAccountId) && SysId.IsValid(data.SportId))
|
||||
{
|
||||
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||
if (SysId.IsValid(data.Id))
|
||||
prmUserSport.IdsExcluded.Add(data.Id);
|
||||
prmUserSport.UserAccountIdsIncluded.Add(data.UserAccountId);
|
||||
prmUserSport.SportIdsIncluded.Add(data.SportId);
|
||||
prmUserSport.StatusCat = SaxUserSport.StatusCat.Any;
|
||||
if (GetUserSportCount(prmUserSport) > 0)
|
||||
{
|
||||
errField.SportId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Sport must be unique for user");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item database interface.
|
||||
public abstract bool InsertUserSport(SaxUserSport userSport, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateUserSport(SaxUserSport userSport, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool UserSportCanBeDeleted(SaxUserSport userSport)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteUserSport(SaxUserSport userSport, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetUserSportColumnDfn(SaxUserSport.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetUserSportQueryFilter(SaxUserSport.Params prmUserSport);
|
||||
public abstract long GetUserSportCount(SaxUserSport.Params prmUserSport);
|
||||
public abstract List<SaxUserSport> GetUserSportList(SaxUserSport.Params prmUserSport);
|
||||
public abstract DbResultSet ExecuteUserSportQuery(List<ColumnDfn> columns, SaxUserSport.Params prmUserSport);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <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 GetUserSportDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxUserSport.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// Notes.
|
||||
case SaxUserSport.Column.Notes:
|
||||
{
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Status.
|
||||
case SaxUserSport.Column.Status_Desc:
|
||||
case SaxUserSport.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SaxUserSport.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||
else if (column.Id == (int)SaxUserSport.Column.Status_Ind)
|
||||
value = new DataValue(SaxUserSport.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -145,7 +145,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
if (errField.SportIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.SportIdPrimary))
|
||||
{
|
||||
SaxSport.Params prmSport = new SaxSport.Params();
|
||||
prmSport.IncludedIds.Add(data.SportIdPrimary);
|
||||
prmSport.IdsIncluded.Add(data.SportIdPrimary);
|
||||
prmSport.StatusCat = SaxSport.StatusCat.ActiveOnly;
|
||||
if (ReferenceMgr.GetSportCount(prmSport) < 1)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
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.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SaxActivityMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// Activity Mgr - Organisation Opportunity
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxOrganisationOpportunity CreateOrganisationOpportunity(SysId organisationId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool OrganisationOpportunityExistsById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SaxOrganisationOpportunity.Params prmOrganisationOpportunity = new SaxOrganisationOpportunity.Params();
|
||||
prmOrganisationOpportunity.IdsIncluded.Add(id);
|
||||
prmOrganisationOpportunity.StatusCat = SaxOrganisationOpportunity.StatusCat.Any;
|
||||
return GetOrganisationOpportunityCount(prmOrganisationOpportunity) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxOrganisationOpportunity GetOrganisationOpportunity(SaxOrganisationOpportunity.Params prmOrganisationOpportunity);
|
||||
public SaxOrganisationOpportunity GetOrganisationOpportunityById(SysId id)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SaxOrganisationOpportunity.Params prmOrganisationOpportunity = new SaxOrganisationOpportunity.Params();
|
||||
prmOrganisationOpportunity.IdsIncluded.Add(id);
|
||||
prmOrganisationOpportunity.StatusCat = SaxOrganisationOpportunity.StatusCat.Any;
|
||||
return GetOrganisationOpportunity(prmOrganisationOpportunity);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (organisationOpportunity == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidOrganisationOpportunityData(organisationOpportunity.GetData(), new SaxOrganisationOpportunity.ErrField());
|
||||
}
|
||||
public virtual bool IsValidOrganisationOpportunityData(SaxOrganisationOpportunity.Data data, SaxOrganisationOpportunity.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
// Organisation.
|
||||
if (errField.OrganisationId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.OrganisationId))
|
||||
{
|
||||
errField.OrganisationId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Organisation must be specified");
|
||||
}
|
||||
// Primary Region.
|
||||
if (errField.RegionIdPrimary != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.RegionIdPrimary))
|
||||
{
|
||||
errField.RegionIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Region must be specified");
|
||||
}
|
||||
// Primary Sport.
|
||||
if (errField.SportIdPrimary != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.SportIdPrimary))
|
||||
{
|
||||
errField.SportIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Sport must be specified");
|
||||
}
|
||||
|
||||
// Opportunity type.
|
||||
if (errField.OpportunityType != SacsHierarchyItem.ValidValue.Ignore && data.OpportunityType <= 0)
|
||||
{
|
||||
errField.Position = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Opportunity type must be specified.");
|
||||
}
|
||||
// Position.
|
||||
if (errField.Position != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Position, "position", (long)SaxDbDfn.GetColTextLen(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position), true))
|
||||
{
|
||||
errField.Position = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Summary.
|
||||
if (errField.Outline != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Outline, "outline", (long)SaxDbDfn.GetColTextLen(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline), true))
|
||||
{
|
||||
errField.Outline = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn.GetColTextLen(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(data.StatusCode, "status", (long)SaxDbDfn.GetColTextLen(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SaxOrganisationOpportunity.ValidStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
// Associated data.
|
||||
|
||||
// Organisation.
|
||||
if (errField.OrganisationId != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.OrganisationId))
|
||||
{
|
||||
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||
prmOrganisation.IdsIncluded.Add(data.OrganisationId);
|
||||
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.ActiveOnly;
|
||||
if (AccountMgr.GetOrganisationCount(prmOrganisation) < 1)
|
||||
{
|
||||
errField.OrganisationId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid organisation specified");
|
||||
}
|
||||
}
|
||||
|
||||
// Primary Region.
|
||||
if (errField.RegionIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.RegionIdPrimary))
|
||||
{
|
||||
SaxRegion.Params prmRegion = new SaxRegion.Params();
|
||||
prmRegion.IdsIncluded.Add(data.RegionIdPrimary);
|
||||
prmRegion.StatusCat = SaxRegion.StatusCat.ActiveOnly;
|
||||
if (ReferenceMgr.GetRegionCount(prmRegion) < 1)
|
||||
{
|
||||
errField.RegionIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid region specified");
|
||||
}
|
||||
}
|
||||
|
||||
// Primary Sport.
|
||||
if (errField.SportIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.SportIdPrimary))
|
||||
{
|
||||
SaxSport.Params prmSport = new SaxSport.Params();
|
||||
prmSport.IdsIncluded.Add(data.SportIdPrimary);
|
||||
prmSport.StatusCat = SaxSport.StatusCat.ActiveOnly;
|
||||
if (ReferenceMgr.GetSportCount(prmSport) < 1)
|
||||
{
|
||||
errField.SportIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid sport specified");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// OrganisationOpportunity database interface.
|
||||
public abstract bool InsertOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool OrganisationOpportunityCanBeDeleted(SaxOrganisationOpportunity organisationOpportunity)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// OrganisationOpportunity list:
|
||||
public abstract ColumnDfn GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetOrganisationOpportunityQueryFilter(SaxOrganisationOpportunity.Params prmOrganisationOpportunity);
|
||||
public abstract long GetOrganisationOpportunityCount(SaxOrganisationOpportunity.Params prmOrganisationOpportunity);
|
||||
public abstract List<SaxOrganisationOpportunity> GetOrganisationOpportunityList(SaxOrganisationOpportunity.Params prmOrganisationOpportunity);
|
||||
public abstract DbResultSet ExecuteOrganisationOpportunityQuery(List<ColumnDfn> columns, SaxOrganisationOpportunity.Params prmOrganisationOpportunity);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <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 GetOrganisationOpportunityDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxOrganisationOpportunity.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// Opportunity type desc.
|
||||
case SaxOrganisationOpportunity.Column.OpportunityType_Desc:
|
||||
{
|
||||
String code = values.GetValue(column.DataName).ToString();
|
||||
value = new DataValue(OpportunityTypes.GetDescForCode(code, code));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Summary - limit to 200 chars.
|
||||
case SaxOrganisationOpportunity.Column.Outline:
|
||||
{
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Notes - limit to 200 chars.
|
||||
case SaxOrganisationOpportunity.Column.Notes:
|
||||
{
|
||||
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Status.
|
||||
case SaxOrganisationOpportunity.Column.Status_Desc:
|
||||
case SaxOrganisationOpportunity.Column.Status_Ind:
|
||||
{
|
||||
String statusCode = values.GetValue(column.DataName).ToString();
|
||||
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||
if (column.Id == (int)SaxOrganisationOpportunity.Column.Status_Desc)
|
||||
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||
else if (column.Id == (int)SaxOrganisationOpportunity.Column.Status_Ind)
|
||||
value = new DataValue(SaxOrganisationOpportunity.GetStatusTriState(status));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -44,6 +44,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
public List<TypeCodeDesc> OrganisationTypes { get { return Internals.OrganisationTypes; } }
|
||||
public List<TypeCodeDesc> OrganisationCategories { get { return Internals.OrganisationCategories; } }
|
||||
public List<TypeCodeDesc> OrganisationRoles { get { return Internals.OrganisationRoles; } }
|
||||
public List<TypeCodeDesc> OpportunityTypes { get { return Internals.OpportunityTypes; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return false;
|
||||
SaxSport.Params prmSport = new SaxSport.Params();
|
||||
prmSport.IncludedIds.Add(id);
|
||||
prmSport.IdsIncluded.Add(id);
|
||||
prmSport.StatusCat = SaxSport.StatusCat.Any;
|
||||
return GetSportCount(prmSport) == 1;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(id)) return null;
|
||||
SaxSport.Params prmSport = new SaxSport.Params();
|
||||
prmSport.IncludedIds.Add(id);
|
||||
prmSport.IdsIncluded.Add(id);
|
||||
prmSport.StatusCat = SaxSport.StatusCat.Any;
|
||||
return GetSport(prmSport);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user