v1.0.6.2
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.0.6.0";
|
||||
private static String version { get; } = "1.0.6.2";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
@@ -40,8 +40,9 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Version history.
|
||||
//-------------------------------------------------------------------
|
||||
// 1.0.6 ?-Jun-2021 ???
|
||||
// - ?.
|
||||
// 1.0.6 2-Jun-2021 Online Profile
|
||||
// - Refresh Online Session with profile region and sport changes.
|
||||
// - Profile Sport - participation and officiating dropdowns.
|
||||
// 1.0.5 31-May-2021 Activity Index
|
||||
// - Admin Database Schema (Home) and Tables page.
|
||||
// - Online Account country, Home activities.
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 15:39:57
|
||||
// Code generated by Sarand Database Utilities Wed 2-Jun-2021 17:55:46
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
@@ -27,6 +27,7 @@ namespace Saxonite.Base.App
|
||||
UserAccount,
|
||||
UserOrganisation,
|
||||
UserRole,
|
||||
UserSession,
|
||||
UserSport,
|
||||
}
|
||||
|
||||
@@ -198,6 +199,12 @@ namespace Saxonite.Base.App
|
||||
UserRole_UpdateOn,
|
||||
UserRole_UpdateBy,
|
||||
UserRole_UpdateHost,
|
||||
UserSession_UserAccountId,
|
||||
UserSession_ActivityIndexIds,
|
||||
UserSession_UserSessionData,
|
||||
UserSession_Flags,
|
||||
UserSession_CreateOn,
|
||||
UserSession_UpdateOn,
|
||||
UserSport_Id,
|
||||
UserSport_UserAccountId,
|
||||
UserSport_SportId,
|
||||
@@ -217,8 +224,8 @@ namespace Saxonite.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 11;
|
||||
private static readonly int columnCount = 178;
|
||||
private static readonly int tableCount = 12;
|
||||
private static readonly int columnCount = 184;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -374,6 +381,7 @@ namespace Saxonite.Base.App
|
||||
"UserAccount",
|
||||
"UserOrganisation",
|
||||
"UserRole",
|
||||
"UserSession",
|
||||
"UserSport",
|
||||
};
|
||||
|
||||
@@ -552,7 +560,7 @@ 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,"Id",5,-5,true,19),
|
||||
new ColumnDfn(10,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(10,"UserRoleCode",0,12,false,16),
|
||||
new ColumnDfn(10,"Notes",0,-9,false,2000),
|
||||
@@ -564,21 +572,27 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(10,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(10,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(10,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(11,"Id",4,4,true,10),
|
||||
new ColumnDfn(11,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(11,"SportId",4,4,false,10),
|
||||
new ColumnDfn(11,"Participation",3,5,false,5),
|
||||
new ColumnDfn(11,"Officiating",3,5,false,5),
|
||||
new ColumnDfn(11,"UserSportData",0,-9,false,0),
|
||||
new ColumnDfn(11,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(11,"ActivityIndexIds",0,-9,false,0),
|
||||
new ColumnDfn(11,"UserSessionData",0,-9,false,0),
|
||||
new ColumnDfn(11,"Flags",3,5,false,5),
|
||||
new ColumnDfn(11,"Status",0,12,false,3),
|
||||
new ColumnDfn(11,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(11,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(11,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(11,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(11,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(11,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(12,"Id",4,4,true,10),
|
||||
new ColumnDfn(12,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(12,"SportId",4,4,false,10),
|
||||
new ColumnDfn(12,"Participation",3,5,false,5),
|
||||
new ColumnDfn(12,"Officiating",3,5,false,5),
|
||||
new ColumnDfn(12,"UserSportData",0,-9,false,0),
|
||||
new ColumnDfn(12,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(12,"Flags",3,5,false,5),
|
||||
new ColumnDfn(12,"Status",0,12,false,3),
|
||||
new ColumnDfn(12,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(12,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(12,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(12,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(12,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(12,"UpdateHost",0,12,false,100),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
// Item list extension methods.
|
||||
public static class SaxActivityIndexList
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
// Item list extension methods.
|
||||
public static class SaxItemSportList
|
||||
{
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
// Item list extension methods.
|
||||
public static class SaxJournalistArticleList
|
||||
{
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
// Item list extension methods.
|
||||
public static class SaxOrganisationList
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -300,7 +300,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
// Item list extension methods.
|
||||
public static class SaxOrganisationOpportunityList
|
||||
{
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
// Item list extension methods.
|
||||
public static class SaxRegionList
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
// Item list extension methods.
|
||||
public static class SaxSportList
|
||||
{
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
// Item list extension methods.
|
||||
public static class SaxUserAccountList
|
||||
{
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
// Item list extension methods.
|
||||
public static class SaxUserOrganisationList
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
// Item list extension methods.
|
||||
public static class SaxUserRoleList
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
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.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
// User Session.
|
||||
//=======================================================================
|
||||
/// <summary>
|
||||
/// User Session - persistent properties from the user's session.
|
||||
/// </summary>
|
||||
public abstract class SaxUserSession : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
// User.
|
||||
UserAccountId,
|
||||
User_EmailAddress,
|
||||
User_DisplayName,
|
||||
User_Title,
|
||||
User_FirstName,
|
||||
User_LastName,
|
||||
// Session data.
|
||||
// Associated data.
|
||||
// Common.
|
||||
Flags,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public SysId UserAccountId { get; set; }
|
||||
public List<SysId> ActivityIndexIds { get; } = new List<SysId>();
|
||||
public String UserSessionData { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data()
|
||||
{
|
||||
}
|
||||
// Properties.
|
||||
public SysId UserAccountId
|
||||
{
|
||||
get { return data.UserAccountId; }
|
||||
set { CheckChanged(data.UserAccountId, value); data.UserAccountId = value; }
|
||||
}
|
||||
public List<SysId> ActivityIndexIds
|
||||
{
|
||||
get { return data.ActivityIndexIds.ToList(); }
|
||||
set { CheckChanged(data.ActivityIndexIds, value); data.ActivityIndexIds.Clear(); data.ActivityIndexIds.AddRange(value); }
|
||||
}
|
||||
public String UserSessionData
|
||||
{
|
||||
get { return data.UserSessionData; }
|
||||
set { CheckChanged(data.UserSessionData, value); data.UserSessionData = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
UserAccountId = data.UserAccountId;
|
||||
ActivityIndexIds = data.ActivityIndexIds;
|
||||
UserSessionData = data.UserSessionData;
|
||||
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 ActivityIndexIds { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UserSessionData { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxUserSession(SysId userAccountId) : base()
|
||||
{
|
||||
base.SetData(data);
|
||||
UserAccountId = userAccountId;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
public override bool ItemHasId => false;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public static String ActivityIndexDelim { get; } = ",";
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
|
||||
throw new NotSupportedException(fn + " User Account Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public SysId UserAccountId
|
||||
{
|
||||
get { return data.UserAccountId; }
|
||||
protected set { data.UserAccountId = value; }
|
||||
}
|
||||
public List<SysId> ActivityIndexIds
|
||||
{
|
||||
get { return data.ActivityIndexIds; }
|
||||
set { data.ActivityIndexIds = value; }
|
||||
}
|
||||
public String UserSessionData
|
||||
{
|
||||
get { return data.UserSessionData; }
|
||||
set { data.UserSessionData = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags - positions 1-16 available.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
// List parameters.
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
/// </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list extension methods.
|
||||
public static class SaxUserSessionList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -238,7 +238,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Company list methods.
|
||||
// Item list extension methods.
|
||||
public static class SaxUserSportList
|
||||
{
|
||||
}
|
||||
|
||||
@@ -145,26 +145,34 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
}
|
||||
}
|
||||
|
||||
// Sport.
|
||||
if (errField.SportIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.SportIdPrimary))
|
||||
//---------------------------------------------------------------
|
||||
// Associated data - ignore for deleted items.
|
||||
if (!data.IsStatusDeleted)
|
||||
{
|
||||
if (!ReferenceMgr.SportExistsById(data.SportIdPrimary))
|
||||
|
||||
// Sport.
|
||||
if (errField.SportIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.SportIdPrimary))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid sport specified");
|
||||
}
|
||||
}
|
||||
|
||||
// Region.
|
||||
if (errField.RegionIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.RegionIdPrimary))
|
||||
{
|
||||
if (!ReferenceMgr.RegionExistsById(data.RegionIdPrimary))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid region specified");
|
||||
if (!ReferenceMgr.SportExistsById(data.SportIdPrimary))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid sport specified");
|
||||
}
|
||||
}
|
||||
|
||||
// Region.
|
||||
if (errField.RegionIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.RegionIdPrimary))
|
||||
{
|
||||
if (!ReferenceMgr.RegionExistsById(data.RegionIdPrimary))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid region specified");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,6 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Email Address must be unique.
|
||||
if (errField.EmailAddress != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
@@ -184,22 +183,28 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Regions.
|
||||
if (errField.RegionIdCountry != SacsHierarchyItem.ValidValue.Ignore || errField.RegionIdProvince != SacsHierarchyItem.ValidValue.Ignore)
|
||||
// Associated data - ignore for deleted items.
|
||||
if (!data.IsStatusDeleted)
|
||||
{
|
||||
List<SaxRegion> regions = Internals.GetRegions(new List<SysId>() { data.RegionIdCountry, data.RegionIdProvince });
|
||||
SaxRegion regionCountry = regions.GetRegionById(data.RegionIdCountry);
|
||||
SaxRegion regionProvince = regions.GetRegionById(data.RegionIdProvince);
|
||||
if (errField.RegionIdCountry != SacsHierarchyItem.ValidValue.Ignore)
|
||||
|
||||
// Regions.
|
||||
if (errField.RegionIdCountry != SacsHierarchyItem.ValidValue.Ignore || errField.RegionIdProvince != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (SysId.IsValid(data.RegionIdCountry) && regionCountry == null)
|
||||
return SetErrorState("Invalid country specified");
|
||||
}
|
||||
if (errField.RegionIdCountry != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (SysId.IsValid(data.RegionIdCountry) && regionCountry == null)
|
||||
return SetErrorState("Invalid country specified");
|
||||
List<SaxRegion> regions = Internals.GetRegions(new List<SysId>() { data.RegionIdCountry, data.RegionIdProvince });
|
||||
SaxRegion regionCountry = regions.GetRegionById(data.RegionIdCountry);
|
||||
SaxRegion regionProvince = regions.GetRegionById(data.RegionIdProvince);
|
||||
if (errField.RegionIdCountry != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (SysId.IsValid(data.RegionIdCountry) && regionCountry == null)
|
||||
return SetErrorState("Invalid country specified");
|
||||
}
|
||||
if (errField.RegionIdCountry != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (SysId.IsValid(data.RegionIdCountry) && regionCountry == null)
|
||||
return SetErrorState("Invalid country specified");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -153,6 +153,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +131,8 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
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 Session
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxUserSession CreateUserSession(SysId userAccountId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool UserSessionExists(SysId userAccountId)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(userAccountId)) return false;
|
||||
SaxUserSession.Params prmUserSession = new SaxUserSession.Params();
|
||||
prmUserSession.UserAccountIdsIncluded.Add(userAccountId);
|
||||
return GetUserSessionCount(prmUserSession) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxUserSession GetUserSession(SaxUserSession.Params prmUserSession);
|
||||
public SaxUserSession GetUserSession(SysId userAccountId)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(userAccountId)) return null;
|
||||
SaxUserSession.Params prmUserSession = new SaxUserSession.Params();
|
||||
prmUserSession.UserAccountIdsIncluded.Add(userAccountId);
|
||||
return GetUserSession(prmUserSession);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidUserSession(SaxUserSession userSession)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (userSession == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidUserSessionData(userSession.GetData(), new SaxUserSession.ErrField());
|
||||
}
|
||||
public virtual bool IsValidUserSessionData(SaxUserSession.Data data, SaxUserSession.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");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item database interface.
|
||||
public abstract bool InsertUserSession(SaxUserSession userSession, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateUserSession(SaxUserSession userSession, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool UserSessionCanBeDeleted(SaxUserSession userSession)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteUserSession(SaxUserSession userSession, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetUserSessionColumnDfn(SaxUserSession.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetUserSessionQueryFilter(SaxUserSession.Params prmUserSession);
|
||||
public abstract long GetUserSessionCount(SaxUserSession.Params prmUserSession);
|
||||
public abstract List<SaxUserSession> GetUserSessionList(SaxUserSession.Params prmUserSession);
|
||||
public abstract DbResultSet ExecuteUserSessionQuery(List<ColumnDfn> columns, SaxUserSession.Params prmUserSession);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <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 GetUserSessionDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxUserSession.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// User Display Name.
|
||||
case SaxUserSession.Column.User_DisplayName:
|
||||
{
|
||||
String userTitle = values.GetValue(GetUserSessionColumnDfn(SaxUserSession.Column.User_Title).DataName).ToString();
|
||||
String userFirstName = values.GetValue(GetUserSessionColumnDfn(SaxUserSession.Column.User_FirstName).DataName).ToString();
|
||||
String userLastName = values.GetValue(GetUserSessionColumnDfn(SaxUserSession.Column.User_LastName).DataName).ToString();
|
||||
value = new DataValue(SaxUserAccount.GetDisplayName(userTitle, userFirstName, userLastName));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -113,45 +113,6 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// 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)
|
||||
{
|
||||
@@ -171,6 +132,47 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Associated data - ignore for deleted items.
|
||||
if (!data.IsStatusDeleted)
|
||||
{
|
||||
|
||||
// User must exist.
|
||||
if (errField.UserAccountId != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (SysId.IsValid(data.UserAccountId))
|
||||
{
|
||||
SaxUserAccount.Params prmUserAccount = new SaxUserAccount.Params();
|
||||
prmUserAccount.IdsIncluded.Add(data.UserAccountId);
|
||||
prmUserAccount.StatusCat = SaxUserAccount.StatusCat.NotDeleted;
|
||||
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();
|
||||
prmSport.IdsIncluded.Add(data.SportId);
|
||||
prmSport.StatusCat = SaxSport.StatusCat.NotDeleted;
|
||||
if (ReferenceMgr.GetSportCount(prmSport) < 1)
|
||||
{
|
||||
errField.SportId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid sport specified");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -97,6 +97,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
|
||||
// NB Associated data items aren't validated as these should be valid on the 'parent' object.
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,48 +112,53 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
}
|
||||
}
|
||||
|
||||
// Associated data.
|
||||
|
||||
// User Account - Journalist.
|
||||
if (errField.UserAccountIdJournalist != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.UserAccountIdJournalist))
|
||||
//---------------------------------------------------------------
|
||||
// Associated data - ignore for deleted items.
|
||||
if (!data.IsStatusDeleted)
|
||||
{
|
||||
SaxUserAccount.Params prmUserAccount = new SaxUserAccount.Params();
|
||||
prmUserAccount.IdsIncluded.Add(data.UserAccountIdJournalist);
|
||||
prmUserAccount.ActiveRoles.Add(App.Sax.UserRole.Journalist);
|
||||
prmUserAccount.StatusCat = SaxUserAccount.StatusCat.ActiveOnly;
|
||||
if (AccountMgr.GetUserAccountCount(prmUserAccount) < 1)
|
||||
|
||||
// User Account - Journalist.
|
||||
if (errField.UserAccountIdJournalist != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.UserAccountIdJournalist))
|
||||
{
|
||||
errField.UserAccountIdJournalist = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("User must be active Journalist");
|
||||
}
|
||||
}
|
||||
|
||||
// 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");
|
||||
}
|
||||
}
|
||||
|
||||
// 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");
|
||||
SaxUserAccount.Params prmUserAccount = new SaxUserAccount.Params();
|
||||
prmUserAccount.IdsIncluded.Add(data.UserAccountIdJournalist);
|
||||
prmUserAccount.ActiveRoles.Add(App.Sax.UserRole.Journalist);
|
||||
prmUserAccount.StatusCat = SaxUserAccount.StatusCat.NotDeleted;
|
||||
if (AccountMgr.GetUserAccountCount(prmUserAccount) < 1)
|
||||
{
|
||||
errField.UserAccountIdJournalist = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("User must be active Journalist");
|
||||
}
|
||||
}
|
||||
|
||||
// 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.NotDeleted;
|
||||
if (ReferenceMgr.GetSportCount(prmSport) < 1)
|
||||
{
|
||||
errField.SportIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid sport 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.NotDeleted;
|
||||
if (ReferenceMgr.GetRegionCount(prmRegion) < 1)
|
||||
{
|
||||
errField.RegionIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid region specified");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,47 +118,52 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
}
|
||||
}
|
||||
|
||||
// Associated data.
|
||||
|
||||
// Organisation.
|
||||
if (errField.OrganisationId != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.OrganisationId))
|
||||
//---------------------------------------------------------------
|
||||
// Associated data - ignore for deleted items.
|
||||
if (!data.IsStatusDeleted)
|
||||
{
|
||||
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||
prmOrganisation.IdsIncluded.Add(data.OrganisationId);
|
||||
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.ActiveOnly;
|
||||
if (AccountMgr.GetOrganisationCount(prmOrganisation) < 1)
|
||||
|
||||
// Organisation.
|
||||
if (errField.OrganisationId != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.OrganisationId))
|
||||
{
|
||||
errField.OrganisationId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid organisation 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");
|
||||
}
|
||||
}
|
||||
|
||||
// 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");
|
||||
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||
prmOrganisation.IdsIncluded.Add(data.OrganisationId);
|
||||
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.NotDeleted;
|
||||
if (AccountMgr.GetOrganisationCount(prmOrganisation) < 1)
|
||||
{
|
||||
errField.OrganisationId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid organisation 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.NotDeleted;
|
||||
if (ReferenceMgr.GetSportCount(prmSport) < 1)
|
||||
{
|
||||
errField.SportIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid sport 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.NotDeleted;
|
||||
if (ReferenceMgr.GetRegionCount(prmRegion) < 1)
|
||||
{
|
||||
errField.RegionIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid region specified");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,6 +114,8 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +141,14 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Associated data - ignore for deleted items.
|
||||
if (!data.IsStatusDeleted)
|
||||
{
|
||||
// ToDo Parent region.
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
public virtual bool IsValidSportData (SaxSport.Data data, SaxSport.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
// Name.
|
||||
if (errField.Name != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Name, "name", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.Sport_Name), true))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user