v1.2.9.2
This commit is contained in:
@@ -36,7 +36,7 @@ namespace Saxonite.Net.Core.UnitTests.Web.Admin.App
|
||||
|
||||
var mockEnvironment = new Mock<IWebHostEnvironment>();
|
||||
mockEnvironment.Setup(m => m.EnvironmentName).Returns(Environments.Development);
|
||||
mockEnvironment.Setup(m => m.ContentRootPath).Returns(@"D:\Sarand\Projects\Users\AHoward\VS2019\Saxonite\Workspace\SaxoniteCoreWebAdmin");
|
||||
mockEnvironment.Setup(m => m.ContentRootPath).Returns(@"D:\Sarand\Projects\Users\AHoward\VS2022\Saxonite\Workspace\SaxoniteCoreWebAdmin");
|
||||
|
||||
app = new SaxApplication_Admin_Test(mockConfiguration.Object, mockEnvironment.Object);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Online.App;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using System;
|
||||
@@ -11,45 +12,59 @@ using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Core.UnitTests.Web.Online.App
|
||||
{
|
||||
//=======================================================================
|
||||
[TestClass]
|
||||
public class SaxApplication_Online_Tester
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Application.
|
||||
private class SaxApplication_Online_Test : SaxApplication_Online
|
||||
{
|
||||
public SaxApplication_Online_Test(IConfiguration configuration, IWebHostEnvironment env) :
|
||||
base(configuration)
|
||||
{
|
||||
InitEnvironment(env);
|
||||
}
|
||||
}
|
||||
private static SaxApplication_Online_Test app;
|
||||
public static SaxApplication_Online App
|
||||
{
|
||||
get
|
||||
{
|
||||
if (app == null)
|
||||
{
|
||||
var mockConfiguration = new Mock<IConfiguration>();
|
||||
//=======================================================================
|
||||
[TestClass]
|
||||
public class SaxApplication_Online_Tester
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Application.
|
||||
private class SaxApplication_Online_Test : SaxApplication_Online
|
||||
{
|
||||
public SaxApplication_Online_Test(IConfiguration configuration, IWebHostEnvironment env) :
|
||||
base(configuration)
|
||||
{
|
||||
InitEnvironment(env);
|
||||
|
||||
var mockEnvironment = new Mock<IWebHostEnvironment>();
|
||||
mockEnvironment.Setup(m => m.EnvironmentName).Returns(Environments.Development);
|
||||
mockEnvironment.Setup(m => m.ContentRootPath).Returns(@"D:\Sarand\Projects\Users\AHoward\VS2019\Saxonite\Workspace\SaxoniteCoreWebOnline");
|
||||
// Application initialisation currently fails reading configuration.
|
||||
if (SessionContext == null)
|
||||
SessionContext = new SessionContextData(new SaxSessionContext_Web(100, Sax.Application.Online)).SessionContext;
|
||||
}
|
||||
}
|
||||
private static SaxApplication_Online_Test app;
|
||||
public static SaxApplication_Online App
|
||||
{
|
||||
get
|
||||
{
|
||||
if (app == null)
|
||||
{
|
||||
var mockConfiguration = new Mock<IConfiguration>();
|
||||
|
||||
app = new SaxApplication_Online_Test(mockConfiguration.Object, mockEnvironment.Object);
|
||||
}
|
||||
return app;
|
||||
}
|
||||
}
|
||||
var mockEnvironment = new Mock<IWebHostEnvironment>();
|
||||
mockEnvironment.Setup(m => m.EnvironmentName).Returns(Environments.Development);
|
||||
mockEnvironment.Setup(m => m.ContentRootPath).Returns(@"D:\Sarand\Projects\Users\AHoward\VS2022\Saxonite\Workspace\SaxoniteCoreWebOnline");
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Internals - component managers etc.
|
||||
private static SaxInternals internals;
|
||||
public static SaxInternals Internals { get { if (internals == null) internals = new SaxInternals(App.SessionContext); return internals; } }
|
||||
app = new SaxApplication_Online_Test(mockConfiguration.Object, mockEnvironment.Object);
|
||||
}
|
||||
return app;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
//-------------------------------------------------------------------
|
||||
// Internals - component managers etc.
|
||||
private static SaxInternals internals;
|
||||
public static SaxInternals Internals
|
||||
{
|
||||
get
|
||||
{
|
||||
if (internals == null)
|
||||
{
|
||||
internals = new SaxInternals(App.SessionContext);
|
||||
}
|
||||
return internals;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
|
||||
@@ -63,6 +63,9 @@ namespace Saxonite.Net.Core.UnitTests.Web.Online.App
|
||||
Assert.IsTrue(sessionData.ValidUserSession);
|
||||
Assert.AreNotEqual("", sessionData.User.DisplayName);
|
||||
|
||||
// User configuration.
|
||||
sessionData.UserConfig.Profile.Eligibility.HideInfo = true;
|
||||
|
||||
// Profile sports.
|
||||
foreach (SaxSessionData_Online.UserProfileData.SportData sport in sports)
|
||||
sessionData.Profile.AddSport(sport.SportId, sport.Status);
|
||||
@@ -121,8 +124,11 @@ namespace Saxonite.Net.Core.UnitTests.Web.Online.App
|
||||
Assert.AreNotEqual(0, userRoleDeserialised.Role);
|
||||
}
|
||||
|
||||
// Profile sports.
|
||||
Assert.AreEqual(sports.Count, sessionDataDeserialised.Profile.Sports.Count);
|
||||
// User configuration.
|
||||
Assert.AreEqual(sessionData.UserConfig.Profile.Eligibility.HideInfo, sessionDataDeserialised.UserConfig.Profile.Eligibility.HideInfo);
|
||||
|
||||
// Profile sports.
|
||||
Assert.AreEqual(sports.Count, sessionDataDeserialised.Profile.Sports.Count);
|
||||
foreach (SaxSessionData_Online.UserProfileData.SportData sport in sports)
|
||||
{
|
||||
SaxSessionData_Online.UserProfileData.SportData sportDeserialised = sessionDataDeserialised.Profile.Sports.Find(item => item.SportId.Equals(sport.SportId));
|
||||
|
||||
@@ -214,9 +214,15 @@ namespace Saxonite.Net.Core.Web.Base.App
|
||||
}
|
||||
|
||||
// Sport Speciality label.
|
||||
public String GetSportSpecialityLabelCaption(Sax.SportSpecialityLabel specialityLabel)
|
||||
public String GetSportSpecialityLabelCaption(Sax.SportSpecialityLabel sportSpecialityLabel)
|
||||
{
|
||||
return GetCodeTypeCaption(Sax.CodeType.SportSpecialityLabel, specialityLabel);
|
||||
return GetCodeTypeCaption(Sax.CodeType.SportSpecialityLabel, sportSpecialityLabel);
|
||||
}
|
||||
|
||||
// Sport Contact Type.
|
||||
public String GetSportContactTypeCaption(Sax.SportContactType sportContactType)
|
||||
{
|
||||
return GetCodeTypeCaption(Sax.CodeType.SportContactType, sportContactType);
|
||||
}
|
||||
|
||||
// Sport Participation.
|
||||
|
||||
@@ -114,6 +114,7 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
|
||||
// System codes.
|
||||
public List<TypeCodeDesc> DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } }
|
||||
public List<TypeCodeDesc> SportSpecialityLabelCodes { get { return Internals.SportSpecialityLabelCodes; } }
|
||||
public List<TypeCodeDesc> SportContactTypeCodes { get { return Internals.SportContactTypeCodes; } }
|
||||
public List<TypeCodeDesc> SportParticipationCodes { get { return Internals.SportParticipationCodes; } }
|
||||
public List<TypeCodeDesc> SportOfficiatingCodes { get { return Internals.SportOfficiatingCodes; } }
|
||||
public List<TypeCodeDesc> RegionTypeCodes { get { return Internals.RegionTypeCodes; } }
|
||||
|
||||
@@ -91,6 +91,7 @@ namespace Saxonite.Net.Core.Web.Base.Models
|
||||
public List<TypeCodeDesc> DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } }
|
||||
public List<TypeCodeDesc> YesNoCodes { get { return Internals.YesNoCodes; } }
|
||||
public List<TypeCodeDesc> SportSpecialityLabelCodes { get { return Internals.SportSpecialityLabelCodes; } }
|
||||
public List<TypeCodeDesc> SportContactTypeCodes { get { return Internals.SportContactTypeCodes; } }
|
||||
public List<TypeCodeDesc> SportParticipationCodes { get { return Internals.SportParticipationCodes; } }
|
||||
public List<TypeCodeDesc> SportOfficiatingCodes { get { return Internals.SportOfficiatingCodes; } }
|
||||
public List<TypeCodeDesc> RegionTypeCodes { get { return Internals.RegionTypeCodes; } }
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
}
|
||||
},
|
||||
"Documents": {
|
||||
"RootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2019\\Saxonite\\Docs"
|
||||
"RootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2022\\Saxonite\\Docs"
|
||||
},
|
||||
"Logging": {
|
||||
"RootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2019\\Saxonite\\Logs\\Admin"
|
||||
"RootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2022\\Saxonite\\Logs\\Admin"
|
||||
}
|
||||
},
|
||||
"Saxonite-Test": {
|
||||
@@ -43,17 +43,17 @@
|
||||
}
|
||||
},
|
||||
"Documents": {
|
||||
"RootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2019\\Saxonite\\Docs"
|
||||
"RootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2022\\Saxonite\\Docs"
|
||||
},
|
||||
"Logging": {
|
||||
"RootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2019\\Saxonite\\QC\\Logs\\Admin"
|
||||
"RootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2022\\Saxonite\\QC\\Logs\\Admin"
|
||||
},
|
||||
"Variants": [
|
||||
{
|
||||
"ApplicationRootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2019\\Saxonite\\QC2\\App",
|
||||
"ApplicationRootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2022\\Saxonite\\QC2\\App",
|
||||
"Instance": "QC",
|
||||
"Logging": {
|
||||
"RootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2019\\Saxonite\\QC2\\Logs\\Admin"
|
||||
"RootFolder": "D:\\Sarand\\Projects\\Users\\AHoward\\VS2022\\Saxonite\\QC2\\Logs\\Admin"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"Environments": [ "Production" ],
|
||||
"Instance": "QC",
|
||||
"CoreDatabase": {
|
||||
"Location": "MsSql:Sarand106\\SQL2014.Saxonite_Dev",
|
||||
"Location": "MsSql:Sarand110\\SQL2016.Saxonite_Dev",
|
||||
"User": "saxonite",
|
||||
"Password": "sax-dev-2021"
|
||||
},
|
||||
|
||||
@@ -132,6 +132,11 @@
|
||||
background-image: url('../img/action/refresh24.png');
|
||||
}
|
||||
|
||||
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-info
|
||||
{
|
||||
background-image: url('../img/action/info24.png');
|
||||
}
|
||||
|
||||
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-add
|
||||
{
|
||||
background-image: url('../img/action/add24.png');
|
||||
|
||||
@@ -198,6 +198,12 @@
|
||||
<data name="caption.my.eligibility" xml:space="preserve">
|
||||
<value>My Eligibility</value>
|
||||
</data>
|
||||
<data name="caption.show.info" xml:space="preserve">
|
||||
<value>Show info</value>
|
||||
</data>
|
||||
<data name="caption.user.config" xml:space="preserve">
|
||||
<value>User Configuration</value>
|
||||
</data>
|
||||
<data name="company.name" xml:space="preserve">
|
||||
<value>Solum Forti</value>
|
||||
</data>
|
||||
@@ -243,6 +249,9 @@
|
||||
<data name="info.chars.available" xml:space="preserve">
|
||||
<value>[{0} chars available]</value>
|
||||
</data>
|
||||
<data name="info.profile.eligibility" xml:space="preserve">
|
||||
<value>You can identify the countries that you are eligible to participate for by adding references to your parentage and passport/visas.</value>
|
||||
</data>
|
||||
<data name="label. registered" xml:space="preserve">
|
||||
<value>Registered</value>
|
||||
</data>
|
||||
@@ -282,6 +291,9 @@
|
||||
<data name="label.awards" xml:space="preserve">
|
||||
<value>Awards</value>
|
||||
</data>
|
||||
<data name="label.bio" xml:space="preserve">
|
||||
<value>Bio</value>
|
||||
</data>
|
||||
<data name="label.calendar" xml:space="preserve">
|
||||
<value>Calendar</value>
|
||||
</data>
|
||||
@@ -678,6 +690,9 @@
|
||||
<data name="msg.error.item.delete.failed" xml:space="preserve">
|
||||
<value>Item deletion failed</value>
|
||||
</data>
|
||||
<data name="msg.error.item.duplicate" xml:space="preserve">
|
||||
<value>A duplicate item already exists.</value>
|
||||
</data>
|
||||
<data name="msg.error.item.id.not.found" xml:space="preserve">
|
||||
<value>Item not found for specified Id</value>
|
||||
</data>
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Saxonite.Net.Core.Web.Online.App
|
||||
private Dictionary<String, SaxAppConfig> appConfigs = new Dictionary<string, SaxAppConfig>();
|
||||
private Dictionary<String, SaxEmailConfig> emailConfigs = new Dictionary<string, SaxEmailConfig>();
|
||||
// Session contexts.
|
||||
private class SessionContextData
|
||||
protected class SessionContextData
|
||||
{
|
||||
public SessionContextData(SaxSessionContext_Web sessionContext)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Online.Controllers;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using Saxonite.Net.Standard.Base.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -49,16 +50,16 @@ namespace Saxonite.Net.Core.Web.Online.App
|
||||
{
|
||||
return base.RefreshUserData(userAccount);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override UserData CreateUserData(SaxSessionContext sessionContext, SaxUserAccount userAccount, List<SaxUserRole> userRoles) { return new UserData_Online(sessionContext, userAccount, userRoles); }
|
||||
/// <summary>User - JSON deserialisation route.</summary>
|
||||
public new UserData User { get { return base.User; } set { SetUser(new UserData_Online(value)); } }
|
||||
|
||||
/// <summary>
|
||||
/// Update the user's contect details against the session.
|
||||
/// <para>- User Account must match that already against the session.</para>
|
||||
/// </summary>
|
||||
public bool RefreshUser(SaxUserAccount userAccount)
|
||||
/// <summary>
|
||||
/// Update the user's contect details against the session.
|
||||
/// <para>- User Account must match that already against the session.</para>
|
||||
/// </summary>
|
||||
public bool RefreshUser(SaxUserAccount userAccount)
|
||||
{
|
||||
UserData_Online user = User as UserData_Online;
|
||||
if (user != null)
|
||||
@@ -67,9 +68,19 @@ namespace Saxonite.Net.Core.Web.Online.App
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// User Profile.
|
||||
// Protected constructors & setters for JSON deserialisation.
|
||||
public class UserProfileData
|
||||
// User Config - user's application settings.
|
||||
public class UserConfigData
|
||||
{
|
||||
/// <summary>Online Profile Config data.</summary>
|
||||
public SaxConfigData.ProfileData Profile{ get; set; } = new SaxConfigData.ProfileData();
|
||||
}
|
||||
/// <summary>User Configuration.</summary>
|
||||
public UserConfigData UserConfig { get; set; } = new UserConfigData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// User Profile.
|
||||
// Protected constructors & setters for JSON deserialisation.
|
||||
public class UserProfileData
|
||||
{
|
||||
public UserProfileData() { }
|
||||
// Sports.
|
||||
|
||||
@@ -18,6 +18,8 @@ using Sarand.Net.Standard.Base.Helpers;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Saxonite.Net.Standard.Base.Data;
|
||||
using static Saxonite.Net.Standard.Base.App.Sax.Config;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
@@ -41,6 +43,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public byte DobDay { get; set; }
|
||||
public byte DobMonth { get; set; }
|
||||
public short DobYear { get; set; }
|
||||
public bool? HasImage { get; set; } = null;
|
||||
// Regions.
|
||||
public String RegionIdCountry { get; set; }
|
||||
public String RegionCaptionCountry { get; set; }
|
||||
@@ -61,6 +64,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
data.DobDay = (byte)userAccount.DateOfBirthDay;
|
||||
data.DobMonth = (byte)userAccount.DateOfBirthMonth;
|
||||
data.DobYear = (short)userAccount.DateOfBirthYear;
|
||||
if (ItemDataMgr.ItemHasActiveImage(userAccount.GetItemId(), Sax.ImageType.Avatar))
|
||||
data.HasImage = true;
|
||||
// Regions.
|
||||
data.RegionIdCountry = model.GetEncryptedRegionId(userAccount.RegionIdCountry);
|
||||
data.RegionIdProvince = model.GetEncryptedRegionId(userAccount.RegionIdProvince);
|
||||
|
||||
@@ -79,6 +79,12 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public List<UserEligibilityResponseListData> Eligibilities { get; } = new List<UserEligibilityResponseListData>();
|
||||
// Eligibility types.
|
||||
public List<EligibilityTypeData> Types { get; } = new List<EligibilityTypeData>();
|
||||
// User configuration.
|
||||
public class ConfigData
|
||||
{
|
||||
public bool? hideInfo { get; set; } = null;
|
||||
}
|
||||
public ConfigData Config { get; } = new ConfigData();
|
||||
}
|
||||
// Ajax request.
|
||||
[HttpPost]
|
||||
@@ -112,6 +118,10 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
if (!SysId.IsValid(userAccountId))
|
||||
userAccountId = SessionUserAccountId;
|
||||
|
||||
// User configuration.
|
||||
if (SessionData_Online.UserConfig.Profile.Eligibility.HideInfo)
|
||||
responseData.Config.hideInfo = true;
|
||||
|
||||
// Item filter.
|
||||
SaxUserEligibility.Params prmUserEligibility = new SaxUserEligibility.Params();
|
||||
prmUserEligibility.UserAccountIdsIncluded.Add(userAccountId);
|
||||
@@ -300,7 +310,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
SaxRegion.Data region = Internals.GetRegion(regionId);
|
||||
|
||||
// Eligibility type.
|
||||
Sax.EligibilityType eligibilityType = userEligibility != null ? userEligibility.EligibilityType : model.Eligibility.getEligibilityType();
|
||||
Sax.EligibilityType eligibilityType = model.Eligibility.Type != null ? model.Eligibility.getEligibilityType() : userEligibility != null ? userEligibility.EligibilityType : 0;
|
||||
if (eligibilityType <= 0)
|
||||
{
|
||||
// Shouldn't get here.
|
||||
@@ -309,7 +319,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Check for duplicate data.
|
||||
// ToDo Should include date range in checking for duplicate eligibility?
|
||||
// ToDo Include date range in checking for duplicate eligibility?
|
||||
{
|
||||
// First check without region.
|
||||
SaxUserEligibility.Params prmUserEligibility = new SaxUserEligibility.Params();
|
||||
@@ -321,33 +331,82 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
long eligibilityCount = AccountMgr.GetUserEligibilityCount(prmUserEligibility);
|
||||
// Selected Eligibility types have a limit on the number of instances allowed.
|
||||
if (eligibilityCount >= SaxUserEligibility.GetMaxInstances(eligibilityType))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.validation.duplicate.value"]));
|
||||
{
|
||||
SaLogger.Warn(fn + " Eligibility type instance limit reached. Type: " + eligibilityType.ToString() + ". Instances: " + eligibilityCount + ". " + GetLogSuffix());
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.duplicate"]));
|
||||
}
|
||||
// Now include region - only allow one eligibility of each type.
|
||||
prmUserEligibility.RegionIdsIncluded.Add(regionId);
|
||||
eligibilityCount = AccountMgr.GetUserEligibilityCount(prmUserEligibility);
|
||||
if (eligibilityCount >= 1)
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.validation.duplicate.value"]));
|
||||
{
|
||||
SaLogger.Warn(fn + " Duplicate Eligibility exists. RegionId: " + SysId.ToString(regionId) + ". Type: " + eligibilityType.ToString() + ". " + GetLogSuffix());
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.duplicate"]));
|
||||
}
|
||||
}
|
||||
|
||||
// If region or eligibility have changed, check whether an equivalent deleted eligibility exists.
|
||||
// NB Can't modify the current eligibility with the modified values as it would conflict with the
|
||||
// deleted item - unique on user, region and eligibility.
|
||||
if (userEligibility != null && (!userEligibility.RegionId.Equals(regionId) || userEligibility.EligibilityType != eligibilityType))
|
||||
{
|
||||
SaxUserEligibility.Params prmUserEligibility = new SaxUserEligibility.Params();
|
||||
prmUserEligibility.IdsExcluded.Add(userEligibility.Id);
|
||||
prmUserEligibility.UserAccountIdsIncluded.Add(userAccountId);
|
||||
prmUserEligibility.RegionIdsIncluded.Add(regionId);
|
||||
prmUserEligibility.EligibilityTypesIncluded.Add(eligibilityType);
|
||||
prmUserEligibility.StatusCat = SaxUserEligibility.StatusCat.DeletedOnly;
|
||||
SaxUserEligibility userEligibilityDeleted = AccountMgr.GetUserEligibility(prmUserEligibility);
|
||||
if (userEligibilityDeleted != null)
|
||||
{
|
||||
disposableItems.Add(userEligibilityDeleted);
|
||||
SaLogger.Info(fn + " Resurrecting User Eligibility with status: " + userEligibilityDeleted.StatusDesc + ". Id: " + SysId.ToString(userEligibilityDeleted.Id) + ". " + GetLogSuffix());
|
||||
userEligibilityDeleted.Status = SaxUserEligibility.DefaultStatus;
|
||||
// Delete current item and replace with previously deleted item.
|
||||
if (!AccountMgr.DeleteUserEligibility(userEligibility, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to delete user eligibility: " + AccountMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
|
||||
}
|
||||
userEligibility = userEligibilityDeleted;
|
||||
}
|
||||
}
|
||||
|
||||
// If eligibility doesn't exist for the user, it may have been previously deleted.
|
||||
if (userEligibility == null)
|
||||
{
|
||||
// See if there is an existing item that matches user, region and eligibility.
|
||||
SaxUserEligibility.Params prmUserEligibility = new SaxUserEligibility.Params();
|
||||
prmUserEligibility.UserAccountIdsIncluded.Add(userAccountId);
|
||||
prmUserEligibility.RegionIdsIncluded.Add(regionId);
|
||||
prmUserEligibility.EligibilityTypesIncluded.Add(eligibilityType);
|
||||
prmUserEligibility.StatusCat = SaxUserEligibility.StatusCat.Any;
|
||||
prmUserEligibility.StatusCat = SaxUserEligibility.StatusCat.DeletedOnly;
|
||||
userEligibility = AccountMgr.GetUserEligibility(prmUserEligibility);
|
||||
if (userEligibility == null)
|
||||
{
|
||||
// Try again for the user & region without the eligibility type.
|
||||
prmUserEligibility.EligibilityTypesIncluded.Clear();
|
||||
userEligibility = AccountMgr.GetUserEligibility(prmUserEligibility);
|
||||
}
|
||||
if (userEligibility == null)
|
||||
{
|
||||
// Try again for the user & eligibility type without the region.
|
||||
prmUserEligibility.RegionIdsIncluded.Clear();
|
||||
prmUserEligibility.EligibilityTypesIncluded.Add(eligibilityType);
|
||||
userEligibility = AccountMgr.GetUserEligibility(prmUserEligibility);
|
||||
}
|
||||
if (userEligibility == null)
|
||||
{
|
||||
// Try again just for the user.
|
||||
prmUserEligibility.RegionIdsIncluded.Clear();
|
||||
prmUserEligibility.EligibilityTypesIncluded.Clear();
|
||||
userEligibility = AccountMgr.GetUserEligibility(prmUserEligibility);
|
||||
}
|
||||
if (userEligibility != null)
|
||||
{
|
||||
disposableItems.Add(userEligibility);
|
||||
if (userEligibility.Status == SaStatus.Deleted)
|
||||
{
|
||||
SaLogger.Info(fn + " Resurrecting User Eligibility with status: " + userEligibility.StatusDesc + ". Id: " + SysId.ToString(userEligibility.Id));
|
||||
userEligibility.Status = SaxUserEligibility.DefaultStatus;
|
||||
}
|
||||
else
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.validation.duplicate.value"]));
|
||||
SaLogger.Info(fn + " Resurrecting User Eligibility with status: " + userEligibility.StatusDesc + ". Id: " + SysId.ToString(userEligibility.Id) + ". " + GetLogSuffix());
|
||||
userEligibility.Status = SaxUserEligibility.DefaultStatus;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -357,6 +416,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Populate item properties.
|
||||
userEligibility.RegionId = regionId;
|
||||
userEligibility.EligibilityType = eligibilityType;
|
||||
if (model.Eligibility.Info != null)
|
||||
userEligibility.Info = model.Eligibility.Info;
|
||||
if (model.Eligibility.ExpiresOn != null)
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Saxonite.Net.Core.Web.Online.Models;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using MailKit;
|
||||
using Org.BouncyCastle.Asn1.Mozilla;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using Saxonite.Net.Standard.Base.Data;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Online Ajax Controller - User Config.
|
||||
//=======================================================================
|
||||
partial class AccountController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data definitions.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update User Config.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_UserConfigData : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_UserConfigData(SaxModel_Online model) : base(model) { }
|
||||
}
|
||||
// Ajax request.
|
||||
[HttpPost]
|
||||
[Route("UserConfig/Ajax/Update")]
|
||||
public IActionResult UpdateUserConfig(SaxModel_Online model)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateUserConfig";
|
||||
AjaxResponse_UserConfigData responseData = new AjaxResponse_UserConfigData(model);
|
||||
String messageTitle = Localiser["caption.user.config"];
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
// Retrieve User Config.
|
||||
Dictionary<Sax.UserConfigType, SaxUserConfig> userConfigs = new Dictionary<Sax.UserConfigType, SaxUserConfig>();
|
||||
|
||||
// Update user's configuration.
|
||||
foreach (String key in Request.Form.Keys)
|
||||
{
|
||||
StringValues formValue = "";
|
||||
Request.Form.TryGetValue(key, out formValue);
|
||||
SaLogger.Debug(fn + " Form data. Key: " + key + ". Value: " + formValue);
|
||||
if (key.EqualsCI("HideProfileEligibilityInfo"))
|
||||
{
|
||||
SaxUserConfig userConfig = RefreshUserConfig(Sax.UserConfigType.Online_Profile, userConfigs);
|
||||
if (userConfig != null)
|
||||
{
|
||||
disposableItems.Add(userConfig);
|
||||
SessionData_Online.UserConfig.Profile.Eligibility.HideInfo = StringUtil.ToBool(formValue);
|
||||
userConfig.ConfigData = SaxConfigData.ProfileData.ToXml(SessionData_Online.UserConfig.Profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store configuration.
|
||||
foreach (SaxUserConfig userConfig in userConfigs.Values)
|
||||
{
|
||||
if (!SysId.IsValid(userConfig.Id))
|
||||
{
|
||||
// Add new configuration.
|
||||
if (!AccountMgr.InsertUserConfig(userConfig, DbUpdateInfo))
|
||||
SaLogger.Warn(fn + " Failed to insert User Config: " + AccountMgr.ErrorStateMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update existing configuration.
|
||||
if (!AccountMgr.UpdateUserConfig(userConfig, DbUpdateInfo))
|
||||
SaLogger.Warn(fn + " Failed to update User Config: " + AccountMgr.ErrorStateMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Retrieve the corresponding User Config if previously stored, otherwise create.
|
||||
/// </summary>
|
||||
private SaxUserConfig RefreshUserConfig(Sax.UserConfigType configType, Dictionary<Sax.UserConfigType, SaxUserConfig> userConfigs)
|
||||
{
|
||||
// Check if Config is already in cache.
|
||||
if (userConfigs.ContainsKey(configType)) return userConfigs.GetValueOrDefault(configType, null);
|
||||
// Retrieve user config.
|
||||
SaxUserConfig userConfig = AccountMgr.GetUserConfig(SessionUserAccountId, configType);
|
||||
if (userConfig == null)
|
||||
{
|
||||
// Configuration doesn't currently exist.
|
||||
userConfig = AccountMgr.CreateUserConfig(SessionUserAccountId, configType);
|
||||
}
|
||||
else
|
||||
{
|
||||
// User Configuration already exists.
|
||||
// Refresh configuration in case updated elsewhere.
|
||||
switch (configType)
|
||||
{
|
||||
case Sax.UserConfigType.Online_Profile:
|
||||
SessionData_Online.UserConfig.Profile = SaxConfigData.ProfileData.FromXml(userConfig.ConfigData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
userConfigs.Add(userConfig.ConfigType, userConfig);
|
||||
return userConfig;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -12,6 +12,7 @@ using Sarand.Net.Standard.Base.Bus;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
@@ -43,19 +44,28 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
String logSuffix = keepLoggedInParams.GetValidParams().Concat("", " ", ".");
|
||||
if (SysId.IsValid(keepLoggedInParams.UserAccountId))
|
||||
{
|
||||
SaxUserAccount userAccount = AccountMgr.GetUserAccountById(keepLoggedInParams.UserAccountId);
|
||||
if (userAccount != null)
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
if (userAccount.IsStatusActive)
|
||||
SaxUserAccount userAccount = AccountMgr.GetUserAccountById(keepLoggedInParams.UserAccountId);
|
||||
if (userAccount != null)
|
||||
{
|
||||
String errorMessage = "";
|
||||
if (SignUserIn(userAccount, AccountMgr.GetRolesForUser(userAccount.Id), true, ref errorMessage))
|
||||
SaLogger.Info(fn + " Keep Logged In cookie found." + logSuffix);
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but failed to sign user in: " + errorMessage + "." + logSuffix);
|
||||
disposableItems.Add(userAccount);
|
||||
if (userAccount.IsStatusActive)
|
||||
{
|
||||
List<SaxUserRole> userRoles = AccountMgr.GetRolesForUser(userAccount.Id);
|
||||
disposableItems.AddRange(userRoles);
|
||||
List<SaxUserConfig> userConfigs = AccountMgr.GetConfigsForUser(userAccount.Id);
|
||||
disposableItems.AddRange(userConfigs);
|
||||
String errorMessage = "";
|
||||
if (SignUserIn(userAccount, userRoles, userConfigs, true, ref errorMessage))
|
||||
SaLogger.Info(fn + " Keep Logged In cookie found." + logSuffix);
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but failed to sign user in: " + errorMessage + "." + logSuffix);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but UserAccount is not active." + logSuffix);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but UserAccount is not active." + logSuffix);
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but UserAccount not found." + logSuffix);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Keep Logged In cookie found but UserAccount not found." + logSuffix);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using Saxonite.Net.Core.Web.Base.Controllers;
|
||||
using Saxonite.Net.Core.Web.Online.App;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using Saxonite.Net.Standard.Base.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
@@ -52,7 +53,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
/// <para>- Open user session - store details against Sesion Data.</para>
|
||||
/// <para>- Set 'Keep logged in' cookie if required.</para>
|
||||
/// </summary>
|
||||
protected bool SignUserIn(SaxUserAccount userAccount, List<SaxUserRole> userRoles, bool keepLoggedIn, ref String errorMessage)
|
||||
protected bool SignUserIn(SaxUserAccount userAccount, List<SaxUserRole> userRoles, List<SaxUserConfig> userConfigs, bool keepLoggedIn, ref String errorMessage)
|
||||
{
|
||||
String fn = GetType().Name + ".SignUserIn";
|
||||
|
||||
@@ -90,6 +91,17 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
OpenUserSession(SessionContext, userAccount, userRoles);
|
||||
RefreshSessionProfileSports();
|
||||
|
||||
// Refresh User configuration.
|
||||
foreach (SaxUserConfig userConfig in userConfigs)
|
||||
{
|
||||
switch (userConfig.ConfigType)
|
||||
{
|
||||
case Sax.UserConfigType.Online_Profile:
|
||||
SessionData_Online.UserConfig.Profile = SaxConfigData.ProfileData.FromXml(userConfig.ConfigData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Send the 'Keep Logged In' cookie if requested.
|
||||
if (userAccount.KeepLoggedIn)
|
||||
SetKeepLoggedInCookie();
|
||||
|
||||
@@ -49,19 +49,26 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
model.ValidateSignInData(responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
|
||||
// Get user account.
|
||||
SaxUserAccount userAccount = GetUserAccountForSignin(model, responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
// Get user account.
|
||||
SaxUserAccount userAccount = GetUserAccountForSignin(model, responseData);
|
||||
disposableItems.Add(userAccount);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
|
||||
String errorMessage = "";
|
||||
if (!SignUserIn(userAccount, AccountMgr.GetRolesForUser(userAccount.Id), model.KeepMeSignedIn, ref errorMessage))
|
||||
return Json(responseData.SetControlError(nameof(model.EmailAddress), errorMessage));
|
||||
|
||||
// Construct response.
|
||||
List<SaxUserRole> userRoles = AccountMgr.GetRolesForUser(userAccount.Id);
|
||||
disposableItems.AddRange(userRoles);
|
||||
List<SaxUserConfig> userConfigs = AccountMgr.GetConfigsForUser(userAccount.Id);
|
||||
disposableItems.AddRange(userConfigs);
|
||||
String errorMessage = "";
|
||||
if (!SignUserIn(userAccount, userRoles, userConfigs, model.KeepMeSignedIn, ref errorMessage))
|
||||
return Json(responseData.SetControlError(nameof(model.EmailAddress), errorMessage));
|
||||
}
|
||||
// Complete response.
|
||||
responseData.Success = SessionData_Online?.ValidUserSession ?? false;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
AdditionalFiles_CSS.Add("css/sax-account.css");
|
||||
AdditionalFiles_JS.Add("js/sax-account.js");
|
||||
AdditionalFiles_JS.Add("js/sax-pro-usr.js");
|
||||
AdditionalFiles_JS.Add("js/sax-pro-cfg.js");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Online\Core\" />
|
||||
<Folder Include="Online\Data\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifAccountAbout"><span>@Localiser["label.about"]</span></label>
|
||||
<label for="ifAccountAbout"><span>@Localiser["label.bio"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
|
||||
@@ -3,166 +3,172 @@
|
||||
|
||||
<div class="sax-panel-section ProfileEligibility sax-populating">
|
||||
|
||||
<div class="sax-panel-info">
|
||||
<div class="sax-panel-info">
|
||||
|
||||
<div class="sax-header">
|
||||
<div class="row">
|
||||
<div class="col sax-action sax-edit"><div class="sax-caption">@Localiser["caption.my.eligibility"]</div></div>
|
||||
<div class="fixed">
|
||||
@* Burger menu *@
|
||||
<ul class="nav navbar-nav navbar-light navbar-right sax-burger">
|
||||
<li class="dropdown-toggle caret-off">
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="navbar-toggler-icon"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sax-dropdown-menu">
|
||||
<li class="sax-dropdown-item sax-action sax-add"><div class="sax-label">@(Localiser["label.add"])</div></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@* Filter item templates *@
|
||||
<div class="sax-panel-item-template">
|
||||
@* Burger dropdown item template - ul is ignored *@
|
||||
<ul class="sax-dropdown-menu ProfileEligibilities">
|
||||
<li class="sax-dropdown-item sax-action"><div class="sax-label">...</div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-header">
|
||||
<div class="row">
|
||||
<div class="col sax-action sax-edit"><div class="sax-caption">@Localiser["caption.my.eligibility"]</div></div>
|
||||
<div class="fixed">
|
||||
@* Burger menu *@
|
||||
<ul class="nav navbar-nav navbar-light navbar-right sax-burger">
|
||||
<li class="dropdown-toggle caret-off">
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="navbar-toggler-icon"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sax-dropdown-menu">
|
||||
<li class="sax-dropdown-item sax-action sax-add"><div class="sax-label">@(Localiser["label.add"])</div></li>
|
||||
<li class="sax-dropdown-item sax-action sax-info"><div class="sax-label">@(Localiser["caption.show.info"])</div></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@* Filter item templates *@
|
||||
<div class="sax-panel-item-template">
|
||||
@* Burger dropdown item template - ul is ignored *@
|
||||
<ul class="sax-dropdown-menu ProfileEligibilities">
|
||||
<li class="sax-dropdown-item sax-action"><div class="sax-label">...</div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-content">
|
||||
@* User Eligibility list. *@
|
||||
<div class="sax-panel-results UserEligibilities"></div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
<div class="sax-panel-results">
|
||||
<div class="sax-panel-infotip hidden"><div class="sax-close"></div><div class="sax-info"></div></div>
|
||||
<div class="sax-panel-messages"></div>
|
||||
@* User Eligibility list. *@
|
||||
<div class="sax-panel-item-list"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Item templates *@
|
||||
<div class="sax-panel-item-template">
|
||||
@* User Eligibility template *@
|
||||
<div class="sax-panel-item UserEligibility">
|
||||
<div class="sax-header row">
|
||||
<div class="col"><div class="sax-caption"><div class="sax-action EligibilityRegionName"></div></div></div>
|
||||
<div class="fixed">
|
||||
@* Burger menu *@
|
||||
<ul class="nav navbar-nav navbar-light navbar-right sax-burger">
|
||||
<li class="dropdown-toggle caret-off">
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="navbar-toggler-icon"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sax-dropdown-menu"></ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-6"><div class="EligibilityType sax-note"></div></div>
|
||||
<div class="col-sm-6 text-sm-right"><div class="EligibilityExpiry sax-note">@Localiser["label.expires"]: <span class="EligibilityExpiresOn"></span></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* User Eligibility Burger dropdown template - ul is ignored *@
|
||||
<ul class="sax-dropdown-menu UserEligibility">
|
||||
<li class="sax-dropdown-item sax-action"><div class="sax-label">...</div></li>
|
||||
</ul>
|
||||
</div>
|
||||
@* Item templates *@
|
||||
<div class="sax-panel-item-template">
|
||||
@* User Eligibility template *@
|
||||
<div class="sax-panel-item UserEligibility">
|
||||
<div class="sax-header row">
|
||||
<div class="col"><div class="sax-caption"><div class="sax-action EligibilityRegionName"></div></div></div>
|
||||
<div class="fixed">
|
||||
@* Burger menu *@
|
||||
<ul class="nav navbar-nav navbar-light navbar-right sax-burger">
|
||||
<li class="dropdown-toggle caret-off">
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="navbar-toggler-icon"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sax-dropdown-menu"></ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-6"><div class="EligibilityType sax-note"></div></div>
|
||||
<div class="col-sm-6 text-sm-right"><div class="EligibilityExpiry sax-note">@Localiser["label.expires"]: <span class="EligibilityExpiresOn"></span></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* User Eligibility Burger dropdown template - ul is ignored *@
|
||||
<ul class="sax-dropdown-menu UserEligibility">
|
||||
<li class="sax-dropdown-item sax-action"><div class="sax-label">...</div></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@* User Eligibility Id form. *@
|
||||
@using (Html.BeginForm(FormMethod.Post, new { @id = "frmUserEligibilityId", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.Hidden("Eligibility.Id", "", new { @id = "", @class = "UserEligibilityId sax-hidden" })
|
||||
}
|
||||
@* User Eligibility Id form. *@
|
||||
@using (Html.BeginForm(FormMethod.Post, new { @id = "frmUserEligibilityId", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.Hidden("Eligibility.Id", "", new { @id = "", @class = "UserEligibilityId sax-hidden" })
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* User Eligibility dialog *@
|
||||
<div id="dlgUserEligibility" class="sax-dialog" title="@Localiser["account.caption.profile.eligibility"]">
|
||||
@* User Eligibility dialog *@
|
||||
<div id="dlgUserEligibility" class="sax-dialog" title="@Localiser["account.caption.profile.eligibility"]">
|
||||
|
||||
<div class="spacer2"></div>
|
||||
@using (Html.BeginForm(FormMethod.Post, new { @id = "frmUserEligibility", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<input type="hidden" class="UserEligibilityId sax-hidden" name="Eligibility.Id" />
|
||||
<input type="hidden" class="EligibilityExists sax-hidden" name="Eligibility.Exists" />
|
||||
<div class="spacer2"></div>
|
||||
@using (Html.BeginForm(FormMethod.Post, new { @id = "frmUserEligibility", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<input type="hidden" class="UserEligibilityId sax-hidden" name="Eligibility.Id" />
|
||||
<input type="hidden" class="EligibilityExists sax-hidden" name="Eligibility.Exists" />
|
||||
|
||||
@* Region *@
|
||||
<div class="sax-form-control EligibilityRegion">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifEligibilityRegionId"><span>@Localiser["label.region"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control row">
|
||||
@Html.Hidden("Eligibility.RegionId", "", new { @id = "ifEligibilityRegionId", @class = "EligibilityRegionId" })
|
||||
<div class="col"><input type="text" id="ifEligibilityRegionName" class="EligibilityRegionName sax-input" readonly="readonly" /></div>
|
||||
<div class="fixed"><button class="SelectEligibilityRegion sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" >@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* Region *@
|
||||
<div class="sax-form-control EligibilityRegion">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifEligibilityRegionId"><span>@Localiser["label.region"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control row">
|
||||
@Html.Hidden("Eligibility.RegionId", "", new { @id = "ifEligibilityRegionId", @class = "EligibilityRegionId" })
|
||||
<div class="col"><input type="text" id="ifEligibilityRegionName" class="EligibilityRegionName sax-input" readonly="readonly" /></div>
|
||||
<div class="fixed"><button class="SelectEligibilityRegion sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Eligibility Type *@
|
||||
<div class="sax-form-control EligibilityType">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifEligibilityType"><span>@Localiser["label.eligibility"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control">
|
||||
@Html.DropDownList("Eligibility.Type", Model.EligibilityTypesForSelect, "", new { @id = "ifEligibilityType", @class = "EligibilityType sax-select", @readonly = "readonly", @maxlength = @Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_EmailAddress) })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* Eligibility Type *@
|
||||
<div class="sax-form-control EligibilityType">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifEligibilityType"><span>@Localiser["label.eligibility"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control">
|
||||
@Html.DropDownList("Eligibility.Type", Model.EligibilityTypesForSelect, "", new { @id = "ifEligibilityType", @class = "EligibilityType sax-select", @readonly = "readonly", @maxlength = @Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_EmailAddress) })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Info *@
|
||||
<div class="sax-form-control EligibilityInfo">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifEligibilityInfo"><span>@Localiser["label.info"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control">
|
||||
@Html.TextArea("Eligibility.Info", "", new { @id = "ifEligibilityInfo", @class = "EligibilityInfo sax-textarea", @rows = 4, @maxlength = @Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserEligibility_Info) })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* Info *@
|
||||
<div class="sax-form-control EligibilityInfo">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifEligibilityInfo"><span>@Localiser["label.info"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control">
|
||||
@Html.TextArea("Eligibility.Info", "", new { @id = "ifEligibilityInfo", @class = "EligibilityInfo sax-textarea", @rows = 4, @maxlength = @Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserEligibility_Info) })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Expiry *@
|
||||
<div class="sax-form-control EligibilityExpiry">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifArticleRegionId"><span>@Localiser["label.expiry"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control">
|
||||
<div class="row EligibilityExpires">
|
||||
<div class="fixed"><div class="pl16 pt4 pr8"><input type="checkbox" id="chkEligibilityExpires" class="EligibilityExpires sax-checkbox" /> <span class="" onclick="$('#chkEligibilityExpires').click()">@Localiser["label.expires.on"]</span></div></div>
|
||||
<div class="col">@Html.TextBox("Eligibility.ExpiresOn", "", new { @id = "ifEligibilityExpiresOn", @class = "sax-input sax-calendar EligibilityExpiresOn", @readonly = "readonly" })</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* Expiry *@
|
||||
<div class="sax-form-control EligibilityExpiry">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifArticleRegionId"><span>@Localiser["label.expiry"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control">
|
||||
<div class="row EligibilityExpires">
|
||||
<div class="fixed"><div class="pl16 pt4 pr8"><input type="checkbox" id="chkEligibilityExpires" class="EligibilityExpires sax-checkbox" /> <span class="" onclick="$('#chkEligibilityExpires').click()">@Localiser["label.expires.on"]</span></div></div>
|
||||
<div class="col">@Html.TextBox("Eligibility.ExpiresOn", "", new { @id = "ifEligibilityExpiresOn", @class = "sax-input sax-calendar EligibilityExpiresOn", @readonly = "readonly" })</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
}
|
||||
<div class="spacer2"></div>
|
||||
</div>
|
||||
}
|
||||
<div class="spacer2"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
sax.dlg.title.addUserEligibility = '@Localiser.GetJavascriptText("account.caption.profile.eligibility.add")';
|
||||
sax.dlg.title.updateUserEligibility = '@Localiser.GetJavascriptText("account.caption.profile.eligibility.update")';
|
||||
sax.dlg.title.removeUserEligibility = '@Localiser.GetJavascriptText("account.caption.profile.eligibility.remove")';
|
||||
sax.msg.removeUserEligibility = '@(Localiser.GetJavascriptText("msg.confirm.item.remove"))';
|
||||
sax.msg.eligibilityInfo = '@Localiser.GetJavascriptText("info.profile.eligibility")';
|
||||
sax.dlg.title.addUserEligibility = '@Localiser.GetJavascriptText("account.caption.profile.eligibility.add")';
|
||||
sax.dlg.title.updateUserEligibility = '@Localiser.GetJavascriptText("account.caption.profile.eligibility.update")';
|
||||
sax.dlg.title.removeUserEligibility = '@Localiser.GetJavascriptText("account.caption.profile.eligibility.remove")';
|
||||
sax.msg.removeUserEligibility = '@(Localiser.GetJavascriptText("msg.confirm.item.remove"))';
|
||||
</script>
|
||||
<script src="~/js/sax-pro-elg.js?@Model.HrefVersion"></script>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
@model SaxModel_Online
|
||||
@inject SaxLocaliser Localiser
|
||||
|
||||
@if (!Model.RegisterView("Views/Common/SportSelect")) return;
|
||||
|
||||
<link rel="stylesheet" href="~/css/sax-spt-cnt.css?@Model.HrefVersion" />
|
||||
<script src="~/js/sax-spt-cnt.js?@Model.HrefVersion"></script>
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
|
||||
<div id="dlgCodeSelect" class="sax-dialog sax-form" style="padding-bottom:8px;">
|
||||
|
||||
@* Filter *@
|
||||
<div class=""></div>
|
||||
|
||||
<div class="row h-100">
|
||||
|
||||
@* Available codes *@
|
||||
<div class="col-sm-5">
|
||||
|
||||
<div class="h-100 sax-codeSelect-codes AvailableCodes"></div>
|
||||
|
||||
</div>
|
||||
|
||||
@* Code selection *@
|
||||
<div class="col-sm-2">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sx-6 col-sm-12 center">
|
||||
<button class="sax-button Select">@Localiser["label.select"]</button>
|
||||
</div>
|
||||
|
||||
<div class="col-sx-6 col-sm-12 center">
|
||||
<button class="sax-button Remove">@Localiser["label.remove"]</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@* Selected codes *@
|
||||
<div class="col-sm-5">
|
||||
|
||||
<div class="h-100 sax-codeSelect-codes SelectedCodes">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-item-template">
|
||||
<div class="sax-panel-item Code">
|
||||
<div class="CodeDesc"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -124,6 +124,11 @@
|
||||
background-image: url('../img/action/refresh24.png');
|
||||
}
|
||||
|
||||
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-info
|
||||
{
|
||||
background-image: url('../img/action/info24.png');
|
||||
}
|
||||
|
||||
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-add
|
||||
{
|
||||
background-image: url('../img/action/add24.png');
|
||||
@@ -203,6 +208,31 @@
|
||||
{
|
||||
}
|
||||
|
||||
/* Information tip*/
|
||||
|
||||
.sax-panel-results .sax-panel-infotip
|
||||
{
|
||||
width: 100%;
|
||||
margin-top: 4px;
|
||||
padding: 4px 4px 4px 8px;
|
||||
font-size: 14px;
|
||||
color: #606060;
|
||||
background-color: #fff;
|
||||
border: 1px solid #989898;
|
||||
border-bottom-right-radius: 8px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.sax-panel-results .sax-panel-infotip .sax-close
|
||||
{
|
||||
float: right;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-left: 8px;
|
||||
background: url("../img/action/delete16.png");
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
/* Messages */
|
||||
|
||||
.sax-panel-results .sax-panel-messages .sax-message
|
||||
@@ -346,7 +376,7 @@
|
||||
{
|
||||
max-width: 48px;
|
||||
max-height: 48px;
|
||||
margin:4px 4px 2px 0;
|
||||
margin: 4px 4px 2px 0;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
|
||||
@@ -362,10 +362,17 @@ a:focus
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div.ui-dialog.center-buttons .ui-dialog-buttonpane .ui-dialog-buttonset
|
||||
{
|
||||
float: none;
|
||||
margin: 0 auto;
|
||||
display: table;
|
||||
}
|
||||
|
||||
.ui-dialog .ui-dialog-buttonpane button
|
||||
{
|
||||
min-width: 60px;
|
||||
margin:4px;
|
||||
margin: 4px;
|
||||
padding: 6px 16px 4px 16px;
|
||||
color: #fff;
|
||||
background-color: #606060;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/*
|
||||
Sport Contact stylesheet.
|
||||
*/
|
||||
|
||||
/* The End */
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* User Config scripts.
|
||||
*/
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
//--------------------------------------------------------------
|
||||
"use strict";
|
||||
let uc = sax.UserConfig = { fn: {}, ajax: {}, data: {}, $pnl: {}, $frm: {}, $dlg: {} };
|
||||
//--------------------------------------------------------------
|
||||
sax.updateUserConfigOption = uc.fn.updateConfigItem = function (key, val)
|
||||
{
|
||||
let formData = new FormData();
|
||||
formData.append("__RequestVerificationToken", $('#frmNavigate input[name="__RequestVerificationToken"]').val());
|
||||
formData.append(key, val);
|
||||
sax.doAjaxRequest({ url: sax.url.base + 'UserConfig/Ajax/Update', formData: formData }, 50);
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -12,6 +12,7 @@
|
||||
sax.refreshProfileEligibilityInfo = function (delay)
|
||||
{
|
||||
ue.init();
|
||||
$pnl.infoTip.hide().find('.sax-info').text(sax.msg.eligibilityInfo);
|
||||
$pnl.usrElg.removeClass('sax-edit').addClass('sax-populating');
|
||||
$('.sax-property', $pnl.usrElg).hide();
|
||||
sax.showDataRefreshingMsg($pnl.usrElg);
|
||||
@@ -30,10 +31,11 @@
|
||||
ue.clearItem();
|
||||
if (!response || !response.success) return;
|
||||
ue.data.types = response.types;
|
||||
$('.sax-message', $pnl.usrElg).stop(true, false).fadeOut(200).empty();
|
||||
$pnl.infoTip.toggle(!response.config.hideInfo);
|
||||
$('.sax-panel-messages', $pnl.results).stop(true, false).hide();
|
||||
let items = response.eligibilities;
|
||||
if (!items) return;
|
||||
let $items = $('.sax-panel-results.UserEligibilities', $pnl.usrElg).empty();
|
||||
let $items = $('.sax-panel-item-list', $pnl.results).empty();
|
||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||
$items.append(ue.populateItem(ue.getItemTemplate(), items[itemIdx]));
|
||||
$items.show();
|
||||
@@ -45,7 +47,7 @@
|
||||
if (!item) return;
|
||||
$item.prop('id', item.id);
|
||||
let fnUpd = function (evt) { ue.updateItem(item, $item); }
|
||||
let fnRmv = function (evt) { ue.removeItem(item,$item); }
|
||||
let fnRmv = function (evt) { ue.removeItem(item, $item); }
|
||||
$('.sax-header .sax-caption', $item).on('click', fnUpd);
|
||||
$('.sax-content', $item).on('dblclick', fnUpd);
|
||||
|
||||
@@ -86,9 +88,26 @@
|
||||
return $opt.find('div.sax-label').text(lbl).end().on('click', fn).addClass(cls);
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
ue.data.hideInfoKey = 'HideProfileEligibilityInfo';
|
||||
ue.showInfoTip = function ()
|
||||
{
|
||||
sax.debug('showInfoTip');
|
||||
$pnl.infoTip.show();
|
||||
sax.updateUserConfigOption(ue.data.hideInfoKey, 0);
|
||||
}
|
||||
ue.hideInfoTip = function ()
|
||||
{
|
||||
$pnl.infoTip.hide();
|
||||
sax.updateUserConfigOption(ue.data.hideInfoKey, 1);
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
ue.addItem = function ()
|
||||
{
|
||||
ue.clearItem();
|
||||
ue.showEligibilityDialog();
|
||||
}
|
||||
ue.showEligibilityDialog = function ()
|
||||
{
|
||||
sax.openDialog($dlg.usrElg.dialog('option', 'title', sax.dlg.title.addUserEligibility), 640, 480);
|
||||
}
|
||||
ue.clearItem = function ()
|
||||
@@ -98,7 +117,7 @@
|
||||
let frm = $frm.usrElg;
|
||||
$('.UserEligibilityId,.EligibilityExists,.EligibilityRegionId,input.sax-input,textarea.sax-textarea,select.sax-select', frm).val('');
|
||||
$('.SelectEligibilityRegion', frm).show();
|
||||
$('.sax-select.EligibilityType', frm).prop('disabled', false);
|
||||
ue.$selType.prop('disabled', false).change();
|
||||
ue.$chkExpires.prop("checked", false);
|
||||
sax.clearControlErrors(frm);
|
||||
}
|
||||
@@ -113,7 +132,7 @@
|
||||
}
|
||||
ue.doUpdateItem = function (response)
|
||||
{
|
||||
sax.debug('doUpdateItem', response);
|
||||
//sax.debug('doUpdateItem', response);
|
||||
if (!response.success) return;
|
||||
ue.clearItem();
|
||||
let frm = $frm.usrElg;
|
||||
@@ -122,19 +141,19 @@
|
||||
ue.$hdnExists.val(1);
|
||||
$('.EligibilityRegionId', frm).val(item.regionId);
|
||||
$('.sax-input.EligibilityRegionName', frm).val(item.regionName);
|
||||
$('.SelectEligibilityRegion', frm).hide();
|
||||
ue.$selType.val(item.eligibilityType).prop('disabled', true).change();
|
||||
//$('.SelectEligibilityRegion', frm).hide();
|
||||
ue.$selType.val(item.eligibilityType);//.prop('disabled', true).change();
|
||||
$('.sax-textarea.EligibilityInfo', frm).val(item.info);
|
||||
ue.$chkExpires.prop("checked", !!item.expiresOnFrm);
|
||||
ue.$dpExpiresOn.val(item.expiresOnFrm);
|
||||
sax.openDialog($dlg.usrElg.dialog('option', 'title', sax.dlg.title.updateUserEligibility), 640, 480);
|
||||
ue.showEligibilityDialog();
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
ue.selectEligibilityRegion = function ()
|
||||
{
|
||||
//sax.debug('selectEligibilityRegion');
|
||||
let frm = $frm.usrElg;
|
||||
if (ue.$hdnExists.val()) return;
|
||||
//if (ue.$hdnExists.val()) return;
|
||||
sax.mdl.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('#ifEligibilityRegionId', frm).val(), fnCallback: ue.storeEligibilityRegion })
|
||||
}
|
||||
ue.storeEligibilityRegion = function (eligibility)
|
||||
@@ -186,7 +205,7 @@
|
||||
//--------------------------------------------------------------
|
||||
ue.removeItem = function (item, $item)
|
||||
{
|
||||
sax.debug('removeItem',item);
|
||||
sax.debug('removeItem', item);
|
||||
ue.data.item = item;
|
||||
ue.data.$item = $item;
|
||||
let fn = function ()
|
||||
@@ -209,7 +228,10 @@
|
||||
{
|
||||
if ($pnl.usrElg) return;
|
||||
$pnl.usrElg = $('.sax-panel-section.ProfileEligibility');
|
||||
$('.sax-action.sax-add', $pnl.usrElg).on('click', function (evt) { ue.addItem(); });
|
||||
$pnl.usrElg.on('click', '.sax-action.sax-add', function (evt) { ue.addItem(); });
|
||||
$pnl.usrElg.on('click', '.sax-action.sax-info', function (evt) { ue.showInfoTip(); });
|
||||
$pnl.results = $('.sax-panel-results', $pnl.usrElg);
|
||||
$pnl.infoTip = $('.sax-panel-infotip', $pnl.results).on('click', '.sax-close', function (evt) { ue.hideInfoTip(); });
|
||||
|
||||
$frm.usrElgId = $('#frmUserEligibilityId', $pnl.usrElg);
|
||||
var opt = sax.dlgOpts();
|
||||
|
||||
@@ -31,14 +31,15 @@
|
||||
sax.onRefreshProfileContactInfo = function (response)
|
||||
{
|
||||
//sax.debug('onRefreshProfileContactInfo', response);
|
||||
if (!response || !response.success || !response.contact) return;
|
||||
if (!response || !response.success) return;
|
||||
let item = response.contact || {};
|
||||
$('.sax-panel-section').slideDown(750);
|
||||
$('.sax-message', $pnl.proCon).stop(true, false).fadeOut(200).empty();
|
||||
$('.sax-value', $pnl.proConInf).empty();
|
||||
sax.refreshInfo($pnl.proConInf, 'AccountEmailAddress', response.contact.emailAddress);
|
||||
sax.refreshInfo($pnl.proConInf, 'AccountName', response.contact.displayName);
|
||||
sax.refreshInfo($pnl.proConInf, 'AccountLocation', response.contact.locationCaption);
|
||||
$('img.AccountContact', $pnl.proConInf).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
|
||||
sax.refreshInfo($pnl.proConInf, 'AccountEmailAddress', item.emailAddress);
|
||||
sax.refreshInfo($pnl.proConInf, 'AccountName', item.displayName);
|
||||
sax.refreshInfo($pnl.proConInf, 'AccountLocation', item.locationCaption);
|
||||
$('img.AccountContact', $pnl.proConInf).prop('src', item.hasImage ? 'Image/Account/Contact/Profile?' + (new Date()).getTime() : '').toggle(!!item.hasImage);
|
||||
sax.showNoInfoMsg($pnl.proConInf);
|
||||
$pnl.proCon.removeClass('sax-populating');
|
||||
}
|
||||
@@ -49,27 +50,28 @@
|
||||
sax.data.genders = response.genders;
|
||||
sax.data.months = response.months;
|
||||
sax.data.imageContentTypes = response.imageContentTypes;
|
||||
let item = response.contact || {};
|
||||
$('.sax-message', $pnl.proCon).stop(true, false).fadeOut(200).empty();
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountEmailAddress', response.contact.emailAddress);
|
||||
sax.refreshSelect($pnl.proConFrm, 'AccountTitle', response.contact.title);
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountFirstName', response.contact.firstName);
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountLastName', response.contact.lastName);
|
||||
sax.refreshTextArea($pnl.proConFrm, 'AccountAbout', response.contact.about);
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountEmailAddress', item.emailAddress);
|
||||
sax.refreshSelect($pnl.proConFrm, 'AccountTitle', item.title);
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountFirstName', item.firstName);
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountLastName', item.lastName);
|
||||
sax.refreshTextArea($pnl.proConFrm, 'AccountAbout', item.about);
|
||||
let $selGender = $('#cbAccountGender');
|
||||
if (response.genders && response.genders.length)
|
||||
sax.populateSelectCodeDesc($('#cbAccountGender'), response.genders);
|
||||
sax.refreshSelect($pnl.proConFrm, 'AccountGender', response.contact.gender || '');
|
||||
sax.refreshSelect($pnl.proConFrm, 'AccountGender', item.gender || '');
|
||||
sax.refreshDob();
|
||||
sax.refreshSelect($pnl.proConFrm, 'AccountDobYear', response.contact.dobYear);
|
||||
sax.refreshSelect($pnl.proConFrm, 'AccountDobYear', item.dobYear);
|
||||
sax.refreshDob();
|
||||
sax.refreshSelect($pnl.proConFrm, 'AccountDobMonth', response.contact.dobMonth);
|
||||
sax.refreshSelect($pnl.proConFrm, 'AccountDobMonth', item.dobMonth);
|
||||
sax.refreshDob();
|
||||
sax.refreshSelect($pnl.proConFrm, 'AccountDobDay', response.contact.dobDay);
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountRegionIdCountry', response.contact.regionIdCountry);
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountRegionCaptionCountry', response.contact.regionCaptionCountry);
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountRegionIdProvince', response.contact.regionIdProvince);
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountRegionCaptionProvince', response.contact.regionCaptionProvince);
|
||||
$('img.AccountContact', $pnl.proConFrm).prop('src', 'Image/Account/Contact/Profile?' + (new Date()).getTime());
|
||||
sax.refreshSelect($pnl.proConFrm, 'AccountDobDay', item.dobDay);
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountRegionIdCountry', item.regionIdCountry);
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountRegionCaptionCountry', item.regionCaptionCountry);
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountRegionIdProvince', item.regionIdProvince);
|
||||
sax.refreshInput($pnl.proConFrm, 'AccountRegionCaptionProvince', item.regionCaptionProvince);
|
||||
$('img.AccountContact', $pnl.proConFrm).prop('src', item.hasImage ? 'Image/Account/Contact/Profile?' + (new Date()).getTime() : '');
|
||||
$('.sax-panel-section').slideUp(750, function () { $pnl.proCon.addClass('sax-edit').slideDown(750); });
|
||||
}
|
||||
sax.storeProfileContact = function ()
|
||||
@@ -149,7 +151,7 @@
|
||||
{
|
||||
//sax.debug('onDropContactImageFile', file, context);
|
||||
if (file.size > sax.maxProfileImageSize) return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileSizeMax.format(sax.formatFileSize(sax.maxProfileImageSize)));
|
||||
if ((sax.data.imageContentTypes||[]).indexOf(file.type) < 0) return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileTypeInvalid.format(sax.getFileType(file)));
|
||||
if ((sax.data.imageContentTypes || []).indexOf(file.type) < 0) return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileTypeInvalid.format(sax.getFileType(file)));
|
||||
$(".UploadMessage", context).text(sax.msg.uploadingFile.format(file.name));
|
||||
$('img.ContactImageUploadProgress', context).fadeIn(200);
|
||||
sax.clearControlError($pnl.contactImageDrag);
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Sport contact.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
//--------------------------------------------------------------
|
||||
"use strict";
|
||||
let sc = sax.mdl.sportContact = { ajax: {}, data: {}, $pnl: {}, $dlg: {}, $frm: {} };
|
||||
//--------------------------------------------------------------
|
||||
/*
|
||||
* Sport Contact config:
|
||||
* - caption - dialog title.
|
||||
* - contact:
|
||||
* - type
|
||||
* - name
|
||||
* - email
|
||||
* - phone
|
||||
* - typesUsed
|
||||
* - fnCallback - method to call on completion to store details.
|
||||
*/
|
||||
sax.showSportContact = function (cfg)
|
||||
{
|
||||
sc.fn.init();
|
||||
sc.data.cfg = cfg;
|
||||
sax.openDialog(sc.$dlg.dialog('option', { title: sc.data.cfg.caption || 'Select Sport' }), sc.data.cfg.width || 400, sc.data.cfg.height || 800);
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
sc.fn.displayContact = function ()
|
||||
{
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
sc.fn.init = function ()
|
||||
{
|
||||
if (sc.$dlg.sptCnt) return;
|
||||
var opt = sax.dlgOpts();
|
||||
opt.open = function (evt, ui) { sc.fn.onDlgSize(); };
|
||||
opt.resize = function (evt, ui) { sc.fn.onDlgSize(); };
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { sc.fn.storeSelectSport(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { sc.fn.cleanUp(); $(this).dialog('close'); };
|
||||
sc.$dlg.sptCnt = $('#dlgSportContact').dialog(opt);
|
||||
}
|
||||
//--------------------------------------------------------------
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.2.9.1";
|
||||
private static String version { get; } = "1.2.9.2";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
DataItemType,
|
||||
Gender,
|
||||
SportSpecialityLabel,
|
||||
SportContactType,
|
||||
SportParticipation,
|
||||
SportOfficiating,
|
||||
RegionType,
|
||||
@@ -138,6 +139,14 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
Visa = 210,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>User Config</summary>
|
||||
public enum UserConfigType
|
||||
{
|
||||
/* Do not change the values - tied to database. */
|
||||
Online_Profile = 100,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>User roles</summary>
|
||||
public enum UserRole
|
||||
@@ -159,6 +168,17 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
NotRelevant = 90,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Sport Contact Type</summary>
|
||||
public enum SportContactType
|
||||
{
|
||||
Unknown = 0,
|
||||
/* Do not change the values/codes - tied to database. */
|
||||
Coach = 100,
|
||||
Manager = 200,
|
||||
Agent = 300,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Sport Participation</summary>
|
||||
public enum SportParticipation
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:45
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
@@ -31,6 +31,7 @@ namespace Saxonite.Base.App
|
||||
Sport,
|
||||
UserAccount,
|
||||
UserActivity,
|
||||
UserConfig,
|
||||
UserEligibility,
|
||||
UserOnline,
|
||||
UserOrganisation,
|
||||
@@ -270,6 +271,7 @@ namespace Saxonite.Base.App
|
||||
UserAccount_PhoneMobile,
|
||||
UserAccount_PhoneAlt,
|
||||
UserAccount_Gender,
|
||||
UserAccount_GenderOther,
|
||||
UserAccount_DateOfBirthDay,
|
||||
UserAccount_DateOfBirthMonth,
|
||||
UserAccount_DateOfBirthYear,
|
||||
@@ -314,6 +316,12 @@ namespace Saxonite.Base.App
|
||||
UserActivity_UpdateOn,
|
||||
UserActivity_UpdateBy,
|
||||
UserActivity_UpdateHost,
|
||||
UserConfig_Id,
|
||||
UserConfig_UserAccountId,
|
||||
UserConfig_ConfigType,
|
||||
UserConfig_ConfigData,
|
||||
UserConfig_CreateOn,
|
||||
UserConfig_UpdateOn,
|
||||
UserEligibility_Id,
|
||||
UserEligibility_UserAccountId,
|
||||
UserEligibility_RegionId,
|
||||
@@ -411,8 +419,8 @@ namespace Saxonite.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 21;
|
||||
private static readonly int columnCount = 362;
|
||||
private static readonly int tableCount = 22;
|
||||
private static readonly int columnCount = 369;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -572,6 +580,7 @@ namespace Saxonite.Base.App
|
||||
"Sport",
|
||||
"UserAccount",
|
||||
"UserActivity",
|
||||
"UserConfig",
|
||||
"UserEligibility",
|
||||
"UserOnline",
|
||||
"UserOrganisation",
|
||||
@@ -830,6 +839,7 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(13,"PhoneMobile",0,-9,false,50),
|
||||
new ColumnDfn(13,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(13,"Gender",2,-6,false,3),
|
||||
new ColumnDfn(13,"GenderOther",0,-9,false,50),
|
||||
new ColumnDfn(13,"DateOfBirthDay",2,-6,false,3),
|
||||
new ColumnDfn(13,"DateOfBirthMonth",2,-6,false,3),
|
||||
new ColumnDfn(13,"DateOfBirthYear",3,5,false,5),
|
||||
@@ -876,42 +886,33 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(14,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(15,"Id",5,-5,true,19),
|
||||
new ColumnDfn(15,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(15,"RegionId",4,4,false,10),
|
||||
new ColumnDfn(15,"EligibilityType",3,5,false,5),
|
||||
new ColumnDfn(15,"Info",0,-9,false,2000),
|
||||
new ColumnDfn(15,"ExpiresOn",9,93,false,16),
|
||||
new ColumnDfn(15,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(15,"Flags",3,5,false,5),
|
||||
new ColumnDfn(15,"Status",0,12,false,3),
|
||||
new ColumnDfn(15,"ConfigType",3,5,false,5),
|
||||
new ColumnDfn(15,"ConfigData",0,-9,false,0),
|
||||
new ColumnDfn(15,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(15,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(15,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(15,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(15,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(15,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(16,"Id",5,-5,true,19),
|
||||
new ColumnDfn(16,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(16,"OnlineAt",9,93,false,16),
|
||||
new ColumnDfn(17,"Id",5,-5,true,19),
|
||||
new ColumnDfn(16,"RegionId",4,4,false,10),
|
||||
new ColumnDfn(16,"EligibilityType",3,5,false,5),
|
||||
new ColumnDfn(16,"Info",0,-9,false,2000),
|
||||
new ColumnDfn(16,"ExpiresOn",9,93,false,16),
|
||||
new ColumnDfn(16,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(16,"Flags",3,5,false,5),
|
||||
new ColumnDfn(16,"Status",0,12,false,3),
|
||||
new ColumnDfn(16,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(16,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(16,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(16,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(16,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(16,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(17,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(17,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(17,"OrganisationRoleCodes",0,12,false,256),
|
||||
new ColumnDfn(17,"OrganisationRoleCount",2,-6,false,3),
|
||||
new ColumnDfn(17,"AdminComment",0,-9,false,2000),
|
||||
new ColumnDfn(17,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(17,"Flags",3,5,false,5),
|
||||
new ColumnDfn(17,"Status",0,12,false,3),
|
||||
new ColumnDfn(17,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(17,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(17,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(17,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(17,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(17,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(17,"OnlineAt",9,93,false,16),
|
||||
new ColumnDfn(18,"Id",5,-5,true,19),
|
||||
new ColumnDfn(18,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(18,"UserRoleCode",0,12,false,16),
|
||||
new ColumnDfn(18,"LastLoginAt",9,93,false,16),
|
||||
new ColumnDfn(18,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(18,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(18,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(18,"OrganisationRoleCodes",0,12,false,256),
|
||||
new ColumnDfn(18,"OrganisationRoleCount",2,-6,false,3),
|
||||
new ColumnDfn(18,"AdminComment",0,-9,false,2000),
|
||||
new ColumnDfn(18,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(18,"Flags",3,5,false,5),
|
||||
new ColumnDfn(18,"Status",0,12,false,3),
|
||||
@@ -921,43 +922,34 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(18,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(18,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(18,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(19,"Id",5,-5,true,19),
|
||||
new ColumnDfn(19,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(19,"ActivityIndexIds",0,-9,false,0),
|
||||
new ColumnDfn(19,"UserSessionData",0,-9,false,0),
|
||||
new ColumnDfn(19,"UserRoleCode",0,12,false,16),
|
||||
new ColumnDfn(19,"LastLoginAt",9,93,false,16),
|
||||
new ColumnDfn(19,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(19,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(19,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(19,"Flags",3,5,false,5),
|
||||
new ColumnDfn(19,"Status",0,12,false,3),
|
||||
new ColumnDfn(19,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(19,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(19,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(19,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(20,"Id",5,-5,true,19),
|
||||
new ColumnDfn(19,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(19,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(20,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(20,"SportId",4,4,false,10),
|
||||
new ColumnDfn(20,"About",0,-9,false,2000),
|
||||
new ColumnDfn(20,"Participation",3,5,false,5),
|
||||
new ColumnDfn(20,"Officiating",3,5,false,5),
|
||||
new ColumnDfn(20,"UserSportData",0,-9,false,0),
|
||||
new ColumnDfn(20,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(20,"ActivityIndexIds",0,-9,false,0),
|
||||
new ColumnDfn(20,"UserSessionData",0,-9,false,0),
|
||||
new ColumnDfn(20,"Flags",3,5,false,5),
|
||||
new ColumnDfn(20,"Status",0,12,false,3),
|
||||
new ColumnDfn(20,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(20,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(20,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(20,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(20,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(20,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(21,"Id",5,-5,true,19),
|
||||
new ColumnDfn(21,"UserSportId",5,-5,false,19),
|
||||
new ColumnDfn(21,"PeriodFrom",9,93,false,16),
|
||||
new ColumnDfn(21,"PeriodTo",9,93,false,16),
|
||||
new ColumnDfn(21,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(21,"OrganisationName",0,-9,false,200),
|
||||
new ColumnDfn(21,"Summary",0,-9,false,2000),
|
||||
new ColumnDfn(21,"Team",0,-9,false,64),
|
||||
new ColumnDfn(21,"League",0,-9,false,64),
|
||||
new ColumnDfn(21,"Speciality",0,-9,false,64),
|
||||
new ColumnDfn(21,"SpecialitiesOther",0,-9,false,1000),
|
||||
new ColumnDfn(21,"RegionIdNation",4,4,false,10),
|
||||
new ColumnDfn(21,"RegionIdProvince",4,4,false,10),
|
||||
new ColumnDfn(21,"Awards",0,-9,false,2000),
|
||||
new ColumnDfn(21,"UserSportExperienceData",0,-9,false,0),
|
||||
new ColumnDfn(21,"UserAccountId",4,4,false,10),
|
||||
new ColumnDfn(21,"SportId",4,4,false,10),
|
||||
new ColumnDfn(21,"About",0,-9,false,2000),
|
||||
new ColumnDfn(21,"Participation",3,5,false,5),
|
||||
new ColumnDfn(21,"Officiating",3,5,false,5),
|
||||
new ColumnDfn(21,"UserSportData",0,-9,false,0),
|
||||
new ColumnDfn(21,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(21,"Flags",3,5,false,5),
|
||||
new ColumnDfn(21,"Status",0,12,false,3),
|
||||
@@ -967,6 +959,30 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(21,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(21,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(21,"UpdateHost",0,12,false,100),
|
||||
new ColumnDfn(22,"Id",5,-5,true,19),
|
||||
new ColumnDfn(22,"UserSportId",5,-5,false,19),
|
||||
new ColumnDfn(22,"PeriodFrom",9,93,false,16),
|
||||
new ColumnDfn(22,"PeriodTo",9,93,false,16),
|
||||
new ColumnDfn(22,"OrganisationId",4,4,false,10),
|
||||
new ColumnDfn(22,"OrganisationName",0,-9,false,200),
|
||||
new ColumnDfn(22,"Summary",0,-9,false,2000),
|
||||
new ColumnDfn(22,"Team",0,-9,false,64),
|
||||
new ColumnDfn(22,"League",0,-9,false,64),
|
||||
new ColumnDfn(22,"Speciality",0,-9,false,64),
|
||||
new ColumnDfn(22,"SpecialitiesOther",0,-9,false,1000),
|
||||
new ColumnDfn(22,"RegionIdNation",4,4,false,10),
|
||||
new ColumnDfn(22,"RegionIdProvince",4,4,false,10),
|
||||
new ColumnDfn(22,"Awards",0,-9,false,2000),
|
||||
new ColumnDfn(22,"UserSportExperienceData",0,-9,false,0),
|
||||
new ColumnDfn(22,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(22,"Flags",3,5,false,5),
|
||||
new ColumnDfn(22,"Status",0,12,false,3),
|
||||
new ColumnDfn(22,"CreateOn",9,93,false,23),
|
||||
new ColumnDfn(22,"CreateBy",4,4,false,10),
|
||||
new ColumnDfn(22,"CreateHost",0,12,false,100),
|
||||
new ColumnDfn(22,"UpdateOn",9,93,false,23),
|
||||
new ColumnDfn(22,"UpdateBy",4,4,false,10),
|
||||
new ColumnDfn(22,"UpdateHost",0,12,false,100),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -92,6 +92,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public List<TypeCodeDesc> YesNoCodes { get { return GetCodesOfType(Sax.CodeType.YesNo); } }
|
||||
public List<TypeCodeDesc> GenderCodes { get { return GetCodesOfType(Sax.CodeType.Gender); } }
|
||||
public List<TypeCodeDesc> SportSpecialityLabelCodes { get { return GetCodesOfType(Sax.CodeType.SportSpecialityLabel); } }
|
||||
public List<TypeCodeDesc> SportContactTypeCodes { get { return GetCodesOfType(Sax.CodeType.SportContactType); } }
|
||||
public List<TypeCodeDesc> SportParticipationCodes { get { return GetCodesOfType(Sax.CodeType.SportParticipation); } }
|
||||
public List<TypeCodeDesc> SportOfficiatingCodes { get { return GetCodesOfType(Sax.CodeType.SportOfficiating); } }
|
||||
public List<TypeCodeDesc> RegionTypeCodes { get { return GetCodesOfType(Sax.CodeType.RegionType); } }
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
private static readonly List<TypeCodeDesc> dataItemTypeCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> genderCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> sportSpecialityLabelCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> sportContactCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> sportParticipationCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> sportOfficiatingCodes = new List<TypeCodeDesc>();
|
||||
private static readonly List<TypeCodeDesc> regionTypeCodes = new List<TypeCodeDesc>();
|
||||
@@ -50,6 +51,8 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
return new List<TypeCodeDesc>(genderCodes);
|
||||
case Sax.CodeType.SportSpecialityLabel:
|
||||
return new List<TypeCodeDesc>(sportSpecialityLabelCodes);
|
||||
case Sax.CodeType.SportContactType:
|
||||
return new List<TypeCodeDesc>(sportContactCodes);
|
||||
case Sax.CodeType.SportParticipation:
|
||||
return new List<TypeCodeDesc>(sportParticipationCodes);
|
||||
case Sax.CodeType.SportOfficiating:
|
||||
@@ -133,6 +136,12 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
sportSpecialityLabelCodes.Add(Sax.SportSpecialityLabel.Discipline, "DIS", "Discipline");
|
||||
sportSpecialityLabelCodes.Add(Sax.SportSpecialityLabel.NotRelevant, "NRE", "Not relevant");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Sport contact.
|
||||
sportContactCodes.Add(Sax.SportContactType.Coach, "COA", "Coach");
|
||||
sportContactCodes.Add(Sax.SportContactType.Manager, "MAN", "Manager");
|
||||
sportContactCodes.Add(Sax.SportContactType.Agent, "AGE", "Agent");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Sport participation.
|
||||
sportParticipationCodes.Add(Sax.SportParticipation.Professional, "PRO", "Professional");
|
||||
|
||||
@@ -78,6 +78,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public String PhoneMain { get; set; } = String.Empty;
|
||||
public String PhoneMobile { get; set; } = String.Empty;
|
||||
public Sax.Gender Gender { get; set; }
|
||||
public String GenderOther { get; set; }
|
||||
public byte DateOfBirthDay { get; set; }
|
||||
public byte DateOfBirthMonth { get; set; }
|
||||
public short DateOfBirthYear { get; set; }
|
||||
@@ -151,6 +152,11 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
get { return data.Gender; }
|
||||
set { CheckChanged((int)data.Gender, (int)value); data.Gender = value; }
|
||||
}
|
||||
public String GenderOther
|
||||
{
|
||||
get { return data.GenderOther; }
|
||||
set { CheckChanged(data.GenderOther, value); data.GenderOther = value; }
|
||||
}
|
||||
public byte DateOfBirthDay
|
||||
{
|
||||
get { return data.DateOfBirthDay; }
|
||||
@@ -230,6 +236,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
PhoneMain = data.PhoneMain;
|
||||
PhoneMobile = data.PhoneMobile;
|
||||
Gender = data.Gender;
|
||||
GenderOther = data.GenderOther;
|
||||
DateOfBirthDay = data.DateOfBirthDay;
|
||||
DateOfBirthMonth = data.DateOfBirthMonth;
|
||||
DateOfBirthYear = data.DateOfBirthYear;
|
||||
@@ -268,6 +275,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public ValidValue PhoneMain { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PhoneMobile { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Gender { get; set; } = ValidValue.Valid;
|
||||
public ValidValue GenderOther { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DateOfBirthDay { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DateOfBirthMonth { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DateOfBirthYear { get; set; } = ValidValue.Valid;
|
||||
@@ -393,6 +401,11 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
get { return data.Gender; }
|
||||
set { data.Gender = value; }
|
||||
}
|
||||
public String GenderOther
|
||||
{
|
||||
get { return data.GenderOther; }
|
||||
set { data.GenderOther = value; }
|
||||
}
|
||||
public byte DateOfBirthDay
|
||||
{
|
||||
get { return data.DateOfBirthDay; }
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
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;
|
||||
using static Saxonite.Net.Standard.Base.App.Sax;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
// User Config.
|
||||
//=======================================================================
|
||||
/// <summary>
|
||||
/// User Config - parameters to control application behaviour.
|
||||
/// </summary>
|
||||
public abstract partial class SaxUserConfig : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
// User.
|
||||
UserAccountId,
|
||||
User_EmailAddress,
|
||||
User_DisplayName,
|
||||
User_Title,
|
||||
User_FirstName,
|
||||
User_LastName,
|
||||
// Configuration.
|
||||
ConfigType,
|
||||
// Associated data.
|
||||
// Common.
|
||||
//Flags,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Properties other than common.</summary>
|
||||
public class DataProperties
|
||||
{
|
||||
public SysId UserAccountId { get; set; }
|
||||
public Sax.UserConfigType ConfigType { get; set; }
|
||||
public String ConfigData { 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 Sax.UserConfigType ConfigType
|
||||
{
|
||||
get { return data.ConfigType; }
|
||||
set { CheckChanged((int)data.ConfigType, (int)value); data.ConfigType = value; }
|
||||
}
|
||||
public String ConfigData
|
||||
{
|
||||
get { return data.ConfigData; }
|
||||
set { CheckChanged(data.ConfigData, value); data.ConfigData = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
UserAccountId = data.UserAccountId;
|
||||
ConfigType = data.ConfigType;
|
||||
ConfigData = data.ConfigData;
|
||||
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 ConfigType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ConfigData { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxUserConfig(SysId id, SysId userAccountId, Sax.UserConfigType configType) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
UserAccountId = userAccountId;
|
||||
ConfigType = configType;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// 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(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 (ConfigType != data.ConfigType)
|
||||
throw new NotSupportedException(fn + " Config Type cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
public SysId UserAccountId
|
||||
{
|
||||
get { return data.UserAccountId; }
|
||||
protected set { data.UserAccountId = value; }
|
||||
}
|
||||
public Sax.UserConfigType ConfigType
|
||||
{
|
||||
get { return data.ConfigType; }
|
||||
protected set { data.ConfigType = value; }
|
||||
}
|
||||
public String ConfigData
|
||||
{
|
||||
get { return data.ConfigData; }
|
||||
set { data.ConfigData = 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>();
|
||||
public Sax.UserConfigType ConfigType { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Item list extension methods.
|
||||
public static class SaxUserConfigList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -221,7 +221,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public SysId UserAccountId
|
||||
{
|
||||
get { return data.UserAccountId; }
|
||||
set
|
||||
protected set
|
||||
{
|
||||
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
|
||||
throw new NotSupportedException("EligibilityType.UserAccountId cannot be changed");
|
||||
@@ -245,7 +245,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public Sax.EligibilityType EligibilityType
|
||||
{
|
||||
get { return data.EligibilityType; }
|
||||
protected set { data.EligibilityType = value; }
|
||||
set { data.EligibilityType = value; }
|
||||
}
|
||||
|
||||
public String Info
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using static Saxonite.Net.Standard.Base.Bus.SaxUserConfig;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Saxonite.Net.Standard.Base.Data
|
||||
{
|
||||
//==========================================================================
|
||||
public class SaxConfigData
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
private static readonly String ElementName_Config = "Config";
|
||||
private static readonly String ElementName_Profile = "Profile";
|
||||
private static readonly String ElementName_Eligibility = "Eligibility";
|
||||
private static readonly String ElementName_HideInfo = "HideInfo";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Profile settings.</summary>
|
||||
public class ProfileData
|
||||
{
|
||||
//---------------------------------------------------------------
|
||||
/// <summary>Eligibility settings.</summary>
|
||||
public class EligibilityData
|
||||
{
|
||||
/// <summary>Hide the eligbiility information tip.</summary>
|
||||
public bool HideInfo { get; set; }
|
||||
}
|
||||
public EligibilityData Eligibility { get; set; } = new EligibilityData();
|
||||
|
||||
//---------------------------------------------------------------
|
||||
/// <summary>Serialise to XML.</summary>
|
||||
public static String ToXml(ProfileData profile)
|
||||
{
|
||||
String fn = typeof(ProfileData).FullName + ".GetConfigData";
|
||||
try
|
||||
{
|
||||
XDocument doc = new XDocument();
|
||||
XElement configElement = doc.AppendElement(ElementName_Config);
|
||||
// Profile.
|
||||
XElement profileElement = configElement.AppendElement(ElementName_Profile);
|
||||
// Profile - Eligibility.
|
||||
XElement eligibilityElement = profileElement.AppendElement(ElementName_Eligibility);
|
||||
if (profile.Eligibility.HideInfo)
|
||||
eligibilityElement.AppendElement(ElementName_HideInfo, "1");
|
||||
return doc.GetXml();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
/// <summary>Deserialise from XML.</summary>
|
||||
public static ProfileData FromXml(String configData)
|
||||
{
|
||||
String fn = typeof(ProfileData).FullName + ".ExtractConfig";
|
||||
ProfileData profile = new ProfileData();
|
||||
if (StringUtil.IsEmpty(configData)) return profile;
|
||||
try
|
||||
{
|
||||
// Load XML data.
|
||||
// NB Serialised data has 'Config' as root element
|
||||
XDocument doc = XDocument.Parse(configData);
|
||||
XElement rootElement = doc.Root;
|
||||
foreach (XElement rootChildElement in rootElement.GetChildElements())
|
||||
{
|
||||
String rootChildElementName = rootChildElement.GetLocalName();
|
||||
if (rootChildElementName.EqualsCI(ElementName_Profile))
|
||||
{
|
||||
// Profile.
|
||||
XElement profileElement = rootChildElement;
|
||||
foreach (XElement profileChildElement in profileElement.GetChildElements())
|
||||
{
|
||||
String profileChildElementName = profileChildElement.GetLocalName();
|
||||
if (profileChildElementName.EqualsCI(ElementName_Eligibility))
|
||||
{
|
||||
// Profile - Eligibility.
|
||||
XElement eligibilityElement = profileChildElement;
|
||||
String hideInfo = eligibilityElement.GetChildText(ElementName_HideInfo);
|
||||
profile.Eligibility.HideInfo = StringUtil.ToBool(hideInfo);
|
||||
}
|
||||
else SaLogger.Warn(fn + " Unexpected 'Profile' child element: " + profileChildElementName);
|
||||
}
|
||||
}
|
||||
else SaLogger.Warn(fn + " Unexpected 'Root' child element: " + rootChildElementName);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
}
|
||||
@@ -137,6 +137,12 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
errField.PhoneMobile = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Gender other.
|
||||
if (errField.GenderOther != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.GenderOther, "gender", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.UserAccount_GenderOther)))
|
||||
{
|
||||
errField.GenderOther = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Date of birth year.
|
||||
if (errField.DateOfBirthYear != SacsHierarchyItem.ValidValue.Ignore && data.DateOfBirthYear > DateTime.Today.Year)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
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 Config
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
public List<SaxUserConfig> GetConfigsForUser(SysId userAccountId)
|
||||
{
|
||||
SaxUserConfig.Params prmUserConfig = new SaxUserConfig.Params();
|
||||
prmUserConfig.UserAccountIdsIncluded.Add(userAccountId);
|
||||
List<SaxUserConfig> userConfigs = AccountMgr.GetUserConfigList(prmUserConfig);
|
||||
return userConfigs;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public abstract SaxUserConfig CreateUserConfig(SysId userAccountId, Sax.UserConfigType configType);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item exists.
|
||||
public bool UserConfigExists(SysId userAccountId)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(userAccountId)) return false;
|
||||
SaxUserConfig.Params prmUserConfig = new SaxUserConfig.Params();
|
||||
prmUserConfig.UserAccountIdsIncluded.Add(userAccountId);
|
||||
return GetUserConfigCount(prmUserConfig) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual items.
|
||||
public abstract SaxUserConfig GetUserConfig(SaxUserConfig.Params prmUserConfig);
|
||||
public SaxUserConfig GetUserConfig(SysId userAccountId, Sax.UserConfigType configType)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(userAccountId) || configType <= 0) return null;
|
||||
SaxUserConfig.Params prmUserConfig = new SaxUserConfig.Params();
|
||||
prmUserConfig.UserAccountIdsIncluded.Add(userAccountId);
|
||||
prmUserConfig.ConfigType = configType;
|
||||
return GetUserConfig(prmUserConfig);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item data.
|
||||
public bool IsValidUserConfig(SaxUserConfig userConfig)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (userConfig == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidUserConfigData(userConfig.GetData(), new SaxUserConfig.ErrField());
|
||||
}
|
||||
public virtual bool IsValidUserConfigData(SaxUserConfig.Data data, SaxUserConfig.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");
|
||||
}
|
||||
|
||||
// Config Type.
|
||||
if (errField.ConfigType != SacsHierarchyItem.ValidValue.Ignore && data.ConfigType <= 0)
|
||||
{
|
||||
errField.UserAccountId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Config type must be specified");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item database interface.
|
||||
public abstract bool InsertUserConfig(SaxUserConfig userConfig, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateUserConfig(SaxUserConfig userConfig, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool UserConfigCanBeDeleted(SaxUserConfig userConfig)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteUserConfig(SaxUserConfig userConfig, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public abstract ColumnDfn GetUserConfigColumnDfn(SaxUserConfig.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetUserConfigQueryFilter(SaxUserConfig.Params prmUserConfig);
|
||||
public abstract long GetUserConfigCount(SaxUserConfig.Params prmUserConfig);
|
||||
public abstract List<SaxUserConfig> GetUserConfigList(SaxUserConfig.Params prmUserConfig);
|
||||
public abstract DbResultSet ExecuteUserConfigQuery(List<ColumnDfn> columns, SaxUserConfig.Params prmUserConfig);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <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 GetUserConfigDataValue(ColumnDfn column, NamedValue.Map values)
|
||||
{
|
||||
DataValue value = new DataValue();
|
||||
switch ((SaxUserConfig.Column)column.Id)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// User Display Name.
|
||||
case SaxUserConfig.Column.User_DisplayName:
|
||||
{
|
||||
String userTitle = values.GetValue(GetUserConfigColumnDfn(SaxUserConfig.Column.User_Title).DataName).ToString();
|
||||
String userFirstName = values.GetValue(GetUserConfigColumnDfn(SaxUserConfig.Column.User_FirstName).DataName).ToString();
|
||||
String userLastName = values.GetValue(GetUserConfigColumnDfn(SaxUserConfig.Column.User_LastName).DataName).ToString();
|
||||
value = new DataValue(SaxUserAccount.GetDisplayName(userTitle, userFirstName, userLastName));
|
||||
}
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -68,6 +68,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
// Application codes.
|
||||
public List<TypeCodeDesc> DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } }
|
||||
public List<TypeCodeDesc> SportSpecialityLabelCodes { get { return Internals.SportSpecialityLabelCodes; } }
|
||||
public List<TypeCodeDesc> SportContactTypeCodes { get { return Internals.SportContactTypeCodes; } }
|
||||
public List<TypeCodeDesc> SportParticipationCodes { get { return Internals.SportParticipationCodes; } }
|
||||
public List<TypeCodeDesc> SportOfficiatingCodes { get { return Internals.SportOfficiatingCodes; } }
|
||||
public List<TypeCodeDesc> RegionTypeCodes { get { return Internals.RegionTypeCodes; } }
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Standard.Dbas.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public class SaxUserConfig_Dbas : SaxUserConfig
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private ISacsDatabase database;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SaxUserConfig_Dbas(ISacsDatabase database, SysId id, SysId userAccountId, Sax.UserConfigType configType, UInt16 flags) :
|
||||
base(id, userAccountId, configType)
|
||||
{
|
||||
this.database = database;
|
||||
Flags = flags;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Associated data.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:45
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:45
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:45
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:45
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:45
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:45
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:45
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:45
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:46
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:45
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:46
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:46
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:46
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -30,6 +30,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
public ColumnDataString _PhoneMobile { get; } = new ColumnDataString("PhoneMobile");
|
||||
public ColumnDataString _PhoneAlt { get; } = new ColumnDataString("PhoneAlt");
|
||||
public ColumnDataByte _Gender { get; } = new ColumnDataByte("Gender");
|
||||
public ColumnDataString _GenderOther { get; } = new ColumnDataString("GenderOther");
|
||||
public ColumnDataByte _DateOfBirthDay { get; } = new ColumnDataByte("DateOfBirthDay");
|
||||
public ColumnDataByte _DateOfBirthMonth { get; } = new ColumnDataByte("DateOfBirthMonth");
|
||||
public ColumnDataInt16 _DateOfBirthYear { get; } = new ColumnDataInt16("DateOfBirthYear");
|
||||
@@ -69,6 +70,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
"PhoneMobile",
|
||||
"PhoneAlt",
|
||||
"Gender",
|
||||
"GenderOther",
|
||||
"DateOfBirthDay",
|
||||
"DateOfBirthMonth",
|
||||
"DateOfBirthYear",
|
||||
@@ -134,6 +136,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
public String _PhoneMobile { get { return Cols._PhoneMobile.Value; } set { Cols._PhoneMobile.Value = value; } }
|
||||
public String _PhoneAlt { get { return Cols._PhoneAlt.Value; } set { Cols._PhoneAlt.Value = value; } }
|
||||
public Byte _Gender { get { return Cols._Gender.Value; } set { Cols._Gender.Value = value; } }
|
||||
public String _GenderOther { get { return Cols._GenderOther.Value; } set { Cols._GenderOther.Value = value; } }
|
||||
public Byte _DateOfBirthDay { get { return Cols._DateOfBirthDay.Value; } set { Cols._DateOfBirthDay.Value = value; } }
|
||||
public Byte _DateOfBirthMonth { get { return Cols._DateOfBirthMonth.Value; } set { Cols._DateOfBirthMonth.Value = value; } }
|
||||
public Int16 _DateOfBirthYear { get { return Cols._DateOfBirthYear.Value; } set { Cols._DateOfBirthYear.Value = value; } }
|
||||
@@ -188,6 +191,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
_PhoneMobile = GetFieldString(dbDataReader, "PhoneMobile", _PhoneMobile);
|
||||
_PhoneAlt = GetFieldString(dbDataReader, "PhoneAlt", _PhoneAlt);
|
||||
_Gender = GetFieldByte(dbDataReader, "Gender", _Gender);
|
||||
_GenderOther = GetFieldString(dbDataReader, "GenderOther", _GenderOther);
|
||||
_DateOfBirthDay = GetFieldByte(dbDataReader, "DateOfBirthDay", _DateOfBirthDay);
|
||||
_DateOfBirthMonth = GetFieldByte(dbDataReader, "DateOfBirthMonth", _DateOfBirthMonth);
|
||||
_DateOfBirthYear = GetFieldInt16(dbDataReader, "DateOfBirthYear", _DateOfBirthYear);
|
||||
@@ -241,6 +245,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
if (columnNames.ContainsCI("PhoneMobile")) AddCommandParameter(dbCommand, "@PhoneMobile", _PhoneMobile);
|
||||
if (columnNames.ContainsCI("PhoneAlt")) AddCommandParameter(dbCommand, "@PhoneAlt", _PhoneAlt);
|
||||
if (columnNames.ContainsCI("Gender")) AddCommandParameter(dbCommand, "@Gender", _Gender);
|
||||
if (columnNames.ContainsCI("GenderOther")) AddCommandParameter(dbCommand, "@GenderOther", _GenderOther);
|
||||
if (columnNames.ContainsCI("DateOfBirthDay")) AddCommandParameter(dbCommand, "@DateOfBirthDay", _DateOfBirthDay);
|
||||
if (columnNames.ContainsCI("DateOfBirthMonth")) AddCommandParameter(dbCommand, "@DateOfBirthMonth", _DateOfBirthMonth);
|
||||
if (columnNames.ContainsCI("DateOfBirthYear")) AddCommandParameter(dbCommand, "@DateOfBirthYear", _DateOfBirthYear);
|
||||
@@ -309,6 +314,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
if (columnNames.ContainsCI("PhoneMobile")) AddCommandParameter(dbCommand, "@PhoneMobile", _PhoneMobile);
|
||||
if (columnNames.ContainsCI("PhoneAlt")) AddCommandParameter(dbCommand, "@PhoneAlt", _PhoneAlt);
|
||||
if (columnNames.ContainsCI("Gender")) AddCommandParameter(dbCommand, "@Gender", _Gender);
|
||||
if (columnNames.ContainsCI("GenderOther")) AddCommandParameter(dbCommand, "@GenderOther", _GenderOther);
|
||||
if (columnNames.ContainsCI("DateOfBirthDay")) AddCommandParameter(dbCommand, "@DateOfBirthDay", _DateOfBirthDay);
|
||||
if (columnNames.ContainsCI("DateOfBirthMonth")) AddCommandParameter(dbCommand, "@DateOfBirthMonth", _DateOfBirthMonth);
|
||||
if (columnNames.ContainsCI("DateOfBirthYear")) AddCommandParameter(dbCommand, "@DateOfBirthYear", _DateOfBirthYear);
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:46
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
internal class UserConfig_Db : SaxDbDataItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Column definitions.
|
||||
public class ColumnsData
|
||||
{
|
||||
public ColumnDataInt64 _Id { get; } = new ColumnDataInt64("Id", true);
|
||||
public ColumnDataInt32 _UserAccountId { get; } = new ColumnDataInt32("UserAccountId");
|
||||
public ColumnDataInt16 _ConfigType { get; } = new ColumnDataInt16("ConfigType");
|
||||
public ColumnDataString _ConfigData { get; } = new ColumnDataString("ConfigData");
|
||||
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
|
||||
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
protected static List<String> fields { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
"UserAccountId",
|
||||
"ConfigType",
|
||||
"ConfigData",
|
||||
"CreateOn",
|
||||
"UpdateOn",
|
||||
};
|
||||
protected static List<String> fieldsId { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
protected static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
{
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal UserConfig_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public override String SchemaName { get; } = "dbo";
|
||||
public override String TableName { get; } = "UserConfig";
|
||||
public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? "[" + SchemaName + "]." : "") + "[" + TableName + "]"; } }
|
||||
public static List<String> Fields { get { return new List<String>(fields); } }
|
||||
public static List<String> FieldsId { get { return new List<String>(fieldsId); } }
|
||||
public static List<String> FieldsNonId { get { return fields.FindAll(item => !fieldsId.ContainsCI(item)); } }
|
||||
// Columns.
|
||||
public ColumnsData Cols { get; } = new ColumnsData();
|
||||
public Int64 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } }
|
||||
public Int32 _UserAccountId { get { return Cols._UserAccountId.Value; } set { Cols._UserAccountId.Value = value; } }
|
||||
public Int16 _ConfigType { get { return Cols._ConfigType.Value; } set { Cols._ConfigType.Value = value; } }
|
||||
public String _ConfigData { get { return Cols._ConfigData.Value; } set { Cols._ConfigData.Value = value; } }
|
||||
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
|
||||
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
|
||||
// Existing columns - confirmed on database if table exists.
|
||||
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
|
||||
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
public override void PopulateFrom (DbCommand dbCommand, String tableAlias, String filter)
|
||||
{
|
||||
dbCommand.CommandText =
|
||||
"SELECT " + ExistingColumnNames.Concat(", ", (!String.IsNullOrEmpty(tableAlias) ? tableAlias + "." : "") + "[", "]") + " " +
|
||||
"FROM " + TableNameFmt + (!String.IsNullOrEmpty(tableAlias) ? " " + tableAlias : "") + " " +
|
||||
(!String.IsNullOrEmpty(filter) ? "WHERE " + filter : "");
|
||||
Log(GetType().Name + ".PopulateFrom", dbCommand.CommandText);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
{
|
||||
dbDataReader.Read();
|
||||
PopulateFrom(dbDataReader);
|
||||
}
|
||||
}
|
||||
public override void PopulateFrom (DbDataReader dbDataReader)
|
||||
{
|
||||
_Id = GetFieldInt64(dbDataReader, "Id", _Id);
|
||||
_UserAccountId = GetFieldInt32(dbDataReader, "UserAccountId", _UserAccountId);
|
||||
_ConfigType = GetFieldInt16(dbDataReader, "ConfigType", _ConfigType);
|
||||
_ConfigData = GetFieldString(dbDataReader, "ConfigData", _ConfigData);
|
||||
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
|
||||
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert command.
|
||||
public override bool ExecuteInsertCommand (DbCommand dbCommand)
|
||||
{
|
||||
List<String> columnNames = ExistingColumnNamesNonId;
|
||||
// Avoid insert if Identity field is already valid.
|
||||
if (_Id != 0) throw new Exception("Invalid for Insert - item already has a valid Id");
|
||||
// Construct query.
|
||||
String query =
|
||||
"INSERT INTO " + TableNameFmt + " " +
|
||||
"("+columnNames.Concat(",","[","]")+") ";
|
||||
query += "Output Inserted.Id ";
|
||||
if (dbCommand is SqlCommand)
|
||||
query += "VALUES (" + columnNames.Concat(",", "@", "") + ") ";
|
||||
else query += "VALUES (" + StringListUtil.CreateList("?", columnNames.Count).Concat(",") + ") ";
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteInsertCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("UserAccountId")) AddCommandParameter(dbCommand, "@UserAccountId", _UserAccountId);
|
||||
if (columnNames.ContainsCI("ConfigType")) AddCommandParameter(dbCommand, "@ConfigType", _ConfigType);
|
||||
if (columnNames.ContainsCI("ConfigData")) AddCommandParameter(dbCommand, "@ConfigData", _ConfigData);
|
||||
if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
// Execute insert command.
|
||||
bool commandSuccess = false;
|
||||
int executeNonQuery = dbCommand.ExecuteNonQuery();
|
||||
if (executeNonQuery == 1)
|
||||
{
|
||||
dbCommand.CommandText = "SELECT Max(Id) FROM " + TableNameFmt + ";";
|
||||
_Id = Convert.ToInt64(dbCommand.ExecuteScalar());
|
||||
commandSuccess = (_Id > 0);
|
||||
}
|
||||
return commandSuccess;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
{
|
||||
// Avoid update if Identity field isn't valid.
|
||||
if (_Id == 0) throw new Exception("Invalid for Update - item has an invalid Id");
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
// Construct query.
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
{
|
||||
query += StringPairList.CreateFrom(columnNames.Bracket("[","]"),columnNames).Concat("=@").Concat(", ") + " ";
|
||||
query += "WHERE Id=@Id;";
|
||||
}
|
||||
else
|
||||
{
|
||||
query += columnNames.Concat(", ", "", "=?") + " ";
|
||||
query += "WHERE Id=?;";
|
||||
}
|
||||
dbCommand.CommandText = query;
|
||||
Log(GetType().Name + ".ExecuteUpdateCommand", dbCommand.CommandText);
|
||||
// Populate parameters.
|
||||
dbCommand.Parameters.Clear();
|
||||
if (columnNames.ContainsCI("UserAccountId")) AddCommandParameter(dbCommand, "@UserAccountId", _UserAccountId);
|
||||
if (columnNames.ContainsCI("ConfigType")) AddCommandParameter(dbCommand, "@ConfigType", _ConfigType);
|
||||
if (columnNames.ContainsCI("ConfigData")) AddCommandParameter(dbCommand, "@ConfigData", _ConfigData);
|
||||
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||
AddCommandParameter(dbCommand, "@Id", _Id);
|
||||
int executeNonQueryResult = dbCommand.ExecuteNonQuery();
|
||||
return (executeNonQueryResult == 1);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:46
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:46
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:46
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:46
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:46
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:46
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 13-Oct-2022 09:38:46
|
||||
// Code generated by Sarand Database Utilities Tue 15-Nov-2022 13:33:16
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -0,0 +1,478 @@
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
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.Dbas.Bus;
|
||||
using Saxonite.Net.Standard.Dbas.Internal;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Text;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using System.Linq;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
|
||||
namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SaxAccountMgr_Dbas
|
||||
{
|
||||
//*******************************************************************
|
||||
// Account Mgr - User Config
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
private List<StringPair> GetLogProperties(SaxUserConfig userConfig)
|
||||
{
|
||||
return new List<StringPair>()
|
||||
{
|
||||
new StringPair("Id",SysId.ToString(userConfig.Id)),
|
||||
new StringPair("UserAccountId",SysId.ToString(userConfig.UserAccountId)),
|
||||
new StringPair("ConfigType",userConfig.ConfigType.ToString()),
|
||||
};
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public override SaxUserConfig CreateUserConfig(SysId userAccountId, Sax.UserConfigType configType)
|
||||
{
|
||||
ClearErrorState();
|
||||
return new SaxUserConfig_Dbas(CoreDatabase, null, userAccountId, configType, 0);
|
||||
}
|
||||
private SaxUserConfig_Dbas CreateUserConfig(UserConfig_Db dbUserConfig)
|
||||
{
|
||||
ClearErrorState();
|
||||
SaxUserConfig_Dbas userConfig = new SaxUserConfig_Dbas(CoreDatabase, new SysId(dbUserConfig._Id), new SysId(dbUserConfig._UserAccountId), (Sax.UserConfigType)dbUserConfig._ConfigType, 0);
|
||||
PopulateFrom(dbUserConfig, userConfig);
|
||||
return userConfig;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get item.
|
||||
public override SaxUserConfig GetUserConfig(SaxUserConfig.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetUserConfig(GetUserConfigQueryFilter(prm).Concat(" And ", "(", ")"));
|
||||
}
|
||||
private SaxUserConfig GetUserConfig(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
long count = GetUserConfigCount(filter);
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple items found");
|
||||
return null;
|
||||
}
|
||||
SaxUserConfig userConfig = null;
|
||||
// Query data.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
UserConfig_Db dbUserConfig = new UserConfig_Db(CoreDbInfo);
|
||||
dbUserConfig.PopulateFrom(dbCommand, aliasUserConfig, filter);
|
||||
userConfig = CreateUserConfig(dbUserConfig);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SaLogger.Warn(GetType().Name + ".GetUserConfig\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
}
|
||||
return userConfig;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item.
|
||||
public override bool IsValidUserConfigData(SaxUserConfig.Data data, SaxUserConfig.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.IsValidUserConfigData(data, errField)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert item.
|
||||
public override bool InsertUserConfig(SaxUserConfig userConfig, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".InsertUserConfig";
|
||||
ClearErrorState();
|
||||
if (!IsValidUserConfig(userConfig)) return false;
|
||||
if (SysId.IsValid(userConfig.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
UserConfig_Db dbUserConfig = new UserConfig_Db(CoreDbInfo);
|
||||
PopulateTo(dbUserConfig, userConfig, dbUpdateInfo);
|
||||
if (UserConfig_Db.FieldsNonId.Contains("Id"))
|
||||
{
|
||||
// Generate next Id.
|
||||
dbUserConfig._Id = CoreDatabase.GetNextIdFromTable("UserConfig");
|
||||
}
|
||||
dbUserConfig.ExecuteInsertCommand(dbCommand);
|
||||
//userConfig.Id = new SysId(dbUserConfig._Id);
|
||||
userConfig.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(userConfig).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update item.
|
||||
public override bool UpdateUserConfig(SaxUserConfig userConfig, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".UpdateUserConfig";
|
||||
ClearErrorState();
|
||||
if (!IsValidUserConfig(userConfig)) return false;
|
||||
if (!SysId.IsValid(userConfig.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!userConfig.Changed)
|
||||
{
|
||||
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(userConfig).Concat(": ").Concat("", "\n\t"));
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
UserConfig_Db dbUserConfig = new UserConfig_Db(CoreDbInfo);
|
||||
dbUserConfig.PopulateFrom(dbCommand, aliasUserConfig, "Id=" + SysId.ToString(userConfig.Id));
|
||||
// Update properties.
|
||||
PopulateTo(dbUserConfig, userConfig, dbUpdateInfo);
|
||||
dbUserConfig.ExecuteUpdateCommand(dbCommand);
|
||||
userConfig.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(userConfig).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Delete item.
|
||||
public override bool UserConfigCanBeDeleted(SaxUserConfig userConfig)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.UserConfigCanBeDeleted(userConfig)) return false;
|
||||
return true;
|
||||
}
|
||||
public override bool DeleteUserConfig(SaxUserConfig userConfig, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
String fn = GetType().Name + ".DeleteUserConfig";
|
||||
ClearErrorState();
|
||||
if (!UserConfigCanBeDeleted(userConfig)) return false;
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
UserConfig_Db dbUserConfig = new UserConfig_Db(CoreDbInfo);
|
||||
dbUserConfig.PopulateFrom(dbCommand, aliasUserConfig, "Id=" + SysId.ToString(userConfig.Id));
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserConfig) + " WHERE Id=" + SysId.ToString(userConfig.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
userConfig.Changed = false;
|
||||
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(userConfig).Concat(": ").Concat("", "\n\t"));
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copy data properties to and from database.
|
||||
private void PopulateTo(UserConfig_Db dbUserConfig, SaxUserConfig userConfig, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
dbUserConfig._UserAccountId = SysId.ToInt(userConfig.UserAccountId);
|
||||
dbUserConfig._ConfigType = (short)userConfig.ConfigType;
|
||||
dbUserConfig._ConfigData = userConfig.ConfigData;
|
||||
// Common.
|
||||
//dbUserConfig._Flags = (short)userConfig.Flags;
|
||||
if (!DateUtil.IsValid(dbUserConfig._CreateOn))
|
||||
{
|
||||
dbUserConfig._CreateOn = DateTime.Now;
|
||||
}
|
||||
dbUserConfig._UpdateOn = DateTime.Now;
|
||||
}
|
||||
private void PopulateFrom(UserConfig_Db dbUserConfig, SaxUserConfig userConfig)
|
||||
{
|
||||
//userConfig.UserAccountId = new SysId(dbUserConfig._UserAccountId);
|
||||
//userConfig.ConfigType = (Sax.UserConfigType)dbUserConfig._ConfigType;
|
||||
userConfig.ConfigData = dbUserConfig._ConfigData;
|
||||
// Common.
|
||||
userConfig.SetCreateStamp(dbUserConfig._CreateOn, new SysId(), "");
|
||||
userConfig.SetUpdateStamp(dbUserConfig._UpdateOn, new SysId(), "");
|
||||
userConfig.AcceptChanges();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item column definitions.
|
||||
private static readonly String aliasUserConfig = "UsrCfg";
|
||||
private static readonly String aliasUserConfig_UserAccount = "UsrCfg_Usr";
|
||||
private static readonly String prefixUserConfig_UserAccount = aliasUserConfig_UserAccount + "_";
|
||||
private void SetUserConfigColDfn
|
||||
(ColumnDfn col, String caption, int width, SaxDbDfn_Core.ColumnIdx dbCol,
|
||||
ColumnAlignment align = ColumnAlignment.Default, DataValue.DataType dataType = DataValue.DataType.String,
|
||||
String alias = "", String prefix = "")
|
||||
{
|
||||
if (String.IsNullOrEmpty(alias) && SaxDbDfn_Core.GetTableForColumn(dbCol) == SaxDbDfn_Core.TableIdx.UserConfig)
|
||||
alias = aliasUserConfig;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SaxDbDfn_Core.GetColumnName(dbCol, false), SaxDbDfn_Core.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
if (dataType == DataValue.DataType.String && dbCol != SaxDbDfn_Core.ColumnIdx.Unknown)
|
||||
col.MaxLength = (int)SaxDbDfn_Core.GetColTextLen(dbCol);
|
||||
}
|
||||
public override ColumnDfn GetUserConfigColumnDfn(SaxUserConfig.Column columnId, string caption = "", int width = 0)
|
||||
{
|
||||
ColumnDfn columnDfn = new ColumnDfn((int)columnId, caption, width);
|
||||
switch (columnId)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
case SaxUserConfig.Column.Pos:
|
||||
SetUserConfigColDfn(columnDfn, "Pos", 60, SaxDbDfn_Core.ColumnIdx.Unknown, ColumnAlignment.Right);
|
||||
columnDfn.SortMode = ColumnDfn.ColumnSortMode.Off;
|
||||
columnDfn.ReadOnly = true;
|
||||
columnDfn.Resizable = false;
|
||||
break;
|
||||
case SaxUserConfig.Column.UserAccountId:
|
||||
SetUserConfigColDfn(columnDfn, "User Id", 80, SaxDbDfn_Core.ColumnIdx.UserConfig_UserAccountId, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-------------------------------------------------------
|
||||
// User.
|
||||
case SaxUserConfig.Column.User_EmailAddress:
|
||||
SetUserConfigColDfn(columnDfn, "Email address", 160, SaxDbDfn_Core.ColumnIdx.UserAccount_EmailAddress, ColumnAlignment.Left, DataValue.DataType.String, aliasUserConfig_UserAccount, prefixUserConfig_UserAccount);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxUserConfig.Column.User_DisplayName:
|
||||
SetUserConfigColDfn(columnDfn, "User", 160, SaxDbDfn_Core.ColumnIdx.Unknown, ColumnAlignment.Left, DataValue.DataType.String);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxUserConfig.Column.User_Title:
|
||||
SetUserConfigColDfn(columnDfn, "Title", 80, SaxDbDfn_Core.ColumnIdx.UserAccount_Title, ColumnAlignment.Left, DataValue.DataType.String, aliasUserConfig_UserAccount, prefixUserConfig_UserAccount);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxUserConfig.Column.User_FirstName:
|
||||
SetUserConfigColDfn(columnDfn, "First name", 120, SaxDbDfn_Core.ColumnIdx.UserAccount_FirstName, ColumnAlignment.Left, DataValue.DataType.String, aliasUserConfig_UserAccount, prefixUserConfig_UserAccount);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxUserConfig.Column.User_LastName:
|
||||
SetUserConfigColDfn(columnDfn, "Last name", 120, SaxDbDfn_Core.ColumnIdx.UserAccount_LastName, ColumnAlignment.Left, DataValue.DataType.String, aliasUserConfig_UserAccount, prefixUserConfig_UserAccount);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Configuration.
|
||||
case SaxUserConfig.Column.ConfigType:
|
||||
SetUserConfigColDfn(columnDfn, "Type", 60, SaxDbDfn_Core.ColumnIdx.UserConfig_ConfigType, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Derived properties.
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Common properties.
|
||||
/*
|
||||
case SaxUserConfig.Column.Flags:
|
||||
SetUserConfigColDfn(columnDfn, "Flags", 60, SaxDbDfn_Core.ColumnIdx.UserConfig_Flags, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
break;
|
||||
*/
|
||||
case SaxUserConfig.Column.CreateOn_Date:
|
||||
SetUserConfigColDfn(columnDfn, "Created", 80, SaxDbDfn_Core.ColumnIdx.UserConfig_CreateOn, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
case SaxUserConfig.Column.UpdateOn_Date:
|
||||
SetUserConfigColDfn(columnDfn, "Updated", 80, SaxDbDfn_Core.ColumnIdx.UserConfig_UpdateOn, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||
columnDfn.ReadOnly = true;
|
||||
break;
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
if (!String.IsNullOrEmpty(caption))
|
||||
columnDfn.Caption = caption;
|
||||
if (width > 0)
|
||||
columnDfn.Width = width;
|
||||
return columnDfn;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item query filter.
|
||||
public override List<string> GetUserConfigQueryFilter(SaxUserConfig.Params prm)
|
||||
{
|
||||
List<String> filter = new List<String>();
|
||||
|
||||
// User accounts.
|
||||
String userAccountIdsIncluded = prm.UserAccountIdsIncluded.Concat(",");
|
||||
if (!userAccountIdsIncluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserConfig_UserAccountId, aliasUserConfig) + " IN (" + userAccountIdsIncluded + ")");
|
||||
|
||||
// Config type.
|
||||
if (prm.ConfigType > 0)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserConfig_ConfigType, aliasUserConfig) + "=" + ((short)prm.ConfigType).ToString());
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetUserConfigSortColumns(SaxUserConfig.Params prm)
|
||||
{
|
||||
// Sort sequence:
|
||||
List<String> sortColumnNames = new List<String>();
|
||||
foreach (var columnDfn in prm.SortColumns)
|
||||
{
|
||||
// Need to ensure correct alias used for UserConfig columns in case of conflict.
|
||||
String sortCol = String.Empty;
|
||||
if (SaxDbDfn_Core.GetTableForColumn((SaxDbDfn_Core.ColumnIdx)columnDfn.DbColumn) == SaxDbDfn_Core.TableIdx.UserConfig)
|
||||
{
|
||||
sortCol = SaxDbDfn_Core.GetColumnNameQual((SaxDbDfn_Core.ColumnIdx)columnDfn.DbColumn, aliasUserConfig);
|
||||
}
|
||||
else
|
||||
{
|
||||
sortCol = columnDfn.DataName;
|
||||
if (!StringUtil.IsEmpty(columnDfn.SortDataName))
|
||||
sortCol = columnDfn.SortDataName;
|
||||
}
|
||||
if (!sortCol.IsEmpty())
|
||||
{
|
||||
DbOrderByNullMode orderByNullMode = DbOrderByNullMode.Default; // eSaOrderByDemoteNulls, eSaOrderByPromoteNulls
|
||||
sortColumnNames.Add(DbQuery.FormatForOrderBy(sortCol, columnDfn.SortAscending, orderByNullMode).Concat(", "));
|
||||
}
|
||||
}
|
||||
sortColumnNames.RemoveBlanks();
|
||||
if (sortColumnNames.IsEmpty())
|
||||
{
|
||||
// Default sort columns.
|
||||
sortColumnNames.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserConfig_UserAccountId, aliasUserConfig) + " ASC");
|
||||
sortColumnNames.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserConfig_ConfigType, aliasUserConfig) + " ASC");
|
||||
}
|
||||
return sortColumnNames;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item count.
|
||||
private long GetUserConfigCount(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
return CoreDatabase.GetRowCount(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserConfig) + " As " + aliasUserConfig, filter);
|
||||
}
|
||||
public override long GetUserConfigCount(SaxUserConfig.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetUserConfigCount(GetUserConfigQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item list.
|
||||
public override List<SaxUserConfig> GetUserConfigList(SaxUserConfig.Params prm)
|
||||
{
|
||||
List<SaxUserConfig> userConfigs = new List<SaxUserConfig>();
|
||||
DbQuery qry = new DbQuery(CoreDatabase.DbmsType);
|
||||
qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserConfig), aliasUserConfig);
|
||||
UserConfig_Db dbUserConfig = new UserConfig_Db(CoreDbInfo);
|
||||
qry.Columns.AddRange(dbUserConfig.ExistingColumnNames);
|
||||
qry.Filters.AddRange(GetUserConfigQueryFilter(prm));
|
||||
qry.OrderBy.AddRange(GetUserConfigSortColumns(prm));
|
||||
// Query data.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
dbConnection.Open();
|
||||
dbCommand.CommandText = qry.BuildQuery(prm.ResultsPaging);
|
||||
using (DbDataReader dbDataReader = dbCommand.ExecuteReader())
|
||||
{
|
||||
while (dbDataReader.Read())
|
||||
{
|
||||
dbUserConfig = new UserConfig_Db(CoreDbInfo);
|
||||
dbUserConfig.PopulateFrom(dbDataReader);
|
||||
userConfigs.Add(CreateUserConfig(dbUserConfig));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn(GetType().Name + ".GetUserConfigList\n\tQuery: " + dbCommand.CommandText + "\n\t" + ExceptionUtil.GetLogMessage(exc));
|
||||
}
|
||||
}
|
||||
return userConfigs;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Item query execution.
|
||||
public override DbResultSet ExecuteUserConfigQuery(List<ColumnDfn> columns, SaxUserConfig.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Construct query.
|
||||
DbQuery query = new DbQuery(CoreDatabase.DbmsType);
|
||||
query.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserConfig), aliasUserConfig);
|
||||
|
||||
// Add columns as defined in query list.
|
||||
bool hasUserAccountCols = (columns.HasId(SaxUserConfig.Column.User_EmailAddress) || columns.HasId(SaxUserConfig.Column.User_DisplayName) || columns.HasId(SaxUserConfig.Column.User_Title) || columns.HasId(SaxUserConfig.Column.User_FirstName) || columns.HasId(SaxUserConfig.Column.User_LastName));
|
||||
if (columns.HasId(SaxUserConfig.Column.UserAccountId) || hasUserAccountCols)
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserConfig_UserAccountId, aliasUserConfig));
|
||||
if (columns.HasId(SaxUserConfig.Column.ConfigType))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserConfig_ConfigType, aliasUserConfig));
|
||||
// Common properties.
|
||||
//if (columns.HasId(SaxUserConfig.Column.Flags))
|
||||
// query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserConfig_Flags, aliasUserConfig));
|
||||
if (columns.HasId(SaxUserConfig.Column.CreateOn_Date))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserConfig_CreateOn, aliasUserConfig));
|
||||
if (columns.HasId(SaxUserConfig.Column.UpdateOn_Date))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserConfig_UpdateOn, aliasUserConfig));
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// User Account.
|
||||
if (hasUserAccountCols)
|
||||
{
|
||||
DbQueryJoin joinUserAccount = new DbQueryJoin(DbJoinType.LeftOuter);
|
||||
joinUserAccount.Table = new StringPair(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserAccount), aliasUserConfig_UserAccount);
|
||||
joinUserAccount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Id, aliasUserConfig_UserAccount) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserConfig_UserAccountId, aliasUserConfig));
|
||||
query.Joins.Add(joinUserAccount);
|
||||
List<SaxDbDfn_Core.ColumnIdx> cols = new List<SaxDbDfn_Core.ColumnIdx>();
|
||||
cols.Add(SaxDbDfn_Core.ColumnIdx.UserAccount_EmailAddress);
|
||||
cols.Add(SaxDbDfn_Core.ColumnIdx.UserAccount_Title);
|
||||
cols.Add(SaxDbDfn_Core.ColumnIdx.UserAccount_FirstName);
|
||||
cols.Add(SaxDbDfn_Core.ColumnIdx.UserAccount_LastName);
|
||||
foreach (var col in cols)
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(col, aliasUserConfig_UserAccount), prefixUserConfig_UserAccount + SaxDbDfn_Core.GetColumnName(col, false));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Populate filter.
|
||||
query.Filters.AddRange(GetUserConfigQueryFilter(prm));
|
||||
|
||||
// Sort is applied if the results are likely to be more than a single row.
|
||||
if (prm.UserAccountIdsIncluded.Count != 1 || prm.ConfigType <= 0)
|
||||
{
|
||||
// Configure sort sequence.
|
||||
foreach (String sortColumn in GetUserConfigSortColumns(prm))
|
||||
query.OrderBy.Add(sortColumn);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
//return new DbResultSet_DataTableReader(db, query.BuildQuery(prm.ResultsPaging));
|
||||
return DbResultSet_DataReader.ExecuteQuery(CoreDatabase, query.BuildQuery(prm.ResultsPaging));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -4888,6 +4888,23 @@
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>12</Pos>
|
||||
<Name>GenderOther</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>50</Size>
|
||||
<BufferLen>100</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>13</Pos>
|
||||
<Name>DateOfBirthDay</Name>
|
||||
<DataType>TinyInt</DataType>
|
||||
<DataTypeName />
|
||||
@@ -4904,7 +4921,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>13</Pos>
|
||||
<Pos>14</Pos>
|
||||
<Name>DateOfBirthMonth</Name>
|
||||
<DataType>TinyInt</DataType>
|
||||
<DataTypeName />
|
||||
@@ -4921,7 +4938,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>14</Pos>
|
||||
<Pos>15</Pos>
|
||||
<Name>DateOfBirthYear</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
@@ -4938,7 +4955,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>15</Pos>
|
||||
<Pos>16</Pos>
|
||||
<Name>RegionIdCountry</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
@@ -4955,7 +4972,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>16</Pos>
|
||||
<Pos>17</Pos>
|
||||
<Name>RegionIdProvince</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
@@ -4972,7 +4989,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>17</Pos>
|
||||
<Pos>18</Pos>
|
||||
<Name>JournalistData</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -4989,7 +5006,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>18</Pos>
|
||||
<Pos>19</Pos>
|
||||
<Name>PasswordToken</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5006,7 +5023,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>19</Pos>
|
||||
<Pos>20</Pos>
|
||||
<Name>PasswordHashed</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5023,7 +5040,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>20</Pos>
|
||||
<Pos>21</Pos>
|
||||
<Name>PasswordHistory</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5040,7 +5057,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>21</Pos>
|
||||
<Pos>22</Pos>
|
||||
<Name>PasswordChangedAt</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5057,7 +5074,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>22</Pos>
|
||||
<Pos>23</Pos>
|
||||
<Name>LastLoginAt</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5074,7 +5091,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>23</Pos>
|
||||
<Pos>24</Pos>
|
||||
<Name>LastInvalidLoginAt</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5091,7 +5108,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>24</Pos>
|
||||
<Pos>25</Pos>
|
||||
<Name>InvalidLoginCount</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5108,7 +5125,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>25</Pos>
|
||||
<Pos>26</Pos>
|
||||
<Name>Notes</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5125,7 +5142,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>26</Pos>
|
||||
<Pos>27</Pos>
|
||||
<Name>Flags</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5142,7 +5159,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>27</Pos>
|
||||
<Pos>28</Pos>
|
||||
<Name>Status</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5159,7 +5176,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>28</Pos>
|
||||
<Pos>29</Pos>
|
||||
<Name>CreateOn</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5176,7 +5193,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>29</Pos>
|
||||
<Pos>30</Pos>
|
||||
<Name>CreateBy</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5193,7 +5210,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>30</Pos>
|
||||
<Pos>31</Pos>
|
||||
<Name>CreateHost</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5210,7 +5227,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>31</Pos>
|
||||
<Pos>32</Pos>
|
||||
<Name>UpdateOn</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5227,7 +5244,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>32</Pos>
|
||||
<Pos>33</Pos>
|
||||
<Name>UpdateBy</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5244,7 +5261,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserAccount</Table>
|
||||
<Pos>33</Pos>
|
||||
<Pos>34</Pos>
|
||||
<Name>UpdateHost</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -5845,6 +5862,162 @@
|
||||
</DbDfnIndex>
|
||||
</Indices>
|
||||
</DbDfnTable>
|
||||
<DbDfnTable>
|
||||
<Schema>dbo</Schema>
|
||||
<Name>UserConfig</Name>
|
||||
<Remarks />
|
||||
<Columns>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserConfig</Table>
|
||||
<Pos>1</Pos>
|
||||
<Name>Id</Name>
|
||||
<DataType>BigInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-5</DataTypeNative>
|
||||
<DataTypeNameNative>bigint</DataTypeNameNative>
|
||||
<IsIdentity>true</IsIdentity>
|
||||
<Size>19</Size>
|
||||
<BufferLen>8</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserConfig</Table>
|
||||
<Pos>2</Pos>
|
||||
<Name>UserAccountId</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>4</DataTypeNative>
|
||||
<DataTypeNameNative>int</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserConfig</Table>
|
||||
<Pos>3</Pos>
|
||||
<Name>ConfigType</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>5</DataTypeNative>
|
||||
<DataTypeNameNative>smallint</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserConfig</Table>
|
||||
<Pos>4</Pos>
|
||||
<Name>ConfigData</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>0</Size>
|
||||
<BufferLen>0</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserConfig</Table>
|
||||
<Pos>5</Pos>
|
||||
<Name>CreateOn</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>93</DataTypeNative>
|
||||
<DataTypeNameNative>datetime</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>23</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>3</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserConfig</Table>
|
||||
<Pos>6</Pos>
|
||||
<Name>UpdateOn</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>93</DataTypeNative>
|
||||
<DataTypeNameNative>datetime</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>23</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>3</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
</Columns>
|
||||
<Indices>
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserConfig</Table>
|
||||
<Name>PK_UserConfig</Name>
|
||||
<IndexType>1</IndexType>
|
||||
<Unique>true</Unique>
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>1</Seq>
|
||||
<Name>Id</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
</Columns>
|
||||
</DbDfnIndex>
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserConfig</Table>
|
||||
<Name>IX_UserConfig_User_Type</Name>
|
||||
<IndexType>3</IndexType>
|
||||
<Unique>true</Unique>
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>1</Seq>
|
||||
<Name>UserAccountId</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
<DbDfnIndexColumn>
|
||||
<Seq>2</Seq>
|
||||
<Name>ConfigType</Name>
|
||||
<Ascend>true</Ascend>
|
||||
</DbDfnIndexColumn>
|
||||
</Columns>
|
||||
</DbDfnIndex>
|
||||
</Indices>
|
||||
</DbDfnTable>
|
||||
<DbDfnTable>
|
||||
<Schema>dbo</Schema>
|
||||
<Name>UserEligibility</Name>
|
||||
@@ -6130,7 +6303,7 @@
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>UserEligibility</Table>
|
||||
<Name>IDX_UserEligibility_User_Region_Eligibilty</Name>
|
||||
<Name>IDX_UserEligibility_User_Region_Eligibility</Name>
|
||||
<IndexType>3</IndexType>
|
||||
<Unique>true</Unique>
|
||||
<Primary>false</Primary>
|
||||
@@ -7410,7 +7583,7 @@
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>15</UniqueValues>
|
||||
<UniqueValues>16</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
|
||||
Reference in New Issue
Block a user