v1.0.4.0
This commit is contained in:
@@ -27,6 +27,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SaxoniteCoreUnitTests", "Sa
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution files", "Solution files", "{BD66A338-2D41-4B64-86B0-670F4F42A489}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution files", "Solution files", "{BD66A338-2D41-4B64-86B0-670F4F42A489}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SaxoniteCoreUnitTestsOnline", "SaxoniteCoreUnitTestsOnline\SaxoniteCoreUnitTestsOnline.csproj", "{303BA8E9-1B95-41AD-9F51-32037A22C908}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -77,6 +79,10 @@ Global
|
|||||||
{CA680625-E334-4F76-881B-1327A2F9FE86}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{CA680625-E334-4F76-881B-1327A2F9FE86}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{CA680625-E334-4F76-881B-1327A2F9FE86}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{CA680625-E334-4F76-881B-1327A2F9FE86}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{CA680625-E334-4F76-881B-1327A2F9FE86}.Release|Any CPU.Build.0 = Release|Any CPU
|
{CA680625-E334-4F76-881B-1327A2F9FE86}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{303BA8E9-1B95-41AD-9F51-32037A22C908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{303BA8E9-1B95-41AD-9F51-32037A22C908}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{303BA8E9-1B95-41AD-9F51-32037A22C908}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{303BA8E9-1B95-41AD-9F51-32037A22C908}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
|
||||||
|
<RootNamespace>Saxonite.Net.Core</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||||
|
<PackageReference Include="Moq" Version="4.16.1" />
|
||||||
|
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
|
||||||
|
<PackageReference Include="coverlet.collector" Version="1.2.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\Common-VS\Workspace\SacsCoreWeb\SacsCoreWeb.csproj" />
|
||||||
|
<ProjectReference Include="..\..\..\Common-VS\Workspace\SacsStandardBase\SacsStandardBase.csproj" />
|
||||||
|
<ProjectReference Include="..\..\..\Common-VS\Workspace\SacsStandardDbas\SacsStandardDbas.csproj" />
|
||||||
|
<ProjectReference Include="..\SaxoniteCoreWebOnline\SaxoniteCoreWebOnline.csproj" />
|
||||||
|
<ProjectReference Include="..\SaxoniteCoreWeb\SaxoniteCoreWeb.csproj" />
|
||||||
|
<ProjectReference Include="..\SaxoniteStandardBase\SaxoniteStandardBase.csproj" />
|
||||||
|
<ProjectReference Include="..\SaxoniteStandardDbas\SaxoniteStandardDbas.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using Moq;
|
||||||
|
using Saxonite.Net.Core.Web.Online.App;
|
||||||
|
using Saxonite.Net.Standard.Base.App;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
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>();
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
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; } }
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
|
using Saxonite.Net.Core.Web.Online.App;
|
||||||
|
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||||
|
using Saxonite.Net.Standard.Base.App;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using Saxonite.Net.Standard.Base.Mgr;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using Sarand.Net.Standard.Base.Helpers;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Core.UnitTests.Web.Online.App
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
[TestClass]
|
||||||
|
public class SaxSessionData_Tester
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Properties.
|
||||||
|
public static SaxApplication_Online App { get { return SaxApplication_Online_Tester.App; } }
|
||||||
|
public static SaxInternals Internals { get { return SaxApplication_Online_Tester.Internals; } }
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
[TestMethod]
|
||||||
|
public void Test_SmmSessionData_Serialization()
|
||||||
|
{
|
||||||
|
// User account.
|
||||||
|
SaxAccountMgr accountMgr = Internals.AccountMgr;
|
||||||
|
|
||||||
|
// User account.
|
||||||
|
SaxUserAccount userAccount = accountMgr.CreateUserAccount();
|
||||||
|
userAccount.Id = new SysId(45678);
|
||||||
|
userAccount.EmailAddress = "john.smith@acme.co.uk";
|
||||||
|
userAccount.FirstName = "John";
|
||||||
|
userAccount.LastName = "Smith";
|
||||||
|
|
||||||
|
// User Roles.
|
||||||
|
List<SaxUserRole> userRoles = new List<SaxUserRole>();
|
||||||
|
SaxUserRole userRole = accountMgr.CreateUserRole(userAccount.Id, Sax.UserRole.Journalist);
|
||||||
|
userRoles.Add(userRole);
|
||||||
|
|
||||||
|
// Create user session and verify user id.
|
||||||
|
SaxSessionData_Online sessionData = new SaxSessionData_Online(App.SessionContext, userAccount, userRoles);
|
||||||
|
Assert.AreEqual(SysId.ToInt(sessionData.User.UserAccountId), SysId.ToInt(sessionData.User.UserAccountId));
|
||||||
|
Assert.AreEqual(userAccount.FirstName, sessionData.User.FirstName);
|
||||||
|
Assert.AreEqual(userAccount.LastName, sessionData.User.LastName);
|
||||||
|
Assert.IsTrue(sessionData.ValidUserSession);
|
||||||
|
Assert.AreNotEqual("", sessionData.User.DisplayName);
|
||||||
|
|
||||||
|
// Filter properties.
|
||||||
|
SysId filterOrganisationId = new SysId(SacsRandomHelper.GetInt32(Int32.MaxValue));
|
||||||
|
sessionData.Filter.OrganisationId = filterOrganisationId;
|
||||||
|
SysId filterOrganisationIdMember = new SysId(SacsRandomHelper.GetInt32(Int32.MaxValue));
|
||||||
|
sessionData.Filter.OrganisationIdMember = filterOrganisationIdMember;
|
||||||
|
|
||||||
|
// Serialise session data using same method as base controller.
|
||||||
|
String sessionDataJson = JsonConvert.SerializeObject(sessionData);
|
||||||
|
Assert.AreNotEqual("", sessionDataJson);
|
||||||
|
|
||||||
|
// Deserialise session data using same method as base controller.
|
||||||
|
SaxSessionData_Online sessionDataDeserialized =
|
||||||
|
JsonConvert.DeserializeObject<SaxSessionData_Online>(
|
||||||
|
sessionDataJson,
|
||||||
|
new JsonSerializerSettings { ContractResolver = new SaxController_Base.SessionStorage.SaxSessionDataContractResolver() }
|
||||||
|
);
|
||||||
|
Assert.IsNotNull(sessionDataDeserialized);
|
||||||
|
|
||||||
|
// Validate deserialised values.
|
||||||
|
Assert.AreEqual(App.SessionContext.Index, sessionDataDeserialized.SessionContext.Index);
|
||||||
|
Assert.AreEqual(Sax.Application.Online, sessionDataDeserialized.SessionContext.Application);
|
||||||
|
Assert.AreEqual(SysId.ToInt(sessionDataDeserialized.User.UserAccountId), SysId.ToInt(sessionDataDeserialized.User.UserAccountId));
|
||||||
|
Assert.AreEqual(SysId.ToInt(sessionData.User.UserAccountId), SysId.ToInt(sessionDataDeserialized.User.UserAccountId));
|
||||||
|
Assert.AreEqual(sessionData.User.EmailAddress, sessionDataDeserialized.User.EmailAddress);
|
||||||
|
Assert.AreEqual(sessionData.User.FirstName, sessionDataDeserialized.User.FirstName);
|
||||||
|
Assert.AreEqual(sessionData.User.LastName, sessionDataDeserialized.User.LastName);
|
||||||
|
Assert.AreEqual(sessionData.User.DisplayName, sessionDataDeserialized.User.DisplayName);
|
||||||
|
// User roles.
|
||||||
|
Assert.AreEqual(userRoles.Count, sessionDataDeserialized.User.Roles.Count);
|
||||||
|
// Filter properties.
|
||||||
|
Assert.IsNotNull(sessionData.Filter.OrganisationId);
|
||||||
|
Assert.IsTrue(SysId.IsValid(sessionData.Filter.OrganisationId));
|
||||||
|
Assert.AreEqual(filterOrganisationId, sessionData.Filter.OrganisationId);
|
||||||
|
Assert.IsNotNull(sessionData.Filter.OrganisationIdMember);
|
||||||
|
Assert.IsTrue(SysId.IsValid(sessionData.Filter.OrganisationIdMember));
|
||||||
|
Assert.AreEqual(filterOrganisationIdMember, sessionData.Filter.OrganisationIdMember);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -122,6 +122,17 @@ namespace Saxonite.Net.Core.Web.Base.App
|
|||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Specific phrase translation.
|
// Specific phrase translation.
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
private class CodeCache
|
||||||
|
{
|
||||||
|
public List<TypeCodeDesc> regionTypes;
|
||||||
|
public List<TypeCodeDesc> userRoles;
|
||||||
|
public List<TypeCodeDesc> organisationTypes;
|
||||||
|
public List<TypeCodeDesc> organisationCategories;
|
||||||
|
public List<TypeCodeDesc> organisationRoles;
|
||||||
|
public List<TypeCodeDesc> opportunityTypes;
|
||||||
|
}
|
||||||
|
private CodeCache codes = new CodeCache();
|
||||||
|
|
||||||
// Status.
|
// Status.
|
||||||
public String GetStatusCaption(SaStatus status)
|
public String GetStatusCaption(SaStatus status)
|
||||||
{
|
{
|
||||||
@@ -130,36 +141,63 @@ namespace Saxonite.Net.Core.Web.Base.App
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Region type.
|
// Region type.
|
||||||
private List<TypeCodeDesc> regionTypes;
|
|
||||||
public String GetRegionTypeCaption(Sax.RegionType regionType)
|
public String GetRegionTypeCaption(Sax.RegionType regionType)
|
||||||
{
|
{
|
||||||
if ((int)regionType < 1) return "";
|
if ((int)regionType < 1) return "";
|
||||||
if (regionTypes == null)
|
if (codes.regionTypes == null)
|
||||||
regionTypes = SaxSystem.GetCodesOfType(Sax.CodeType.RegionType);
|
codes.regionTypes = SaxSystem.GetCodesOfType(Sax.CodeType.RegionType);
|
||||||
// ToDo Region type localisation.
|
// ToDo Region type localisation.
|
||||||
return regionTypes.GetDescForType(regionType);
|
return codes.regionTypes.GetDescForType(regionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// User role.
|
// User role.
|
||||||
private List<TypeCodeDesc> userRoles;
|
|
||||||
public String GetUserRoleCaption(Sax.UserRole userRole)
|
public String GetUserRoleCaption(Sax.UserRole userRole)
|
||||||
{
|
{
|
||||||
if ((int)userRole < 1) return "";
|
if ((int)userRole < 1) return "";
|
||||||
if (userRoles == null)
|
if (codes.userRoles == null)
|
||||||
userRoles = SaxSystem.GetCodesOfType(Sax.CodeType.UserRole);
|
codes.userRoles = SaxSystem.GetCodesOfType(Sax.CodeType.UserRole);
|
||||||
// ToDo User Role localisation.
|
// ToDo User Role localisation.
|
||||||
return userRoles.GetDescForType(userRole);
|
return codes.userRoles.GetDescForType(userRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Organisation type.
|
||||||
|
public String GetOrganisationTypeCaption(Sax.OrganisationType organisationType)
|
||||||
|
{
|
||||||
|
if ((int)organisationType < 1) return "";
|
||||||
|
if (codes.organisationTypes == null)
|
||||||
|
codes.organisationTypes = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationType);
|
||||||
|
// ToDo Organisation Type localisation.
|
||||||
|
return codes.organisationTypes.GetDescForType(organisationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Organisation category.
|
||||||
|
public String GetOrganisationCategoryCaption(Sax.OrganisationCategory organisationCategory)
|
||||||
|
{
|
||||||
|
if ((int)organisationCategory < 1) return "";
|
||||||
|
if (codes.organisationCategories == null)
|
||||||
|
codes.organisationCategories = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationCategory);
|
||||||
|
// ToDo Organisation Category localisation.
|
||||||
|
return codes.organisationCategories.GetDescForType(organisationCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Organisation role.
|
// Organisation role.
|
||||||
private List<TypeCodeDesc> organisationRoles;
|
|
||||||
public String GetOrganisationRoleCaption(Sax.OrganisationRole organisationRole)
|
public String GetOrganisationRoleCaption(Sax.OrganisationRole organisationRole)
|
||||||
{
|
{
|
||||||
if ((int)organisationRole < 1) return "";
|
if ((int)organisationRole < 1) return "";
|
||||||
if (organisationRoles == null)
|
if (codes.organisationRoles == null)
|
||||||
organisationRoles = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationRole);
|
codes.organisationRoles = SaxSystem.GetCodesOfType(Sax.CodeType.OrganisationRole);
|
||||||
// ToDo Organisation Role localisation.
|
// ToDo Organisation Role localisation.
|
||||||
return organisationRoles.GetDescForType(organisationRole);
|
return codes.organisationRoles.GetDescForType(organisationRole);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opportunity type.
|
||||||
|
public String GetOpportunityTypeCaption(Sax.OpportunityType opportunityType)
|
||||||
|
{
|
||||||
|
if ((int)opportunityType < 1) return "";
|
||||||
|
if (codes.opportunityTypes == null)
|
||||||
|
codes.opportunityTypes = SaxSystem.GetCodesOfType(Sax.CodeType.OpportunityType);
|
||||||
|
// ToDo Opportunity Type localisation.
|
||||||
|
return codes.opportunityTypes.GetDescForType(opportunityType);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
|
|||||||
public List<TypeCodeDesc> OrganisationTypes { get { return Internals.OrganisationTypes; } }
|
public List<TypeCodeDesc> OrganisationTypes { get { return Internals.OrganisationTypes; } }
|
||||||
public List<TypeCodeDesc> OrganisationCategories { get { return Internals.OrganisationCategories; } }
|
public List<TypeCodeDesc> OrganisationCategories { get { return Internals.OrganisationCategories; } }
|
||||||
public List<TypeCodeDesc> OrganisationRoles { get { return Internals.OrganisationRoles; } }
|
public List<TypeCodeDesc> OrganisationRoles { get { return Internals.OrganisationRoles; } }
|
||||||
|
public List<TypeCodeDesc> OpportunityTypes { get { return Internals.OpportunityTypes; } }
|
||||||
// Email.
|
// Email.
|
||||||
public SaEmailConfig EmailConfig { get { return App.EmailConfig; } }
|
public SaEmailConfig EmailConfig { get { return App.EmailConfig; } }
|
||||||
public SaxEmailConsole EmailConsole { get { return Internals.EmailConsole; } }
|
public SaxEmailConsole EmailConsole { get { return Internals.EmailConsole; } }
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ namespace Saxonite.Net.Core.Web.Base.Models
|
|||||||
public List<TypeCodeDesc> OrganisationTypes { get { return Internals.OrganisationTypes; } }
|
public List<TypeCodeDesc> OrganisationTypes { get { return Internals.OrganisationTypes; } }
|
||||||
public List<TypeCodeDesc> OrganisationCategories { get { return Internals.OrganisationCategories; } }
|
public List<TypeCodeDesc> OrganisationCategories { get { return Internals.OrganisationCategories; } }
|
||||||
public List<TypeCodeDesc> OrganisationRoles { get { return Internals.OrganisationRoles; } }
|
public List<TypeCodeDesc> OrganisationRoles { get { return Internals.OrganisationRoles; } }
|
||||||
|
public List<TypeCodeDesc> OpportunityTypes { get { return Internals.OpportunityTypes; } }
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Page configuration.
|
// Page configuration.
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
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.Net.Core.Web.Admin.Models;
|
||||||
|
using Saxonite.Net.Standard.Base.App;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
// System - Ajax - Database controller
|
||||||
|
//=======================================================================
|
||||||
|
partial class SystemController
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Database data.
|
||||||
|
public class DatabaseTableData
|
||||||
|
{
|
||||||
|
public String Name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Get Database Table List ajax request.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
public class AjaxResponse_DatabaseTableList : AjaxResponse_Data
|
||||||
|
{
|
||||||
|
public List<DatabaseTableData> Tables { get; } = new List<DatabaseTableData>();
|
||||||
|
}
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
[HttpPost]
|
||||||
|
[Route("System/Ajax/GetDatabaseTables")]
|
||||||
|
public IActionResult Ajax_GetDatabaseTables(Model_Sport model)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".Ajax_GetDatabaseTables";
|
||||||
|
String messageTitle = Localiser["system.caption.database"];
|
||||||
|
AjaxResponse_DatabaseTableList responseData = new AjaxResponse_DatabaseTableList();
|
||||||
|
|
||||||
|
// Validate session.
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return GetAjaxResult_InvalidSession(responseData);
|
||||||
|
|
||||||
|
// Complete response.
|
||||||
|
responseData.Success = true;
|
||||||
|
|
||||||
|
return Json(responseData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
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.Net.Core.Web.Admin.Models;
|
||||||
|
using Saxonite.Net.Standard.Base.App;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
// System - Ajax - Database controller
|
||||||
|
//=======================================================================
|
||||||
|
partial class SystemController
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Database data.
|
||||||
|
public class LogFileData
|
||||||
|
{
|
||||||
|
public String Name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Get Database Table List ajax request.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
public class AjaxResponse_LogFileList : AjaxResponse_Data
|
||||||
|
{
|
||||||
|
public List<LogFileData> Tables { get; } = new List<LogFileData>();
|
||||||
|
}
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
[HttpPost]
|
||||||
|
[Route("System/Ajax/GetLogFileList")]
|
||||||
|
public IActionResult Ajax_GetLogFileList(Model_Sport model)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".Ajax_GetLogFileList";
|
||||||
|
String messageTitle = Localiser["system.caption.logs"];
|
||||||
|
AjaxResponse_LogFileList responseData = new AjaxResponse_LogFileList();
|
||||||
|
|
||||||
|
// Validate session.
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return GetAjaxResult_InvalidSession(responseData);
|
||||||
|
|
||||||
|
// Complete response.
|
||||||
|
responseData.Success = true;
|
||||||
|
|
||||||
|
return Json(responseData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Sarand.Net.Standard.Base.App;
|
||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
|
using Sarand.Net.Standard.Base.Core;
|
||||||
|
using Sarand.Net.Standard.Base.Utils;
|
||||||
|
using Saxonite.Net.Core.Web.Admin.Models;
|
||||||
|
using Saxonite.Net.Core.Web.Base.App;
|
||||||
|
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
public partial class SystemController : SaxController_Admin
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Construction.
|
||||||
|
public SystemController(SaxLocaliser localiser, ILogger<HomeController> logger) :
|
||||||
|
base(localiser, logger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
/// <summary>
|
||||||
|
/// System - Home.
|
||||||
|
/// <para>- No 'System' home page for now, redirect to home page.</para>
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return RedirectToAction("", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
/// <summary>
|
||||||
|
/// System - Database page.
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Database(Model_System model)
|
||||||
|
{
|
||||||
|
// Validate session.
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return RedirectToAction("", "");
|
||||||
|
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
/// <summary>
|
||||||
|
/// System - Logs page.
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Logs(Model_System model)
|
||||||
|
{
|
||||||
|
// Validate session.
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return RedirectToAction("", "");
|
||||||
|
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
|
public IActionResult Error()
|
||||||
|
{
|
||||||
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -65,7 +65,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
|||||||
// Check for duplicate name.
|
// Check for duplicate name.
|
||||||
SaxSport.Params prmSport = new SaxSport.Params();
|
SaxSport.Params prmSport = new SaxSport.Params();
|
||||||
if (SysId.IsValid(SportId))
|
if (SysId.IsValid(SportId))
|
||||||
prmSport.ExcludedIds.Add(SportId);
|
prmSport.IdsExcluded.Add(SportId);
|
||||||
prmSport.NamePartial = SportName;
|
prmSport.NamePartial = SportName;
|
||||||
prmSport.StatusCat = SaxSport.StatusCat.Any;
|
prmSport.StatusCat = SaxSport.StatusCat.Any;
|
||||||
if (ReferenceMgr.GetSportCount(prmSport) > 0)
|
if (ReferenceMgr.GetSportCount(prmSport) > 0)
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
using Saxonite.Net.Core.Web.Base.App;
|
||||||
|
using Saxonite.Net.Core.Web.Base.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Core.Web.Admin.Models
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
public class Model_System : SaxModel_Admin
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Construction.
|
||||||
|
public Model_System(SaxLocaliser localiser) :
|
||||||
|
base(localiser)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Properties.
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Database page properties.
|
||||||
|
public class DatabaseFilterData
|
||||||
|
{
|
||||||
|
public String Table { get; set; }
|
||||||
|
}
|
||||||
|
public DatabaseFilterData DatabaseFilter { get; } = new DatabaseFilterData();
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Logs page properties.
|
||||||
|
public class LogsFilterData
|
||||||
|
{
|
||||||
|
public String Filename { get; set; }
|
||||||
|
}
|
||||||
|
public LogsFilterData LogsFilter { get; } = new LogsFilterData();
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -162,12 +162,21 @@
|
|||||||
<data name="label.create" xml:space="preserve">
|
<data name="label.create" xml:space="preserve">
|
||||||
<value>Create</value>
|
<value>Create</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="label.database" xml:space="preserve">
|
||||||
|
<value>Database</value>
|
||||||
|
</data>
|
||||||
|
<data name="label.database.table" xml:space="preserve">
|
||||||
|
<value>Database table</value>
|
||||||
|
</data>
|
||||||
<data name="label.delete" xml:space="preserve">
|
<data name="label.delete" xml:space="preserve">
|
||||||
<value>Delete</value>
|
<value>Delete</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="label.email.address" xml:space="preserve">
|
<data name="label.email.address" xml:space="preserve">
|
||||||
<value>Email address</value>
|
<value>Email address</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="label.filename" xml:space="preserve">
|
||||||
|
<value>Filename</value>
|
||||||
|
</data>
|
||||||
<data name="label.first.name" xml:space="preserve">
|
<data name="label.first.name" xml:space="preserve">
|
||||||
<value>First name</value>
|
<value>First name</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -189,6 +198,9 @@
|
|||||||
<data name="label.last.name" xml:space="preserve">
|
<data name="label.last.name" xml:space="preserve">
|
||||||
<value>Last name</value>
|
<value>Last name</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="label.logs" xml:space="preserve">
|
||||||
|
<value>Logs</value>
|
||||||
|
</data>
|
||||||
<data name="label.members" xml:space="preserve">
|
<data name="label.members" xml:space="preserve">
|
||||||
<value>Members</value>
|
<value>Members</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -249,6 +261,9 @@
|
|||||||
<data name="label.strength" xml:space="preserve">
|
<data name="label.strength" xml:space="preserve">
|
||||||
<value>Strength</value>
|
<value>Strength</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="label.system" xml:space="preserve">
|
||||||
|
<value>System</value>
|
||||||
|
</data>
|
||||||
<data name="label.title" xml:space="preserve">
|
<data name="label.title" xml:space="preserve">
|
||||||
<value>Title</value>
|
<value>Title</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -414,6 +429,12 @@
|
|||||||
<data name="sport.caption.sports" xml:space="preserve">
|
<data name="sport.caption.sports" xml:space="preserve">
|
||||||
<value>Sports</value>
|
<value>Sports</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="system.caption.database" xml:space="preserve">
|
||||||
|
<value>System - Database</value>
|
||||||
|
</data>
|
||||||
|
<data name="system.caption.logs" xml:space="preserve">
|
||||||
|
<value>System - Logs</value>
|
||||||
|
</data>
|
||||||
<data name="user.caption.select.user.roles" xml:space="preserve">
|
<data name="user.caption.select.user.roles" xml:space="preserve">
|
||||||
<value>Select User Roles</value>
|
<value>Select User Roles</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
@model SaxModel_Admin
|
|
||||||
@inject SaxLocaliser Localiser
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="~/css/sax-organisationSelection.css?@Model.HrefVersion" />
|
|
||||||
<script src="~/js/sax-organisationSelection.js?@Model.HrefVersion"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
sax.organisationSelection.dlgTitleSelectOrganisation = '@Localiser.GetJavascriptText("organisation.caption.select.organisation")';
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div id="dlgOrganisationSelection" class="sax-dialog sax-form">
|
|
||||||
|
|
||||||
@* Filter *@
|
|
||||||
<div class="sax-panel-filter">
|
|
||||||
|
|
||||||
<div class="sax-content">
|
|
||||||
|
|
||||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOrganisationSelectionFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
|
||||||
{
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["organisation.caption.organisation"]</div>
|
|
||||||
<div class="col-sm-7"><input type="text" id="" class="sax-input FilterOrganisation" name="Filter.Organisation" maxlength="32" /></div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="">
|
|
||||||
|
|
||||||
@* Organisations *@
|
|
||||||
<div class="sax-selection-results Organisations"></div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="sax-panel-item-template">
|
|
||||||
<div class="sax-panel-item Organisation">
|
|
||||||
<div class="Name"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
@model SaxModel_Admin
|
||||||
|
@inject SaxLocaliser Localiser
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="~/css/sax-selectOrganisation.css?@Model.HrefVersion" />
|
||||||
|
<script src="~/js/sax-selectOrganisation.js?@Model.HrefVersion"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
sax.selectOrganisation.dlgTitleSelectOrganisation = '@Localiser.GetJavascriptText("organisation.caption.select.organisation")';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="dlgSelectOrganisation" class="sax-dialog sax-form">
|
||||||
|
|
||||||
|
@* Filter *@
|
||||||
|
<div class="sax-panel-filter">
|
||||||
|
|
||||||
|
<div class="sax-content">
|
||||||
|
|
||||||
|
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmSelectOrganisationFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["organisation.caption.organisation"]</div>
|
||||||
|
<div class="col-sm-7"><input type="text" class="sax-input FilterOrganisation" name="Filter.Organisation" maxlength="32" /></div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="">
|
||||||
|
|
||||||
|
@* Organisations *@
|
||||||
|
<div class="sax-selection-results Organisations"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sax-panel-item-template">
|
||||||
|
<div class="sax-panel-item Organisation">
|
||||||
|
<div class="Name"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
@Html.HiddenFor(model => model.Filter.OrganisationId, new { @id = "ifFilterOrganisationId" })
|
@Html.HiddenFor(model => model.Filter.OrganisationId, new { @id = "ifFilterOrganisationId" })
|
||||||
<input type="text" id="ifFilterOrganisation" class="sax-input" readonly="readonly" value="@(Model.MemberOrganisationName)" />
|
<input type="text" id="ifFilterOrganisation" class="sax-input" readonly="readonly" value="@(Model.MemberOrganisationName)" />
|
||||||
</div>
|
</div>
|
||||||
<div class="fixed"><button id="" class="sax-button" onclick="sax.selectOrganisation()">@Localiser["label.select"]</button></div>
|
<div class="fixed"><button id="" class="sax-button" onclick="sax.selectFilterOrganisation()">@Localiser["label.select"]</button></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -62,4 +62,4 @@
|
|||||||
|
|
||||||
<partial name="Panel-MemberDialog.cshtml" />
|
<partial name="Panel-MemberDialog.cshtml" />
|
||||||
|
|
||||||
<partial name="~/Views/Common/OrganisationSelection.cshtml" />
|
<partial name="~/Views/Common/SelectOrganisation.cshtml" />
|
||||||
|
|||||||
@@ -134,6 +134,15 @@
|
|||||||
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Organisation');">@Localiser["organisation.caption.organisations"]</div>
|
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Organisation');">@Localiser["organisation.caption.organisations"]</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a class="nav-link text-dark dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
@Localiser["label.system"]
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||||
|
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('System/Database');">@Localiser["label.database"]</div>
|
||||||
|
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('System/Logs');">@Localiser["label.logs"]</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link text-dark dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a class="nav-link text-dark dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
@Localiser["label.security"]
|
@Localiser["label.security"]
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
@model Model_System
|
||||||
|
@inject SaxLocaliser Localiser
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "System - Database";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="sax-panel-filter">
|
||||||
|
<div class="sax-header">
|
||||||
|
<div class="floatl sax-caption">@Localiser["system.caption.database"]</div>
|
||||||
|
<div class="floatr sax-action sax-results-refresh"><img src="~/img/action/refresh24.png" alt="@(Localiser["label.refresh"])" title="@(Localiser["label.refresh"])" /></div>
|
||||||
|
<div class="clearb"></div>
|
||||||
|
</div>
|
||||||
|
<div class="sax-content">
|
||||||
|
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmDatabaseFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["label.database.table"]</div>
|
||||||
|
<div class="col-sm-7">@Html.TextBoxFor(model => model.DatabaseFilter.Table, new { @id = "ifFilterDatabaseTable", @class = "FilterDatabaseTable", @maxlength = "32" })</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sax-panel-results">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sax-panel-item-template">
|
||||||
|
<div class="sax-panel-item DatabaseTable">
|
||||||
|
<div class="sax-header">
|
||||||
|
<div class="sax-caption TableName"></div>
|
||||||
|
</div>
|
||||||
|
<div class="sax-content"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
@model Model_System
|
||||||
|
@inject SaxLocaliser Localiser
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "System - Logs";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="sax-panel-filter">
|
||||||
|
<div class="sax-header">
|
||||||
|
<div class="floatl sax-caption">@Localiser["system.caption.logs"]</div>
|
||||||
|
<div class="floatr sax-action sax-results-refresh"><img src="~/img/action/refresh24.png" alt="@(Localiser["label.refresh"])" title="@(Localiser["label.refresh"])" /></div>
|
||||||
|
<div class="clearb"></div>
|
||||||
|
</div>
|
||||||
|
<div class="sax-content">
|
||||||
|
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmLogsFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["label.filename"]</div>
|
||||||
|
<div class="col-sm-7">@Html.TextBoxFor(model => model.LogsFilter.Filename, new { @id = "ifFilterLogFilename", @class = "FilterLogFilename", @maxlength = "32" })</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sax-panel-results">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sax-panel-item-template">
|
||||||
|
<div class="sax-panel-item LogFile">
|
||||||
|
<div class="sax-header">
|
||||||
|
<div class="sax-caption Filename"></div>
|
||||||
|
</div>
|
||||||
|
<div class="sax-content"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
+4
-4
@@ -4,18 +4,18 @@
|
|||||||
|
|
||||||
/* Panels */
|
/* Panels */
|
||||||
|
|
||||||
#dlgOrganisationSelection .sax-panel-filter
|
#dlgSelectOrganisation .sax-panel-filter
|
||||||
{
|
{
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#dlgOrganisationSelection .sax-panel-filter .sax-content
|
#dlgSelectOrganisation .sax-panel-filter .sax-content
|
||||||
{
|
{
|
||||||
margin:4px 8px;
|
margin:4px 8px;
|
||||||
padding:2px 4px;
|
padding:2px 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#dlgOrganisationSelection .sax-selection-results.Organisations
|
#dlgSelectOrganisation .sax-selection-results.Organisations
|
||||||
{
|
{
|
||||||
padding:2px 0;
|
padding:2px 0;
|
||||||
background-color:#f0f0f0;
|
background-color:#f0f0f0;
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#dlgOrganisationSelection.sax-form button.sax-button
|
#dlgSelectOrganisation.sax-form button.sax-button
|
||||||
{
|
{
|
||||||
margin: 4px 0;
|
margin: 4px 0;
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
sax.doRefreshResults = function (response)
|
sax.doRefreshResults = function (response)
|
||||||
{
|
{
|
||||||
sax.debug('doRefreshResults', response);
|
//sax.debug('doRefreshResults', response);
|
||||||
delete sax.awaitingRefreshResponse;
|
delete sax.awaitingRefreshResponse;
|
||||||
sax.refreshControlValues(response.controlValues);
|
sax.refreshControlValues(response.controlValues);
|
||||||
var $results = $('.sax-panel-results');
|
var $results = $('.sax-panel-results');
|
||||||
@@ -62,12 +62,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
sax.selectOrganisation = function ()
|
sax.selectFilterOrganisation = function ()
|
||||||
{
|
{
|
||||||
//sax.debug('sax.selectOrganisation');
|
//sax.debug('sax.selectFilterOrganisation');
|
||||||
sax.organisationSelection.fn.openDialog({ caption: sax.dlg.title.selectOrganisation, fnCallback: sax.onOrganisationSelected });
|
sax.selectOrganisation.fn.openDialog({ caption: sax.dlg.title.selectOrganisation, fnCallback: sax.onFilterOrganisationSelected });
|
||||||
}
|
}
|
||||||
sax.onOrganisationSelected = function (id, name)
|
sax.onFilterOrganisationSelected = function (id, name)
|
||||||
{
|
{
|
||||||
//sax.debug('sax.onOrganisationSelected', id, name);
|
//sax.debug('sax.onOrganisationSelected', id, name);
|
||||||
$('#frmMemberFilter #ifFilterOrganisationId').val(id);
|
$('#frmMemberFilter #ifFilterOrganisationId').val(id);
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
/*
|
|
||||||
* Admin - User page scripts.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function (win, doc, undef)
|
|
||||||
{
|
|
||||||
"use strict";
|
|
||||||
let os = sax.organisationSelection = sax.organisationSelection || { data: {}, fn: {}, $dlg: {}, itemIdPrefix: 'Org_' };
|
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
* Organisation selection config:
|
|
||||||
* - caption - dialog title.
|
|
||||||
* - width: preferred dialog width (default: 400).
|
|
||||||
* - height: preferred dialog height (default: 400).
|
|
||||||
* - fnCallback - method to call on completion.
|
|
||||||
*/
|
|
||||||
os.fn.openDialog = function (cfg)
|
|
||||||
{
|
|
||||||
//sax.debug('openDialog', cfg);
|
|
||||||
os.fn.init();
|
|
||||||
os.cfg = cfg;
|
|
||||||
sax.openDialog(os.$dlg.dialog('option', { title: cfg.caption || os.dlgTitleSelectOrganisation || 'Select Organisation' }), os.cfg.width || 480, os.cfg.height || 600);
|
|
||||||
}
|
|
||||||
os.fn.refreshOrganisations = function (delay)
|
|
||||||
{
|
|
||||||
//sax.debug('refreshOrganisations');
|
|
||||||
os.ajaxRefreshResults = os.ajaxRefreshResults || { url: sax.url.base + 'Organisation/Ajax/GetList', formId: 'frmOrganisationSelectionFilter', callbackFn: os.fn.doRefreshResults };
|
|
||||||
sax.doAjaxRequest(os.ajaxRefreshResults, delay || 50);
|
|
||||||
}
|
|
||||||
os.fn.doRefreshResults = function (response)
|
|
||||||
{
|
|
||||||
//sax.debug('os.doRefreshResults', response);
|
|
||||||
if (!response.success) return;
|
|
||||||
let $results = $('.sax-selection-results.Organisations', os.$dlg).empty().hide();
|
|
||||||
let $tmpl = $('.sax-panel-item-template .sax-panel-item.Organisation', os.$dlg);
|
|
||||||
let items = response.organisations;
|
|
||||||
if (items)
|
|
||||||
{
|
|
||||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
|
||||||
{
|
|
||||||
let item = items[itemIdx];
|
|
||||||
let $item = $tmpl.clone().prop('id', os.itemIdPrefix + item.id).on('click', function () { os.fn.onClickOrganisation(item); }).on('dblclick', function () { os.fn.onDblClickOrganisation(item); });
|
|
||||||
$('.Name', $item).text(item.name);
|
|
||||||
$results.append($item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$results.fadeIn(200);
|
|
||||||
}
|
|
||||||
os.fn.onClickOrganisation = function (item)
|
|
||||||
{
|
|
||||||
//sax.debug('onClickOrganisation', item);
|
|
||||||
os.data.item = item;
|
|
||||||
$('.sax-panel-item.Organisation', os.$dlg).removeClass('sel');
|
|
||||||
$('.sax-panel-item.Organisation#' + os.itemIdPrefix + item.id, os.$dlg).addClass('sel');
|
|
||||||
}
|
|
||||||
os.fn.onDblClickOrganisation = function (item)
|
|
||||||
{
|
|
||||||
//sax.debug('onDblClickCode', item);
|
|
||||||
os.data.item = item;
|
|
||||||
os.fn.confirmSelection();
|
|
||||||
}
|
|
||||||
os.fn.confirmSelection = function ()
|
|
||||||
{
|
|
||||||
//sax.debug('confirmSelection', os.data.item);
|
|
||||||
if (!os.data.item) return;
|
|
||||||
if (os.cfg.fnCallback) os.cfg.fnCallback(os.data.item.id, os.data.item.name);
|
|
||||||
os.$dlg.dialog('close');
|
|
||||||
delete os.cfg;
|
|
||||||
delete os.data.item;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
|
||||||
os.fn.init = function ()
|
|
||||||
{
|
|
||||||
if (!os.$dlg) return;
|
|
||||||
var opt = sax.dlgOpts();
|
|
||||||
opt.open = function () { os.fn.refreshOrganisations(200); };
|
|
||||||
opt.buttons[sax.dlg.btn.ok] = function () { os.fn.confirmSelection(); };
|
|
||||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
|
||||||
os.$dlg = $('#dlgOrganisationSelection').dialog(opt);
|
|
||||||
|
|
||||||
$('.sax-input.FilterOrganisation', os.$dlg).on('input', function () { sax.organisationSelection.fn.refreshOrganisations(250); });
|
|
||||||
}
|
|
||||||
|
|
||||||
}(window, window.document));
|
|
||||||
|
|
||||||
/* The End */
|
|
||||||
@@ -98,6 +98,10 @@
|
|||||||
//sax.debug('storeSelectCode', sc.cfg, sc.selectedCodes);
|
//sax.debug('storeSelectCode', sc.cfg, sc.selectedCodes);
|
||||||
if (sc.cfg.fnCallback) sc.cfg.fnCallback(sc.selectedCodes);
|
if (sc.cfg.fnCallback) sc.cfg.fnCallback(sc.selectedCodes);
|
||||||
sc.$dlg.dialog('close');
|
sc.$dlg.dialog('close');
|
||||||
|
sc.fn.cleanUp();
|
||||||
|
}
|
||||||
|
sc.fn.cleanUp = function ()
|
||||||
|
{
|
||||||
delete sc.cfg;
|
delete sc.cfg;
|
||||||
delete sc.selectedCodes;
|
delete sc.selectedCodes;
|
||||||
}
|
}
|
||||||
@@ -108,7 +112,7 @@
|
|||||||
if (!sc.$dlg) return;
|
if (!sc.$dlg) return;
|
||||||
var opt = sax.dlgOpts();
|
var opt = sax.dlgOpts();
|
||||||
opt.buttons[sax.dlg.btn.ok] = function () { sc.fn.storeSelectCode(); };
|
opt.buttons[sax.dlg.btn.ok] = function () { sc.fn.storeSelectCode(); };
|
||||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
opt.buttons[sax.dlg.btn.cancel] = function () { sc.fn.cleanUp(); $(this).dialog('close'); };
|
||||||
sc.$dlg = $('#dlgSelectCode').dialog(opt);
|
sc.$dlg = $('#dlgSelectCode').dialog(opt);
|
||||||
$('.sax-button.Select', sc.$dlg).on('click', function () { sc.fn.onClickSelect(); });
|
$('.sax-button.Select', sc.$dlg).on('click', function () { sc.fn.onClickSelect(); });
|
||||||
$('.sax-button.Remove', sc.$dlg).on('click', function () { sc.fn.onClickRemove(); });
|
$('.sax-button.Remove', sc.$dlg).on('click', function () { sc.fn.onClickRemove(); });
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* Admin - User page scripts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function (win, doc, undef)
|
||||||
|
{
|
||||||
|
"use strict";
|
||||||
|
let so = sax.selectOrganisation = sax.selectOrganisation || { data: {}, fn: {}, $dlg: {}, itemIdPrefix: 'Org_' };
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
* Organisation selection config:
|
||||||
|
* - caption - dialog title.
|
||||||
|
* - width: preferred dialog width (default: 400).
|
||||||
|
* - height: preferred dialog height (default: 400).
|
||||||
|
* - fnCallback - method to call on completion.
|
||||||
|
*/
|
||||||
|
so.fn.openDialog = function (cfg)
|
||||||
|
{
|
||||||
|
//sax.debug('openDialog', cfg);
|
||||||
|
so.fn.init();
|
||||||
|
so.cfg = cfg;
|
||||||
|
sax.openDialog(so.$dlg.dialog('option', { title: cfg.caption || so.dlgTitleSelectOrganisation || 'Select Organisation' }), so.cfg.width || 480, so.cfg.height || 600);
|
||||||
|
}
|
||||||
|
so.fn.refreshOrganisations = function (delay)
|
||||||
|
{
|
||||||
|
//sax.debug('refreshOrganisations');
|
||||||
|
$('.sax-selection-results.Organisations', so.$dlg).empty().hide();
|
||||||
|
so.ajaxRefreshResults = so.ajaxRefreshResults || { url: sax.url.base + 'Organisation/Ajax/GetList', formId: 'frmSelectOrganisationFilter', callbackFn: so.fn.doRefreshResults };
|
||||||
|
sax.doAjaxRequest(so.ajaxRefreshResults, delay || 50);
|
||||||
|
}
|
||||||
|
so.fn.doRefreshResults = function (response)
|
||||||
|
{
|
||||||
|
//sax.debug('so.doRefreshResults', response);
|
||||||
|
if (!response.success) return;
|
||||||
|
let $results = $('.sax-selection-results.Organisations', so.$dlg).empty().hide();
|
||||||
|
let $tmpl = $('.sax-panel-item-template .sax-panel-item.Organisation', so.$dlg);
|
||||||
|
let items = response.organisations;
|
||||||
|
if (items)
|
||||||
|
{
|
||||||
|
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||||
|
{
|
||||||
|
let item = items[itemIdx];
|
||||||
|
let $item = $tmpl.clone().prop('id', so.itemIdPrefix + item.id).on('click', function () { so.fn.onClickOrganisation(item); }).on('dblclick', function () { so.fn.onDblClickOrganisation(item); });
|
||||||
|
$('.Name', $item).text(item.name);
|
||||||
|
$results.append($item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$results.fadeIn(200);
|
||||||
|
}
|
||||||
|
so.fn.onClickOrganisation = function (item)
|
||||||
|
{
|
||||||
|
//sax.debug('onClickOrganisation', item);
|
||||||
|
so.data.item = item;
|
||||||
|
$('.sax-panel-item.Organisation', so.$dlg).removeClass('sel');
|
||||||
|
$('.sax-panel-item.Organisation#' + so.itemIdPrefix + item.id, so.$dlg).addClass('sel');
|
||||||
|
}
|
||||||
|
so.fn.onDblClickOrganisation = function (item)
|
||||||
|
{
|
||||||
|
//sax.debug('onDblClickCode', item);
|
||||||
|
so.data.item = item;
|
||||||
|
so.fn.confirmSelection();
|
||||||
|
}
|
||||||
|
so.fn.confirmSelection = function ()
|
||||||
|
{
|
||||||
|
//sax.debug('confirmSelection', so.data.item);
|
||||||
|
if (!so.data.item) return;
|
||||||
|
if (so.cfg.fnCallback) so.cfg.fnCallback(so.data.item.id, so.data.item.name);
|
||||||
|
so.$dlg.dialog('close');
|
||||||
|
so.fn.cleanUp();
|
||||||
|
}
|
||||||
|
so.fn.cleanUp = function ()
|
||||||
|
{
|
||||||
|
$('.sax-selection-results.Organisations', so.$dlg).empty().hide();
|
||||||
|
delete so.cfg;
|
||||||
|
delete so.data.item;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
so.fn.init = function ()
|
||||||
|
{
|
||||||
|
if (!so.$dlg) return;
|
||||||
|
var opt = sax.dlgOpts();
|
||||||
|
opt.open = function () { so.fn.refreshOrganisations(200); };
|
||||||
|
opt.buttons[sax.dlg.btn.ok] = function () { so.fn.confirmSelection(); };
|
||||||
|
opt.buttons[sax.dlg.btn.cancel] = function () { so.fn.cleanUp(); $(this).dialog('close'); };
|
||||||
|
so.$dlg = $('#dlgSelectOrganisation').dialog(opt);
|
||||||
|
|
||||||
|
$('.sax-input.FilterOrganisation', so.$dlg).on('input', function () { sax.selectOrganisation.fn.refreshOrganisations(250); });
|
||||||
|
}
|
||||||
|
|
||||||
|
}(window, window.document));
|
||||||
|
|
||||||
|
/* The End */
|
||||||
@@ -126,6 +126,15 @@
|
|||||||
<data name="account.caption.profile.organisations" xml:space="preserve">
|
<data name="account.caption.profile.organisations" xml:space="preserve">
|
||||||
<value>My Organisations</value>
|
<value>My Organisations</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="account.caption.profile.sport" xml:space="preserve">
|
||||||
|
<value>My Sport</value>
|
||||||
|
</data>
|
||||||
|
<data name="account.caption.profile.sport.add" xml:space="preserve">
|
||||||
|
<value>Add Sport</value>
|
||||||
|
</data>
|
||||||
|
<data name="account.caption.profile.sport.update" xml:space="preserve">
|
||||||
|
<value>My Sport</value>
|
||||||
|
</data>
|
||||||
<data name="account.caption.profile.sports" xml:space="preserve">
|
<data name="account.caption.profile.sports" xml:space="preserve">
|
||||||
<value>My Sports</value>
|
<value>My Sports</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -171,6 +180,9 @@
|
|||||||
<data name="label.account" xml:space="preserve">
|
<data name="label.account" xml:space="preserve">
|
||||||
<value>My Account</value>
|
<value>My Account</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="label.add" xml:space="preserve">
|
||||||
|
<value>Add</value>
|
||||||
|
</data>
|
||||||
<data name="label.article" xml:space="preserve">
|
<data name="label.article" xml:space="preserve">
|
||||||
<value>Article</value>
|
<value>Article</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -225,6 +237,18 @@
|
|||||||
<data name="label.ok" xml:space="preserve">
|
<data name="label.ok" xml:space="preserve">
|
||||||
<value>OK</value>
|
<value>OK</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="label.opportunities" xml:space="preserve">
|
||||||
|
<value>Opportunities</value>
|
||||||
|
</data>
|
||||||
|
<data name="label.opportunity" xml:space="preserve">
|
||||||
|
<value>Opportunity</value>
|
||||||
|
</data>
|
||||||
|
<data name="label.organisation" xml:space="preserve">
|
||||||
|
<value>Organisation</value>
|
||||||
|
</data>
|
||||||
|
<data name="label.outline" xml:space="preserve">
|
||||||
|
<value>Outline</value>
|
||||||
|
</data>
|
||||||
<data name="label.password" xml:space="preserve">
|
<data name="label.password" xml:space="preserve">
|
||||||
<value>Password</value>
|
<value>Password</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -234,6 +258,9 @@
|
|||||||
<data name="label.password.current" xml:space="preserve">
|
<data name="label.password.current" xml:space="preserve">
|
||||||
<value>Current password</value>
|
<value>Current password</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="label.position" xml:space="preserve">
|
||||||
|
<value>Position</value>
|
||||||
|
</data>
|
||||||
<data name="label.published" xml:space="preserve">
|
<data name="label.published" xml:space="preserve">
|
||||||
<value>Published</value>
|
<value>Published</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -345,6 +372,24 @@
|
|||||||
<data name="msg.validation.maximum.length" xml:space="preserve">
|
<data name="msg.validation.maximum.length" xml:space="preserve">
|
||||||
<value>Value must not exceed {0} characters</value>
|
<value>Value must not exceed {0} characters</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="organisation.caption.opportunities" xml:space="preserve">
|
||||||
|
<value>Organisation Opportunities</value>
|
||||||
|
</data>
|
||||||
|
<data name="organisation.caption.opportunity" xml:space="preserve">
|
||||||
|
<value>Organisation Opportunity</value>
|
||||||
|
</data>
|
||||||
|
<data name="organisation.caption.opportunity.create" xml:space="preserve">
|
||||||
|
<value>Create Opportunity</value>
|
||||||
|
</data>
|
||||||
|
<data name="organisation.caption.opportunity.update" xml:space="preserve">
|
||||||
|
<value>Update Opportunity</value>
|
||||||
|
</data>
|
||||||
|
<data name="organisation.caption.organisations" xml:space="preserve">
|
||||||
|
<value>Organisations</value>
|
||||||
|
</data>
|
||||||
|
<data name="organisation.caption.select.organisation" xml:space="preserve">
|
||||||
|
<value>Select Organisation</value>
|
||||||
|
</data>
|
||||||
<data name="policies.caption.privacy" xml:space="preserve">
|
<data name="policies.caption.privacy" xml:space="preserve">
|
||||||
<value>Privacy</value>
|
<value>Privacy</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
using Saxonite.Net.Core.Web.Base.App;
|
using Saxonite.Net.Core.Web.Base.App;
|
||||||
using Saxonite.Net.Standard.Base.App;
|
using Saxonite.Net.Standard.Base.App;
|
||||||
using Saxonite.Net.Standard.Base.Bus;
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
@@ -27,10 +28,25 @@ namespace Saxonite.Net.Core.Web.Online.App
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Properties.
|
// Security.
|
||||||
/// <summary>User - JSON deserialisation route.</summary>
|
/// <summary>User - JSON deserialisation route.</summary>
|
||||||
public new UserData User { get { return base.User; } set { SetUser(value); } }
|
public new UserData User { get { return base.User; } set { SetUser(value); } }
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Filter properties.
|
||||||
|
public class FilterData
|
||||||
|
{
|
||||||
|
/// <summary>Id for currently selected Organisation.</summary>
|
||||||
|
public SysId OrganisationId { get; set; }
|
||||||
|
/// <summary>Display text for currently selected Organisation.</summary>
|
||||||
|
public String OrganisationCaption { get; set; }
|
||||||
|
/// <summary>Id for currently selected Organisation of which the user is a member.</summary>
|
||||||
|
public SysId OrganisationIdMember { get; set; }
|
||||||
|
/// <summary>Display text for currently selected Organisation of which the user is a member.</summary>
|
||||||
|
public String OrganisationCaptionMember { get; set; }
|
||||||
|
}
|
||||||
|
public FilterData Filter { get; } = new FilterData();
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using Sarand.Net.Standard.Base.Utils;
|
|||||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Online Account Controller - Ajax actions.
|
// Online Account Controller - Contact - Ajax actions.
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
partial class AccountController
|
partial class AccountController
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using Sarand.Net.Standard.Base.Utils;
|
|||||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Online Account Controller - Ajax actions.
|
// Online Account Controller - Organisations - Ajax actions.
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
partial class AccountController
|
partial class AccountController
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,263 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
// Online Account Controller - Sports - Ajax actions.
|
||||||
|
//=======================================================================
|
||||||
|
partial class AccountController
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Data definitions.
|
||||||
|
public class ProfileSportResponseData_List
|
||||||
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
public long SportId { get; set; }
|
||||||
|
public String SportName { get; set; }
|
||||||
|
public String StatusCode { get; set; }
|
||||||
|
public String StatusDesc { get; set; }
|
||||||
|
}
|
||||||
|
public class ProfileSportResponseData_Item : ProfileSportResponseData_List
|
||||||
|
{
|
||||||
|
public String CreatedOnFmt { get; set; }
|
||||||
|
}
|
||||||
|
private void PopulateProfileSportResponseData(Model_Account model, SaxUserSport userSport, SaxSport sport, ProfileSportResponseData_Item data)
|
||||||
|
{
|
||||||
|
data.Id = SysId.ToLong(userSport.Id);
|
||||||
|
data.SportId = SysId.ToLong(userSport.SportId);
|
||||||
|
data.SportName = sport.Name;
|
||||||
|
data.CreatedOnFmt = DateUtil.Format(userSport.CreateStamp.On, "d-MMM-yyyy");
|
||||||
|
data.StatusCode = userSport.StatusCode;
|
||||||
|
data.StatusDesc = userSport.StatusDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Account - Get Profile Sports.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
public class AjaxResponse_ProfileSportsData : AjaxResponse_Data
|
||||||
|
{
|
||||||
|
public List<ProfileSportResponseData_List> Sports { get; } = new List<ProfileSportResponseData_List>();
|
||||||
|
}
|
||||||
|
// Ajax request.
|
||||||
|
[HttpPost]
|
||||||
|
[Route("Account/Ajax/GetProfileSports")]
|
||||||
|
public IActionResult GetProfileSports(Model_Account model)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".GetProfileSports";
|
||||||
|
AjaxResponse_ProfileSportsData responseData = new AjaxResponse_ProfileSportsData();
|
||||||
|
String messageTitle = Localiser["account.caption.profile.sports"];
|
||||||
|
|
||||||
|
// Validate session and referrer.
|
||||||
|
if (!ValidReferer)
|
||||||
|
return Forbid();
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return GetAjaxResult_InvalidSession(responseData);
|
||||||
|
|
||||||
|
// Item filter.
|
||||||
|
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||||
|
prmUserSport.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||||
|
prmUserSport.StatusCat = SaxUserSport.StatusCat.NotDeleted;
|
||||||
|
model.DataItemTotal = (ulong)AccountMgr.GetUserSportCount(prmUserSport);
|
||||||
|
model.PopulatePagingTo(prmUserSport.ResultsPaging);
|
||||||
|
|
||||||
|
// Item columns.
|
||||||
|
ColumnDfn colId = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Id);
|
||||||
|
ColumnDfn colSportId = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.SportId);
|
||||||
|
ColumnDfn colSportName = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Sport_Name);
|
||||||
|
ColumnDfn colStatus = AccountMgr.GetUserSportColumnDfn(SaxUserSport.Column.Status);
|
||||||
|
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||||
|
{
|
||||||
|
colId,
|
||||||
|
colSportId, colSportName,
|
||||||
|
colStatus,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Sort columns.
|
||||||
|
prmUserSport.SortColumns.Add(colSportName);
|
||||||
|
|
||||||
|
// Query items.
|
||||||
|
model.DataItemCount = 0;
|
||||||
|
using (DbResultSet resultSet = AccountMgr.ExecuteUserSportQuery(columns, prmUserSport))
|
||||||
|
{
|
||||||
|
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||||
|
{
|
||||||
|
model.DataItemCount++;
|
||||||
|
NamedValue.Map values = resultSet.GetRecordValues();
|
||||||
|
ProfileSportResponseData_List userSportData = new ProfileSportResponseData_List()
|
||||||
|
{
|
||||||
|
Id = values.GetLong(colId.DataName),
|
||||||
|
SportId = values.GetLong(colSportId.DataName),
|
||||||
|
SportName = values.GetString(colSportName.DataName),
|
||||||
|
StatusCode = values.GetString(colStatus.DataName),
|
||||||
|
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||||
|
};
|
||||||
|
responseData.Sports.Add(userSportData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complete response.
|
||||||
|
responseData.SetPaging(model);
|
||||||
|
responseData.Success = true;
|
||||||
|
return Json(responseData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Get Profile Sport ajax request.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
public class AjaxResponse_ProfileSport : AjaxResponse_Data
|
||||||
|
{
|
||||||
|
public ProfileSportResponseData_Item Sport { get; } = new ProfileSportResponseData_Item();
|
||||||
|
}
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
[HttpPost]
|
||||||
|
[Route("Account/Ajax/GetProfileSport")]
|
||||||
|
public IActionResult Ajax_GetProfileSport(Model_Account model)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".Ajax_GetProfileSport";
|
||||||
|
String messageTitle = Localiser["account.caption.profile.sport"];
|
||||||
|
AjaxResponse_ProfileSport responseData = new AjaxResponse_ProfileSport();
|
||||||
|
|
||||||
|
// Validate session and referrer.
|
||||||
|
if (!ValidReferer)
|
||||||
|
return Forbid();
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return GetAjaxResult_InvalidSession(responseData);
|
||||||
|
|
||||||
|
// Identify item.
|
||||||
|
SysId userSportId = model.UserSportId.ToSysId();
|
||||||
|
if (!SysId.IsValid(userSportId))
|
||||||
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||||
|
|
||||||
|
// Retrieve item.
|
||||||
|
SaxUserSport userSport = AccountMgr.GetUserSportById(userSportId);
|
||||||
|
if (userSport == null)
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Failed to retrieve User Sport for Id: '" + model.UserSportId + "'");
|
||||||
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve sport.
|
||||||
|
SaxSport sport = ReferenceMgr.GetSportById(userSport.SportId);
|
||||||
|
if (sport == null)
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Failed to retrieve Sport for Id: '" + userSport.SportId + "'");
|
||||||
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct response.
|
||||||
|
PopulateProfileSportResponseData(model, userSport, sport, responseData.Sport);
|
||||||
|
responseData.Success = true;
|
||||||
|
return Json(responseData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Store ProfileSport ajax request.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
[HttpPost]
|
||||||
|
[Route("Account/Ajax/StoreProfileSport")]
|
||||||
|
public IActionResult Ajax_StoreProfileSport(Model_Account model)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".Ajax_StoreProfileSport";
|
||||||
|
String messageTitle = Localiser["account.caption.profile.sport"];
|
||||||
|
AjaxResponse_ProfileSport responseData = new AjaxResponse_ProfileSport();
|
||||||
|
|
||||||
|
// Validate session and referrer.
|
||||||
|
if (!ValidReferer)
|
||||||
|
return Forbid();
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return GetAjaxResult_InvalidSession(responseData);
|
||||||
|
|
||||||
|
// Validate item properties.
|
||||||
|
model.ValidateProfileSportData(responseData);
|
||||||
|
if (responseData.HasControlErrors())
|
||||||
|
return Json(responseData);
|
||||||
|
|
||||||
|
// Validate Profile Sport Id against 'Exists' flag.
|
||||||
|
SysId userSportId = model.UserSportId.ToSysId();
|
||||||
|
bool profileSportExists = StringUtil.ToBool(model.ProfileSportExists);
|
||||||
|
if (profileSportExists && !SysId.IsValid(userSportId))
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Id not specified for existing Profile Sport.");
|
||||||
|
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||||
|
}
|
||||||
|
if (!profileSportExists && SysId.IsValid(userSportId))
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Id specified for new Profile Sport: '" + model.UserSportId + "'");
|
||||||
|
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve the sport.
|
||||||
|
SysId sportId = model.ProfileSportId.ToSysId();
|
||||||
|
SaxSport sport = ReferenceMgr.GetSportById(sportId);
|
||||||
|
if (sport == null)
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Failed to retrieve Sport for Id: " + sportId);
|
||||||
|
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve existing item.
|
||||||
|
SaxUserSport userSport = AccountMgr.GetUserSportById(userSportId);
|
||||||
|
if (userSport == null && SysId.IsValid(userSportId))
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Failed to retrieve User Sport for Id: '" + model.UserSportId + "'");
|
||||||
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||||
|
}
|
||||||
|
// Validate user sport properties.
|
||||||
|
if (userSport != null)
|
||||||
|
{
|
||||||
|
if (!userSport.SportId.Equals(sportId))
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Inconsistent Sport Id specified for User Sport. Expected: " + userSport.SportId + ". Found: " + sportId);
|
||||||
|
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new item if required.
|
||||||
|
if (userSport == null)
|
||||||
|
userSport = AccountMgr.CreateUserSport(SessionData.User.UserAccountId, sportId);
|
||||||
|
|
||||||
|
// Populate item properties.
|
||||||
|
|
||||||
|
// Store item.
|
||||||
|
if (!SysId.IsValid(userSport.Id))
|
||||||
|
{
|
||||||
|
if (!AccountMgr.InsertUserSport(userSport, DbUpdateInfo))
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Failed to insert user sport: " + AccountMgr.ErrorStateMessage);
|
||||||
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + AccountMgr.ErrorStateMessage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!AccountMgr.UpdateUserSport(userSport, DbUpdateInfo))
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Failed to update user sport [Id:" + SysId.ToString(userSport.Id) + "]: " + AccountMgr.ErrorStateMessage);
|
||||||
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + AccountMgr.ErrorStateMessage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct response.
|
||||||
|
PopulateProfileSportResponseData(model, userSport, sport, responseData.Sport);
|
||||||
|
responseData.Success = true;
|
||||||
|
return Json(responseData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -192,7 +192,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
|||||||
// Store Article ajax request.
|
// Store Article ajax request.
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("JOurnalist/Ajax/StoreArticle")]
|
[Route("Journalist/Ajax/StoreArticle")]
|
||||||
public IActionResult Ajax_StoreArticle(Model_Journalist model)
|
public IActionResult Ajax_StoreArticle(Model_Journalist model)
|
||||||
{
|
{
|
||||||
String fn = GetType().Name + ".Ajax_StoreArticle";
|
String fn = GetType().Name + ".Ajax_StoreArticle";
|
||||||
|
|||||||
+342
@@ -0,0 +1,342 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Sarand.Net.Standard.Base.App;
|
||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
|
using Sarand.Net.Standard.Base.Core;
|
||||||
|
using Sarand.Net.Standard.Base.Dbas;
|
||||||
|
using Sarand.Net.Standard.Base.Utils;
|
||||||
|
using Saxonite.Net.Core.Web.Online.Models;
|
||||||
|
using Saxonite.Net.Standard.Base.App;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
// Online Organisation Controller - Opportunities - Ajax actions.
|
||||||
|
//=======================================================================
|
||||||
|
partial class OrganisationController
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Organisation Opportunity data.
|
||||||
|
public class OpportunityData_List
|
||||||
|
{
|
||||||
|
public String Id { get; set; }
|
||||||
|
public String TypeCode { get; set; }
|
||||||
|
public String TypeDesc { get; set; }
|
||||||
|
public String Position { get; set; }
|
||||||
|
public String Outline { get; set; }
|
||||||
|
public String RegionCaption { get; set; }
|
||||||
|
public String SportCaption { get; set; }
|
||||||
|
public String PublishedOnFmt { get; set; }
|
||||||
|
public String ExpiresOnFmt { get; set; }
|
||||||
|
public String CreatedOnFmt { get; set; }
|
||||||
|
public String StatusCode { get; set; }
|
||||||
|
public String StatusDesc { get; set; }
|
||||||
|
}
|
||||||
|
public class OpportunityData_Full : OpportunityData_List
|
||||||
|
{
|
||||||
|
public String RegionIdPrimary { get; set; }
|
||||||
|
public String SportIdPrimary { get; set; }
|
||||||
|
public String PublishedOn_YYYYMMDD { get; set; }
|
||||||
|
public String ExpiresOn_YYYYMMDD { get; set; }
|
||||||
|
}
|
||||||
|
private void PopulateOpportunityResponseData(Model_Organisation_Opportunities model, SaxOrganisationOpportunity opportunity, OpportunityData_List data)
|
||||||
|
{
|
||||||
|
data.Id = SysId.ToString(opportunity.Id);
|
||||||
|
data.TypeCode = OpportunityTypes.GetCodeForType(opportunity.OpportunityType);
|
||||||
|
data.TypeDesc = Localiser.GetOpportunityTypeCaption(opportunity.OpportunityType);
|
||||||
|
data.Position = opportunity.Position;
|
||||||
|
data.Outline = opportunity.Outline;
|
||||||
|
data.RegionCaption = model.GetRegionCaption(opportunity.RegionIdPrimary);
|
||||||
|
data.SportCaption = model.GetSportCaption(opportunity.SportIdPrimary);
|
||||||
|
data.CreatedOnFmt = DateUtil.Format(opportunity.CreateStamp.On, "d-MMM-yyyy");
|
||||||
|
data.PublishedOnFmt = DateUtil.Format(opportunity.PublishedAt, "d-MMM-yyyy");
|
||||||
|
data.ExpiresOnFmt = DateUtil.Format(opportunity.ExpiresAt, "d-MMM-yyyy");
|
||||||
|
data.StatusCode = opportunity.StatusCode;
|
||||||
|
data.StatusDesc = opportunity.StatusDesc;
|
||||||
|
}
|
||||||
|
private void PopulateOpportunityResponseData(Model_Organisation_Opportunities model, SaxOrganisationOpportunity opportunity, OpportunityData_Full data)
|
||||||
|
{
|
||||||
|
PopulateOpportunityResponseData(model, opportunity, data as OpportunityData_List);
|
||||||
|
data.RegionIdPrimary = SysId.ToString(opportunity.RegionIdPrimary);
|
||||||
|
data.SportIdPrimary = SysId.ToString(opportunity.SportIdPrimary);
|
||||||
|
data.PublishedOn_YYYYMMDD = DateUtil.Format(opportunity.PublishedAt, "yyyyMMdd");
|
||||||
|
data.ExpiresOn_YYYYMMDD = DateUtil.Format(opportunity.ExpiresAt, "yyyyMMdd");
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Get Opportunity List ajax request.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
public class AjaxResponse_OpportunityList : AjaxResponse_Data
|
||||||
|
{
|
||||||
|
public List<OpportunityData_List> Opportunities { get; } = new List<OpportunityData_List>();
|
||||||
|
// User profile.
|
||||||
|
public class UserData
|
||||||
|
{
|
||||||
|
public bool CanManage { get; set; }
|
||||||
|
}
|
||||||
|
public UserData User { get; } = new UserData();
|
||||||
|
// Reference data.
|
||||||
|
public List<CodeDesc> OpportunityTypes { get; } = new List<CodeDesc>();
|
||||||
|
}
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
[HttpPost]
|
||||||
|
[Route("Organisation/Ajax/GetOpportunityList")]
|
||||||
|
[Route("Organisation/Ajax/GetOpportunities")]
|
||||||
|
public IActionResult Ajax_GetOpportunityList(Model_Organisation_Opportunities model)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".Ajax_GetOpportunityList";
|
||||||
|
String messageTitle = Localiser["organisation.caption.opportunities"];
|
||||||
|
AjaxResponse_OpportunityList responseData = new AjaxResponse_OpportunityList();
|
||||||
|
|
||||||
|
// Validate session and referrer.
|
||||||
|
if (!ValidReferer)
|
||||||
|
return Forbid();
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return GetAjaxResult_InvalidSession(responseData);
|
||||||
|
|
||||||
|
// Organisation.
|
||||||
|
SysId organisationId = model.Filter.OrganisationId.ToSysId();
|
||||||
|
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||||
|
|
||||||
|
if (organisation != null)
|
||||||
|
{
|
||||||
|
// Store filter data.
|
||||||
|
SessionData_Online.Filter.OrganisationIdMember = organisation.Id;
|
||||||
|
SessionData_Online.Filter.OrganisationCaptionMember = organisation.Name;
|
||||||
|
|
||||||
|
// Reference data - opportunity types.
|
||||||
|
foreach (TypeCodeDesc opportunityType in OpportunityTypes)
|
||||||
|
responseData.OpportunityTypes.Add(opportunityType.Code, Localiser.GetOpportunityTypeCaption((Sax.OpportunityType)opportunityType.Type));
|
||||||
|
|
||||||
|
// User organisation.
|
||||||
|
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||||
|
prmUserOrganisation.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||||
|
prmUserOrganisation.OrganisationIdsIncluded.Add(organisationId);
|
||||||
|
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
|
||||||
|
SaxUserOrganisation userOrganisation = AccountMgr.GetUserOrganisation(prmUserOrganisation);
|
||||||
|
|
||||||
|
// User details.
|
||||||
|
responseData.User.CanManage = userOrganisation?.OrganisationRoles.Contains(Sax.OrganisationRole.OpportunityAdmin) ?? false;
|
||||||
|
|
||||||
|
// Item filter.
|
||||||
|
SaxOrganisationOpportunity.Params prmOpportunity = new SaxOrganisationOpportunity.Params();
|
||||||
|
prmOpportunity.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||||
|
prmOpportunity.OrganisationIdsIncluded.Add(organisationId);
|
||||||
|
prmOpportunity.OpportunityFilter = model.Filter.Opportunity;
|
||||||
|
prmOpportunity.StatusCat = SaxOrganisationOpportunity.StatusCat.NotDeleted;
|
||||||
|
model.DataItemTotal = (ulong)ActivityMgr.GetOrganisationOpportunityCount(prmOpportunity);
|
||||||
|
model.PopulatePagingTo(prmOpportunity.ResultsPaging);
|
||||||
|
|
||||||
|
// Item columns.
|
||||||
|
ColumnDfn colId = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Id);
|
||||||
|
ColumnDfn colOpportunityTypeCode = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.OpportunityTypeCode);
|
||||||
|
ColumnDfn colPosition = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Position);
|
||||||
|
ColumnDfn colOutline = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Outline);
|
||||||
|
ColumnDfn colRegionId = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.RegionIdPrimary);
|
||||||
|
ColumnDfn colRegionName = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Region_Name);
|
||||||
|
ColumnDfn colSportId = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.SportIdPrimary);
|
||||||
|
ColumnDfn colSportName = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Sport_Name);
|
||||||
|
ColumnDfn colPublishedOn = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.PublishedAt_Date);
|
||||||
|
ColumnDfn colExpiresOn = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.ExpiresAt_Date);
|
||||||
|
ColumnDfn colStatus = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.Status);
|
||||||
|
ColumnDfn colCreatedOn = ActivityMgr.GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column.CreateOn_Date);
|
||||||
|
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||||
|
{
|
||||||
|
colId, colOpportunityTypeCode, colPosition, colOutline,
|
||||||
|
colRegionId, colRegionName, colSportId, colSportName,
|
||||||
|
colPublishedOn, colExpiresOn,
|
||||||
|
colStatus, colCreatedOn
|
||||||
|
};
|
||||||
|
|
||||||
|
// Sort columns.
|
||||||
|
colCreatedOn.SortAscending = false;
|
||||||
|
prmOpportunity.SortColumns.Add(colCreatedOn);
|
||||||
|
|
||||||
|
// Query items.
|
||||||
|
model.DataItemCount = 0;
|
||||||
|
using (DbResultSet resultSet = ActivityMgr.ExecuteOrganisationOpportunityQuery(columns, prmOpportunity))
|
||||||
|
{
|
||||||
|
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||||
|
{
|
||||||
|
model.DataItemCount++;
|
||||||
|
NamedValue.Map values = resultSet.GetRecordValues();
|
||||||
|
OpportunityData_List opportunityData = new OpportunityData_List()
|
||||||
|
{
|
||||||
|
Id = values.GetString(colId.DataName),
|
||||||
|
TypeCode = values.GetString(colOpportunityTypeCode.DataName),
|
||||||
|
TypeDesc = Localiser.GetOpportunityTypeCaption((Sax.OpportunityType)OpportunityTypes.GetTypeForCode(values.GetString(colOpportunityTypeCode.DataName))),
|
||||||
|
Position = values.GetString(colPosition.DataName),
|
||||||
|
Outline = values.GetString(colOutline.DataName),
|
||||||
|
RegionCaption = model.GetRegionCaption(values.GetString(colRegionName.DataName).ToSysId()),
|
||||||
|
SportCaption = model.GetSportCaption(values.GetString(colSportName.DataName).ToSysId()),
|
||||||
|
CreatedOnFmt = DateUtil.Format(values.GetDateTime(colCreatedOn.DataName), "d-MMM-yyyy"),
|
||||||
|
PublishedOnFmt = DateUtil.Format(values.GetDateTime(colPublishedOn.DataName), "d-MMM-yyyy"),
|
||||||
|
ExpiresOnFmt = DateUtil.Format(values.GetDateTime(colExpiresOn.DataName), "d-MMM-yyyy"),
|
||||||
|
StatusCode = values.GetString(colStatus.DataName),
|
||||||
|
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||||
|
};
|
||||||
|
responseData.Opportunities.Add(opportunityData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complete response.
|
||||||
|
responseData.SetPaging(model);
|
||||||
|
responseData.Success = true;
|
||||||
|
return Json(responseData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Get Opportunity ajax request.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
public class AjaxResponse_Opportunity : AjaxResponse_Data
|
||||||
|
{
|
||||||
|
public OpportunityData_Full Opportunity { get; } = new OpportunityData_Full();
|
||||||
|
}
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
[HttpPost]
|
||||||
|
[Route("Organisation/Ajax/GetOpportunity")]
|
||||||
|
public IActionResult Ajax_GetOpportunity(Model_Organisation_Opportunities model)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".Ajax_GetOpportunity";
|
||||||
|
String messageTitle = Localiser["organisation.caption.opportunity"];
|
||||||
|
AjaxResponse_Opportunity responseData = new AjaxResponse_Opportunity();
|
||||||
|
|
||||||
|
// Validate session and referrer.
|
||||||
|
if (!ValidReferer)
|
||||||
|
return Forbid();
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return GetAjaxResult_InvalidSession(responseData);
|
||||||
|
|
||||||
|
// Identify item.
|
||||||
|
SysId opportunityId = model.OpportunityId.ToSysId();
|
||||||
|
if (!SysId.IsValid(opportunityId))
|
||||||
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||||
|
|
||||||
|
// Retrieve item.
|
||||||
|
SaxOrganisationOpportunity opportunity = ActivityMgr.GetOrganisationOpportunityById(opportunityId);
|
||||||
|
if (opportunity == null)
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Failed to retrieve Organisation Opportunity for Id: '" + model.OpportunityId + "'");
|
||||||
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct response.
|
||||||
|
PopulateOpportunityResponseData(model, opportunity, responseData.Opportunity);
|
||||||
|
|
||||||
|
// Complete response.
|
||||||
|
responseData.Success = true;
|
||||||
|
|
||||||
|
return Json(responseData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Store Opportunity ajax request.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
[HttpPost]
|
||||||
|
[Route("Organisation/Ajax/StoreOpportunity")]
|
||||||
|
public IActionResult Ajax_StoreOpportunity(Model_Organisation_Opportunities model)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".Ajax_StoreOpportunity";
|
||||||
|
String messageTitle = Localiser["organisation.caption.opportunity"];
|
||||||
|
AjaxResponse_Opportunity responseData = new AjaxResponse_Opportunity();
|
||||||
|
|
||||||
|
// Validate session and referrer.
|
||||||
|
if (!ValidReferer)
|
||||||
|
return Forbid();
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return GetAjaxResult_InvalidSession(responseData);
|
||||||
|
|
||||||
|
// Validate item properties.
|
||||||
|
model.ValidateOpportunityData(responseData);
|
||||||
|
if (responseData.HasControlErrors())
|
||||||
|
return Json(responseData);
|
||||||
|
|
||||||
|
// Validate Opportunity against Id against 'Exists' flag.
|
||||||
|
SysId opportunityId = model.OpportunityId.ToSysId();
|
||||||
|
bool opportunityExists = StringUtil.ToBool(model.OpportunityExists);
|
||||||
|
if (opportunityExists && !SysId.IsValid(opportunityId))
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Id not specified for existing Opportunity.");
|
||||||
|
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||||
|
}
|
||||||
|
if (!opportunityExists && SysId.IsValid(opportunityId))
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Id specified for new Opportunity: '" + model.OpportunityId + "'");
|
||||||
|
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve existing item.
|
||||||
|
SaxOrganisationOpportunity opportunity = ActivityMgr.GetOrganisationOpportunityById(opportunityId);
|
||||||
|
if (opportunity == null && SysId.IsValid(opportunityId))
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Failed to retrieve opportunity for Id: '" + model.OpportunityId + "'");
|
||||||
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate the Organisation Id.
|
||||||
|
SysId organisationId = model.OpportunityOrganisationId.ToSysId();
|
||||||
|
if (!SysId.IsValid(organisationId))
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Organisation Id not specified for Opportunity.");
|
||||||
|
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||||
|
}
|
||||||
|
if (opportunity != null && !opportunity.OrganisationId.Equals(organisationId))
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Inconsistent Organisation Id specified for Opportunity. Expected: " + opportunity.OrganisationId + ". Found: " + organisationId);
|
||||||
|
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new item if required.
|
||||||
|
if (opportunity == null)
|
||||||
|
opportunity = ActivityMgr.CreateOrganisationOpportunity(organisationId);
|
||||||
|
|
||||||
|
// Populate item properties.
|
||||||
|
if (model.OpportunityRegionId != null)
|
||||||
|
opportunity.RegionIdPrimary = model.OpportunityRegionId.ToSysId();
|
||||||
|
if (model.OpportunitySportId != null)
|
||||||
|
opportunity.SportIdPrimary = model.OpportunitySportId.ToSysId();
|
||||||
|
if (model.OpportunityTypeCode != null)
|
||||||
|
opportunity.OpportunityType = (Sax.OpportunityType)OpportunityTypes.GetTypeForCode(model.OpportunityTypeCode);
|
||||||
|
if (model.OpportunityPosition != null)
|
||||||
|
opportunity.Position = model.OpportunityPosition;
|
||||||
|
if (model.OpportunityOutline != null)
|
||||||
|
opportunity.Outline = model.OpportunityOutline;
|
||||||
|
if (model.OpportunityStatusCode != null)
|
||||||
|
opportunity.Status = model.OpportunityStatus;
|
||||||
|
|
||||||
|
// Store item.
|
||||||
|
if (!SysId.IsValid(opportunity.Id))
|
||||||
|
{
|
||||||
|
if (!ActivityMgr.InsertOrganisationOpportunity(opportunity, DbUpdateInfo))
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Failed to insert opportunity: " + ActivityMgr.ErrorStateMessage);
|
||||||
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.insert.failed"] + "\n\n" + ActivityMgr.ErrorStateMessage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!ActivityMgr.UpdateOrganisationOpportunity(opportunity, DbUpdateInfo))
|
||||||
|
{
|
||||||
|
SaLogger.Warn(fn + " Failed to update opportunity [Id:" + SysId.ToString(opportunity.Id) + "]: " + ActivityMgr.ErrorStateMessage);
|
||||||
|
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + ActivityMgr.ErrorStateMessage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct response.
|
||||||
|
PopulateOpportunityResponseData(model, opportunity, responseData.Opportunity);
|
||||||
|
|
||||||
|
// Complete response.
|
||||||
|
responseData.Success = true;
|
||||||
|
|
||||||
|
return Json(responseData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Sarand.Net.Standard.Base.App;
|
||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
|
using Sarand.Net.Standard.Base.Core;
|
||||||
|
using Sarand.Net.Standard.Base.Dbas;
|
||||||
|
using Sarand.Net.Standard.Base.Utils;
|
||||||
|
using Saxonite.Net.Core.Web.Online.Models;
|
||||||
|
using Saxonite.Net.Standard.Base.App;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
// Online Organisation Controller - Ajax actions.
|
||||||
|
//=======================================================================
|
||||||
|
partial class OrganisationController
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Organisation data.
|
||||||
|
public class OrganisationResponseData
|
||||||
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
public String Name { get; set; }
|
||||||
|
public long RegionId { get; set; }
|
||||||
|
public String RegionName { get; set; }
|
||||||
|
public long SportId { get; set; }
|
||||||
|
public String SportName { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Get Organisation List ajax request.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
public class AjaxResponse_OrganisationList : AjaxResponse_Data
|
||||||
|
{
|
||||||
|
public List<OrganisationResponseData> Organisations { get; } = new List<OrganisationResponseData>();
|
||||||
|
}
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
[HttpPost]
|
||||||
|
[Route("Organisation/Ajax/GetOrganisationList")]
|
||||||
|
public IActionResult Ajax_GetOrganisationList(Model_Organisation model)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".Ajax_GetOrganisationList";
|
||||||
|
String messageTitle = Localiser["organisation.caption.organisations"];
|
||||||
|
AjaxResponse_OrganisationList responseData = new AjaxResponse_OrganisationList();
|
||||||
|
|
||||||
|
// Validate session and referrer.
|
||||||
|
if (!ValidReferer)
|
||||||
|
return Forbid();
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return GetAjaxResult_InvalidSession(responseData);
|
||||||
|
|
||||||
|
// Query columns.
|
||||||
|
ColumnDfn colOrganisationId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Id);
|
||||||
|
ColumnDfn colOrganisationName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Name);
|
||||||
|
ColumnDfn colRegionId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.RegionId);
|
||||||
|
ColumnDfn colRegionName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Region_Name);
|
||||||
|
ColumnDfn colSportId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.SportId);
|
||||||
|
ColumnDfn colSportName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Sport_Name);
|
||||||
|
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||||
|
{
|
||||||
|
colOrganisationId, colOrganisationName,
|
||||||
|
colRegionId, colRegionName,
|
||||||
|
colSportId, colSportName
|
||||||
|
};
|
||||||
|
|
||||||
|
// Organisation filter.
|
||||||
|
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||||
|
prmOrganisation.OrganisationFilter = model.Filter.Organisation;
|
||||||
|
prmOrganisation.RegionIdsIncluded.AddId(model.Filter.RegionId.ToSysId());
|
||||||
|
prmOrganisation.SportIdsIncluded.AddId(model.Filter.SportId.ToSysId());
|
||||||
|
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.ActiveOnly;
|
||||||
|
prmOrganisation.SortColumns.Add(colOrganisationName);
|
||||||
|
model.DataItemTotal = (ulong)AccountMgr.GetOrganisationCount(prmOrganisation);
|
||||||
|
model.PopulatePagingTo(prmOrganisation.ResultsPaging);
|
||||||
|
using (DbResultSet resultSet = AccountMgr.ExecuteOrganisationQuery(columns, prmOrganisation))
|
||||||
|
{
|
||||||
|
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||||
|
{
|
||||||
|
NamedValue.Map values = resultSet.GetRecordValues();
|
||||||
|
OrganisationResponseData organisationData = new OrganisationResponseData()
|
||||||
|
{
|
||||||
|
Id = values.GetLong(colOrganisationId.DataName),
|
||||||
|
Name = values.GetString(colOrganisationName.DataName),
|
||||||
|
RegionId = values.GetLong(colRegionId.DataName),
|
||||||
|
RegionName = values.GetString(colRegionName.DataName),
|
||||||
|
SportId = values.GetLong(colSportId.DataName),
|
||||||
|
SportName = values.GetString(colSportName.DataName),
|
||||||
|
};
|
||||||
|
responseData.Organisations.Add(organisationData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complete response.
|
||||||
|
responseData.SetPaging(model);
|
||||||
|
responseData.Success = true;
|
||||||
|
return Json(responseData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Get Member Organisation List ajax request.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
public class AjaxResponse_MemberOrganisationList : AjaxResponse_Data
|
||||||
|
{
|
||||||
|
public List<OrganisationResponseData> Organisations { get; } = new List<OrganisationResponseData>();
|
||||||
|
}
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
[HttpPost]
|
||||||
|
[Route("Organisation/Ajax/GetMemberOrganisationList")]
|
||||||
|
public IActionResult Ajax_GetMemberOrganisationList(Model_Organisation model)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".Ajax_GetMemberOrganisationList";
|
||||||
|
String messageTitle = Localiser["organisation.caption.organisations"];
|
||||||
|
AjaxResponse_MemberOrganisationList responseData = new AjaxResponse_MemberOrganisationList();
|
||||||
|
|
||||||
|
// Validate session and referrer.
|
||||||
|
if (!ValidReferer)
|
||||||
|
return Forbid();
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return GetAjaxResult_InvalidSession(responseData);
|
||||||
|
|
||||||
|
// Query columns.
|
||||||
|
ColumnDfn colOrganisationId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.OrganisationId);
|
||||||
|
ColumnDfn colOrganisationName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Name);
|
||||||
|
ColumnDfn colRegionId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_RegionId);
|
||||||
|
ColumnDfn colRegionName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Region_Name);
|
||||||
|
ColumnDfn colSportId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_SportId);
|
||||||
|
ColumnDfn colSportName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Sport_Name);
|
||||||
|
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||||
|
{
|
||||||
|
colOrganisationId, colOrganisationName,
|
||||||
|
colRegionId, colRegionName,
|
||||||
|
colSportId, colSportName
|
||||||
|
};
|
||||||
|
|
||||||
|
// Organisation filter
|
||||||
|
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||||
|
prmUserOrganisation.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||||
|
prmUserOrganisation.OrganisationMembersOnly = true;
|
||||||
|
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
|
||||||
|
prmUserOrganisation.SortColumns.Add(colOrganisationName);
|
||||||
|
model.DataItemTotal = (ulong)AccountMgr.GetUserOrganisationCount(prmUserOrganisation);
|
||||||
|
model.PopulatePagingTo(prmUserOrganisation.ResultsPaging);
|
||||||
|
using (DbResultSet resultSet = AccountMgr.ExecuteUserOrganisationQuery(columns, prmUserOrganisation))
|
||||||
|
{
|
||||||
|
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||||
|
{
|
||||||
|
NamedValue.Map values = resultSet.GetRecordValues();
|
||||||
|
OrganisationResponseData organisationData = new OrganisationResponseData()
|
||||||
|
{
|
||||||
|
Id = values.GetLong(colOrganisationId.DataName),
|
||||||
|
Name = values.GetString(colOrganisationName.DataName),
|
||||||
|
RegionId = values.GetLong(colRegionId.DataName),
|
||||||
|
RegionName = values.GetString(colRegionName.DataName),
|
||||||
|
SportId = values.GetLong(colSportId.DataName),
|
||||||
|
SportName = values.GetString(colSportName.DataName),
|
||||||
|
};
|
||||||
|
responseData.Organisations.Add(organisationData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complete response.
|
||||||
|
responseData.SetPaging(model);
|
||||||
|
responseData.Success = true;
|
||||||
|
return Json(responseData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
|
using Sarand.Net.Standard.Base.Core;
|
||||||
|
using Sarand.Net.Standard.Base.Dbas;
|
||||||
|
using Sarand.Net.Standard.Base.Utils;
|
||||||
|
using Saxonite.Net.Core.Web.Base.App;
|
||||||
|
using Saxonite.Net.Core.Web.Online.Models;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
// Online Organisation Controller.
|
||||||
|
//=======================================================================
|
||||||
|
public partial class OrganisationController : SaxController_Online
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Construction.
|
||||||
|
public OrganisationController(SaxLocaliser localiser, ILogger<HomeController> logger) :
|
||||||
|
base(localiser, logger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
// Validate session.
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return RedirectToAction("", "");
|
||||||
|
|
||||||
|
// No 'Index' view as yet - default to 'Opportunities' view.
|
||||||
|
return RedirectToAction("Opportunities", "Organisation");
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Opportunities()
|
||||||
|
{
|
||||||
|
// Validate session.
|
||||||
|
if (!ValidUserSession)
|
||||||
|
return RedirectToAction("", "");
|
||||||
|
|
||||||
|
// Check that user is associated with organisations.
|
||||||
|
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||||
|
prmUserOrganisation.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||||
|
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
|
||||||
|
if (AccountMgr.GetUserOrganisationCount(prmUserOrganisation) < 1)
|
||||||
|
return RedirectToAction("", "");
|
||||||
|
|
||||||
|
// Model.
|
||||||
|
Model_Organisation_Opportunities model = new Model_Organisation_Opportunities(Localiser);
|
||||||
|
|
||||||
|
// Filter organisation.
|
||||||
|
model.Filter.OrganisationId = SysId.ToString(SessionData_Online.Filter.OrganisationIdMember);
|
||||||
|
model.Filter.OrganisationCaption = SessionData_Online.Filter.OrganisationCaptionMember;
|
||||||
|
if (StringUtil.IsEmpty(model.Filter.OrganisationId))
|
||||||
|
{
|
||||||
|
// Pick the first Organisation that the user is a member of.
|
||||||
|
ColumnDfn colOrganisationId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.OrganisationId);
|
||||||
|
ColumnDfn colOrganisationName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Name);
|
||||||
|
prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||||
|
prmUserOrganisation.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||||
|
prmUserOrganisation.OrganisationMembersOnly = true;
|
||||||
|
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
|
||||||
|
prmUserOrganisation.SortColumns.Add(colOrganisationName);
|
||||||
|
prmUserOrganisation.ResultsPaging.PageLength = 1;
|
||||||
|
prmUserOrganisation.ResultsPaging.PageNo = 1;
|
||||||
|
using (DbResultSet resultSet = AccountMgr.ExecuteUserOrganisationQuery(new List<ColumnDfn>() { colOrganisationId, colOrganisationName }, prmUserOrganisation))
|
||||||
|
{
|
||||||
|
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||||
|
{
|
||||||
|
NamedValue.Map values = resultSet.GetRecordValues();
|
||||||
|
model.Filter.OrganisationId = SysId.ToString(new SysId(values.GetLong(colOrganisationId.DataName)));
|
||||||
|
if (!StringUtil.IsEmpty(model.Filter.OrganisationId))
|
||||||
|
{
|
||||||
|
model.Filter.OrganisationCaption = values.GetString(colOrganisationName.DataName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (SysId.IsValid(model.Filter.OrganisationId.ToSysId()) && StringUtil.IsEmpty(model.Filter.OrganisationCaption))
|
||||||
|
{
|
||||||
|
// Organisation has been identified but no caption available as yet.
|
||||||
|
using (SaxOrganisation organisation = AccountMgr.GetOrganisationById(model.Filter.OrganisationId.ToSysId()))
|
||||||
|
{
|
||||||
|
if (organisation != null)
|
||||||
|
model.Filter.OrganisationCaption = organisation.Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Make a note of the filter values.
|
||||||
|
SessionData_Online.Filter.OrganisationIdMember = model.Filter.OrganisationId.ToSysId();
|
||||||
|
SessionData_Online.Filter.OrganisationCaptionMember = model.Filter.OrganisationCaption;
|
||||||
|
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -24,12 +24,18 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Properties.
|
// Contact Properties.
|
||||||
public String AccountEmailAddress { get; set; }
|
public String AccountEmailAddress { get; set; }
|
||||||
public String AccountTitle { get; set; }
|
public String AccountTitle { get; set; }
|
||||||
public String AccountFirstName { get; set; }
|
public String AccountFirstName { get; set; }
|
||||||
public String AccountLastName { get; set; }
|
public String AccountLastName { get; set; }
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Sport properties.
|
||||||
|
public String UserSportId { get; set; }
|
||||||
|
public String ProfileSportId { get; set; }
|
||||||
|
public String ProfileSportExists { get; set; }
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
public bool ValidateContactDetails(SaxController_Base.AjaxResponse_Data responseData)
|
public bool ValidateContactDetails(SaxController_Base.AjaxResponse_Data responseData)
|
||||||
{
|
{
|
||||||
@@ -66,6 +72,20 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
|||||||
return !responseData.HasControlErrors();
|
return !responseData.HasControlErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
public bool ValidateProfileSportData(SaxController_Base.AjaxResponse_Data responseData)
|
||||||
|
{
|
||||||
|
// Sport.
|
||||||
|
if (ProfileSportId != null)
|
||||||
|
{
|
||||||
|
SysId profileSportId = ProfileSportId.ToSysId();
|
||||||
|
if (!SysId.IsValid(profileSportId))
|
||||||
|
responseData.SetControlError(nameof(ProfileSportId), Localiser["msg.validation.mandatory.value"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return !responseData.HasControlErrors();
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
|||||||
public Model_Journalist(SaxLocaliser localiser) :
|
public Model_Journalist(SaxLocaliser localiser) :
|
||||||
base(localiser)
|
base(localiser)
|
||||||
{
|
{
|
||||||
//AdditionalFiles_CSS.Add("css/sax-journalist.css");
|
//AdditionalFiles_CSS.Add("css/sax-jrn-art.css");
|
||||||
AdditionalFiles_JS.Add("js/sax-journalist.js");
|
AdditionalFiles_JS.Add("js/sax-jrn-art.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
using Sarand.Net.Standard.Base.App;
|
||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
|
using Sarand.Net.Standard.Base.Core;
|
||||||
|
using Sarand.Net.Standard.Base.Utils;
|
||||||
|
using Saxonite.Base.App;
|
||||||
|
using Saxonite.Net.Core.Web.Base.App;
|
||||||
|
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Core.Web.Online.Models
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
public class Model_Organisation : SaxModel_Online
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Construction.
|
||||||
|
public Model_Organisation(SaxLocaliser localiser) :
|
||||||
|
base(localiser)
|
||||||
|
{
|
||||||
|
//AdditionalFiles_CSS.Add("css/sax-org.css");
|
||||||
|
AdditionalFiles_JS.Add("js/sax-org.js");
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// List configuration.
|
||||||
|
public class OrganisationFilterData
|
||||||
|
{
|
||||||
|
public String Organisation { get; set; }
|
||||||
|
public String RegionId { get; set; }
|
||||||
|
public String SportId { get; set; }
|
||||||
|
}
|
||||||
|
public OrganisationFilterData Filter { get; } = new OrganisationFilterData();
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Organisation properties.
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Validation.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Organisation.
|
||||||
|
public bool ValidateOrganisationData(SaxController_Base.AjaxResponse_Data responseData)
|
||||||
|
{
|
||||||
|
return !responseData.HasControlErrors();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
using Sarand.Net.Standard.Base.App;
|
||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
|
using Sarand.Net.Standard.Base.Core;
|
||||||
|
using Sarand.Net.Standard.Base.Utils;
|
||||||
|
using Saxonite.Base.App;
|
||||||
|
using Saxonite.Net.Core.Web.Base.App;
|
||||||
|
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Core.Web.Online.Models
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
public class Model_Organisation_Opportunities : SaxModel_Online
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Construction.
|
||||||
|
public Model_Organisation_Opportunities(SaxLocaliser localiser) :
|
||||||
|
base(localiser)
|
||||||
|
{
|
||||||
|
//AdditionalFiles_CSS.Add("css/sax-org-opp.css");
|
||||||
|
AdditionalFiles_JS.Add("js/sax-org-opp.js");
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// List configuration.
|
||||||
|
public class OpportunityFilterData
|
||||||
|
{
|
||||||
|
public String OrganisationId { get; set; }
|
||||||
|
public String OrganisationCaption { get; set; }
|
||||||
|
public String Opportunity { get; set; }
|
||||||
|
}
|
||||||
|
public OpportunityFilterData Filter { get; } = new OpportunityFilterData();
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Opportunity properties.
|
||||||
|
public String OpportunityId { get; set; }
|
||||||
|
public String OpportunityExists { get; set; }
|
||||||
|
// Opportunity properties.
|
||||||
|
public String OpportunityOrganisationId { get; set; }
|
||||||
|
// Region.
|
||||||
|
public String OpportunityRegionId { get; set; }
|
||||||
|
// Sport.
|
||||||
|
public String OpportunitySportId { get; set; }
|
||||||
|
// Opportunity Content.
|
||||||
|
public String OpportunityTypeCode { get; set; }
|
||||||
|
public String OpportunityPosition { get; set; }
|
||||||
|
public String OpportunityOutline { get; set; }
|
||||||
|
public String OpportunityStatusCode { get; set; }
|
||||||
|
public SaStatus OpportunityStatus { get { return SacsSystem.GetStatusForCode(OpportunityStatusCode); } }
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Validation.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Opportunity.
|
||||||
|
public bool ValidateOpportunityData(SaxController_Base.AjaxResponse_Data responseData)
|
||||||
|
{
|
||||||
|
// Opportunity type.
|
||||||
|
if (OpportunityTypeCode != null)
|
||||||
|
{
|
||||||
|
if (StringUtil.IsEmpty(OpportunityTypeCode))
|
||||||
|
responseData.SetControlError(nameof(OpportunityTypeCode), Localiser["msg.validation.mandatory.value"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opportunity position.
|
||||||
|
if (OpportunityPosition != null)
|
||||||
|
{
|
||||||
|
responseData.SetControlValue(nameof(OpportunityPosition), OpportunityPosition);
|
||||||
|
if (StringUtil.IsEmpty(OpportunityPosition))
|
||||||
|
responseData.SetControlError(nameof(OpportunityPosition), Localiser["msg.validation.mandatory.value"]);
|
||||||
|
else if (StringUtil.GetLength(OpportunityPosition) > GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position))
|
||||||
|
responseData.SetControlError(nameof(OpportunityPosition), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opportunity outline.
|
||||||
|
if (OpportunityOutline != null)
|
||||||
|
{
|
||||||
|
responseData.SetControlValue(nameof(OpportunityOutline), OpportunityOutline);
|
||||||
|
if (StringUtil.IsEmpty(OpportunityOutline))
|
||||||
|
responseData.SetControlError(nameof(OpportunityOutline), Localiser["msg.validation.mandatory.value"]);
|
||||||
|
else if (StringUtil.GetLength(OpportunityOutline) > GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline))
|
||||||
|
responseData.SetControlError(nameof(OpportunityOutline), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opportunity region.
|
||||||
|
if (OpportunityRegionId != null)
|
||||||
|
{
|
||||||
|
SysId articleRegionId = OpportunityRegionId.ToSysId();
|
||||||
|
if (!SysId.IsValid(articleRegionId))
|
||||||
|
responseData.SetControlError(nameof(OpportunityRegionId), Localiser["msg.validation.mandatory.value"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opportunity sport.
|
||||||
|
if (OpportunitySportId != null)
|
||||||
|
{
|
||||||
|
SysId articleSportId = OpportunitySportId.ToSysId();
|
||||||
|
if (!SysId.IsValid(articleSportId))
|
||||||
|
responseData.SetControlError(nameof(OpportunitySportId), Localiser["msg.validation.mandatory.value"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opportunity status.
|
||||||
|
if (OpportunityStatusCode != null)
|
||||||
|
{
|
||||||
|
if (StringUtil.IsEmpty(OpportunityStatusCode))
|
||||||
|
responseData.SetControlError(nameof(OpportunityStatusCode), Localiser["msg.validation.mandatory.value"]);
|
||||||
|
else if (!SaxOrganisationOpportunity.ValidStatuses.Contains(OpportunityStatus))
|
||||||
|
responseData.SetControlError(nameof(OpportunityStatusCode), Localiser["msg.validation.invalid.value"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return !responseData.HasControlErrors();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -14,6 +14,11 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
public class SaxModel_Online : SaxModel_Base
|
public class SaxModel_Online : SaxModel_Base
|
||||||
{
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Data members.
|
||||||
|
private bool userCanManageOrganisationOpportunities = false;
|
||||||
|
private bool userCanManageOrganisationOpportunitiesChecked = false;
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Protected construction.
|
// Protected construction.
|
||||||
protected SaxModel_Online(SaxLocaliser localiser) :
|
protected SaxModel_Online(SaxLocaliser localiser) :
|
||||||
@@ -26,6 +31,23 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
|||||||
public SaxSessionData_Online SessionData_Online { get { return SessionData as SaxSessionData_Online; } }
|
public SaxSessionData_Online SessionData_Online { get { return SessionData as SaxSessionData_Online; } }
|
||||||
// Security profile.
|
// Security profile.
|
||||||
public bool UserIsJournalist { get { return SessionData != null && SessionData.User != null && SessionData.User.IsJournalist; } }
|
public bool UserIsJournalist { get { return SessionData != null && SessionData.User != null && SessionData.User.IsJournalist; } }
|
||||||
|
public bool UserCanManageOrganisationOpportunities
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!userCanManageOrganisationOpportunitiesChecked && ValidUserSession)
|
||||||
|
{
|
||||||
|
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||||
|
prmUserOrganisation.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||||
|
prmUserOrganisation.OrganisationMembersOnly = true;
|
||||||
|
prmUserOrganisation.OrganisationRoles.Add(Sax.OrganisationRole.OpportunityAdmin);
|
||||||
|
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
|
||||||
|
userCanManageOrganisationOpportunities = (AccountMgr.GetUserOrganisationCount(prmUserOrganisation) > 0);
|
||||||
|
userCanManageOrganisationOpportunitiesChecked = true;
|
||||||
|
}
|
||||||
|
return userCanManageOrganisationOpportunities;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Reference Data.
|
// Reference Data.
|
||||||
|
|||||||
@@ -15,11 +15,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sax-content">
|
<div class="sax-content">
|
||||||
|
|
||||||
<div class="sax-panel-results Organisations">
|
<div class="sax-panel-results Organisations">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sax-panel-item-template">
|
<div class="sax-panel-item-template">
|
||||||
|
|||||||
@@ -9,37 +9,71 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col"><div class="sax-caption">@Localiser["account.caption.profile.sports"]</div></div>
|
<div class="col"><div class="sax-caption">@Localiser["account.caption.profile.sports"]</div></div>
|
||||||
<div class="fixed">
|
<div class="fixed">
|
||||||
<div class="sax-action sax-edit"><img src="~/img/action/edit24.png" alt="@(Localiser["label.update"])" title="@(Localiser["label.update"])" /></div>
|
<div class="sax-action sax-add"><img src="~/img/action/add24.png" alt="@(Localiser["label.add"])" title="@(Localiser["label.add"])" /></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sax-content">
|
<div class="sax-content">
|
||||||
|
<div class="sax-panel-results ProfileSports">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="sax-panel-form">
|
<div class="sax-panel-item-template">
|
||||||
|
<div class="sax-panel-item ProfileSport">
|
||||||
<div class="sax-header">
|
<div class="sax-header row">
|
||||||
<div class="row">
|
<div class="col"><div class="SportName"></div></div>
|
||||||
<div class="col"><div class="sax-caption">@Localiser["account.caption.profile.sports"]</div></div>
|
<div class="fixed">
|
||||||
<div class="fixed">
|
<div class="sax-action sax-edit"><img src="~/img/action/edit24.png" alt="@(Localiser["label.update"])" title="@(Localiser["label.update"])" /></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sax-content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6"><div class=""></div></div>
|
||||||
|
<div class="col-sm-6"><div class=""></div></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sax-content">
|
</div>
|
||||||
|
|
||||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmProfileSports", @class = "sax-form", @onSubmit = "return false;" }))
|
@using (Html.BeginForm(FormMethod.Post, new { @id = "frmProfileSportId", @class = "sax-form", @onSubmit = "return false;" }))
|
||||||
{
|
{
|
||||||
|
@Html.HiddenFor(model => model.UserSportId, new { @id = "", @class = "UserSportId" })
|
||||||
|
}
|
||||||
|
|
||||||
|
<div id="dlgProfileSport" class="sax-dialog">
|
||||||
|
|
||||||
}
|
@using (Html.BeginForm(FormMethod.Post, new { @id = "frmProfileSport", @class = "sax-form", @onSubmit = "return false;" }))
|
||||||
|
{
|
||||||
|
<input type="hidden" class="UserSportId" name="UserSportId" />
|
||||||
|
<input type="hidden" class="ProfileSportExists" name="ProfileSportExists" />
|
||||||
|
|
||||||
</div>
|
@* Sport *@
|
||||||
|
<div class="sax-form-control ProfileSportId">
|
||||||
|
<div class="sax-label">
|
||||||
|
<label for="ifProfileSport"><span><span class="required">*</span> @Localiser["label.sport"]</span></label>
|
||||||
|
</div>
|
||||||
|
<div class="sax-control row">
|
||||||
|
<input type="hidden" id="ifProfileSportId" class="ProfileSportId" name="ProfileSportId" />
|
||||||
|
<div class="col"><input type="text" id="ifProfileSport" class="ProfileSport sax-input" name="ProfileSport" readonly="readonly" maxlength=128 /></div>
|
||||||
|
<div class="fixed"><button id="pbSelectSport" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectUserSport()">@Localiser["label.select"]</button></div>
|
||||||
|
</div>
|
||||||
|
<div class="sax-message"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
sax.dlg.title.addUserSport = '@Localiser.GetJavascriptText("account.caption.profile.sport.add")';
|
||||||
|
sax.dlg.title.updateUserSport = '@Localiser.GetJavascriptText("account.caption.profile.sport.update")';
|
||||||
|
sax.dlg.title.selectRegion = '@Localiser.GetJavascriptText("reference.caption.region.select")';
|
||||||
|
sax.dlg.title.selectSport = '@Localiser.GetJavascriptText("reference.caption.sport.select")';
|
||||||
|
</script>
|
||||||
|
<partial name="~/Views/Common/SelectRegion.cshtml" />
|
||||||
|
<partial name="~/Views/Common/SelectSport.cshtml" />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
@model SaxModel_Online
|
||||||
|
@inject SaxLocaliser Localiser
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="~/css/sax-selectOrganisation.css?@Model.HrefVersion" />
|
||||||
|
<script src="~/js/sax-selectOrganisation.js?@Model.HrefVersion"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
sax.selectOrganisation.dlgTitleSelectOrganisation = '@Localiser.GetJavascriptText("organisation.caption.select.organisation")';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="dlgSelectOrganisation" class="sax-dialog sax-form">
|
||||||
|
|
||||||
|
@* Filter *@
|
||||||
|
<div class="sax-panel-filter">
|
||||||
|
|
||||||
|
<div class="sax-content">
|
||||||
|
|
||||||
|
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmSelectOrganisationFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||||
|
{
|
||||||
|
<input type="hidden" class="FilterRegionId" name="Filter.RegionId" />
|
||||||
|
<input type="hidden" class="FilterSportId" name="Filter.SportId" />
|
||||||
|
<input type="hidden" class="FilterPageLength" name="DataPageLength" value="0" />
|
||||||
|
<input type="hidden" class="FilterPageNo" name="DataPageNo" value="0" />
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["label.search"]</div>
|
||||||
|
<div class="col-sm-7"><input type="search" id="" class="sax-input FilterOrganisation" name="Filter.Organisation" maxlength="32" /></div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="">
|
||||||
|
|
||||||
|
@* Organisations *@
|
||||||
|
<div class="sax-selection-results Organisations"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sax-panel-item-template">
|
||||||
|
<div class="sax-panel-item Organisation">
|
||||||
|
<div class="Name"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
@* Selected Region *@
|
@* Selected Region *@
|
||||||
<div class="SelectedRegion">
|
<div class="SelectedRegion">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12"><div class="sax-label">@Localiser["label.region.selected"]:</div></div>
|
<div class="col-12"><div class="sax-label">@Localiser["label.region.selected"]:</div></div>
|
||||||
<div class="col-sm-12"><div class="SelectedRegionName"></div></div>
|
<div class="col-12"><div class="SelectedRegionName"></div></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer2"></div>
|
<div class="spacer2"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<div class="RegionFilter sax-form">
|
<div class="RegionFilter sax-form">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col right"><div class="sax-label">@Localiser["label.search"]</div></div>
|
<div class="col right"><div class="sax-label">@Localiser["label.search"]</div></div>
|
||||||
<div class="fixed"><input id="ifRegionFilter" class="sax-input" type="text" onkeyup="sax.data.selectRegion.fn.displayRegions();" /></div>
|
<div class="fixed"><input id="ifRegionFilter" class="sax-input" type="search" onkeyup="sax.data.selectRegion.fn.displayRegions();" /></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer2"></div>
|
<div class="spacer2"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-sm-12 sax-selectRegion-regions AvailableRegions"></div>
|
<div class="col-12 sax-selectRegion-regions AvailableRegions"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
@* Selected Sport *@
|
@* Selected Sport *@
|
||||||
<div class="SelectedSport">
|
<div class="SelectedSport">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12"><div class="sax-label">@Localiser["label.sport.selected"]</div></div>
|
<div class="col-12"><div class="sax-label">@Localiser["label.sport.selected"]</div></div>
|
||||||
<div class="col-sm-12"><div class="SelectedSportName"></div></div>
|
<div class="col-12"><div class="SelectedSportName"></div></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer2"></div>
|
<div class="spacer2"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<div class="SportFilter sax-form">
|
<div class="SportFilter sax-form">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col right"><div class="sax-label">@Localiser["label.search"]</div></div>
|
<div class="col right"><div class="sax-label">@Localiser["label.search"]</div></div>
|
||||||
<div class="fixed"><input id="ifSportFilter" class="sax-input" type="text" onkeyup="sax.data.selectSport.fn.displaySports();" /></div>
|
<div class="fixed"><input id="ifSportFilter" class="sax-input" type="search" onkeyup="sax.data.selectSport.fn.displaySports();" /></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer2"></div>
|
<div class="spacer2"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-sm-12 sax-selectSport-sports AvailableSports"></div>
|
<div class="col-12 sax-selectSport-sports AvailableSports"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@model Model_Journalist
|
@model Model_Journalist
|
||||||
@inject SaxLocaliser Localiser
|
@inject SaxLocaliser Localiser
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Journalist";
|
ViewData["Title"] = "Journalist - Articles";
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="">
|
<div class="">
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
@model Model_Organisation_Opportunities
|
||||||
|
@inject SaxLocaliser Localiser
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Organisation - Opportunities";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div id="pnlOpportunities">
|
||||||
|
|
||||||
|
<div class="sax-panel-filter">
|
||||||
|
<div class="sax-header">
|
||||||
|
<div class="floatl sax-caption">@Localiser["organisation.caption.opportunities"]</div>
|
||||||
|
<div class="floatr sax-action sax-results-refresh"><img src="~/img/action/refresh24.png" alt="@(Localiser["label.refresh"])" title="@(Localiser["label.refresh"])" /></div>
|
||||||
|
<div class="floatr sax-action sax-item-create hidden"><img src="~/img/action/add24.png" alt="@(Localiser["label.create"])" title="@(Localiser["label.create"])" /></div>
|
||||||
|
<div class="clearb"></div>
|
||||||
|
</div>
|
||||||
|
<div class="sax-content">
|
||||||
|
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOpportunityFilter", @class = "sax-form", @action = "#", @method = "POST", onsubmit = "return false;" }))
|
||||||
|
{
|
||||||
|
<div class="sax-control row">
|
||||||
|
<div class="col-sm-4"><div class="sax-label text-left text-sm-right">@Localiser["label.organisation"]</div></div>
|
||||||
|
<div class="col-sm-8 row">
|
||||||
|
@Html.HiddenFor(model => model.Filter.OrganisationId, new { @id = "ifFilterOrganisationId", @class = "FilterOrganisationId" })
|
||||||
|
<div class="col"><input type="text" id="ifFilterOrganisation" class="FilterOrganisation sax-input" value="@(Model.Filter.OrganisationCaption)" /></div>
|
||||||
|
<div class="fixed"><button class="sax-button" onclick="sax.selectFilterOrganisation()">@Localiser["label.select"]</button></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sax-control row">
|
||||||
|
<div class="col-sm-4"><div class="sax-label text-left text-sm-right">@Localiser["label.opportunity"]</div></div>
|
||||||
|
<div class="col-sm-8">@Html.TextBoxFor(model => model.Filter.Opportunity, new { @id = "ifOpportunityFilter", @class = "OpportunityFilter sax-input", @maxlength = "64", @onkeypress = "sax.refreshResults(250)" })</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sax-panel-results">
|
||||||
|
<div class="sax-panel-messages"></div>
|
||||||
|
<div class="sax-panel-item-list"></div>
|
||||||
|
<div class="sax-panel-item-template">
|
||||||
|
<div class="sax-panel-item Opportunity">
|
||||||
|
<div class="sax-header">
|
||||||
|
<div class="floatl sax-caption"><span class="OpportunityType"></span> - <span class="OpportunityPosition"></span></div>
|
||||||
|
<div class="floatr sax-action sax-item-update hidden"><img src="~/img/action/edit24.png" alt="@(Localiser["label.update"])" title="@(Localiser["label.update"])" /></div>
|
||||||
|
<div class="clearb"></div>
|
||||||
|
</div>
|
||||||
|
<div class="sax-content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12"><div class="OpportunityOutline"></div></div>
|
||||||
|
<div class="col-sm-6"><div class="OpportunityRegionCaption"></div></div>
|
||||||
|
<div class="col-sm-6 right"><div class="OpportunitySportCaption"></div></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-4"><div class="">@Localiser["label.created"]: <span class="OpportunityCreatedOn"></span></div></div>
|
||||||
|
<div class="col-sm-4"><div class="OpportunityPublished">@Localiser["label.published"]: <span class="OpportunityPublishedOn"></span></div></div>
|
||||||
|
<div class="col-sm-4 right"><div class="OpportunityStatusDesc"></div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<partial name="Panel-OpportunityDialog.cshtml" />
|
||||||
|
<partial name="~/Views/Common/SelectOrganisation.cshtml" />
|
||||||
|
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
@model Model_Organisation_Opportunities
|
||||||
|
@inject SaxLocaliser Localiser
|
||||||
|
@{
|
||||||
|
/* Opportunities - Opportunity dialog panel */
|
||||||
|
}
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
sax.dlg.title.createOpportunity = '@Localiser.GetJavascriptText("organisation.caption.opportunity.create")';
|
||||||
|
sax.dlg.title.updateOpportunity = '@Localiser.GetJavascriptText("organisation.caption.opportunity.update")';
|
||||||
|
sax.dlg.title.selectRegion = '@Localiser.GetJavascriptText("reference.caption.region.select")';
|
||||||
|
sax.dlg.title.selectSport = '@Localiser.GetJavascriptText("reference.caption.sport.select")';
|
||||||
|
</script>
|
||||||
|
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOpportunityId", @class = "sax-form" }))
|
||||||
|
{
|
||||||
|
@Html.HiddenFor(model => model.OpportunityId, new { @class = "OpportunityId" })
|
||||||
|
}
|
||||||
|
<div id="dlgOpportunity" class="sax-dialog" title="">
|
||||||
|
|
||||||
|
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOpportunity", @class = "sax-form", @onSubmit = "return false;" }))
|
||||||
|
{
|
||||||
|
@Html.HiddenFor(model => model.OpportunityId, new { @id = "ifOpportunityId", @class = "OpportunityId" })
|
||||||
|
@Html.HiddenFor(model => model.OpportunityExists, new { @id = "ifOpportunityExists", @class = "OpportunityExists" })
|
||||||
|
<input type="hidden" id="ifOpportunityOrganisationId" class="OpportunityOrganisationId" name="OpportunityOrganisationId" value="@(Model.Filter.OrganisationId)" />
|
||||||
|
|
||||||
|
@* Opportunity type *@
|
||||||
|
<div class="sax-form-control OpportunityTypeCode">
|
||||||
|
<div class="sax-label">
|
||||||
|
<label for="ifOpportunityType"><span><span class="required">*</span> @Localiser["label.type"]</span></label>
|
||||||
|
</div>
|
||||||
|
<div class="sax-control">
|
||||||
|
<select id="cbOpportunityType" class="OpportunityType sax-select" name="OpportunityTypeCode"></select>
|
||||||
|
</div>
|
||||||
|
<div class="sax-message"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@* Opportunity position *@
|
||||||
|
<div class="sax-form-control OpportunityPosition">
|
||||||
|
<div class="sax-label">
|
||||||
|
<label for="ifOpportunityPosition"><span><span class="required">*</span> @Localiser["label.position"]</span></label>
|
||||||
|
</div>
|
||||||
|
<div class="sax-control">
|
||||||
|
@Html.TextBoxFor(model => model.OpportunityPosition, new { @id = "ifOpportunityPosition", @class = "OpportunityPosition sax-input", @maxlength = @Model.GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position) })
|
||||||
|
</div>
|
||||||
|
<div class="sax-message"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@* Opportunity outline *@
|
||||||
|
<div class="sax-form-control OpportunityOutline">
|
||||||
|
<div class="sax-label">
|
||||||
|
<label for="ifOpportunityOutline"><span><span class="required">*</span> @Localiser["label.outline"]</span></label>
|
||||||
|
</div>
|
||||||
|
<div class="sax-control">
|
||||||
|
@Html.TextAreaFor(model => model.OpportunityOutline, new { @id = "ifOpportunityOutline", @class = "OpportunityOutline sax-input", @maxlength = @Model.GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline) })
|
||||||
|
</div>
|
||||||
|
<div class="sax-message"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@* Region *@
|
||||||
|
<div class="sax-form-control OpportunityRegionId">
|
||||||
|
<div class="sax-label">
|
||||||
|
<label for="ifOpportunityRegionId"><span><span class="required">*</span> @Localiser["label.region"]</span></label>
|
||||||
|
</div>
|
||||||
|
<div class="sax-control row">
|
||||||
|
@Html.HiddenFor(model => model.OpportunityRegionId, new { @id = "ifOpportunityRegionId", @class = "OpportunityRegionId" })
|
||||||
|
<div class="col"><input type="text" id="ifOpportunityRegionCaption" class="OpportunityRegionCaption sax-input" readonly="readonly" ondblclick="sax.selectRegion()" /></div>
|
||||||
|
<div class="fixed"><button id="pbSelectRegion" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectRegion()">@Localiser["label.select"]</button></div>
|
||||||
|
</div>
|
||||||
|
<div class="sax-message"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@* Sport *@
|
||||||
|
<div class="sax-form-control OpportunitySportId">
|
||||||
|
<div class="sax-label">
|
||||||
|
<label for="ifOpportunitySportId"><span><span class="required">*</span> @Localiser["label.sport"]</span></label>
|
||||||
|
</div>
|
||||||
|
<div class="sax-control row">
|
||||||
|
@Html.HiddenFor(model => model.OpportunitySportId, new { @id = "ifOpportunitySportId", @class = "OpportunitySportId" })
|
||||||
|
<div class="col"><input type="text" id="ifOpportunitySportCaption" class="OpportunitySportCaption sax-input" readonly="readonly" ondblclick="sax.selectSport()" /></div>
|
||||||
|
<div class="fixed"><button id="pbSelectSport" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectSport()">@Localiser["label.select"]</button></div>
|
||||||
|
</div>
|
||||||
|
<div class="sax-message"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
<partial name="~/Views/Common/SelectRegion.cshtml" />
|
||||||
|
<partial name="~/Views/Common/SelectSport.cshtml" />
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -126,6 +126,10 @@
|
|||||||
{
|
{
|
||||||
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Journalist/Articles');">@Localiser["journalist.caption.articles"]</div>
|
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Journalist/Articles');">@Localiser["journalist.caption.articles"]</div>
|
||||||
}
|
}
|
||||||
|
@if (Model.UserCanManageOrganisationOpportunities)
|
||||||
|
{
|
||||||
|
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Organisation/Opportunities');">@Localiser["label.opportunities"]</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
|
|||||||
@@ -34,7 +34,8 @@
|
|||||||
|
|
||||||
.sax-profile > .sax-content
|
.sax-profile > .sax-content
|
||||||
{
|
{
|
||||||
padding: 6px 12px;
|
padding: 6px 6px;
|
||||||
|
background-color:#fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sax-profile .sax-panel-info,
|
.sax-profile .sax-panel-info,
|
||||||
@@ -58,4 +59,9 @@
|
|||||||
text-align:left;
|
text-align:left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sax-profile .sax-panel-item
|
||||||
|
{
|
||||||
|
border-width:1px;
|
||||||
|
}
|
||||||
|
|
||||||
/* The End */
|
/* The End */
|
||||||
|
|||||||
@@ -55,10 +55,14 @@
|
|||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sax-panel-filter > .sax-content .sax-control
|
||||||
|
{
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.sax-panel-filter > .sax-content .sax-label
|
.sax-panel-filter > .sax-content .sax-label
|
||||||
{
|
{
|
||||||
padding-top: 2px;
|
padding: 2px 12px 2px 0;
|
||||||
padding-right: 12px;
|
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +70,7 @@
|
|||||||
{
|
{
|
||||||
min-width: auto;
|
min-width: auto;
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
padding: 4px 6px;
|
padding: 4px 6px 2px 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Data Items panel */
|
/* Data Items panel */
|
||||||
@@ -102,12 +106,12 @@
|
|||||||
.sax-panel-item
|
.sax-panel-item
|
||||||
{
|
{
|
||||||
margin: 8px auto;
|
margin: 8px auto;
|
||||||
background-color:#f8f8f8;
|
background-color: #f8f8f8;
|
||||||
border: solid 2px #979797;
|
border: solid 2px #979797;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
-webkit-border-radius: 6px;
|
-webkit-border-radius: 6px;
|
||||||
-moz-border-radius: 6px;
|
-moz-border-radius: 6px;
|
||||||
overflow:hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sax-panel-item > .sax-header
|
.sax-panel-item > .sax-header
|
||||||
@@ -131,6 +135,14 @@
|
|||||||
padding: 4px 4px;
|
padding: 4px 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Profile Sports */
|
||||||
|
|
||||||
|
.sax-panel-item.ProfileSport,
|
||||||
|
.sax-panel-item.ProfileSport > .sax-header
|
||||||
|
{
|
||||||
|
border-color: var(--color-alt2);
|
||||||
|
}
|
||||||
|
|
||||||
/* Organisations */
|
/* Organisations */
|
||||||
|
|
||||||
.sax-panel-item.Organisation,
|
.sax-panel-item.Organisation,
|
||||||
|
|||||||
@@ -59,7 +59,8 @@
|
|||||||
.sax-panel-info > .sax-content,
|
.sax-panel-info > .sax-content,
|
||||||
.sax-panel-form > .sax-content
|
.sax-panel-form > .sax-content
|
||||||
{
|
{
|
||||||
padding: 24px 24px;
|
padding: 12px 12px;
|
||||||
|
background-color: #f8f8f8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sax-panel-section.sax-edit .sax-panel-info,
|
.sax-panel-section.sax-edit .sax-panel-info,
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
Admin - Code Selection stylesheet.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Panels */
|
||||||
|
|
||||||
|
#dlgSelectOrganisation .sax-panel-filter
|
||||||
|
{
|
||||||
|
border-width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dlgSelectOrganisation .sax-panel-filter .sax-content
|
||||||
|
{
|
||||||
|
margin:4px 8px;
|
||||||
|
padding:2px 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dlgSelectOrganisation .sax-selection-results.Organisations
|
||||||
|
{
|
||||||
|
padding:2px 0;
|
||||||
|
background-color:#f0f0f0;
|
||||||
|
border: 1px solid #b0b0b0;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dlgSelectOrganisation.sax-form button.sax-button
|
||||||
|
{
|
||||||
|
margin: 4px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sax-panel-item.Organisation
|
||||||
|
{
|
||||||
|
margin: 2px 4px;
|
||||||
|
padding: 2px 4px;
|
||||||
|
background-color:#fff;
|
||||||
|
border: 2px solid #d8d8ff;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sax-panel-item.Organisation.sel
|
||||||
|
{
|
||||||
|
background-color: #ececff;
|
||||||
|
border-color: #8a8aff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The End */
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#dlgSelectRegion .SelectedRegionName
|
#dlgSelectRegion .SelectedRegionName
|
||||||
{
|
{
|
||||||
min-height: 1rem;
|
min-height: 26px;
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
background-color: #f0f0f0;
|
background-color: #f0f0f0;
|
||||||
border: 1px solid #b0b0b0;
|
border: 1px solid #b0b0b0;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#dlgSelectSport .SelectedSportName
|
#dlgSelectSport .SelectedSportName
|
||||||
{
|
{
|
||||||
min-height: 1rem;
|
min-height: 26px;
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
background-color: #f0f0f0;
|
background-color: #f0f0f0;
|
||||||
border: 1px solid #b0b0b0;
|
border: 1px solid #b0b0b0;
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
sax.refreshProfile = function ()
|
sax.refreshProfile = function ()
|
||||||
{
|
{
|
||||||
setTimeout(sax.refreshProfileContactInfo, 50);
|
setTimeout(sax.refreshProfileContactInfo, 50);
|
||||||
setTimeout(sax.refreshSportsInfo, 50);
|
setTimeout(sax.refreshProfileSportsInfo, 50);
|
||||||
setTimeout(sax.refreshOrganisationsInfo, 50);
|
setTimeout(sax.refreshProfileOrganisationsInfo, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
@@ -67,20 +67,108 @@
|
|||||||
sax.onStoreProfileContact = function (response)
|
sax.onStoreProfileContact = function (response)
|
||||||
{
|
{
|
||||||
sax.refreshControlValues(response.controlValues);
|
sax.refreshControlValues(response.controlValues);
|
||||||
if (!response.success)
|
if (!response || !response.success)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
sax.refreshProfileContactInfo();
|
sax.refreshProfileContactInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
sax.refreshSportsInfo = function ()
|
sax.refreshProfileSportsInfo = function (delay)
|
||||||
{
|
{
|
||||||
|
var $section = $('.sax-panel-section.ProfileSports');
|
||||||
|
$section.removeClass('sax-edit').addClass('sax-populating');
|
||||||
|
$('.sax-property', $section).hide();
|
||||||
|
sax.showDataRefreshingMsg($section);
|
||||||
|
sax.refreshProfileSports(sax.onRefreshProfileSportsInfo);
|
||||||
|
}
|
||||||
|
sax.refreshProfileSports = function (callbackFn)
|
||||||
|
{
|
||||||
|
//sax.debug('refreshProfileSports');
|
||||||
|
delete sax.page.profileSportsChanged;
|
||||||
|
sax.ajaxProfileSports = sax.ajaxProfileSports || { url: sax.url.base + 'Account/Ajax/GetProfileSports', formId: 'frmNavigate', noWaitIcon: true };
|
||||||
|
sax.ajaxProfileSports.callbackFn = callbackFn;
|
||||||
|
sax.doAjaxRequest(sax.ajaxProfileSports, 50);
|
||||||
|
}
|
||||||
|
sax.onRefreshProfileSportsInfo = function (response)
|
||||||
|
{
|
||||||
|
sax.debug('onRefreshProfileSportsInfo', response);
|
||||||
|
if (!response || !response.success) return;
|
||||||
|
var $section = $('.sax-panel-section.ProfileSports');
|
||||||
|
$('.sax-message', $section).stop(true, false).fadeOut(200).empty();
|
||||||
|
|
||||||
|
let items = response.sports;
|
||||||
|
if (!items) return;
|
||||||
|
let $items = $('.sax-panel-results.ProfileSports', $section).empty();
|
||||||
|
let $tmpl = $('.sax-panel-item-template .sax-panel-item.ProfileSport', $section);
|
||||||
|
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||||
|
{
|
||||||
|
let item = items[itemIdx];
|
||||||
|
let $item = $tmpl.clone().prop('id', 'ProSpt_' + item.id);
|
||||||
|
$('.sax-header .sax-action.sax-edit', $item).on('click', function (evt) { sax.updateProfileSport(item.id); });
|
||||||
|
$('.SportName', $item).text(item.sportName);
|
||||||
|
$items.append($item);
|
||||||
|
}
|
||||||
|
$items.show();
|
||||||
|
sax.showNoInfoMsg($section);
|
||||||
|
$section.removeClass('sax-populating');
|
||||||
|
}
|
||||||
|
sax.addProfileSport = function ()
|
||||||
|
{
|
||||||
|
sax.debug('addProfileSport');
|
||||||
|
let $dlg = sax.$dlg.profileSport;
|
||||||
|
$('.UserSportId,.ProfileSportExists,#ifProfileSportId,#ifProfileSport', $dlg).val('');
|
||||||
|
$('#pbSelectSport', $dlg).show();
|
||||||
|
$dlg.dialog('option', 'title', sax.dlg.title.addUserSport);
|
||||||
|
sax.openDialog($dlg, 480, 400);
|
||||||
|
}
|
||||||
|
sax.updateProfileSport = function (id)
|
||||||
|
{
|
||||||
|
sax.debug('updateProfileSport', id);
|
||||||
|
$('#frmProfileSportId .UserSportId').val(id);
|
||||||
|
sax.ajaxProfileSport = sax.ajaxProfileSport || { url: sax.url.base + 'Account/Ajax/GetProfileSport', formId: 'frmProfileSportId', callbackFn: sax.doUpdateProfileSport };
|
||||||
|
sax.doAjaxRequest(sax.ajaxProfileSport, 50);
|
||||||
|
}
|
||||||
|
sax.doUpdateProfileSport = function (response)
|
||||||
|
{
|
||||||
|
sax.debug('doUpdateProfileSport', response);
|
||||||
|
let $dlg = sax.$dlg.profileSport;
|
||||||
|
let item = response.sport;
|
||||||
|
$('.UserSportId', $dlg).val(item.id);
|
||||||
|
$('.ProfileSportExists', $dlg).val(1);
|
||||||
|
$('#ifProfileSportId', $dlg).val(item.sportId);
|
||||||
|
$('#ifProfileSport', $dlg).val(item.sportName);
|
||||||
|
$('#pbSelectSport', $dlg).hide();
|
||||||
|
$dlg.dialog('option', 'title', sax.dlg.title.updateUserSport);
|
||||||
|
sax.openDialog($dlg, 480, 400);
|
||||||
|
}
|
||||||
|
sax.selectUserSport = function (sport)
|
||||||
|
{
|
||||||
|
sax.debug('selectUserSport');
|
||||||
|
sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#frmProfileSport #ifProfileSportId').val(), fnCallback: sax.onSelectUserSport })
|
||||||
|
}
|
||||||
|
sax.onSelectUserSport = function (sport)
|
||||||
|
{
|
||||||
|
sax.clearControlError($('#ifProfileSportId').val(sport ? sport.id : ''));
|
||||||
|
$('#ifProfileSport').val(sport ? sport.name : '');
|
||||||
|
}
|
||||||
|
sax.storeProfileSport = function ()
|
||||||
|
{
|
||||||
|
sax.debug('storeProfileSport');
|
||||||
|
sax.clearControlErrors();
|
||||||
|
sax.ajaxStoreProfileSport = sax.ajaxStoreProfileSport || { url: sax.url.base + 'Account/Ajax/StoreProfileSport', formId: 'frmProfileSport', callbackFn: sax.onStoreProfileSport };
|
||||||
|
sax.doAjaxRequest(sax.ajaxStoreProfileSport, 50);
|
||||||
|
}
|
||||||
|
sax.onStoreProfileSport = function (response)
|
||||||
|
{
|
||||||
|
sax.refreshControlValues(response.controlValues);
|
||||||
|
if (!response || !response.success)
|
||||||
|
return;
|
||||||
|
sax.$dlg.profileSport.dialog('close');
|
||||||
|
sax.refreshProfileSportsInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
sax.refreshOrganisationsInfo = function (delay)
|
sax.refreshProfileOrganisationsInfo = function (delay)
|
||||||
{
|
{
|
||||||
var $section = $('.sax-panel-section.ProfileOrganisations');
|
var $section = $('.sax-panel-section.ProfileOrganisations');
|
||||||
$section.removeClass('sax-edit').addClass('sax-populating');
|
$section.removeClass('sax-edit').addClass('sax-populating');
|
||||||
@@ -110,8 +198,7 @@
|
|||||||
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||||
{
|
{
|
||||||
let item = items[itemIdx];
|
let item = items[itemIdx];
|
||||||
let $item = $tmpl.clone();
|
let $item = $tmpl.clone().prop('id', 'ProOrg_' + item.id);
|
||||||
sax.debug(item, $item);
|
|
||||||
$('.OrganisationName', $item).text(item.name);
|
$('.OrganisationName', $item).text(item.name);
|
||||||
$items.append($item);
|
$items.append($item);
|
||||||
}
|
}
|
||||||
@@ -167,6 +254,12 @@
|
|||||||
$('.sax-panel-section.ProfileContact .sax-action.sax-edit').on('click', function (evt) { sax.refreshProfileContactForm(); });
|
$('.sax-panel-section.ProfileContact .sax-action.sax-edit').on('click', function (evt) { sax.refreshProfileContactForm(); });
|
||||||
$('input,textarea,select', '.sax-panel-section.ProfileContact').on('change', function () { sax.clearControlErrors(); sax.page.profileContactChanged = true; });
|
$('input,textarea,select', '.sax-panel-section.ProfileContact').on('change', function () { sax.clearControlErrors(); sax.page.profileContactChanged = true; });
|
||||||
|
|
||||||
|
$('.sax-panel-section.ProfileSports .sax-action.sax-add').on('click', function (evt) { sax.addProfileSport(); });
|
||||||
|
var opt = sax.dlgOpts();
|
||||||
|
opt.buttons[sax.dlg.btn.ok] = function () { sax.storeProfileSport(); };
|
||||||
|
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||||
|
sax.$dlg.profileSport = $('#dlgProfileSport').dialog(opt);
|
||||||
|
|
||||||
setTimeout(sax.refreshProfile, 200);
|
setTimeout(sax.refreshProfile, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -52,9 +52,10 @@
|
|||||||
$('.ArticleSportCaption', $item).text(item.sportCaptionPrimary);
|
$('.ArticleSportCaption', $item).text(item.sportCaptionPrimary);
|
||||||
$('.ArticleCreatedOn', $item).text(item.createdOnFmt);
|
$('.ArticleCreatedOn', $item).text(item.createdOnFmt);
|
||||||
$('.ArticlePublishedOn', $item).text(item.publishedOnFmt);
|
$('.ArticlePublishedOn', $item).text(item.publishedOnFmt);
|
||||||
$('.ArticlePublished', $item).toggle(item.publishedOnFmt);
|
$('.ArticlePublished', $item).toggle(!!item.publishedOnFmt);
|
||||||
$('.ArticleStatusDesc', $item).text(item.statusDesc);
|
$('.ArticleStatusDesc', $item).text(item.statusDesc);
|
||||||
$('.sax-action.sax-item-update', $item).off('click').on('click', function () { sax.updateItem(item.id) })
|
$('.sax-action.sax-item-update', $item).off('click').on('click', function () { sax.updateItem(item.id) })
|
||||||
|
$('.sax-panel-results .sax-panel-messages').hide().empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
@@ -38,6 +38,19 @@
|
|||||||
sax.debug = sax.debugMode ? window.console.log.bind(window.console) : function () { };
|
sax.debug = sax.debugMode ? window.console.log.bind(window.console) : function () { };
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
|
sax.setOddDataRowClass = function (rowSel, cName)
|
||||||
|
{
|
||||||
|
$(rowSel).addClass(function (index, currentClasses)
|
||||||
|
{
|
||||||
|
return index % 2 == 1 ? (cName || "other") : "";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
sax.populateSelectCodeDesc = function ($sel, values)
|
||||||
|
{
|
||||||
|
$sel = $($sel).empty();
|
||||||
|
for (const value of values)
|
||||||
|
$sel.append($('<option>').prop('value', value.code).text(value.desc));
|
||||||
|
}
|
||||||
sax.checkTextAreaMaxLength = function (ctrl, len)
|
sax.checkTextAreaMaxLength = function (ctrl, len)
|
||||||
{
|
{
|
||||||
if (ctrl == null || ctrl.value == null) return;
|
if (ctrl == null || ctrl.value == null) return;
|
||||||
@@ -58,13 +71,6 @@
|
|||||||
var sel = $(':selected', $sel).length;
|
var sel = $(':selected', $sel).length;
|
||||||
$('.sax-select-items-selected', $sel.closest('.sax-form-control')).text(sel == 0 ? sax.lbl.noneSelected : sax.lbl.numberSelected.replace(/\{0\}/g, sel));
|
$('.sax-select-items-selected', $sel.closest('.sax-form-control')).text(sel == 0 ? sax.lbl.noneSelected : sax.lbl.numberSelected.replace(/\{0\}/g, sel));
|
||||||
}
|
}
|
||||||
sax.setOddDataRowClass = function (rowSel, cName)
|
|
||||||
{
|
|
||||||
$(rowSel).addClass(function (index, currentClasses)
|
|
||||||
{
|
|
||||||
return index % 2 == 1 ? (cName || "other") : "";
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
// Page navigation.
|
// Page navigation.
|
||||||
|
|||||||
@@ -0,0 +1,227 @@
|
|||||||
|
/*
|
||||||
|
* Organisation - Opportunities page scripts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function (win, doc, undef)
|
||||||
|
{
|
||||||
|
"use strict";
|
||||||
|
sax.itemIdPrefix = 'Itm_';
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
sax.refreshResults = function (delay)
|
||||||
|
{
|
||||||
|
var $results = $('.sax-panel-results');
|
||||||
|
sax.data.userCanManageOpportunities = false;
|
||||||
|
if (!sax.awaitingRefreshResponse)
|
||||||
|
{
|
||||||
|
var $items = $('.sax-panel-item-list', $results).fadeOut(200).empty();
|
||||||
|
var $msgs = $('.sax-panel-messages', $results).hide().empty().append($('<div class="sax-message">' + sax.msg.dataQuerying + '</div>')).fadeIn(200);
|
||||||
|
}
|
||||||
|
sax.ajaxRefreshResults = sax.ajaxRefreshResults || { url: sax.url.base + 'Organisation/Ajax/GetOpportunityList', formId: 'frmOpportunityFilter', callbackFn: sax.doRefreshResults };
|
||||||
|
sax.doAjaxRequest(sax.ajaxRefreshResults, delay || 50);
|
||||||
|
sax.awaitingRefreshResponse = true;
|
||||||
|
}
|
||||||
|
sax.doRefreshResults = function (response)
|
||||||
|
{
|
||||||
|
sax.debug('doRefreshResults', response);
|
||||||
|
delete sax.awaitingRefreshResponse;
|
||||||
|
sax.refreshControlValues(response.controlValues);
|
||||||
|
var $panel = $('#pnlOpportunities');
|
||||||
|
$('.sax-action.sax-item-create', $panel).hide();
|
||||||
|
var $results = $('.sax-panel-results', $panel);
|
||||||
|
var $msgs = $('.sax-panel-messages', $results).hide().empty();
|
||||||
|
var $items = $('.sax-panel-item-list', $results).hide().empty();
|
||||||
|
var $templ = $('.sax-panel-item-template .sax-panel-item', $results);
|
||||||
|
if (!response.success) return;
|
||||||
|
// Reference data - Opportunity types.
|
||||||
|
if (response.opportunityTypes)
|
||||||
|
sax.populateSelectCodeDesc('#cbOpportunityType', response.opportunityTypes);
|
||||||
|
// Items.
|
||||||
|
sax.data.userCanManageOpportunities = (response.user && response.user.canManage);
|
||||||
|
$('#pnlOpportunities .sax-panel-filter .sax-action.sax-item-create').toggle(sax.data.userCanManageOpportunities);
|
||||||
|
var items = response.opportunities;
|
||||||
|
if (!items.length)
|
||||||
|
return $msgs.append($('<div class="sax-message">' + sax.msg.dataNoneFound + '</div>')).fadeIn(500);
|
||||||
|
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||||
|
{
|
||||||
|
let item = items[itemIdx];
|
||||||
|
let $item = $templ.clone();
|
||||||
|
sax.populateItem($item, item);
|
||||||
|
$items.append($item);
|
||||||
|
}
|
||||||
|
$('.sax-action.sax-item-update', $items).toggle(sax.data.userCanManageOpportunities);
|
||||||
|
$items.fadeIn(50);
|
||||||
|
}
|
||||||
|
sax.populateItem = function ($item, item)
|
||||||
|
{
|
||||||
|
if (!item) return;
|
||||||
|
$item.prop('id', sax.itemIdPrefix + item.id);
|
||||||
|
$('.OpportunityType', $item).text(item.typeDesc);
|
||||||
|
$('.OpportunityPosition', $item).text(item.position);
|
||||||
|
$('.OpportunityOutline', $item).text(item.outline);
|
||||||
|
$('.OpportunityRegionCaption', $item).text(item.regionCaption);
|
||||||
|
$('.OpportunitySportCaption', $item).text(item.sportCaption);
|
||||||
|
$('.OpportunityCreatedOn', $item).text(item.createdOnFmt);
|
||||||
|
$('.OpportunityPublishedOn', $item).text(item.publishedOnFmt);
|
||||||
|
$('.OpportunityPublished', $item).toggle(!!item.publishedOnFmt);
|
||||||
|
$('.OpportunityExpiresOn', $item).text(item.expiresOnFmt);
|
||||||
|
$('.OpportunityExpires', $item).toggle(!!item.expiresOnFmt);
|
||||||
|
$('.OpportunityStatusDesc', $item).text(item.statusDesc);
|
||||||
|
$('.sax-action.sax-item-update', $item).off('click').on('click', function () { sax.updateItem(item.id) });
|
||||||
|
$('.sax-panel-results .sax-panel-messages').hide().empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
sax.selectFilterOrganisation = function ()
|
||||||
|
{
|
||||||
|
if (!sax.data.memberOrganisations)
|
||||||
|
sax.getMemberOrganisations(sax.showSelectOrganisation);
|
||||||
|
else sax.showSelectOrganisation();
|
||||||
|
}
|
||||||
|
sax.getMemberOrganisations = function (fnCallback)
|
||||||
|
{
|
||||||
|
let handleMemberOrganisationsResponse = function (response)
|
||||||
|
{
|
||||||
|
sax.debug('handleUserOrgsResponse', response);
|
||||||
|
if (!response.success) return;
|
||||||
|
sax.data.memberOrganisations = response.organisations;
|
||||||
|
if (fnCallback) fnCallback();
|
||||||
|
}
|
||||||
|
sax.ajaxUserOrgs = sax.ajaxUserOrgs || { url: sax.url.base + 'Organisation/Ajax/GetMemberOrganisationList', formId: 'frmNavigate', callbackFn: handleMemberOrganisationsResponse };
|
||||||
|
sax.doAjaxRequest(sax.ajaxUserOrgs);
|
||||||
|
}
|
||||||
|
sax.showSelectOrganisation = function ()
|
||||||
|
{
|
||||||
|
//sax.debug('sax.selectFilterOrganisation');
|
||||||
|
sax.selectOrganisation.fn.selectOrganisation({ caption: sax.dlg.title.selectOrganisation, items: sax.data.memberOrganisations, fnCallback: sax.onOrganisationSelected });
|
||||||
|
}
|
||||||
|
sax.onOrganisationSelected = function (id, name)
|
||||||
|
{
|
||||||
|
//sax.debug('sax.onOrganisationSelected', id, name);
|
||||||
|
$('#frmOpportunityFilter #ifFilterOrganisationId, #frmOpportunity #ifOpportunityOrganisationId').val(id);
|
||||||
|
$('#frmOpportunityFilter #ifFilterOrganisation').val(name);
|
||||||
|
sax.refreshResults(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
sax.selectRegion = function ()
|
||||||
|
{
|
||||||
|
sax.data.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('#ifOpportunityRegionId').val(), fnCallback: sax.onSelectRegion })
|
||||||
|
}
|
||||||
|
sax.onSelectRegion = function (region)
|
||||||
|
{
|
||||||
|
sax.clearControlError($('#ifOpportunityRegionId').val(region.id));
|
||||||
|
$('#ifOpportunityRegionCaption').val(region ? region.name : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
sax.selectSport = function ()
|
||||||
|
{
|
||||||
|
sax.data.selectSport.fn.selectSport({ caption: sax.dlg.title.selectSport, sportId: $('#ifOpportunitySportId').val(), fnCallback: sax.onSelectSport })
|
||||||
|
}
|
||||||
|
sax.onSelectSport = function (sport)
|
||||||
|
{
|
||||||
|
sax.clearControlError($('#ifOpportunitySportId').val(sport.id));
|
||||||
|
$('#ifOpportunitySportCaption').val(sport ? sport.name : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
sax.createItem = function ()
|
||||||
|
{
|
||||||
|
if (!sax.data.userCanManageOpportunities) return;
|
||||||
|
sax.clearItem();
|
||||||
|
sax.$dlg.opportunity.dialog('option', 'title', sax.dlg.title.createOpportunity);
|
||||||
|
sax.openDialog(sax.$dlg.opportunity, 600, 600);
|
||||||
|
}
|
||||||
|
sax.clearItem = function ()
|
||||||
|
{
|
||||||
|
$('#ifOpportunityId,#ifOpportunityExists,#ifOpportunityRegionId,#ifOpportunitySportId,input[type="text"],textarea,select', sax.$frm.opportunity).val('');
|
||||||
|
sax.clearControlErrors();
|
||||||
|
}
|
||||||
|
sax.doCreateItem = function ()
|
||||||
|
{
|
||||||
|
sax.storeItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
sax.updateItem = function (id)
|
||||||
|
{
|
||||||
|
if (!sax.data.userCanManageOpportunities) return;
|
||||||
|
$('.OpportunityId', sax.$frm.opportunityId).val(id);
|
||||||
|
sax.ajaxUpdateItem = sax.ajaxUpdateItem || { url: sax.url.base + 'Organisation/Ajax/GetOpportunity', formId: 'frmOpportunityId', callbackFn: sax.onUpdateItem };
|
||||||
|
sax.doAjaxRequest(sax.ajaxUpdateItem, 50);
|
||||||
|
}
|
||||||
|
sax.onUpdateItem = function (response)
|
||||||
|
{
|
||||||
|
//sax.debug('onUpdateItem', response);
|
||||||
|
sax.clearItem();
|
||||||
|
if (!response.success) return;
|
||||||
|
let $frm = sax.$frm.opportunity;
|
||||||
|
let item = response.opportunity;
|
||||||
|
$('#ifOpportunityId', $frm).val(item.id);
|
||||||
|
$('#ifOpportunityExists', $frm).val(1);
|
||||||
|
$('#cbOpportunityType', $frm).val(item.typeCode);
|
||||||
|
$('#ifOpportunityPosition', $frm).val(item.position);
|
||||||
|
$('#ifOpportunityOutline', $frm).val(item.outline);
|
||||||
|
$('#ifOpportunityRegionId', $frm).val(item.regionIdPrimary);
|
||||||
|
$('#ifOpportunityRegionCaption', $frm).val(item.regionCaption);
|
||||||
|
$('#ifOpportunitySportId', $frm).val(item.sportIdPrimary);
|
||||||
|
$('#ifOpportunitySportCaption', $frm).val(item.sportCaption);
|
||||||
|
$('#cbOpportunityStatusCode', $frm).val(item.statusCode);
|
||||||
|
sax.clearControlErrors();
|
||||||
|
sax.$dlg.opportunity.dialog('option', 'title', sax.dlg.title.updateOpportunity);
|
||||||
|
sax.openDialog(sax.$dlg.opportunity, 600, 600);
|
||||||
|
}
|
||||||
|
sax.doUpdateItem = function ()
|
||||||
|
{
|
||||||
|
sax.storeItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
sax.storeItem = function ()
|
||||||
|
{
|
||||||
|
sax.ajaxStoreItem = sax.ajaxStoreItem || { url: sax.url.base + 'Organisation/Ajax/StoreOpportunity', formId: 'frmOpportunity', callbackFn: sax.onStoreItem };
|
||||||
|
sax.doAjaxRequest(sax.ajaxStoreItem, 50);
|
||||||
|
}
|
||||||
|
sax.onStoreItem = function (response)
|
||||||
|
{
|
||||||
|
//sax.debug('onStoreItem', response);
|
||||||
|
sax.refreshControlValues(response.controlValues);
|
||||||
|
if (!response.success) return;
|
||||||
|
sax.$dlg.opportunity.dialog('close');
|
||||||
|
|
||||||
|
var item = response.opportunity;
|
||||||
|
var $item = $('#' + sax.itemIdPrefix + item.id);
|
||||||
|
if (!$item.length)
|
||||||
|
{
|
||||||
|
var $results = $('.sax-panel-results');
|
||||||
|
$item = $('.sax-panel-item-template .sax-panel-item', $results).clone();
|
||||||
|
$('.sax-panel-item-list', $results).prepend($item).show();
|
||||||
|
}
|
||||||
|
sax.populateItem($item, item)
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
$(function ()
|
||||||
|
{
|
||||||
|
$('.sax-action.sax-item-create').on('click', function () { sax.createItem(); });
|
||||||
|
$('.sax-action.sax-results-refresh').on('click', function () { sax.refreshResults(); });
|
||||||
|
$('.OpportunityFilter', '#frmOpportunityFilter').keypress(function (event)
|
||||||
|
{
|
||||||
|
if (event.keyCode == 13) setTimeout(sax.refreshResults, 50);
|
||||||
|
});
|
||||||
|
sax.$frm.opportunityId = $('#frmOpportunityId');
|
||||||
|
sax.$frm.opportunity = $('#frmOpportunity');
|
||||||
|
$('.sax-input', sax.$frm.opportunity).on('input', function () { sax.clearControlError(this); });
|
||||||
|
|
||||||
|
var opt = sax.dlgOpts();
|
||||||
|
opt.buttons[sax.dlg.btn.ok] = function () { sax.doCreateItem(); };
|
||||||
|
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||||
|
sax.$dlg.opportunity = $('#dlgOpportunity').dialog(opt);
|
||||||
|
|
||||||
|
setTimeout(sax.refreshResults, 250);
|
||||||
|
});
|
||||||
|
|
||||||
|
}(window, window.document));
|
||||||
|
|
||||||
|
/* The End */
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
/*
|
||||||
|
* Admin - User page scripts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function (win, doc, undef)
|
||||||
|
{
|
||||||
|
"use strict";
|
||||||
|
let so = sax.selectOrganisation = sax.selectOrganisation || { data: {}, fn: {}, $dlg: {}, itemIdPrefix: 'Org_' };
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
* Organisation selection config:
|
||||||
|
* - caption dialog title.
|
||||||
|
* - items restricted list of organisations.
|
||||||
|
* - width preferred dialog width (default: 400).
|
||||||
|
* - height preferred dialog height (default: 400).
|
||||||
|
* - fnCallback method to call on completion.
|
||||||
|
*/
|
||||||
|
so.fn.selectOrganisation = function (cfg)
|
||||||
|
{
|
||||||
|
//sax.debug('openDialog', cfg);
|
||||||
|
so.fn.init();
|
||||||
|
so.cfg = cfg;
|
||||||
|
sax.openDialog(so.$dlg.dialog('option', { title: cfg.caption || so.dlgTitleSelectOrganisation || 'Select Organisation' }), so.cfg.width || 480, so.cfg.height || 600);
|
||||||
|
}
|
||||||
|
so.fn.refreshResults = function (delay)
|
||||||
|
{
|
||||||
|
//sax.debug('refreshResults');
|
||||||
|
if (so.cfg && so.cfg.items && so.cfg.items.length)
|
||||||
|
{
|
||||||
|
so.fn.displayResults(so.cfg.items);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
so.$results.empty();
|
||||||
|
so.ajaxSearch = so.ajaxSearch || { url: sax.url.base + 'Organisation/Ajax/GetOrganisationList', formId: 'frmSelectOrganisationFilter', callbackFn: so.fn.doRefreshResults };
|
||||||
|
sax.doAjaxRequest(so.ajaxSearch, delay || 50);
|
||||||
|
}
|
||||||
|
so.fn.doRefreshResults = function (response)
|
||||||
|
{
|
||||||
|
//sax.debug('so.doRefreshResults', response);
|
||||||
|
if (!response.success) return;
|
||||||
|
so.fn.displayResults(response.organisations);
|
||||||
|
}
|
||||||
|
so.fn.displayResults = function (items)
|
||||||
|
{
|
||||||
|
so.$results.empty().hide();
|
||||||
|
let $tmpl = $('.sax-panel-item-template .sax-panel-item.Organisation', so.$dlg);
|
||||||
|
if (items)
|
||||||
|
{
|
||||||
|
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
|
||||||
|
{
|
||||||
|
let item = items[itemIdx];
|
||||||
|
if (!so.fn.matchesFilter(item)) continue;
|
||||||
|
let $item = $tmpl.clone().prop('id', so.itemIdPrefix + item.id).on('click', function () { so.fn.onClickOrganisation(item); }).on('dblclick', function () { so.fn.onDblClickOrganisation(item); });
|
||||||
|
$('.Name', $item).text(item.name);
|
||||||
|
so.$results.append($item);
|
||||||
|
}
|
||||||
|
so.$results.fadeIn(200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
so.fn.matchesFilter = function (item)
|
||||||
|
{
|
||||||
|
let filterName = $('.sax-input.FilterOrganisation', so.$filter).val();
|
||||||
|
if (filterName.length)
|
||||||
|
{
|
||||||
|
let reFilterName = new RegExp(sax.escapeRegExp((filterName || '').trim()), 'i');
|
||||||
|
if (!item.name.match(reFilterName)) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
so.fn.onClickOrganisation = function (item)
|
||||||
|
{
|
||||||
|
//sax.debug('onClickOrganisation', item);
|
||||||
|
so.data.item = item;
|
||||||
|
$('.sax-panel-item.Organisation', so.$dlg).removeClass('sel');
|
||||||
|
$('.sax-panel-item.Organisation#' + so.itemIdPrefix + item.id, so.$dlg).addClass('sel');
|
||||||
|
}
|
||||||
|
so.fn.onDblClickOrganisation = function (item)
|
||||||
|
{
|
||||||
|
//sax.debug('onDblClickCode', item);
|
||||||
|
so.data.item = item;
|
||||||
|
so.fn.confirmSelection();
|
||||||
|
}
|
||||||
|
so.fn.confirmSelection = function ()
|
||||||
|
{
|
||||||
|
//sax.debug('confirmSelection', so.data.item);
|
||||||
|
if (!so.data.item) return;
|
||||||
|
if (so.cfg.fnCallback) so.cfg.fnCallback(so.data.item.id, so.data.item.name);
|
||||||
|
so.$dlg.dialog('close');
|
||||||
|
so.fn.cleanUp();
|
||||||
|
}
|
||||||
|
so.fn.cleanUp = function ()
|
||||||
|
{
|
||||||
|
//sax.debug('confirmSelection', so.data.item);
|
||||||
|
so.$results.empty();
|
||||||
|
delete so.cfg;
|
||||||
|
delete so.data.item;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
so.fn.init = function ()
|
||||||
|
{
|
||||||
|
if (!so.$dlg) return;
|
||||||
|
var opt = sax.dlgOpts();
|
||||||
|
opt.open = function () { so.fn.refreshResults(200); };
|
||||||
|
opt.buttons[sax.dlg.btn.ok] = function () { so.fn.confirmSelection(); };
|
||||||
|
opt.buttons[sax.dlg.btn.cancel] = function () { so.fn.cleanUp(); $(this).dialog('close'); };
|
||||||
|
so.$dlg = $('#dlgSelectOrganisation').dialog(opt);
|
||||||
|
|
||||||
|
so.$results = $('.sax-selection-results.Organisations', so.$dlg);
|
||||||
|
so.$filter = $('.sax-panel-filter', so.$dlg);
|
||||||
|
$('.sax-input.FilterOrganisation', so.$filter).on('input', function () { sax.selectOrganisation.fn.refreshResults(250); });
|
||||||
|
}
|
||||||
|
|
||||||
|
}(window, window.document));
|
||||||
|
|
||||||
|
/* The End */
|
||||||
@@ -37,11 +37,11 @@
|
|||||||
$('.SelectedRegionName', sr.$dlg).text(sr.fn.getRegionName(sr.regionId));
|
$('.SelectedRegionName', sr.$dlg).text(sr.fn.getRegionName(sr.regionId));
|
||||||
$('#ifRegionFilter', sr.$dlg).val('');
|
$('#ifRegionFilter', sr.$dlg).val('');
|
||||||
sr.fn.displayRegions();
|
sr.fn.displayRegions();
|
||||||
sax.openDialog(sr.$dlg.dialog('option', { title: sr.cfg.caption || 'Select Region' }), 400, 600);
|
sax.openDialog(sr.$dlg.dialog('option', { title: sr.cfg.caption || 'Select Region' }), sr.cfg.width || 400, sr.cfg.height || 800);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
sr.fn.compareRegions=function(a, b)
|
sr.fn.compareRegions = function (a, b)
|
||||||
{
|
{
|
||||||
var comparison = a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
var comparison = a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
||||||
if (comparison === 0)
|
if (comparison === 0)
|
||||||
@@ -54,8 +54,8 @@
|
|||||||
{
|
{
|
||||||
let filter = $('#ifRegionFilter', sr.$dlg).val();
|
let filter = $('#ifRegionFilter', sr.$dlg).val();
|
||||||
let reFilter = new RegExp(sax.escapeRegExp((filter || '').trim()), 'i');
|
let reFilter = new RegExp(sax.escapeRegExp((filter || '').trim()), 'i');
|
||||||
let $regionsAvail = $('.sax-selectRegion-regions.AvailableRegions').empty();
|
let $regionsAvail = $('.sax-selectRegion-regions.AvailableRegions', sr.$dlg).empty();
|
||||||
let $regionTmpl = $('.sax-panel-item-template .sax-panel-item.Region');
|
let $regionTmpl = $('.sax-panel-item-template .sax-panel-item.Region', sr.$dlg);
|
||||||
let regions = [...sr.regions];
|
let regions = [...sr.regions];
|
||||||
regions.sort(sr.fn.compareRegions);
|
regions.sort(sr.fn.compareRegions);
|
||||||
for (let rgnIdx = 0; rgnIdx < regions.length; rgnIdx++)
|
for (let rgnIdx = 0; rgnIdx < regions.length; rgnIdx++)
|
||||||
@@ -87,8 +87,8 @@
|
|||||||
sr.fn.onClickRegion = function (id)
|
sr.fn.onClickRegion = function (id)
|
||||||
{
|
{
|
||||||
$('.SelectedRegionName', sr.$dlg).text(sr.fn.getRegionName(sr.regionId = id));
|
$('.SelectedRegionName', sr.$dlg).text(sr.fn.getRegionName(sr.regionId = id));
|
||||||
$('.sax-panel-item.Region').removeClass('sel');
|
$('.sax-panel-item.Region', sr.$dlg).removeClass('sel');
|
||||||
$('.sax-panel-item.Region#' + sr.itemIdPrefix + id).addClass('sel');
|
$('.sax-panel-item.Region#' + sr.itemIdPrefix + id, sr.$dlg).addClass('sel');
|
||||||
}
|
}
|
||||||
sr.fn.onDblClickRegion = function (id)
|
sr.fn.onDblClickRegion = function (id)
|
||||||
{
|
{
|
||||||
@@ -100,10 +100,12 @@
|
|||||||
if (!sr.regionId) return;
|
if (!sr.regionId) return;
|
||||||
let region = sr.fn.getRegion(sr.regionId);
|
let region = sr.fn.getRegion(sr.regionId);
|
||||||
if (!region) return;
|
if (!region) return;
|
||||||
|
|
||||||
if (sr.cfg.fnCallback) sr.cfg.fnCallback(region);
|
if (sr.cfg.fnCallback) sr.cfg.fnCallback(region);
|
||||||
|
|
||||||
sr.$dlg.dialog('close');
|
sr.$dlg.dialog('close');
|
||||||
|
sr.fn.cleanUp();
|
||||||
|
}
|
||||||
|
sr.fn.cleanUp = function ()
|
||||||
|
{
|
||||||
delete sr.cfg;
|
delete sr.cfg;
|
||||||
delete sr.regionId;
|
delete sr.regionId;
|
||||||
}
|
}
|
||||||
@@ -111,7 +113,7 @@
|
|||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
sr.fn.onDlgSize = function ()
|
sr.fn.onDlgSize = function ()
|
||||||
{
|
{
|
||||||
let $pnl = $('.sax-selectRegion-regions.AvailableRegions');
|
let $pnl = $('.sax-selectRegion-regions.AvailableRegions', sr.$dlg);
|
||||||
$pnl.outerHeight(Math.floor(sr.$dlg.innerHeight() - $pnl.position().top - ($pnl.outerHeight(true) - $pnl.innerHeight())));
|
$pnl.outerHeight(Math.floor(sr.$dlg.innerHeight() - $pnl.position().top - ($pnl.outerHeight(true) - $pnl.innerHeight())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +125,7 @@
|
|||||||
opt.open = function (evt, ui) { sr.fn.onDlgSize(); };
|
opt.open = function (evt, ui) { sr.fn.onDlgSize(); };
|
||||||
opt.resize = function (evt, ui) { sr.fn.onDlgSize(); };
|
opt.resize = function (evt, ui) { sr.fn.onDlgSize(); };
|
||||||
opt.buttons[sax.dlg.btn.ok] = function () { sr.fn.storeSelectRegion(); };
|
opt.buttons[sax.dlg.btn.ok] = function () { sr.fn.storeSelectRegion(); };
|
||||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
opt.buttons[sax.dlg.btn.cancel] = function () { sr.fn.cleanUp(); $(this).dialog('close'); };
|
||||||
sr.$dlg = $('#dlgSelectRegion').dialog(opt);
|
sr.$dlg = $('#dlgSelectRegion').dialog(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,14 +34,14 @@
|
|||||||
}
|
}
|
||||||
ss.fn.showSelectSport = function ()
|
ss.fn.showSelectSport = function ()
|
||||||
{
|
{
|
||||||
$('.SelectedSportName', ss.$dlg).text(ss.fn.getSportName(ss.sportId));
|
$('.SelectedSportName', ss.$dlg).text(ss.fn.getSportName(ss.sportId) || ' ');
|
||||||
$('#ifSportFilter', ss.$dlg).val('');
|
$('#ifSportFilter', ss.$dlg).val('');
|
||||||
ss.fn.displaySports();
|
ss.fn.displaySports();
|
||||||
sax.openDialog(ss.$dlg.dialog('option', { title: ss.cfg.caption || 'Select Sport' }), 400, 600);
|
sax.openDialog(ss.$dlg.dialog('option', { title: ss.cfg.caption || 'Select Sport' }), ss.cfg.width || 400, ss.cfg.height || 800);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
ss.fn.compareSports= function (a, b)
|
ss.fn.compareSports = function (a, b)
|
||||||
{
|
{
|
||||||
var comparison = a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
var comparison = a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
||||||
if (comparison === 0)
|
if (comparison === 0)
|
||||||
@@ -54,8 +54,8 @@
|
|||||||
{
|
{
|
||||||
let filter = $('#ifSportFilter', ss.$dlg).val();
|
let filter = $('#ifSportFilter', ss.$dlg).val();
|
||||||
let reFilter = new RegExp(sax.escapeRegExp((filter || '').trim()), 'i');
|
let reFilter = new RegExp(sax.escapeRegExp((filter || '').trim()), 'i');
|
||||||
let $sportsAvail = $('.sax-selectSport-sports.AvailableSports').empty();
|
let $sportsAvail = $('.sax-selectSport-sports.AvailableSports', ss.$dlg).empty();
|
||||||
let $sportTmpl = $('.sax-panel-item-template .sax-panel-item.Sport');
|
let $sportTmpl = $('.sax-panel-item-template .sax-panel-item.Sport', ss.$dlg);
|
||||||
let sports = [...ss.sports];
|
let sports = [...ss.sports];
|
||||||
sports.sort(ss.fn.compareSports);
|
sports.sort(ss.fn.compareSports);
|
||||||
for (let rgnIdx = 0; rgnIdx < sports.length; rgnIdx++)
|
for (let rgnIdx = 0; rgnIdx < sports.length; rgnIdx++)
|
||||||
@@ -86,9 +86,9 @@
|
|||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
ss.fn.onClickSport = function (id)
|
ss.fn.onClickSport = function (id)
|
||||||
{
|
{
|
||||||
$('.SelectedSportName', ss.$dlg).text(ss.fn.getSportName(ss.sportId = id));
|
$('.SelectedSportName', ss.$dlg).text(ss.fn.getSportName(ss.sportId = id) || ' ');
|
||||||
$('.sax-panel-item.Sport').removeClass('sel');
|
$('.sax-panel-item.Sport', ss.$dlg).removeClass('sel');
|
||||||
$('.sax-panel-item.Sport#' + ss.itemIdPrefix + id).addClass('sel');
|
$('.sax-panel-item.Sport#' + ss.itemIdPrefix + id, ss.$dlg).addClass('sel');
|
||||||
}
|
}
|
||||||
ss.fn.onDblClickSport = function (id)
|
ss.fn.onDblClickSport = function (id)
|
||||||
{
|
{
|
||||||
@@ -100,10 +100,12 @@
|
|||||||
if (!ss.sportId) return;
|
if (!ss.sportId) return;
|
||||||
let sport = ss.fn.getSport(ss.sportId);
|
let sport = ss.fn.getSport(ss.sportId);
|
||||||
if (!sport) return;
|
if (!sport) return;
|
||||||
|
|
||||||
if (ss.cfg.fnCallback) ss.cfg.fnCallback(sport);
|
if (ss.cfg.fnCallback) ss.cfg.fnCallback(sport);
|
||||||
|
|
||||||
ss.$dlg.dialog('close');
|
ss.$dlg.dialog('close');
|
||||||
|
ss.fn.cleanUp();
|
||||||
|
}
|
||||||
|
ss.fn.cleanUp = function ()
|
||||||
|
{
|
||||||
delete ss.cfg;
|
delete ss.cfg;
|
||||||
delete ss.sportId;
|
delete ss.sportId;
|
||||||
}
|
}
|
||||||
@@ -111,7 +113,7 @@
|
|||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
ss.fn.onDlgSize = function ()
|
ss.fn.onDlgSize = function ()
|
||||||
{
|
{
|
||||||
let $pnl = $('.sax-selectSport-sports.AvailableSports');
|
let $pnl = $('.sax-selectSport-sports.AvailableSports', ss.$dlg);
|
||||||
$pnl.outerHeight(Math.floor(ss.$dlg.innerHeight() - $pnl.position().top - ($pnl.outerHeight(true) - $pnl.innerHeight())));
|
$pnl.outerHeight(Math.floor(ss.$dlg.innerHeight() - $pnl.position().top - ($pnl.outerHeight(true) - $pnl.innerHeight())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +125,7 @@
|
|||||||
opt.open = function (evt, ui) { ss.fn.onDlgSize(); };
|
opt.open = function (evt, ui) { ss.fn.onDlgSize(); };
|
||||||
opt.resize = function (evt, ui) { ss.fn.onDlgSize(); };
|
opt.resize = function (evt, ui) { ss.fn.onDlgSize(); };
|
||||||
opt.buttons[sax.dlg.btn.ok] = function () { ss.fn.storeSelectSport(); };
|
opt.buttons[sax.dlg.btn.ok] = function () { ss.fn.storeSelectSport(); };
|
||||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
opt.buttons[sax.dlg.btn.cancel] = function () { ss.fn.cleanUp(); $(this).dialog('close'); };
|
||||||
ss.$dlg = $('#dlgSelectSport').dialog(opt);
|
ss.$dlg = $('#dlgSelectSport').dialog(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,10 @@ namespace Saxonite.Net.Standard.Base.App
|
|||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Version history.
|
// Version history.
|
||||||
// 1.0.4 ?-May-2021 Online Profile Organisation
|
// 1.0.4 20-May-2021 Online profile sports & opportunities
|
||||||
// - Admin Organisation Region & Sport.
|
// - Admin Organisation Region & Sport.
|
||||||
|
// - Online Profile Sports - simple list with name.
|
||||||
|
// - Online Organisation Opportunities.
|
||||||
// 1.0.3 11-May-2021 Admin Organisation Members
|
// 1.0.3 11-May-2021 Admin Organisation Members
|
||||||
// - Admin data filters & styling, organisation members.
|
// - Admin data filters & styling, organisation members.
|
||||||
// - Online Profile Organisations - simple list with name.
|
// - Online Profile Organisations - simple list with name.
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ namespace Saxonite.Net.Standard.Base.App
|
|||||||
OrganisationType,
|
OrganisationType,
|
||||||
OrganisationCategory,
|
OrganisationCategory,
|
||||||
OrganisationRole,
|
OrganisationRole,
|
||||||
|
OpportunityType,
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@@ -124,6 +125,7 @@ namespace Saxonite.Net.Standard.Base.App
|
|||||||
UserAccount = 100,
|
UserAccount = 100,
|
||||||
UserRole = 101,
|
UserRole = 101,
|
||||||
UserOrganisation = 102,
|
UserOrganisation = 102,
|
||||||
|
UserSport = 103,
|
||||||
Organisation = 120,
|
Organisation = 120,
|
||||||
// Activty data.
|
// Activty data.
|
||||||
ScheduledEvent = 200,
|
ScheduledEvent = 200,
|
||||||
@@ -160,6 +162,18 @@ namespace Saxonite.Net.Standard.Base.App
|
|||||||
SystemAdmin,
|
SystemAdmin,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
/// <summary>Sport Participation</summary>
|
||||||
|
public enum SportParticipation
|
||||||
|
{
|
||||||
|
Unknown = 0,
|
||||||
|
/* Do not change the values/codes - tied to database. */
|
||||||
|
Regular,
|
||||||
|
Occasional,
|
||||||
|
Spectator,
|
||||||
|
Interested
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
/// <summary>Yes or No option.</summary>
|
/// <summary>Yes or No option.</summary>
|
||||||
public enum YesNo
|
public enum YesNo
|
||||||
@@ -226,6 +240,20 @@ namespace Saxonite.Net.Standard.Base.App
|
|||||||
OpportunityAdmin,
|
OpportunityAdmin,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
/// <summary>Opportunity Type</summary>
|
||||||
|
public enum OpportunityType
|
||||||
|
{
|
||||||
|
Unknown = 0,
|
||||||
|
/* Do not change the values or codes - tied to database. */
|
||||||
|
Playing,
|
||||||
|
Official,
|
||||||
|
Coaching,
|
||||||
|
Volunteer,
|
||||||
|
Staff,
|
||||||
|
Board,
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Code generated by Sarand Database Utilities Mon 10-May-2021 16:59:32
|
// Code generated by Sarand Database Utilities Thu 20-May-2021 17:19:55
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
namespace Saxonite.Base.App
|
namespace Saxonite.Base.App
|
||||||
{
|
{
|
||||||
@@ -26,6 +26,7 @@ namespace Saxonite.Base.App
|
|||||||
UserAccount,
|
UserAccount,
|
||||||
UserOrganisation,
|
UserOrganisation,
|
||||||
UserRole,
|
UserRole,
|
||||||
|
UserSport,
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@@ -86,6 +87,7 @@ namespace Saxonite.Base.App
|
|||||||
OrganisationOpportunity_OrganisationId,
|
OrganisationOpportunity_OrganisationId,
|
||||||
OrganisationOpportunity_RegionIdPrimary,
|
OrganisationOpportunity_RegionIdPrimary,
|
||||||
OrganisationOpportunity_SportIdPrimary,
|
OrganisationOpportunity_SportIdPrimary,
|
||||||
|
OrganisationOpportunity_OpportunityTypeCode,
|
||||||
OrganisationOpportunity_Position,
|
OrganisationOpportunity_Position,
|
||||||
OrganisationOpportunity_Outline,
|
OrganisationOpportunity_Outline,
|
||||||
OrganisationOpportunity_OpportunityData,
|
OrganisationOpportunity_OpportunityData,
|
||||||
@@ -179,12 +181,25 @@ namespace Saxonite.Base.App
|
|||||||
UserRole_UpdateOn,
|
UserRole_UpdateOn,
|
||||||
UserRole_UpdateBy,
|
UserRole_UpdateBy,
|
||||||
UserRole_UpdateHost,
|
UserRole_UpdateHost,
|
||||||
|
UserSport_Id,
|
||||||
|
UserSport_UserAccountId,
|
||||||
|
UserSport_SportId,
|
||||||
|
UserSport_UserSportData,
|
||||||
|
UserSport_Notes,
|
||||||
|
UserSport_Flags,
|
||||||
|
UserSport_Status,
|
||||||
|
UserSport_CreateOn,
|
||||||
|
UserSport_CreateBy,
|
||||||
|
UserSport_CreateHost,
|
||||||
|
UserSport_UpdateOn,
|
||||||
|
UserSport_UpdateBy,
|
||||||
|
UserSport_UpdateHost,
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Data members.
|
// Data members.
|
||||||
private static readonly int tableCount = 9;
|
private static readonly int tableCount = 10;
|
||||||
private static readonly int columnCount = 146;
|
private static readonly int columnCount = 160;
|
||||||
private static ulong maxTextLen = 0;
|
private static ulong maxTextLen = 0;
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@@ -339,6 +354,7 @@ namespace Saxonite.Base.App
|
|||||||
"UserAccount",
|
"UserAccount",
|
||||||
"UserOrganisation",
|
"UserOrganisation",
|
||||||
"UserRole",
|
"UserRole",
|
||||||
|
"UserSport",
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@@ -418,6 +434,7 @@ namespace Saxonite.Base.App
|
|||||||
new ColumnDfn(4,"OrganisationId",4,4,false,10),
|
new ColumnDfn(4,"OrganisationId",4,4,false,10),
|
||||||
new ColumnDfn(4,"RegionIdPrimary",4,4,false,10),
|
new ColumnDfn(4,"RegionIdPrimary",4,4,false,10),
|
||||||
new ColumnDfn(4,"SportIdPrimary",4,4,false,10),
|
new ColumnDfn(4,"SportIdPrimary",4,4,false,10),
|
||||||
|
new ColumnDfn(4,"OpportunityTypeCode",0,12,false,3),
|
||||||
new ColumnDfn(4,"Position",0,-9,false,200),
|
new ColumnDfn(4,"Position",0,-9,false,200),
|
||||||
new ColumnDfn(4,"Outline",0,-9,false,2000),
|
new ColumnDfn(4,"Outline",0,-9,false,2000),
|
||||||
new ColumnDfn(4,"OpportunityData",0,-9,false,0),
|
new ColumnDfn(4,"OpportunityData",0,-9,false,0),
|
||||||
@@ -511,6 +528,19 @@ namespace Saxonite.Base.App
|
|||||||
new ColumnDfn(9,"UpdateOn",9,93,false,23),
|
new ColumnDfn(9,"UpdateOn",9,93,false,23),
|
||||||
new ColumnDfn(9,"UpdateBy",4,4,false,10),
|
new ColumnDfn(9,"UpdateBy",4,4,false,10),
|
||||||
new ColumnDfn(9,"UpdateHost",0,12,false,100),
|
new ColumnDfn(9,"UpdateHost",0,12,false,100),
|
||||||
|
new ColumnDfn(10,"Id",4,4,true,10),
|
||||||
|
new ColumnDfn(10,"UserAccountId",4,4,false,10),
|
||||||
|
new ColumnDfn(10,"SportId",4,4,false,10),
|
||||||
|
new ColumnDfn(10,"UserSportData",0,-9,false,0),
|
||||||
|
new ColumnDfn(10,"Notes",0,-9,false,2000),
|
||||||
|
new ColumnDfn(10,"Flags",3,5,false,5),
|
||||||
|
new ColumnDfn(10,"Status",0,12,false,3),
|
||||||
|
new ColumnDfn(10,"CreateOn",9,93,false,23),
|
||||||
|
new ColumnDfn(10,"CreateBy",4,4,false,10),
|
||||||
|
new ColumnDfn(10,"CreateHost",0,12,false,100),
|
||||||
|
new ColumnDfn(10,"UpdateOn",9,93,false,23),
|
||||||
|
new ColumnDfn(10,"UpdateBy",4,4,false,10),
|
||||||
|
new ColumnDfn(10,"UpdateHost",0,12,false,100),
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ namespace Saxonite.Net.Standard.Base.App
|
|||||||
public List<TypeCodeDesc> OrganisationTypes { get { return GetCodesOfType(Sax.CodeType.OrganisationType); } }
|
public List<TypeCodeDesc> OrganisationTypes { get { return GetCodesOfType(Sax.CodeType.OrganisationType); } }
|
||||||
public List<TypeCodeDesc> OrganisationCategories { get { return GetCodesOfType(Sax.CodeType.OrganisationCategory); } }
|
public List<TypeCodeDesc> OrganisationCategories { get { return GetCodesOfType(Sax.CodeType.OrganisationCategory); } }
|
||||||
public List<TypeCodeDesc> OrganisationRoles { get { return GetCodesOfType(Sax.CodeType.OrganisationRole); } }
|
public List<TypeCodeDesc> OrganisationRoles { get { return GetCodesOfType(Sax.CodeType.OrganisationRole); } }
|
||||||
|
public List<TypeCodeDesc> OpportunityTypes { get { return GetCodesOfType(Sax.CodeType.OpportunityType); } }
|
||||||
public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
|
public List<TypeCodeDesc> GetCodesOfType(Sax.CodeType codeType)
|
||||||
{
|
{
|
||||||
if (!codeTypes.ContainsKey(codeType))
|
if (!codeTypes.ContainsKey(codeType))
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace Saxonite.Net.Standard.Base.App
|
|||||||
private static readonly List<TypeCodeDesc> organisationTypeCodes = new List<TypeCodeDesc>();
|
private static readonly List<TypeCodeDesc> organisationTypeCodes = new List<TypeCodeDesc>();
|
||||||
private static readonly List<TypeCodeDesc> organisationCategoryCodes = new List<TypeCodeDesc>();
|
private static readonly List<TypeCodeDesc> organisationCategoryCodes = new List<TypeCodeDesc>();
|
||||||
private static readonly List<TypeCodeDesc> organisationRoleCodes = new List<TypeCodeDesc>();
|
private static readonly List<TypeCodeDesc> organisationRoleCodes = new List<TypeCodeDesc>();
|
||||||
|
private static readonly List<TypeCodeDesc> opportunityTypeCodes = new List<TypeCodeDesc>();
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
/// <summary>Static initialisation.</summary>
|
/// <summary>Static initialisation.</summary>
|
||||||
@@ -62,7 +63,7 @@ namespace Saxonite.Net.Standard.Base.App
|
|||||||
organisationTypeCodes.Add(Sax.OrganisationType.PublicSector, "PBS", "Public Sector");
|
organisationTypeCodes.Add(Sax.OrganisationType.PublicSector, "PBS", "Public Sector");
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// Organisation types.
|
// Organisation categories.
|
||||||
organisationCategoryCodes.Add(Sax.OrganisationCategory.Association, "ASC", "Association");
|
organisationCategoryCodes.Add(Sax.OrganisationCategory.Association, "ASC", "Association");
|
||||||
organisationCategoryCodes.Add(Sax.OrganisationCategory.Club, "CLB", "Club");
|
organisationCategoryCodes.Add(Sax.OrganisationCategory.Club, "CLB", "Club");
|
||||||
organisationCategoryCodes.Add(Sax.OrganisationCategory.Education, "EDU", "Education");
|
organisationCategoryCodes.Add(Sax.OrganisationCategory.Education, "EDU", "Education");
|
||||||
@@ -71,12 +72,21 @@ namespace Saxonite.Net.Standard.Base.App
|
|||||||
organisationCategoryCodes.Add(Sax.OrganisationCategory.Other, "OTH", "Other");
|
organisationCategoryCodes.Add(Sax.OrganisationCategory.Other, "OTH", "Other");
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// Organisation types.
|
// Organisation roles.
|
||||||
organisationRoleCodes.Add(Sax.OrganisationRole.Member, "MBR", "Member");
|
organisationRoleCodes.Add(Sax.OrganisationRole.Member, "MBR", "Member");
|
||||||
organisationRoleCodes.Add(Sax.OrganisationRole.MemberAdmin, "MBA", "Member Admin");
|
organisationRoleCodes.Add(Sax.OrganisationRole.MemberAdmin, "MBA", "Member Admin");
|
||||||
organisationRoleCodes.Add(Sax.OrganisationRole.ScheduleAdmin, "SCA", "Schedule Admin");
|
organisationRoleCodes.Add(Sax.OrganisationRole.ScheduleAdmin, "SCA", "Schedule Admin");
|
||||||
organisationRoleCodes.Add(Sax.OrganisationRole.OpportunityAdmin, "OPA", "Opportunity Admin");
|
organisationRoleCodes.Add(Sax.OrganisationRole.OpportunityAdmin, "OPA", "Opportunity Admin");
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// Opportunity types.
|
||||||
|
opportunityTypeCodes.Add(Sax.OpportunityType.Playing, "PLG", "Playing");
|
||||||
|
opportunityTypeCodes.Add(Sax.OpportunityType.Official, "OFL", "Official");
|
||||||
|
opportunityTypeCodes.Add(Sax.OpportunityType.Coaching, "CHG", "Coaching");
|
||||||
|
opportunityTypeCodes.Add(Sax.OpportunityType.Volunteer, "VTR", "Volunteer");
|
||||||
|
opportunityTypeCodes.Add(Sax.OpportunityType.Staff, "STF", "Staff");
|
||||||
|
opportunityTypeCodes.Add(Sax.OpportunityType.Board, "BRD", "Board");
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ namespace Saxonite.Net.Standard.Base.App
|
|||||||
// Lists are cloned to avoid modifications to the internal static lists.
|
// Lists are cloned to avoid modifications to the internal static lists.
|
||||||
switch (systemCode)
|
switch (systemCode)
|
||||||
{
|
{
|
||||||
//-----------------------------------------------------------
|
|
||||||
case Sax.CodeType.YesNo:
|
case Sax.CodeType.YesNo:
|
||||||
return new List<TypeCodeDesc>(yesNoCodes);
|
return new List<TypeCodeDesc>(yesNoCodes);
|
||||||
case Sax.CodeType.RegionType:
|
case Sax.CodeType.RegionType:
|
||||||
@@ -51,10 +50,12 @@ namespace Saxonite.Net.Standard.Base.App
|
|||||||
return new List<TypeCodeDesc>(organisationCategoryCodes);
|
return new List<TypeCodeDesc>(organisationCategoryCodes);
|
||||||
case Sax.CodeType.OrganisationRole:
|
case Sax.CodeType.OrganisationRole:
|
||||||
return new List<TypeCodeDesc>(organisationRoleCodes);
|
return new List<TypeCodeDesc>(organisationRoleCodes);
|
||||||
|
case Sax.CodeType.OpportunityType:
|
||||||
|
return new List<TypeCodeDesc>(opportunityTypeCodes);
|
||||||
|
|
||||||
//-----------------------------------------------------------
|
default:
|
||||||
|
throw new NotSupportedException(nameof(SaxSystem) + ".GetCodesOfType Unexpected code type: " + systemCode.ToString());
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System.Text;
|
|||||||
namespace Saxonite.Net.Standard.Base.Bus
|
namespace Saxonite.Net.Standard.Base.Bus
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// JournalistArticle.
|
// Journalist Article.
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SaxJournalistArticle : SacsHierarchyItem
|
public abstract class SaxJournalistArticle : SacsHierarchyItem
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,309 @@
|
|||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
|
using Sarand.Net.Standard.Base.Core;
|
||||||
|
using Saxonite.Net.Standard.Base.App;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Standard.Base.Bus
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
// Organisation Opportunity.
|
||||||
|
//=======================================================================
|
||||||
|
public abstract class SaxOrganisationOpportunity : SacsHierarchyItem
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Columns.
|
||||||
|
public enum Column
|
||||||
|
{
|
||||||
|
Pos,
|
||||||
|
Id,
|
||||||
|
// Organisation.
|
||||||
|
OrganisationId,
|
||||||
|
Organisation_Name,
|
||||||
|
// Region.
|
||||||
|
RegionIdPrimary,
|
||||||
|
Region_Name,
|
||||||
|
// Sport.
|
||||||
|
SportIdPrimary,
|
||||||
|
Sport_Name,
|
||||||
|
// Opportunity.
|
||||||
|
OpportunityTypeCode,
|
||||||
|
OpportunityType_Desc,
|
||||||
|
Position,
|
||||||
|
Outline,
|
||||||
|
PublishedAt_Date,
|
||||||
|
PublishedAt_DateTime,
|
||||||
|
ExpiresAt_Date,
|
||||||
|
ExpiresAt_DateTime,
|
||||||
|
// Associated data.
|
||||||
|
// Common.
|
||||||
|
Notes,
|
||||||
|
Flags,
|
||||||
|
Status,
|
||||||
|
Status_Desc,
|
||||||
|
Status_Ind,
|
||||||
|
CreateOn_Date,
|
||||||
|
UpdateOn_Date,
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
/// <summary>Properties other than common.</summary>
|
||||||
|
public class DataProperties
|
||||||
|
{
|
||||||
|
public SysId OrganisationId { get; set; }
|
||||||
|
public SysId RegionIdPrimary { get; set; }
|
||||||
|
public SysId SportIdPrimary { get; set; }
|
||||||
|
public Sax.OpportunityType OpportunityType { get; set; }
|
||||||
|
public String Position { get; set; } = String.Empty;
|
||||||
|
public String Outline { get; set; } = String.Empty;
|
||||||
|
public String OpportunityData { get; set; } = String.Empty;
|
||||||
|
public DateTime PublishedAt { get; set; }
|
||||||
|
public DateTime ExpiresAt { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Data.
|
||||||
|
public new class Data : SacsHierarchyItem.Data
|
||||||
|
{
|
||||||
|
// Data members.
|
||||||
|
private readonly DataProperties data = new DataProperties();
|
||||||
|
// Construction.
|
||||||
|
public Data()
|
||||||
|
{
|
||||||
|
Status = DefaultStatus;
|
||||||
|
}
|
||||||
|
// Properties.
|
||||||
|
public SysId OrganisationId
|
||||||
|
{
|
||||||
|
get { return data.OrganisationId; }
|
||||||
|
set { CheckChanged(data.OrganisationId, value); data.OrganisationId = value; }
|
||||||
|
}
|
||||||
|
public SysId RegionIdPrimary
|
||||||
|
{
|
||||||
|
get { return data.RegionIdPrimary; }
|
||||||
|
set { CheckChanged(data.RegionIdPrimary, value); data.RegionIdPrimary = value; }
|
||||||
|
}
|
||||||
|
public SysId SportIdPrimary
|
||||||
|
{
|
||||||
|
get { return data.SportIdPrimary; }
|
||||||
|
set { CheckChanged(data.SportIdPrimary, value); data.SportIdPrimary = value; }
|
||||||
|
}
|
||||||
|
public Sax.OpportunityType OpportunityType
|
||||||
|
{
|
||||||
|
get { return data.OpportunityType; }
|
||||||
|
set { CheckChanged((int)data.OpportunityType, (int)value); data.OpportunityType = value; }
|
||||||
|
}
|
||||||
|
public String Position
|
||||||
|
{
|
||||||
|
get { return data.Position; }
|
||||||
|
set { CheckChanged(data.Position, value); data.Position = value; }
|
||||||
|
}
|
||||||
|
public String Outline
|
||||||
|
{
|
||||||
|
get { return data.Outline; }
|
||||||
|
set { CheckChanged(data.Outline, value); data.Outline = value; }
|
||||||
|
}
|
||||||
|
public String OpportunityData
|
||||||
|
{
|
||||||
|
get { return data.OpportunityData; }
|
||||||
|
set { CheckChanged(data.OpportunityData, value); data.OpportunityData = value; }
|
||||||
|
}
|
||||||
|
public DateTime PublishedAt
|
||||||
|
{
|
||||||
|
get { return data.PublishedAt; }
|
||||||
|
set { CheckChanged(data.PublishedAt, value); data.PublishedAt = value; }
|
||||||
|
}
|
||||||
|
public DateTime ExpiresAt
|
||||||
|
{
|
||||||
|
get { return data.ExpiresAt; }
|
||||||
|
set { CheckChanged(data.ExpiresAt, value); data.ExpiresAt = value; }
|
||||||
|
}
|
||||||
|
// Population.
|
||||||
|
internal void PopulateFrom(Data data)
|
||||||
|
{
|
||||||
|
OrganisationId = data.OrganisationId;
|
||||||
|
RegionIdPrimary = data.RegionIdPrimary;
|
||||||
|
SportIdPrimary = data.SportIdPrimary;
|
||||||
|
OpportunityType = data.OpportunityType;
|
||||||
|
Position = data.Position;
|
||||||
|
Outline = data.Outline;
|
||||||
|
OpportunityData = data.OpportunityData;
|
||||||
|
PublishedAt = data.PublishedAt;
|
||||||
|
ExpiresAt = data.ExpiresAt;
|
||||||
|
base.PopulateFrom(data);
|
||||||
|
}
|
||||||
|
public Data Clone()
|
||||||
|
{
|
||||||
|
Data data = new Data();
|
||||||
|
data.PopulateFrom(this);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Error field - identify properties with validation error.
|
||||||
|
public new class ErrField : SacsHierarchyItem.ErrField
|
||||||
|
{
|
||||||
|
// Identifies the field that has invalid data.
|
||||||
|
public ValidValue OrganisationId { get; set; } = ValidValue.Valid;
|
||||||
|
public ValidValue RegionIdPrimary { get; set; } = ValidValue.Valid;
|
||||||
|
public ValidValue SportIdPrimary { get; set; } = ValidValue.Valid;
|
||||||
|
public ValidValue OpportunityType { get; set; } = ValidValue.Valid;
|
||||||
|
public ValidValue Position { get; set; } = ValidValue.Valid;
|
||||||
|
public ValidValue Outline { get; set; } = ValidValue.Valid;
|
||||||
|
public ValidValue OpportunityData { get; set; } = ValidValue.Valid;
|
||||||
|
public ValidValue PublishedAt { get; set; } = ValidValue.Valid;
|
||||||
|
public ValidValue ExpiresAt { get; set; } = ValidValue.Valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Data members.
|
||||||
|
private readonly Data data = new Data();
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Construction.
|
||||||
|
protected SaxOrganisationOpportunity(SysId id, SysId OrganisationId) : base(id)
|
||||||
|
{
|
||||||
|
base.SetData(data);
|
||||||
|
this.OrganisationId = OrganisationId;
|
||||||
|
Status = DefaultStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Status.
|
||||||
|
private static readonly List<SaStatus> validStatuses = new List<SaStatus>()
|
||||||
|
{
|
||||||
|
SaStatus.Active,
|
||||||
|
SaStatus.Inactive,
|
||||||
|
SaStatus.Deleted,
|
||||||
|
};
|
||||||
|
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||||
|
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(validStatuses); } }
|
||||||
|
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||||
|
{
|
||||||
|
if (status == SaStatus.Active) return DataValue.TriStateType.Green;
|
||||||
|
if (status == SaStatus.Inactive) return DataValue.TriStateType.Red;
|
||||||
|
if (status == SaStatus.Deleted) return DataValue.TriStateType.Purple;
|
||||||
|
return DataValue.TriStateType.Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Utilities.
|
||||||
|
public ItemId GetItemId()
|
||||||
|
{
|
||||||
|
return new ItemId((short)Sax.DataItemType.OrganisationOpportunity, Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Properties.
|
||||||
|
public Data GetData() { return data.Clone(); }
|
||||||
|
public void SetData(Data data)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".SetData";
|
||||||
|
// Properties that cannot be changed if previously specified.
|
||||||
|
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||||
|
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||||
|
if (SysId.IsValid(OrganisationId) && SysId.ToInt(OrganisationId) != SysId.ToInt(data.OrganisationId))
|
||||||
|
throw new NotSupportedException(fn + " Organisation Id cannot be changed");
|
||||||
|
this.data.PopulateFrom(data);
|
||||||
|
}
|
||||||
|
public SysId OrganisationId
|
||||||
|
{
|
||||||
|
get { return data.OrganisationId; }
|
||||||
|
protected set { data.OrganisationId = value; }
|
||||||
|
}
|
||||||
|
public SysId RegionIdPrimary
|
||||||
|
{
|
||||||
|
get { return data.RegionIdPrimary; }
|
||||||
|
set { data.RegionIdPrimary = value; }
|
||||||
|
}
|
||||||
|
public SysId SportIdPrimary
|
||||||
|
{
|
||||||
|
get { return data.SportIdPrimary; }
|
||||||
|
set { data.SportIdPrimary = value; }
|
||||||
|
}
|
||||||
|
public Sax.OpportunityType OpportunityType
|
||||||
|
{
|
||||||
|
get { return data.OpportunityType; }
|
||||||
|
set { data.OpportunityType = value; }
|
||||||
|
}
|
||||||
|
public String Position
|
||||||
|
{
|
||||||
|
get { return data.Position; }
|
||||||
|
set { data.Position = value; }
|
||||||
|
}
|
||||||
|
public String Outline
|
||||||
|
{
|
||||||
|
get { return data.Outline; }
|
||||||
|
set { data.Outline = value; }
|
||||||
|
}
|
||||||
|
public String OpportunityData
|
||||||
|
{
|
||||||
|
get { return data.OpportunityData; }
|
||||||
|
set { data.OpportunityData = value; }
|
||||||
|
}
|
||||||
|
public DateTime PublishedAt
|
||||||
|
{
|
||||||
|
get { return data.PublishedAt; }
|
||||||
|
set { data.PublishedAt = value; }
|
||||||
|
}
|
||||||
|
public DateTime ExpiresAt
|
||||||
|
{
|
||||||
|
get { return data.ExpiresAt; }
|
||||||
|
set { data.ExpiresAt = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Flags - positions 1-16 available.
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// A s s o c i a t e d D a t a
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// P a r a m s
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// List parameters.
|
||||||
|
public enum StatusCat
|
||||||
|
{
|
||||||
|
Any,
|
||||||
|
NotDeleted,
|
||||||
|
ActiveOnly,
|
||||||
|
InctiveOnly,
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Item list parameters.
|
||||||
|
/// </summary>
|
||||||
|
public new class Params : SacsHierarchyItem.Params
|
||||||
|
{
|
||||||
|
// List filtering.
|
||||||
|
public List<SysId> IdsIncluded { get; } = new List<SysId>();
|
||||||
|
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||||
|
/// <summary>Restrict to User Account via User Organisations and Organisations.</summary>
|
||||||
|
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
|
||||||
|
public List<SysId> OrganisationIdsIncluded { get; } = new List<SysId>();
|
||||||
|
public List<SysId> RegionIdsIncluded { get; } = new List<SysId>();
|
||||||
|
public List<SysId> SportIdsIncluded { get; set; } = new List<SysId>();
|
||||||
|
public String PositionPartial { get; set; }
|
||||||
|
public String OutlinePartial { get; set; }
|
||||||
|
/// <summary>General filter value - position, outline, sport, body etc. </summary>
|
||||||
|
public String OpportunityFilter { get; set; }
|
||||||
|
public String NotesPartial { get; set; }
|
||||||
|
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
|
||||||
|
// Linked table aliases - blank if not linked.
|
||||||
|
public String Alias_Organisation { get; set; }
|
||||||
|
public String Alias_UserOrganisation { get; set; }
|
||||||
|
public String Alias_UserAccount { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
// Company list methods.
|
||||||
|
public static class SaxOrganisationOpportunityList
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -154,8 +154,8 @@ namespace Saxonite.Net.Standard.Base.Bus
|
|||||||
public new class Params : SacsHierarchyItem.Params
|
public new class Params : SacsHierarchyItem.Params
|
||||||
{
|
{
|
||||||
// List filtering.
|
// List filtering.
|
||||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
public List<SysId> IdsIncluded { get; } = new List<SysId>();
|
||||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||||
/// <summary>Generic filter - partial sport name, or other matching value (tbd).</summary>
|
/// <summary>Generic filter - partial sport name, or other matching value (tbd).</summary>
|
||||||
public String SportFilter { get; set; }
|
public String SportFilter { get; set; }
|
||||||
public String NameFull { get; set; }
|
public String NameFull { get; set; }
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ namespace Saxonite.Net.Standard.Base.Bus
|
|||||||
User_LastName,
|
User_LastName,
|
||||||
// Associated data.
|
// Associated data.
|
||||||
Organisation_Name,
|
Organisation_Name,
|
||||||
|
Organisation_RegionId,
|
||||||
Organisation_Region_Name,
|
Organisation_Region_Name,
|
||||||
|
Organisation_SportId,
|
||||||
Organisation_Sport_Name,
|
Organisation_Sport_Name,
|
||||||
// Associated data.
|
// Associated data.
|
||||||
// Common.
|
// Common.
|
||||||
@@ -252,6 +254,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
|||||||
public List<SysId> OrganisationIdsIncluded { get; } = new List<SysId>();
|
public List<SysId> OrganisationIdsIncluded { get; } = new List<SysId>();
|
||||||
/// <summary>Set true to restruct to User Organisations with at least one Organisation Role.</summary>
|
/// <summary>Set true to restruct to User Organisations with at least one Organisation Role.</summary>
|
||||||
public bool OrganisationMembersOnly { get; set; }
|
public bool OrganisationMembersOnly { get; set; }
|
||||||
|
public List<Sax.OrganisationRole> OrganisationRoles { get; } = new List<Sax.OrganisationRole>();
|
||||||
public String NotesPartial { get; set; }
|
public String NotesPartial { get; set; }
|
||||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,215 @@
|
|||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
|
using Sarand.Net.Standard.Base.Core;
|
||||||
|
using Saxonite.Net.Standard.Base.App;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Standard.Base.Bus
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
// UserSport.
|
||||||
|
//=======================================================================
|
||||||
|
public abstract class SaxUserSport : SacsHierarchyItem
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Columns.
|
||||||
|
public enum Column
|
||||||
|
{
|
||||||
|
Pos,
|
||||||
|
Id,
|
||||||
|
// User.
|
||||||
|
UserAccountId,
|
||||||
|
User_EmailAddress,
|
||||||
|
User_DisplayName,
|
||||||
|
User_Title,
|
||||||
|
User_FirstName,
|
||||||
|
User_LastName,
|
||||||
|
// Sport.
|
||||||
|
SportId,
|
||||||
|
Sport_Name,
|
||||||
|
// Associated data.
|
||||||
|
// Common.
|
||||||
|
Notes,
|
||||||
|
Flags,
|
||||||
|
Status,
|
||||||
|
Status_Desc,
|
||||||
|
Status_Ind,
|
||||||
|
CreateOn_Date,
|
||||||
|
UpdateOn_Date,
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
/// <summary>Properties other than common.</summary>
|
||||||
|
public class DataProperties
|
||||||
|
{
|
||||||
|
public SysId UserAccountId { get; set; }
|
||||||
|
public SysId SportId { get; set; }
|
||||||
|
public String UserSportData { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Data.
|
||||||
|
public new class Data : SacsHierarchyItem.Data
|
||||||
|
{
|
||||||
|
// Data members.
|
||||||
|
private readonly DataProperties data = new DataProperties();
|
||||||
|
// Construction.
|
||||||
|
public Data()
|
||||||
|
{
|
||||||
|
Status = DefaultStatus;
|
||||||
|
}
|
||||||
|
// Properties.
|
||||||
|
public SysId UserAccountId
|
||||||
|
{
|
||||||
|
get { return data.UserAccountId; }
|
||||||
|
set { CheckChanged(data.UserAccountId, value); data.UserAccountId = value; }
|
||||||
|
}
|
||||||
|
public SysId SportId
|
||||||
|
{
|
||||||
|
get { return data.SportId; }
|
||||||
|
set { CheckChanged(data.SportId, value); data.SportId = value; }
|
||||||
|
}
|
||||||
|
public String UserSportData
|
||||||
|
{
|
||||||
|
get { return data.UserSportData; }
|
||||||
|
set { CheckChanged(data.UserSportData, value); data.UserSportData = value; }
|
||||||
|
}
|
||||||
|
// Population.
|
||||||
|
internal void PopulateFrom(Data data)
|
||||||
|
{
|
||||||
|
UserAccountId = data.UserAccountId;
|
||||||
|
SportId = data.SportId;
|
||||||
|
UserSportData = data.UserSportData;
|
||||||
|
base.PopulateFrom(data);
|
||||||
|
}
|
||||||
|
public Data Clone()
|
||||||
|
{
|
||||||
|
Data data = new Data();
|
||||||
|
data.PopulateFrom(this);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Error field - identify properties with validation error.
|
||||||
|
public new class ErrField : SacsHierarchyItem.ErrField
|
||||||
|
{
|
||||||
|
// Identifies the field that has invalid data.
|
||||||
|
public ValidValue UserAccountId { get; set; } = ValidValue.Valid;
|
||||||
|
public ValidValue SportId { get; set; } = ValidValue.Valid;
|
||||||
|
public ValidValue UserSportData { get; set; } = ValidValue.Valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Data members.
|
||||||
|
private readonly Data data = new Data();
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Construction.
|
||||||
|
protected SaxUserSport(SysId id, SysId userAccountId, SysId sportId) : base(id)
|
||||||
|
{
|
||||||
|
base.SetData(data);
|
||||||
|
UserAccountId = userAccountId;
|
||||||
|
SportId = sportId;
|
||||||
|
Status = DefaultStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Status.
|
||||||
|
private static readonly List<SaStatus> validStatuses = new List<SaStatus>()
|
||||||
|
{
|
||||||
|
SaStatus.Active,
|
||||||
|
SaStatus.Inactive,
|
||||||
|
SaStatus.Deleted,
|
||||||
|
};
|
||||||
|
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||||
|
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(validStatuses); } }
|
||||||
|
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||||
|
{
|
||||||
|
if (status == SaStatus.Active) return DataValue.TriStateType.Green;
|
||||||
|
if (status == SaStatus.Inactive) return DataValue.TriStateType.Red;
|
||||||
|
if (status == SaStatus.Deleted) return DataValue.TriStateType.Purple;
|
||||||
|
return DataValue.TriStateType.Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Utilities.
|
||||||
|
public ItemId GetItemId()
|
||||||
|
{
|
||||||
|
return new ItemId((short)Sax.DataItemType.UserSport, Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Properties.
|
||||||
|
public Data GetData() { return data.Clone(); }
|
||||||
|
public void SetData(Data data)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".SetData";
|
||||||
|
// Properties that cannot be changed if previously specified.
|
||||||
|
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||||
|
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||||
|
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
|
||||||
|
throw new NotSupportedException(fn + " User Account Id cannot be changed");
|
||||||
|
if (SysId.IsValid(SportId) && SysId.ToInt(SportId) != SysId.ToInt(data.SportId))
|
||||||
|
throw new NotSupportedException(fn + " Sport Id cannot be changed");
|
||||||
|
this.data.PopulateFrom(data);
|
||||||
|
}
|
||||||
|
public SysId UserAccountId
|
||||||
|
{
|
||||||
|
get { return data.UserAccountId; }
|
||||||
|
protected set { data.UserAccountId = value; }
|
||||||
|
}
|
||||||
|
public SysId SportId
|
||||||
|
{
|
||||||
|
get { return data.SportId; }
|
||||||
|
protected set { data.SportId = value; }
|
||||||
|
}
|
||||||
|
public String UserSportData
|
||||||
|
{
|
||||||
|
get { return data.UserSportData; }
|
||||||
|
set { data.UserSportData = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Flags - positions 1-16 available.
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// A s s o c i a t e d D a t a
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// P a r a m s
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// List parameters.
|
||||||
|
public enum StatusCat
|
||||||
|
{
|
||||||
|
Any,
|
||||||
|
NotDeleted,
|
||||||
|
ActiveOnly,
|
||||||
|
InctiveOnly,
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Item list parameters.
|
||||||
|
/// </summary>
|
||||||
|
public new class Params : SacsHierarchyItem.Params
|
||||||
|
{
|
||||||
|
// List filtering.
|
||||||
|
public List<SysId> IdsIncluded { get; } = new List<SysId>();
|
||||||
|
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||||
|
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
|
||||||
|
public List<SysId> SportIdsIncluded { get; } = new List<SysId>();
|
||||||
|
public String NotesPartial { get; set; }
|
||||||
|
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
// Company list methods.
|
||||||
|
public static class SaxUserSportList
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -16,9 +16,46 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
|||||||
partial class SaxAccountMgr
|
partial class SaxAccountMgr
|
||||||
{
|
{
|
||||||
//*******************************************************************
|
//*******************************************************************
|
||||||
// Account Mgr - User Role
|
// Account Mgr - User Organisation
|
||||||
//*******************************************************************
|
//*******************************************************************
|
||||||
// Utilities.
|
// Utilities.
|
||||||
|
/// <summary>
|
||||||
|
/// Is the user a member of the organisation - excluding relationships which just indicate an 'interest'.
|
||||||
|
/// </summary>
|
||||||
|
public bool UserIsOrganisationMember(SysId userAccountId, SysId organisationId, SaxUserOrganisation.StatusCat statusCat = SaxUserOrganisation.StatusCat.ActiveOnly)
|
||||||
|
{
|
||||||
|
if (!SysId.IsValid(userAccountId) || !SysId.IsValid(organisationId)) return false;
|
||||||
|
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||||
|
prmUserOrganisation.UserAccountIdsIncluded.Add(userAccountId);
|
||||||
|
prmUserOrganisation.OrganisationIdsIncluded.Add(organisationId);
|
||||||
|
prmUserOrganisation.OrganisationMembersOnly = true;
|
||||||
|
prmUserOrganisation.StatusCat = statusCat;
|
||||||
|
return GetUserOrganisationCount(prmUserOrganisation) > 0;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Does the user have the specified role with the organisation.
|
||||||
|
/// </summary>
|
||||||
|
public bool UserHasOrganisationRole(SysId userAccountId, SysId organisationId, Sax.OrganisationRole organisationRole, SaxUserOrganisation.StatusCat statusCat = SaxUserOrganisation.StatusCat.ActiveOnly)
|
||||||
|
{
|
||||||
|
if (!SysId.IsValid(userAccountId) || !SysId.IsValid(organisationId) || organisationRole <= 0) return false;
|
||||||
|
return GetOrganisationRolesForUser(userAccountId, organisationId, statusCat).Contains(organisationRole);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the roles that a user has with the organisation.
|
||||||
|
/// </summary>
|
||||||
|
public List<Sax.OrganisationRole> GetOrganisationRolesForUser(SysId userAccountId, SysId organisationId, SaxUserOrganisation.StatusCat statusCat = SaxUserOrganisation.StatusCat.ActiveOnly)
|
||||||
|
{
|
||||||
|
List<Sax.OrganisationRole> organisationRoles = new List<Sax.OrganisationRole>();
|
||||||
|
if (!SysId.IsValid(userAccountId) || !SysId.IsValid(organisationId)) return organisationRoles;
|
||||||
|
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||||
|
prmUserOrganisation.UserAccountIdsIncluded.Add(userAccountId);
|
||||||
|
prmUserOrganisation.OrganisationIdsIncluded.Add(organisationId);
|
||||||
|
prmUserOrganisation.StatusCat = statusCat;
|
||||||
|
using (SaxUserOrganisation userOrganisation = GetUserOrganisation(prmUserOrganisation))
|
||||||
|
if (userOrganisation != null)
|
||||||
|
organisationRoles = userOrganisation.OrganisationRoles;
|
||||||
|
return organisationRoles;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Create item.
|
// Create item.
|
||||||
@@ -158,16 +195,16 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
|||||||
value = new DataValue(SaxUserAccount.GetDisplayName(userTitle, userFirstName, userLastName));
|
value = new DataValue(SaxUserAccount.GetDisplayName(userTitle, userFirstName, userLastName));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
// User Role.
|
// User Role.
|
||||||
case SaxUserOrganisation.Column.UserOrganisation_Desc:
|
case SaxUserOrganisation.Column.UserOrganisation_Desc:
|
||||||
{
|
{
|
||||||
String userOrganisationCode = values.GetValue(column.DataName).ToString();
|
String userOrganisationCode = values.GetValue(column.DataName).ToString();
|
||||||
value = new DataValue(UserOrganisations.GetDescForCode(userOrganisationCode));
|
value = new DataValue(UserOrganisations.GetDescForCode(userOrganisationCode));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
// Notes.
|
// Notes.
|
||||||
case SaxUserOrganisation.Column.Notes:
|
case SaxUserOrganisation.Column.Notes:
|
||||||
|
|||||||
@@ -0,0 +1,237 @@
|
|||||||
|
using Sarand.Net.Standard.Base.App;
|
||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
|
using Sarand.Net.Standard.Base.Core;
|
||||||
|
using Sarand.Net.Standard.Base.Dbas;
|
||||||
|
using Saxonite.Base.App;
|
||||||
|
using Saxonite.Net.Standard.Base.App;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Standard.Base.Mgr
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
partial class SaxAccountMgr
|
||||||
|
{
|
||||||
|
//*******************************************************************
|
||||||
|
// Account Mgr - User Sport
|
||||||
|
//*******************************************************************
|
||||||
|
// Utilities.
|
||||||
|
public bool UserHasSport(SysId userAccountId, SysId sportId, SaxUserSport.StatusCat statusCat = SaxUserSport.StatusCat.ActiveOnly)
|
||||||
|
{
|
||||||
|
if (!SysId.IsValid(userAccountId) || !SysId.IsValid(sportId)) return false;
|
||||||
|
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||||
|
prmUserSport.UserAccountIdsIncluded.Add(userAccountId);
|
||||||
|
prmUserSport.SportIdsIncluded.Add(sportId);
|
||||||
|
prmUserSport.StatusCat = statusCat;
|
||||||
|
return GetUserSportCount(prmUserSport) > 0;
|
||||||
|
}
|
||||||
|
public List<SaxUserSport> GetSportsForUser(SysId userAccountId, SaxUserSport.StatusCat statusCat = SaxUserSport.StatusCat.ActiveOnly)
|
||||||
|
{
|
||||||
|
if (!SysId.IsValid(userAccountId)) return new List<SaxUserSport>();
|
||||||
|
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||||
|
prmUserSport.UserAccountIdsIncluded.Add(userAccountId);
|
||||||
|
prmUserSport.StatusCat = statusCat;
|
||||||
|
return GetUserSportList(prmUserSport);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Create item.
|
||||||
|
public abstract SaxUserSport CreateUserSport(SysId userAccountId, SysId sportId);
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Item exists.
|
||||||
|
public bool UserSportExistsById(SysId id)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
if (!SysId.IsValid(id)) return false;
|
||||||
|
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||||
|
prmUserSport.IdsIncluded.Add(id);
|
||||||
|
prmUserSport.StatusCat = SaxUserSport.StatusCat.Any;
|
||||||
|
return GetUserSportCount(prmUserSport) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Retrieve individual items.
|
||||||
|
public abstract SaxUserSport GetUserSport(SaxUserSport.Params prmUserSport);
|
||||||
|
public SaxUserSport GetUserSportById(SysId id)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
if (!SysId.IsValid(id)) return null;
|
||||||
|
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||||
|
prmUserSport.IdsIncluded.Add(id);
|
||||||
|
prmUserSport.StatusCat = SaxUserSport.StatusCat.Any;
|
||||||
|
return GetUserSport(prmUserSport);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Validate item data.
|
||||||
|
public bool IsValidUserSport(SaxUserSport userSport)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
if (userSport == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||||
|
return IsValidUserSportData(userSport.GetData(), new SaxUserSport.ErrField());
|
||||||
|
}
|
||||||
|
public virtual bool IsValidUserSportData(SaxUserSport.Data data, SaxUserSport.ErrField errField)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// User Account.
|
||||||
|
if (errField.UserAccountId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.UserAccountId))
|
||||||
|
{
|
||||||
|
errField.UserAccountId = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState("User Account Id must be specified");
|
||||||
|
}
|
||||||
|
// Sport.
|
||||||
|
if (errField.SportId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.SportId))
|
||||||
|
{
|
||||||
|
errField.SportId = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState("User Sport must be specified");
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// Common properties.
|
||||||
|
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn.GetColTextLen(SaxDbDfn.ColumnIdx.UserSport_Notes)))
|
||||||
|
{
|
||||||
|
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||||
|
{
|
||||||
|
if (!IsValidValue(data.StatusCode, "status", (long)SaxDbDfn.GetColTextLen(SaxDbDfn.ColumnIdx.UserSport_Status), true, true))
|
||||||
|
{
|
||||||
|
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!SaxUserSport.ValidStatuses.Contains(data.Status))
|
||||||
|
{
|
||||||
|
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// User must exist.
|
||||||
|
if (errField.UserAccountId != SacsHierarchyItem.ValidValue.Ignore)
|
||||||
|
{
|
||||||
|
if (SysId.IsValid(data.UserAccountId))
|
||||||
|
{
|
||||||
|
SaxUserAccount.Params prmUserAccount = new SaxUserAccount.Params();
|
||||||
|
if (SysId.IsValid(data.Id))
|
||||||
|
prmUserAccount.IdsExcluded.Add(data.Id);
|
||||||
|
prmUserAccount.IdsIncluded.Add(data.UserAccountId);
|
||||||
|
prmUserAccount.StatusCat = SaxUserAccount.StatusCat.Any;
|
||||||
|
if (GetUserAccountCount(prmUserAccount) < 1)
|
||||||
|
{
|
||||||
|
errField.UserAccountId = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState("invalid user specified");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// Sport must exist.
|
||||||
|
if (errField.SportId != SacsHierarchyItem.ValidValue.Ignore)
|
||||||
|
{
|
||||||
|
if (SysId.IsValid(data.SportId))
|
||||||
|
{
|
||||||
|
SaxSport.Params prmSport = new SaxSport.Params();
|
||||||
|
if (SysId.IsValid(data.Id))
|
||||||
|
prmSport.IdsExcluded.Add(data.Id);
|
||||||
|
prmSport.IdsIncluded.Add(data.SportId);
|
||||||
|
prmSport.StatusCat = SaxSport.StatusCat.Any;
|
||||||
|
if (ReferenceMgr.GetSportCount(prmSport) < 1)
|
||||||
|
{
|
||||||
|
errField.SportId = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState("invalid sport specified");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// User & Sport combination must be unique.
|
||||||
|
if (errField.UserAccountId != SacsHierarchyItem.ValidValue.Ignore && errField.SportId != SacsHierarchyItem.ValidValue.Ignore)
|
||||||
|
{
|
||||||
|
if (SysId.IsValid(data.UserAccountId) && SysId.IsValid(data.SportId))
|
||||||
|
{
|
||||||
|
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||||
|
if (SysId.IsValid(data.Id))
|
||||||
|
prmUserSport.IdsExcluded.Add(data.Id);
|
||||||
|
prmUserSport.UserAccountIdsIncluded.Add(data.UserAccountId);
|
||||||
|
prmUserSport.SportIdsIncluded.Add(data.SportId);
|
||||||
|
prmUserSport.StatusCat = SaxUserSport.StatusCat.Any;
|
||||||
|
if (GetUserSportCount(prmUserSport) > 0)
|
||||||
|
{
|
||||||
|
errField.SportId = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState("Sport must be unique for user");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Item database interface.
|
||||||
|
public abstract bool InsertUserSport(SaxUserSport userSport, DbUpdateInfo dbUpdateInfo);
|
||||||
|
public abstract bool UpdateUserSport(SaxUserSport userSport, DbUpdateInfo dbUpdateInfo);
|
||||||
|
public virtual bool UserSportCanBeDeleted(SaxUserSport userSport)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public abstract bool DeleteUserSport(SaxUserSport userSport, DbUpdateInfo dbUpdateInfo);
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Item list.
|
||||||
|
public abstract ColumnDfn GetUserSportColumnDfn(SaxUserSport.Column columnId, String caption = "", int width = 0);
|
||||||
|
public abstract List<String> GetUserSportQueryFilter(SaxUserSport.Params prmUserSport);
|
||||||
|
public abstract long GetUserSportCount(SaxUserSport.Params prmUserSport);
|
||||||
|
public abstract List<SaxUserSport> GetUserSportList(SaxUserSport.Params prmUserSport);
|
||||||
|
public abstract DbResultSet ExecuteUserSportQuery(List<ColumnDfn> columns, SaxUserSport.Params prmUserSport);
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
/// <summary>
|
||||||
|
/// Extract and format result set data value where specific handling is required.
|
||||||
|
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
|
||||||
|
/// </summary>
|
||||||
|
public virtual DataValue GetUserSportDataValue(ColumnDfn column, NamedValue.Map values)
|
||||||
|
{
|
||||||
|
DataValue value = new DataValue();
|
||||||
|
switch ((SaxUserSport.Column)column.Id)
|
||||||
|
{
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Notes.
|
||||||
|
case SaxUserSport.Column.Notes:
|
||||||
|
{
|
||||||
|
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Status.
|
||||||
|
case SaxUserSport.Column.Status_Desc:
|
||||||
|
case SaxUserSport.Column.Status_Ind:
|
||||||
|
{
|
||||||
|
String statusCode = values.GetValue(column.DataName).ToString();
|
||||||
|
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||||
|
if (column.Id == (int)SaxUserSport.Column.Status_Desc)
|
||||||
|
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||||
|
else if (column.Id == (int)SaxUserSport.Column.Status_Ind)
|
||||||
|
value = new DataValue(SaxUserSport.GetStatusTriState(status));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -145,7 +145,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
|||||||
if (errField.SportIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.SportIdPrimary))
|
if (errField.SportIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.SportIdPrimary))
|
||||||
{
|
{
|
||||||
SaxSport.Params prmSport = new SaxSport.Params();
|
SaxSport.Params prmSport = new SaxSport.Params();
|
||||||
prmSport.IncludedIds.Add(data.SportIdPrimary);
|
prmSport.IdsIncluded.Add(data.SportIdPrimary);
|
||||||
prmSport.StatusCat = SaxSport.StatusCat.ActiveOnly;
|
prmSport.StatusCat = SaxSport.StatusCat.ActiveOnly;
|
||||||
if (ReferenceMgr.GetSportCount(prmSport) < 1)
|
if (ReferenceMgr.GetSportCount(prmSport) < 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,241 @@
|
|||||||
|
using Sarand.Net.Standard.Base.App;
|
||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
|
using Sarand.Net.Standard.Base.Core;
|
||||||
|
using Sarand.Net.Standard.Base.Dbas;
|
||||||
|
using Sarand.Net.Standard.Base.Utils;
|
||||||
|
using Saxonite.Base.App;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Standard.Base.Mgr
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
partial class SaxActivityMgr
|
||||||
|
{
|
||||||
|
//*******************************************************************
|
||||||
|
// Activity Mgr - Organisation Opportunity
|
||||||
|
//*******************************************************************
|
||||||
|
// Utilities.
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Create item.
|
||||||
|
public abstract SaxOrganisationOpportunity CreateOrganisationOpportunity(SysId organisationId);
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Item exists.
|
||||||
|
public bool OrganisationOpportunityExistsById(SysId id)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
if (!SysId.IsValid(id)) return false;
|
||||||
|
SaxOrganisationOpportunity.Params prmOrganisationOpportunity = new SaxOrganisationOpportunity.Params();
|
||||||
|
prmOrganisationOpportunity.IdsIncluded.Add(id);
|
||||||
|
prmOrganisationOpportunity.StatusCat = SaxOrganisationOpportunity.StatusCat.Any;
|
||||||
|
return GetOrganisationOpportunityCount(prmOrganisationOpportunity) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Retrieve individual items.
|
||||||
|
public abstract SaxOrganisationOpportunity GetOrganisationOpportunity(SaxOrganisationOpportunity.Params prmOrganisationOpportunity);
|
||||||
|
public SaxOrganisationOpportunity GetOrganisationOpportunityById(SysId id)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
if (!SysId.IsValid(id)) return null;
|
||||||
|
SaxOrganisationOpportunity.Params prmOrganisationOpportunity = new SaxOrganisationOpportunity.Params();
|
||||||
|
prmOrganisationOpportunity.IdsIncluded.Add(id);
|
||||||
|
prmOrganisationOpportunity.StatusCat = SaxOrganisationOpportunity.StatusCat.Any;
|
||||||
|
return GetOrganisationOpportunity(prmOrganisationOpportunity);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Validate item data.
|
||||||
|
public bool IsValidOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
if (organisationOpportunity == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||||
|
return IsValidOrganisationOpportunityData(organisationOpportunity.GetData(), new SaxOrganisationOpportunity.ErrField());
|
||||||
|
}
|
||||||
|
public virtual bool IsValidOrganisationOpportunityData(SaxOrganisationOpportunity.Data data, SaxOrganisationOpportunity.ErrField errField)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
|
||||||
|
// Organisation.
|
||||||
|
if (errField.OrganisationId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.OrganisationId))
|
||||||
|
{
|
||||||
|
errField.OrganisationId = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState("Organisation must be specified");
|
||||||
|
}
|
||||||
|
// Primary Region.
|
||||||
|
if (errField.RegionIdPrimary != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.RegionIdPrimary))
|
||||||
|
{
|
||||||
|
errField.RegionIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState("Region must be specified");
|
||||||
|
}
|
||||||
|
// Primary Sport.
|
||||||
|
if (errField.SportIdPrimary != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.SportIdPrimary))
|
||||||
|
{
|
||||||
|
errField.SportIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState("Sport must be specified");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opportunity type.
|
||||||
|
if (errField.OpportunityType != SacsHierarchyItem.ValidValue.Ignore && data.OpportunityType <= 0)
|
||||||
|
{
|
||||||
|
errField.Position = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState("Opportunity type must be specified.");
|
||||||
|
}
|
||||||
|
// Position.
|
||||||
|
if (errField.Position != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Position, "position", (long)SaxDbDfn.GetColTextLen(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position), true))
|
||||||
|
{
|
||||||
|
errField.Position = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Summary.
|
||||||
|
if (errField.Outline != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Outline, "outline", (long)SaxDbDfn.GetColTextLen(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline), true))
|
||||||
|
{
|
||||||
|
errField.Outline = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Common properties.
|
||||||
|
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn.GetColTextLen(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Notes)))
|
||||||
|
{
|
||||||
|
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||||
|
{
|
||||||
|
if (!IsValidValue(data.StatusCode, "status", (long)SaxDbDfn.GetColTextLen(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status), true, true))
|
||||||
|
{
|
||||||
|
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!SaxOrganisationOpportunity.ValidStatuses.Contains(data.Status))
|
||||||
|
{
|
||||||
|
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Associated data.
|
||||||
|
|
||||||
|
// Organisation.
|
||||||
|
if (errField.OrganisationId != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.OrganisationId))
|
||||||
|
{
|
||||||
|
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||||
|
prmOrganisation.IdsIncluded.Add(data.OrganisationId);
|
||||||
|
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.ActiveOnly;
|
||||||
|
if (AccountMgr.GetOrganisationCount(prmOrganisation) < 1)
|
||||||
|
{
|
||||||
|
errField.OrganisationId = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState("Invalid organisation specified");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Primary Region.
|
||||||
|
if (errField.RegionIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.RegionIdPrimary))
|
||||||
|
{
|
||||||
|
SaxRegion.Params prmRegion = new SaxRegion.Params();
|
||||||
|
prmRegion.IdsIncluded.Add(data.RegionIdPrimary);
|
||||||
|
prmRegion.StatusCat = SaxRegion.StatusCat.ActiveOnly;
|
||||||
|
if (ReferenceMgr.GetRegionCount(prmRegion) < 1)
|
||||||
|
{
|
||||||
|
errField.RegionIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState("Invalid region specified");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Primary Sport.
|
||||||
|
if (errField.SportIdPrimary != SacsHierarchyItem.ValidValue.Ignore && SysId.IsValid(data.SportIdPrimary))
|
||||||
|
{
|
||||||
|
SaxSport.Params prmSport = new SaxSport.Params();
|
||||||
|
prmSport.IdsIncluded.Add(data.SportIdPrimary);
|
||||||
|
prmSport.StatusCat = SaxSport.StatusCat.ActiveOnly;
|
||||||
|
if (ReferenceMgr.GetSportCount(prmSport) < 1)
|
||||||
|
{
|
||||||
|
errField.SportIdPrimary = SacsHierarchyItem.ValidValue.Invalid;
|
||||||
|
return SetErrorState("Invalid sport specified");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// OrganisationOpportunity database interface.
|
||||||
|
public abstract bool InsertOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo);
|
||||||
|
public abstract bool UpdateOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo);
|
||||||
|
public virtual bool OrganisationOpportunityCanBeDeleted(SaxOrganisationOpportunity organisationOpportunity)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public abstract bool DeleteOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo);
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// OrganisationOpportunity list:
|
||||||
|
public abstract ColumnDfn GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column columnId, String caption = "", int width = 0);
|
||||||
|
public abstract List<String> GetOrganisationOpportunityQueryFilter(SaxOrganisationOpportunity.Params prmOrganisationOpportunity);
|
||||||
|
public abstract long GetOrganisationOpportunityCount(SaxOrganisationOpportunity.Params prmOrganisationOpportunity);
|
||||||
|
public abstract List<SaxOrganisationOpportunity> GetOrganisationOpportunityList(SaxOrganisationOpportunity.Params prmOrganisationOpportunity);
|
||||||
|
public abstract DbResultSet ExecuteOrganisationOpportunityQuery(List<ColumnDfn> columns, SaxOrganisationOpportunity.Params prmOrganisationOpportunity);
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
/// <summary>
|
||||||
|
/// Extract and format result set data value where specific handling is required.
|
||||||
|
/// <para>Where response is an invalid data value, format value using column.FormatValue(values).</para>
|
||||||
|
/// </summary>
|
||||||
|
public virtual DataValue GetOrganisationOpportunityDataValue(ColumnDfn column, NamedValue.Map values)
|
||||||
|
{
|
||||||
|
DataValue value = new DataValue();
|
||||||
|
switch ((SaxOrganisationOpportunity.Column)column.Id)
|
||||||
|
{
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Opportunity type desc.
|
||||||
|
case SaxOrganisationOpportunity.Column.OpportunityType_Desc:
|
||||||
|
{
|
||||||
|
String code = values.GetValue(column.DataName).ToString();
|
||||||
|
value = new DataValue(OpportunityTypes.GetDescForCode(code, code));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Summary - limit to 200 chars.
|
||||||
|
case SaxOrganisationOpportunity.Column.Outline:
|
||||||
|
{
|
||||||
|
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Notes - limit to 200 chars.
|
||||||
|
case SaxOrganisationOpportunity.Column.Notes:
|
||||||
|
{
|
||||||
|
value = new DataValue(SacsHierarchyItem.FormatForDisplay(values.GetValue(column.DataName).ToString(), 200));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Status.
|
||||||
|
case SaxOrganisationOpportunity.Column.Status_Desc:
|
||||||
|
case SaxOrganisationOpportunity.Column.Status_Ind:
|
||||||
|
{
|
||||||
|
String statusCode = values.GetValue(column.DataName).ToString();
|
||||||
|
SaStatus status = SacsSystem.GetStatusForCode(statusCode);
|
||||||
|
if (column.Id == (int)SaxOrganisationOpportunity.Column.Status_Desc)
|
||||||
|
value = new DataValue(SacsSystem.GetStatusDesc(status));
|
||||||
|
else if (column.Id == (int)SaxOrganisationOpportunity.Column.Status_Ind)
|
||||||
|
value = new DataValue(SaxOrganisationOpportunity.GetStatusTriState(status));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -44,6 +44,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
|||||||
public List<TypeCodeDesc> OrganisationTypes { get { return Internals.OrganisationTypes; } }
|
public List<TypeCodeDesc> OrganisationTypes { get { return Internals.OrganisationTypes; } }
|
||||||
public List<TypeCodeDesc> OrganisationCategories { get { return Internals.OrganisationCategories; } }
|
public List<TypeCodeDesc> OrganisationCategories { get { return Internals.OrganisationCategories; } }
|
||||||
public List<TypeCodeDesc> OrganisationRoles { get { return Internals.OrganisationRoles; } }
|
public List<TypeCodeDesc> OrganisationRoles { get { return Internals.OrganisationRoles; } }
|
||||||
|
public List<TypeCodeDesc> OpportunityTypes { get { return Internals.OpportunityTypes; } }
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
|||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!SysId.IsValid(id)) return false;
|
if (!SysId.IsValid(id)) return false;
|
||||||
SaxSport.Params prmSport = new SaxSport.Params();
|
SaxSport.Params prmSport = new SaxSport.Params();
|
||||||
prmSport.IncludedIds.Add(id);
|
prmSport.IdsIncluded.Add(id);
|
||||||
prmSport.StatusCat = SaxSport.StatusCat.Any;
|
prmSport.StatusCat = SaxSport.StatusCat.Any;
|
||||||
return GetSportCount(prmSport) == 1;
|
return GetSportCount(prmSport) == 1;
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
|||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
if (!SysId.IsValid(id)) return null;
|
if (!SysId.IsValid(id)) return null;
|
||||||
SaxSport.Params prmSport = new SaxSport.Params();
|
SaxSport.Params prmSport = new SaxSport.Params();
|
||||||
prmSport.IncludedIds.Add(id);
|
prmSport.IdsIncluded.Add(id);
|
||||||
prmSport.StatusCat = SaxSport.StatusCat.Any;
|
prmSport.StatusCat = SaxSport.StatusCat.Any;
|
||||||
return GetSport(prmSport);
|
return GetSport(prmSport);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
|
using Sarand.Net.Standard.Base.Dbas;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Standard.Dbas.Bus
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
public class SaxOrganisationOpportunity_Dbas : SaxOrganisationOpportunity
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Data members.
|
||||||
|
private ISacsDatabase database;
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Construction.
|
||||||
|
public SaxOrganisationOpportunity_Dbas(ISacsDatabase database, SysId id, SysId organisationId, UInt16 flags) :
|
||||||
|
base(id, organisationId)
|
||||||
|
{
|
||||||
|
this.database = database;
|
||||||
|
Flags = flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Associated data.
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using Sarand.Net.Standard.Base.Bus;
|
||||||
|
using Sarand.Net.Standard.Base.Dbas;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Standard.Dbas.Bus
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
public class SaxUserSport_Dbas : SaxUserSport
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Data members.
|
||||||
|
private ISacsDatabase database;
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Construction.
|
||||||
|
public SaxUserSport_Dbas(ISacsDatabase database, SysId id, SysId userAccountId, SysId sportId, UInt16 flags) :
|
||||||
|
base(id, userAccountId, sportId)
|
||||||
|
{
|
||||||
|
this.database = database;
|
||||||
|
Flags = flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Associated data.
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Code generated by Sarand Database Utilities Mon 10-May-2021 16:59:32
|
// Code generated by Sarand Database Utilities Thu 20-May-2021 17:19:55
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Code generated by Sarand Database Utilities Mon 10-May-2021 16:59:32
|
// Code generated by Sarand Database Utilities Thu 20-May-2021 17:19:55
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Code generated by Sarand Database Utilities Mon 10-May-2021 16:59:32
|
// Code generated by Sarand Database Utilities Thu 20-May-2021 17:19:55
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||||
{
|
{
|
||||||
@@ -23,6 +23,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
|||||||
public ColumnDataInt32 _OrganisationId { get; } = new ColumnDataInt32("OrganisationId");
|
public ColumnDataInt32 _OrganisationId { get; } = new ColumnDataInt32("OrganisationId");
|
||||||
public ColumnDataInt32 _RegionIdPrimary { get; } = new ColumnDataInt32("RegionIdPrimary");
|
public ColumnDataInt32 _RegionIdPrimary { get; } = new ColumnDataInt32("RegionIdPrimary");
|
||||||
public ColumnDataInt32 _SportIdPrimary { get; } = new ColumnDataInt32("SportIdPrimary");
|
public ColumnDataInt32 _SportIdPrimary { get; } = new ColumnDataInt32("SportIdPrimary");
|
||||||
|
public ColumnDataString _OpportunityTypeCode { get; } = new ColumnDataString("OpportunityTypeCode");
|
||||||
public ColumnDataString _Position { get; } = new ColumnDataString("Position");
|
public ColumnDataString _Position { get; } = new ColumnDataString("Position");
|
||||||
public ColumnDataString _Outline { get; } = new ColumnDataString("Outline");
|
public ColumnDataString _Outline { get; } = new ColumnDataString("Outline");
|
||||||
public ColumnDataString _OpportunityData { get; } = new ColumnDataString("OpportunityData");
|
public ColumnDataString _OpportunityData { get; } = new ColumnDataString("OpportunityData");
|
||||||
@@ -47,6 +48,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
|||||||
"OrganisationId",
|
"OrganisationId",
|
||||||
"RegionIdPrimary",
|
"RegionIdPrimary",
|
||||||
"SportIdPrimary",
|
"SportIdPrimary",
|
||||||
|
"OpportunityTypeCode",
|
||||||
"Position",
|
"Position",
|
||||||
"Outline",
|
"Outline",
|
||||||
"OpportunityData",
|
"OpportunityData",
|
||||||
@@ -97,6 +99,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
|||||||
public Int32 _OrganisationId { get { return Cols._OrganisationId.Value; } set { Cols._OrganisationId.Value = value; } }
|
public Int32 _OrganisationId { get { return Cols._OrganisationId.Value; } set { Cols._OrganisationId.Value = value; } }
|
||||||
public Int32 _RegionIdPrimary { get { return Cols._RegionIdPrimary.Value; } set { Cols._RegionIdPrimary.Value = value; } }
|
public Int32 _RegionIdPrimary { get { return Cols._RegionIdPrimary.Value; } set { Cols._RegionIdPrimary.Value = value; } }
|
||||||
public Int32 _SportIdPrimary { get { return Cols._SportIdPrimary.Value; } set { Cols._SportIdPrimary.Value = value; } }
|
public Int32 _SportIdPrimary { get { return Cols._SportIdPrimary.Value; } set { Cols._SportIdPrimary.Value = value; } }
|
||||||
|
public String _OpportunityTypeCode { get { return Cols._OpportunityTypeCode.Value; } set { Cols._OpportunityTypeCode.Value = value; } }
|
||||||
public String _Position { get { return Cols._Position.Value; } set { Cols._Position.Value = value; } }
|
public String _Position { get { return Cols._Position.Value; } set { Cols._Position.Value = value; } }
|
||||||
public String _Outline { get { return Cols._Outline.Value; } set { Cols._Outline.Value = value; } }
|
public String _Outline { get { return Cols._Outline.Value; } set { Cols._Outline.Value = value; } }
|
||||||
public String _OpportunityData { get { return Cols._OpportunityData.Value; } set { Cols._OpportunityData.Value = value; } }
|
public String _OpportunityData { get { return Cols._OpportunityData.Value; } set { Cols._OpportunityData.Value = value; } }
|
||||||
@@ -136,6 +139,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
|||||||
_OrganisationId = GetFieldInt32(dbDataReader, "OrganisationId", _OrganisationId);
|
_OrganisationId = GetFieldInt32(dbDataReader, "OrganisationId", _OrganisationId);
|
||||||
_RegionIdPrimary = GetFieldInt32(dbDataReader, "RegionIdPrimary", _RegionIdPrimary);
|
_RegionIdPrimary = GetFieldInt32(dbDataReader, "RegionIdPrimary", _RegionIdPrimary);
|
||||||
_SportIdPrimary = GetFieldInt32(dbDataReader, "SportIdPrimary", _SportIdPrimary);
|
_SportIdPrimary = GetFieldInt32(dbDataReader, "SportIdPrimary", _SportIdPrimary);
|
||||||
|
_OpportunityTypeCode = GetFieldString(dbDataReader, "OpportunityTypeCode", _OpportunityTypeCode);
|
||||||
_Position = GetFieldString(dbDataReader, "Position", _Position);
|
_Position = GetFieldString(dbDataReader, "Position", _Position);
|
||||||
_Outline = GetFieldString(dbDataReader, "Outline", _Outline);
|
_Outline = GetFieldString(dbDataReader, "Outline", _Outline);
|
||||||
_OpportunityData = GetFieldString(dbDataReader, "OpportunityData", _OpportunityData);
|
_OpportunityData = GetFieldString(dbDataReader, "OpportunityData", _OpportunityData);
|
||||||
@@ -174,6 +178,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
|||||||
if (columnNames.ContainsCI("OrganisationId")) AddCommandParameter(dbCommand, "@OrganisationId", _OrganisationId);
|
if (columnNames.ContainsCI("OrganisationId")) AddCommandParameter(dbCommand, "@OrganisationId", _OrganisationId);
|
||||||
if (columnNames.ContainsCI("RegionIdPrimary")) AddCommandParameter(dbCommand, "@RegionIdPrimary", _RegionIdPrimary);
|
if (columnNames.ContainsCI("RegionIdPrimary")) AddCommandParameter(dbCommand, "@RegionIdPrimary", _RegionIdPrimary);
|
||||||
if (columnNames.ContainsCI("SportIdPrimary")) AddCommandParameter(dbCommand, "@SportIdPrimary", _SportIdPrimary);
|
if (columnNames.ContainsCI("SportIdPrimary")) AddCommandParameter(dbCommand, "@SportIdPrimary", _SportIdPrimary);
|
||||||
|
if (columnNames.ContainsCI("OpportunityTypeCode")) AddCommandParameter(dbCommand, "@OpportunityTypeCode", _OpportunityTypeCode);
|
||||||
if (columnNames.ContainsCI("Position")) AddCommandParameter(dbCommand, "@Position", _Position);
|
if (columnNames.ContainsCI("Position")) AddCommandParameter(dbCommand, "@Position", _Position);
|
||||||
if (columnNames.ContainsCI("Outline")) AddCommandParameter(dbCommand, "@Outline", _Outline);
|
if (columnNames.ContainsCI("Outline")) AddCommandParameter(dbCommand, "@Outline", _Outline);
|
||||||
if (columnNames.ContainsCI("OpportunityData")) AddCommandParameter(dbCommand, "@OpportunityData", _OpportunityData);
|
if (columnNames.ContainsCI("OpportunityData")) AddCommandParameter(dbCommand, "@OpportunityData", _OpportunityData);
|
||||||
@@ -227,6 +232,7 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
|||||||
if (columnNames.ContainsCI("OrganisationId")) AddCommandParameter(dbCommand, "@OrganisationId", _OrganisationId);
|
if (columnNames.ContainsCI("OrganisationId")) AddCommandParameter(dbCommand, "@OrganisationId", _OrganisationId);
|
||||||
if (columnNames.ContainsCI("RegionIdPrimary")) AddCommandParameter(dbCommand, "@RegionIdPrimary", _RegionIdPrimary);
|
if (columnNames.ContainsCI("RegionIdPrimary")) AddCommandParameter(dbCommand, "@RegionIdPrimary", _RegionIdPrimary);
|
||||||
if (columnNames.ContainsCI("SportIdPrimary")) AddCommandParameter(dbCommand, "@SportIdPrimary", _SportIdPrimary);
|
if (columnNames.ContainsCI("SportIdPrimary")) AddCommandParameter(dbCommand, "@SportIdPrimary", _SportIdPrimary);
|
||||||
|
if (columnNames.ContainsCI("OpportunityTypeCode")) AddCommandParameter(dbCommand, "@OpportunityTypeCode", _OpportunityTypeCode);
|
||||||
if (columnNames.ContainsCI("Position")) AddCommandParameter(dbCommand, "@Position", _Position);
|
if (columnNames.ContainsCI("Position")) AddCommandParameter(dbCommand, "@Position", _Position);
|
||||||
if (columnNames.ContainsCI("Outline")) AddCommandParameter(dbCommand, "@Outline", _Outline);
|
if (columnNames.ContainsCI("Outline")) AddCommandParameter(dbCommand, "@Outline", _Outline);
|
||||||
if (columnNames.ContainsCI("OpportunityData")) AddCommandParameter(dbCommand, "@OpportunityData", _OpportunityData);
|
if (columnNames.ContainsCI("OpportunityData")) AddCommandParameter(dbCommand, "@OpportunityData", _OpportunityData);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Code generated by Sarand Database Utilities Mon 10-May-2021 16:59:32
|
// Code generated by Sarand Database Utilities Thu 20-May-2021 17:19:55
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Code generated by Sarand Database Utilities Mon 10-May-2021 16:59:32
|
// Code generated by Sarand Database Utilities Thu 20-May-2021 17:19:55
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Code generated by Sarand Database Utilities Mon 10-May-2021 16:59:32
|
// Code generated by Sarand Database Utilities Thu 20-May-2021 17:19:55
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Code generated by Sarand Database Utilities Mon 10-May-2021 16:59:32
|
// Code generated by Sarand Database Utilities Thu 20-May-2021 17:19:55
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Code generated by Sarand Database Utilities Mon 10-May-2021 16:59:32
|
// Code generated by Sarand Database Utilities Thu 20-May-2021 17:19:55
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Code generated by Sarand Database Utilities Mon 10-May-2021 16:59:32
|
// Code generated by Sarand Database Utilities Thu 20-May-2021 17:19:55
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,218 @@
|
|||||||
|
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 Thu 20-May-2021 17:19:55
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||||
|
{
|
||||||
|
internal class UserSport_Db : SaxDbDataItem
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Column definitions.
|
||||||
|
public class ColumnsData
|
||||||
|
{
|
||||||
|
public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id", true);
|
||||||
|
public ColumnDataInt32 _UserAccountId { get; } = new ColumnDataInt32("UserAccountId");
|
||||||
|
public ColumnDataInt32 _SportId { get; } = new ColumnDataInt32("SportId");
|
||||||
|
public ColumnDataString _UserSportData { get; } = new ColumnDataString("UserSportData");
|
||||||
|
public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
|
||||||
|
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
|
||||||
|
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
|
||||||
|
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
|
||||||
|
public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
|
||||||
|
public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
|
||||||
|
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
|
||||||
|
public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
|
||||||
|
public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Data members.
|
||||||
|
protected static List<String> fields { get; } = new List<String>()
|
||||||
|
{
|
||||||
|
"Id",
|
||||||
|
"UserAccountId",
|
||||||
|
"SportId",
|
||||||
|
"UserSportData",
|
||||||
|
"Notes",
|
||||||
|
"Flags",
|
||||||
|
"Status",
|
||||||
|
"CreateOn",
|
||||||
|
"CreateBy",
|
||||||
|
"CreateHost",
|
||||||
|
"UpdateOn",
|
||||||
|
"UpdateBy",
|
||||||
|
"UpdateHost",
|
||||||
|
};
|
||||||
|
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 UserSport_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Properties.
|
||||||
|
public override String SchemaName { get; } = "dbo";
|
||||||
|
public override String TableName { get; } = "UserSport";
|
||||||
|
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 Int32 _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 Int32 _SportId { get { return Cols._SportId.Value; } set { Cols._SportId.Value = value; } }
|
||||||
|
public String _UserSportData { get { return Cols._UserSportData.Value; } set { Cols._UserSportData.Value = value; } }
|
||||||
|
public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
|
||||||
|
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
|
||||||
|
public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
|
||||||
|
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
|
||||||
|
public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
|
||||||
|
public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
|
||||||
|
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
|
||||||
|
public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
|
||||||
|
public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.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 = GetFieldInt32(dbDataReader, "Id", _Id);
|
||||||
|
_UserAccountId = GetFieldInt32(dbDataReader, "UserAccountId", _UserAccountId);
|
||||||
|
_SportId = GetFieldInt32(dbDataReader, "SportId", _SportId);
|
||||||
|
_UserSportData = GetFieldString(dbDataReader, "UserSportData", _UserSportData);
|
||||||
|
_Notes = GetFieldString(dbDataReader, "Notes", _Notes);
|
||||||
|
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
|
||||||
|
_Status = GetFieldString(dbDataReader, "Status", _Status);
|
||||||
|
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
|
||||||
|
_CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
|
||||||
|
_CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
|
||||||
|
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
|
||||||
|
_UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
|
||||||
|
_UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// 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("SportId")) AddCommandParameter(dbCommand, "@SportId", _SportId);
|
||||||
|
if (columnNames.ContainsCI("UserSportData")) AddCommandParameter(dbCommand, "@UserSportData", _UserSportData);
|
||||||
|
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||||
|
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||||
|
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||||
|
if (columnNames.ContainsCI("CreateOn")) AddCommandParameter(dbCommand, "@CreateOn", _CreateOn);
|
||||||
|
if (columnNames.ContainsCI("CreateBy")) AddCommandParameter(dbCommand, "@CreateBy", _CreateBy);
|
||||||
|
if (columnNames.ContainsCI("CreateHost")) AddCommandParameter(dbCommand, "@CreateHost", _CreateHost);
|
||||||
|
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||||
|
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||||
|
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||||
|
// Execute insert command.
|
||||||
|
bool commandSuccess = false;
|
||||||
|
int executeNonQuery = dbCommand.ExecuteNonQuery();
|
||||||
|
if (executeNonQuery == 1)
|
||||||
|
{
|
||||||
|
dbCommand.CommandText = "SELECT Max(Id) FROM " + TableNameFmt + ";";
|
||||||
|
_Id = (Int32)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("SportId")) AddCommandParameter(dbCommand, "@SportId", _SportId);
|
||||||
|
if (columnNames.ContainsCI("UserSportData")) AddCommandParameter(dbCommand, "@UserSportData", _UserSportData);
|
||||||
|
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||||
|
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||||
|
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||||
|
if (columnNames.ContainsCI("UpdateOn")) AddCommandParameter(dbCommand, "@UpdateOn", _UpdateOn);
|
||||||
|
if (columnNames.ContainsCI("UpdateBy")) AddCommandParameter(dbCommand, "@UpdateBy", _UpdateBy);
|
||||||
|
if (columnNames.ContainsCI("UpdateHost")) AddCommandParameter(dbCommand, "@UpdateHost", _UpdateHost);
|
||||||
|
AddCommandParameter(dbCommand, "@Id", _Id);
|
||||||
|
int executeNonQueryResult = dbCommand.ExecuteNonQuery();
|
||||||
|
return (executeNonQueryResult == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -239,15 +239,15 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
|||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Item column definitions.
|
// Item column definitions.
|
||||||
private static readonly String aliasUserOrganisation = "UsrRol";
|
private static readonly String aliasUserOrganisation = "UsrOrg";
|
||||||
private static readonly String aliasUserOrganisation_UserAccount = "UsrRol_Usr";
|
private static readonly String aliasUserOrganisation_UserAccount = "UsrOrg_Usr";
|
||||||
private static readonly String prefixUserOrganisation_UserAccount = "UsrRol_Usr_";
|
private static readonly String prefixUserOrganisation_UserAccount = "UsrOrg_Usr_";
|
||||||
private static readonly String aliasUserOrganisation_Organisation = "UsrRol_Org";
|
private static readonly String aliasUserOrganisation_Organisation = "UsrOrg_Org";
|
||||||
private static readonly String prefixUserOrganisation_Organisation = "UsrRol_Org_";
|
private static readonly String prefixUserOrganisation_Organisation = "UsrOrg_Org_";
|
||||||
private static readonly String aliasUserOrganisation_Organisation_Region = "UsrRol_Org_Rgn";
|
private static readonly String aliasUserOrganisation_Organisation_Region = "UsrOrg_Org_Rgn";
|
||||||
private static readonly String prefixUserOrganisation_Organisation_Region = "UsrRol_Org_Rgn_";
|
private static readonly String prefixUserOrganisation_Organisation_Region = "UsrOrg_Org_Rgn_";
|
||||||
private static readonly String aliasUserOrganisation_Organisation_Sport = "UsrRol_Org_Spt";
|
private static readonly String aliasUserOrganisation_Organisation_Sport = "UsrOrg_Org_Spt";
|
||||||
private static readonly String prefixUserOrganisation_Organisation_Sport = "UsrRol_Org_Spt_";
|
private static readonly String prefixUserOrganisation_Organisation_Sport = "UsrOrg_Org_Spt_";
|
||||||
private void SetUserOrganisationColDfn
|
private void SetUserOrganisationColDfn
|
||||||
(ColumnDfn col, String caption, int width, SaxDbDfn.ColumnIdx dbCol,
|
(ColumnDfn col, String caption, int width, SaxDbDfn.ColumnIdx dbCol,
|
||||||
ColumnAlignment align = ColumnAlignment.Default, DataValue.DataType dataType = DataValue.DataType.String,
|
ColumnAlignment align = ColumnAlignment.Default, DataValue.DataType dataType = DataValue.DataType.String,
|
||||||
@@ -328,10 +328,18 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
|||||||
SetUserOrganisationColDfn(columnDfn, "Organisation", 160, SaxDbDfn.ColumnIdx.Organisation_Name, ColumnAlignment.Left, DataValue.DataType.String, aliasUserOrganisation_Organisation, prefixUserOrganisation_Organisation);
|
SetUserOrganisationColDfn(columnDfn, "Organisation", 160, SaxDbDfn.ColumnIdx.Organisation_Name, ColumnAlignment.Left, DataValue.DataType.String, aliasUserOrganisation_Organisation, prefixUserOrganisation_Organisation);
|
||||||
columnDfn.ReadOnly = true;
|
columnDfn.ReadOnly = true;
|
||||||
break;
|
break;
|
||||||
|
case SaxUserOrganisation.Column.Organisation_RegionId:
|
||||||
|
SetUserOrganisationColDfn(columnDfn, "Organisation region Id", 80, SaxDbDfn.ColumnIdx.Organisation_RegionIdPrimary, ColumnAlignment.Right, DataValue.DataType.Long, aliasUserOrganisation_Organisation, prefixUserOrganisation_Organisation);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
case SaxUserOrganisation.Column.Organisation_Region_Name:
|
case SaxUserOrganisation.Column.Organisation_Region_Name:
|
||||||
SetUserOrganisationColDfn(columnDfn, "Organisation region", 160, SaxDbDfn.ColumnIdx.Region_Name, ColumnAlignment.Left, DataValue.DataType.String, aliasUserOrganisation_Organisation_Region, prefixUserOrganisation_Organisation_Region);
|
SetUserOrganisationColDfn(columnDfn, "Organisation region", 160, SaxDbDfn.ColumnIdx.Region_Name, ColumnAlignment.Left, DataValue.DataType.String, aliasUserOrganisation_Organisation_Region, prefixUserOrganisation_Organisation_Region);
|
||||||
columnDfn.ReadOnly = true;
|
columnDfn.ReadOnly = true;
|
||||||
break;
|
break;
|
||||||
|
case SaxUserOrganisation.Column.Organisation_SportId:
|
||||||
|
SetUserOrganisationColDfn(columnDfn, "Organisation sport Id", 80, SaxDbDfn.ColumnIdx.Organisation_SportIdPrimary, ColumnAlignment.Right, DataValue.DataType.Long, aliasUserOrganisation_Organisation, prefixUserOrganisation_Organisation);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
case SaxUserOrganisation.Column.Organisation_Sport_Name:
|
case SaxUserOrganisation.Column.Organisation_Sport_Name:
|
||||||
SetUserOrganisationColDfn(columnDfn, "Organisation sport", 160, SaxDbDfn.ColumnIdx.Sport_Name, ColumnAlignment.Left, DataValue.DataType.String, aliasUserOrganisation_Organisation_Sport, prefixUserOrganisation_Organisation_Sport);
|
SetUserOrganisationColDfn(columnDfn, "Organisation sport", 160, SaxDbDfn.ColumnIdx.Sport_Name, ColumnAlignment.Left, DataValue.DataType.String, aliasUserOrganisation_Organisation_Sport, prefixUserOrganisation_Organisation_Sport);
|
||||||
columnDfn.ReadOnly = true;
|
columnDfn.ReadOnly = true;
|
||||||
@@ -402,6 +410,16 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
|||||||
// Organisation roles.
|
// Organisation roles.
|
||||||
if (prm.OrganisationMembersOnly)
|
if (prm.OrganisationMembersOnly)
|
||||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserOrganisation_OrganisationRoleCount, aliasUserOrganisation) + ">0");
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserOrganisation_OrganisationRoleCount, aliasUserOrganisation) + ">0");
|
||||||
|
if (!prm.OrganisationRoles.IsEmpty())
|
||||||
|
{
|
||||||
|
List<String> organisationRoleCodes = new List<string>();
|
||||||
|
foreach (Sax.OrganisationRole organisationRole in prm.OrganisationRoles)
|
||||||
|
{
|
||||||
|
String organisationRoleCode = OrganisationRoles.GetCodeForType(organisationRole).TrimAll();
|
||||||
|
if (!StringUtil.IsEmpty(organisationRoleCode))
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserOrganisation_OrganisationRoleCodes, aliasUserOrganisation) + " LIKE '%" + DbQuery.FormatForLike(organisationRoleCode) + "%'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Notes.
|
// Notes.
|
||||||
if (!StringUtil.IsEmpty(prm.NotesPartial))
|
if (!StringUtil.IsEmpty(prm.NotesPartial))
|
||||||
@@ -517,7 +535,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
|||||||
bool hasUserAccountCols = (columns.HasId(SaxUserOrganisation.Column.User_EmailAddress) || columns.HasId(SaxUserOrganisation.Column.User_DisplayName) || columns.HasId(SaxUserOrganisation.Column.User_Title) || columns.HasId(SaxUserOrganisation.Column.User_FirstName) || columns.HasId(SaxUserOrganisation.Column.User_LastName));
|
bool hasUserAccountCols = (columns.HasId(SaxUserOrganisation.Column.User_EmailAddress) || columns.HasId(SaxUserOrganisation.Column.User_DisplayName) || columns.HasId(SaxUserOrganisation.Column.User_Title) || columns.HasId(SaxUserOrganisation.Column.User_FirstName) || columns.HasId(SaxUserOrganisation.Column.User_LastName));
|
||||||
if (columns.HasId(SaxUserOrganisation.Column.UserAccountId) || hasUserAccountCols)
|
if (columns.HasId(SaxUserOrganisation.Column.UserAccountId) || hasUserAccountCols)
|
||||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserOrganisation_UserAccountId, aliasUserOrganisation));
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserOrganisation_UserAccountId, aliasUserOrganisation));
|
||||||
bool hasOrganisationCols = (columns.HasId(SaxUserOrganisation.Column.Organisation_Name));
|
bool hasOrganisationCols = (columns.HasId(SaxUserOrganisation.Column.Organisation_Name) || columns.HasId(SaxUserOrganisation.Column.Organisation_RegionId) || columns.HasId(SaxUserOrganisation.Column.Organisation_SportId));
|
||||||
bool hasOrganisationRegionCols = (columns.HasId(SaxUserOrganisation.Column.Organisation_Region_Name));
|
bool hasOrganisationRegionCols = (columns.HasId(SaxUserOrganisation.Column.Organisation_Region_Name));
|
||||||
bool hasOrganisationSportCols = (columns.HasId(SaxUserOrganisation.Column.Organisation_Sport_Name));
|
bool hasOrganisationSportCols = (columns.HasId(SaxUserOrganisation.Column.Organisation_Sport_Name));
|
||||||
if (columns.HasId(SaxUserOrganisation.Column.OrganisationId) || hasOrganisationCols || hasOrganisationRegionCols || hasOrganisationSportCols)
|
if (columns.HasId(SaxUserOrganisation.Column.OrganisationId) || hasOrganisationCols || hasOrganisationRegionCols || hasOrganisationSportCols)
|
||||||
@@ -565,6 +583,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
|||||||
query.Joins.Add(joinOrganisation);
|
query.Joins.Add(joinOrganisation);
|
||||||
List<SaxDbDfn.ColumnIdx> OrganisationCols = new List<SaxDbDfn.ColumnIdx>();
|
List<SaxDbDfn.ColumnIdx> OrganisationCols = new List<SaxDbDfn.ColumnIdx>();
|
||||||
OrganisationCols.Add(SaxDbDfn.ColumnIdx.Organisation_Name);
|
OrganisationCols.Add(SaxDbDfn.ColumnIdx.Organisation_Name);
|
||||||
|
OrganisationCols.Add(SaxDbDfn.ColumnIdx.Organisation_RegionIdPrimary);
|
||||||
|
OrganisationCols.Add(SaxDbDfn.ColumnIdx.Organisation_SportIdPrimary);
|
||||||
foreach (var col in OrganisationCols)
|
foreach (var col in OrganisationCols)
|
||||||
query.Columns.Add(SaxDbDfn.GetColumnNameQual(col, aliasUserOrganisation_Organisation), prefixUserOrganisation_Organisation + SaxDbDfn.GetColumnName(col, false));
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(col, aliasUserOrganisation_Organisation), prefixUserOrganisation_Organisation + SaxDbDfn.GetColumnName(col, false));
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,552 @@
|
|||||||
|
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 Sport
|
||||||
|
//*******************************************************************
|
||||||
|
// Utilities.
|
||||||
|
private List<StringPair> GetLogProperties(SaxUserSport userSport)
|
||||||
|
{
|
||||||
|
return new List<StringPair>()
|
||||||
|
{
|
||||||
|
new StringPair("Id",SysId.ToString(userSport.Id)),
|
||||||
|
new StringPair("UserAccountId",SysId.ToString(userSport.UserAccountId)),
|
||||||
|
new StringPair("SportId",SysId.ToString(userSport.SportId)),
|
||||||
|
new StringPair("Status",userSport.StatusCode)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Create item.
|
||||||
|
public override SaxUserSport CreateUserSport(SysId userAccountId, SysId sportId)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
return new SaxUserSport_Dbas(CoreDatabase, null, userAccountId, sportId, 0);
|
||||||
|
}
|
||||||
|
private SaxUserSport_Dbas CreateUserSport(UserSport_Db dbUserSport)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
SaxUserSport_Dbas userSport = new SaxUserSport_Dbas(CoreDatabase, new SysId(dbUserSport._Id), new SysId(dbUserSport._UserAccountId), new SysId(dbUserSport._SportId), (ushort)dbUserSport._Flags);
|
||||||
|
PopulateFrom(dbUserSport, userSport);
|
||||||
|
return userSport;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Get item.
|
||||||
|
public override SaxUserSport GetUserSport(SaxUserSport.Params prm)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
return GetUserSport(GetUserSportQueryFilter(prm).Concat(" And ", "(", ")"));
|
||||||
|
}
|
||||||
|
private SaxUserSport GetUserSport(String filter)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
long count = GetUserSportCount(filter);
|
||||||
|
if (count == 0) return null;
|
||||||
|
if (count != 1)
|
||||||
|
{
|
||||||
|
SetErrorState("Multiple items found");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
SaxUserSport userSport = null;
|
||||||
|
// Query data.
|
||||||
|
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||||
|
using (var dbCommand = dbConnection.CreateCommand())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbConnection.Open();
|
||||||
|
UserSport_Db dbUserSport = new UserSport_Db(CoreDbInfo);
|
||||||
|
dbUserSport.PopulateFrom(dbCommand, aliasUserSport, filter);
|
||||||
|
userSport = CreateUserSport(dbUserSport);
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
SetErrorState("Database query exception");
|
||||||
|
SaLogger.Warn(GetType().Name + ".GetUserSport\n\tQuery: " + dbCommand.CommandText + "\n\t" + exc.GetType().Name + ": " + exc.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return userSport;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Validate item.
|
||||||
|
public override bool IsValidUserSportData(SaxUserSport.Data data, SaxUserSport.ErrField errField)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
if (!base.IsValidUserSportData(data, errField)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Insert item.
|
||||||
|
public override bool InsertUserSport(SaxUserSport userSport, DbUpdateInfo dbUpdateInfo)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".InsertUserSport";
|
||||||
|
ClearErrorState();
|
||||||
|
if (!IsValidUserSport(userSport)) return false;
|
||||||
|
if (SysId.IsValid(userSport.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
|
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||||
|
using (var dbCommand = dbConnection.CreateCommand())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbConnection.Open();
|
||||||
|
UserSport_Db dbUserSport = new UserSport_Db(CoreDbInfo);
|
||||||
|
PopulateTo(dbUserSport, userSport, dbUpdateInfo);
|
||||||
|
if (UserSport_Db.FieldsNonId.Contains("Id"))
|
||||||
|
{
|
||||||
|
// Generate next Id.
|
||||||
|
dbUserSport._Id = CoreDatabase.GetNextIdFromTable("UserSport");
|
||||||
|
}
|
||||||
|
dbUserSport.ExecuteInsertCommand(dbCommand);
|
||||||
|
userSport.Id = new SysId(dbUserSport._Id);
|
||||||
|
userSport.Changed = false;
|
||||||
|
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(userSport).Concat(": ").Concat("", "\n\t"));
|
||||||
|
}
|
||||||
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
|
}
|
||||||
|
return !HasErrorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Update item.
|
||||||
|
public override bool UpdateUserSport(SaxUserSport userSport, DbUpdateInfo dbUpdateInfo)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".UpdateUserSport";
|
||||||
|
ClearErrorState();
|
||||||
|
if (!IsValidUserSport(userSport)) return false;
|
||||||
|
if (!SysId.IsValid(userSport.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
|
if (!userSport.Changed)
|
||||||
|
{
|
||||||
|
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(userSport).Concat(": ").Concat("", "\n\t"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||||
|
using (var dbCommand = dbConnection.CreateCommand())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Retrieve item.
|
||||||
|
dbConnection.Open();
|
||||||
|
UserSport_Db dbUserSport = new UserSport_Db(CoreDbInfo);
|
||||||
|
dbUserSport.PopulateFrom(dbCommand, aliasUserSport, "Id=" + SysId.ToString(userSport.Id));
|
||||||
|
// ToDo SaxUpdateLogItemMonitor_UserSport updateLogMonitor = new SaxUpdateLogItemMonitor_UserSport(SessionContext, CreateUserSport(dbUserSport), dbUpdateInfo);
|
||||||
|
// Update properties.
|
||||||
|
PopulateTo(dbUserSport, userSport, dbUpdateInfo);
|
||||||
|
dbUserSport.ExecuteUpdateCommand(dbCommand);
|
||||||
|
userSport.Changed = false;
|
||||||
|
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(userSport).Concat(": ").Concat("", "\n\t"));
|
||||||
|
// Record updates.
|
||||||
|
// ToDo updateLogMonitor.RecordUpdatedValues(userSport);
|
||||||
|
// ToDo updateLogMonitor.LogUpdates();
|
||||||
|
}
|
||||||
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
|
}
|
||||||
|
return !HasErrorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Delete item.
|
||||||
|
public override bool UserSportCanBeDeleted(SaxUserSport userSport)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
if (!base.UserSportCanBeDeleted(userSport)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public override bool DeleteUserSport(SaxUserSport userSport, DbUpdateInfo dbUpdateInfo)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".DeleteUserSport";
|
||||||
|
ClearErrorState();
|
||||||
|
if (!UserSportCanBeDeleted(userSport)) return false;
|
||||||
|
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||||
|
using (var dbCommand = dbConnection.CreateCommand())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Retrieve userSport.
|
||||||
|
dbConnection.Open();
|
||||||
|
UserSport_Db dbUserSport = new UserSport_Db(CoreDbInfo);
|
||||||
|
dbUserSport.PopulateFrom(dbCommand, aliasUserSport, "Id=" + userSport.Id.ToString());
|
||||||
|
// Delete userSport.
|
||||||
|
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||||
|
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.UserSport) + " WHERE Id=" + SysId.ToString(userSport.Id) + ";";
|
||||||
|
dbCommand.ExecuteNonQuery();
|
||||||
|
userSport.Changed = false;
|
||||||
|
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(userSport).Concat(": ").Concat("", "\n\t"));
|
||||||
|
}
|
||||||
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
|
}
|
||||||
|
return !HasErrorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Copy data properties to and from database.
|
||||||
|
private void PopulateTo(UserSport_Db dbUserSport, SaxUserSport userSport, DbUpdateInfo dbUpdateInfo)
|
||||||
|
{
|
||||||
|
dbUserSport._Id = SysId.ToInt(userSport.Id);
|
||||||
|
dbUserSport._UserAccountId = SysId.ToInt(userSport.UserAccountId);
|
||||||
|
dbUserSport._SportId = SysId.ToInt(userSport.SportId);
|
||||||
|
dbUserSport._UserSportData = userSport.UserSportData;
|
||||||
|
// Common.
|
||||||
|
dbUserSport._Notes = userSport.Notes;
|
||||||
|
dbUserSport._Status = SacsSystem.GetStatusCode(userSport.Status);
|
||||||
|
dbUserSport._Flags = (short)userSport.Flags;
|
||||||
|
if (!SysId.IsValid(userSport.Id))
|
||||||
|
{
|
||||||
|
dbUserSport._CreateOn = DateTime.Now;
|
||||||
|
dbUserSport._CreateBy = dbUpdateInfo.UserId.ToInt();
|
||||||
|
dbUserSport._CreateHost = dbUpdateInfo.Host;
|
||||||
|
}
|
||||||
|
dbUserSport._UpdateOn = DateTime.Now;
|
||||||
|
dbUserSport._UpdateBy = dbUpdateInfo.UserId.ToInt();
|
||||||
|
dbUserSport._UpdateHost = dbUpdateInfo.Host;
|
||||||
|
}
|
||||||
|
private void PopulateFrom(UserSport_Db dbUserSport, SaxUserSport userSport)
|
||||||
|
{
|
||||||
|
//userSport.Id = new SysId(dbUserSport._Id);
|
||||||
|
//userSport.UserAccountId = new SysId(dbUserSport._UserAccountId);
|
||||||
|
//userSport.SportId = new SysId(dbUserSport._SportId);
|
||||||
|
userSport.UserSportData = dbUserSport._UserSportData;
|
||||||
|
// Common.
|
||||||
|
userSport.Notes = dbUserSport._Notes;
|
||||||
|
userSport.Status = SacsSystem.GetStatusForCode(dbUserSport._Status);
|
||||||
|
userSport.SetCreateStamp(dbUserSport._CreateOn, new SysId(dbUserSport._CreateBy), dbUserSport._CreateHost);
|
||||||
|
userSport.SetUpdateStamp(dbUserSport._UpdateOn, new SysId(dbUserSport._UpdateBy), dbUserSport._UpdateHost);
|
||||||
|
userSport.AcceptChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Item column definitions.
|
||||||
|
private static readonly String aliasUserSport = "UsrSpt";
|
||||||
|
private static readonly String aliasUserSport_UserAccount = "UsrSpt_Usr";
|
||||||
|
private static readonly String prefixUserSport_UserAccount = "UsrSpt_Usr_";
|
||||||
|
private static readonly String aliasUserSport_Sport = "UsrSpt_Spt";
|
||||||
|
private static readonly String prefixUserSport_Sport = "UsrSpt_Spt_";
|
||||||
|
private void SetUserSportColDfn
|
||||||
|
(ColumnDfn col, String caption, int width, SaxDbDfn.ColumnIdx dbCol,
|
||||||
|
ColumnAlignment align = ColumnAlignment.Default, DataValue.DataType dataType = DataValue.DataType.String,
|
||||||
|
String alias = "", String prefix = "")
|
||||||
|
{
|
||||||
|
if (String.IsNullOrEmpty(alias) && SaxDbDfn.GetTableForColumn(dbCol) == SaxDbDfn.TableIdx.UserSport)
|
||||||
|
alias = aliasUserSport;
|
||||||
|
col.Set(caption, width, (int)dbCol, prefix + SaxDbDfn.GetColumnName(dbCol, false), SaxDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||||
|
if (dataType == DataValue.DataType.String && dbCol != SaxDbDfn.ColumnIdx.Unknown)
|
||||||
|
col.MaxLength = (int)SaxDbDfn.GetColTextLen(dbCol);
|
||||||
|
}
|
||||||
|
public override ColumnDfn GetUserSportColumnDfn(SaxUserSport.Column columnId, string caption = "", int width = 0)
|
||||||
|
{
|
||||||
|
ColumnDfn columnDfn = new ColumnDfn((int)columnId, caption, width);
|
||||||
|
switch (columnId)
|
||||||
|
{
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
case SaxUserSport.Column.Pos:
|
||||||
|
SetUserSportColDfn(columnDfn, "Pos", 60, SaxDbDfn.ColumnIdx.Unknown, ColumnAlignment.Right);
|
||||||
|
columnDfn.SortMode = ColumnDfn.ColumnSortMode.Off;
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
columnDfn.Resizable = false;
|
||||||
|
break;
|
||||||
|
case SaxUserSport.Column.Id:
|
||||||
|
SetUserSportColDfn(columnDfn, "Id", 80, SaxDbDfn.ColumnIdx.UserSport_Id, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-------------------------------------------------------
|
||||||
|
// User.
|
||||||
|
case SaxUserSport.Column.UserAccountId:
|
||||||
|
SetUserSportColDfn(columnDfn, "User Id", 80, SaxDbDfn.ColumnIdx.UserSport_UserAccountId, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxUserSport.Column.User_EmailAddress:
|
||||||
|
SetUserSportColDfn(columnDfn, "Email address", 160, SaxDbDfn.ColumnIdx.UserAccount_EmailAddress, ColumnAlignment.Left, DataValue.DataType.String, aliasUserSport_UserAccount, prefixUserSport_UserAccount);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxUserSport.Column.User_DisplayName:
|
||||||
|
SetUserSportColDfn(columnDfn, "User", 160, SaxDbDfn.ColumnIdx.Unknown, ColumnAlignment.Left, DataValue.DataType.String);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxUserSport.Column.User_Title:
|
||||||
|
SetUserSportColDfn(columnDfn, "TItle", 80, SaxDbDfn.ColumnIdx.UserAccount_Title, ColumnAlignment.Left, DataValue.DataType.String, aliasUserSport_UserAccount, prefixUserSport_UserAccount);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxUserSport.Column.User_FirstName:
|
||||||
|
SetUserSportColDfn(columnDfn, "First name", 120, SaxDbDfn.ColumnIdx.UserAccount_FirstName, ColumnAlignment.Left, DataValue.DataType.String, aliasUserSport_UserAccount, prefixUserSport_UserAccount);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxUserSport.Column.User_LastName:
|
||||||
|
SetUserSportColDfn(columnDfn, "Last name", 120, SaxDbDfn.ColumnIdx.UserAccount_LastName, ColumnAlignment.Left, DataValue.DataType.String, aliasUserSport_UserAccount, prefixUserSport_UserAccount);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-------------------------------------------------------
|
||||||
|
// Sport.
|
||||||
|
case SaxUserSport.Column.SportId:
|
||||||
|
SetUserSportColDfn(columnDfn, "Sport Id", 80, SaxDbDfn.ColumnIdx.UserSport_SportId, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxUserSport.Column.Sport_Name:
|
||||||
|
SetUserSportColDfn(columnDfn, "Email address", 160, SaxDbDfn.ColumnIdx.Sport_Name, ColumnAlignment.Left, DataValue.DataType.String, aliasUserSport_Sport, prefixUserSport_Sport);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Derived properties.
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Common properties.
|
||||||
|
case SaxUserSport.Column.Notes:
|
||||||
|
SetUserSportColDfn(columnDfn, "Notes", 240, SaxDbDfn.ColumnIdx.UserSport_Notes);
|
||||||
|
break;
|
||||||
|
case SaxUserSport.Column.Flags:
|
||||||
|
SetUserSportColDfn(columnDfn, "Flags", 60, SaxDbDfn.ColumnIdx.UserSport_Flags, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||||
|
break;
|
||||||
|
case SaxUserSport.Column.Status:
|
||||||
|
SetUserSportColDfn(columnDfn, "Status", 80, SaxDbDfn.ColumnIdx.UserSport_Status, ColumnAlignment.Center);
|
||||||
|
break;
|
||||||
|
case SaxUserSport.Column.Status_Desc:
|
||||||
|
SetUserSportColDfn(columnDfn, "Status", 90, SaxDbDfn.ColumnIdx.UserSport_Status, ColumnAlignment.Center);
|
||||||
|
break;
|
||||||
|
case SaxUserSport.Column.Status_Ind:
|
||||||
|
SetUserSportColDfn(columnDfn, "Status", 80, SaxDbDfn.ColumnIdx.UserSport_Status, ColumnAlignment.Center, DataValue.DataType.TriState);
|
||||||
|
columnDfn.TriStateFormat = ColumnTriStateFormat.Lights;
|
||||||
|
break;
|
||||||
|
case SaxUserSport.Column.CreateOn_Date:
|
||||||
|
SetUserSportColDfn(columnDfn, "Created", 80, SaxDbDfn.ColumnIdx.UserSport_CreateOn, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxUserSport.Column.UpdateOn_Date:
|
||||||
|
SetUserSportColDfn(columnDfn, "Updated", 80, SaxDbDfn.ColumnIdx.UserSport_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> GetUserSportQueryFilter(SaxUserSport.Params prm)
|
||||||
|
{
|
||||||
|
List<String> filter = new List<String>();
|
||||||
|
|
||||||
|
// Item Ids.
|
||||||
|
String idsIncluded = prm.IdsIncluded.Concat(",");
|
||||||
|
if (!idsIncluded.IsEmpty())
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_Id, aliasUserSport) + " IN (" + idsIncluded + ")");
|
||||||
|
String idsxcluded = prm.IdsExcluded.Concat(",");
|
||||||
|
if (!idsxcluded.IsEmpty())
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_Id, aliasUserSport) + " NOT IN (" + idsxcluded + ")");
|
||||||
|
|
||||||
|
// User accounts.
|
||||||
|
String userAccountIdsIncluded = prm.UserAccountIdsIncluded.Concat(",");
|
||||||
|
if (!userAccountIdsIncluded.IsEmpty())
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_UserAccountId, aliasUserSport) + " IN (" + userAccountIdsIncluded + ")");
|
||||||
|
|
||||||
|
// Sports.
|
||||||
|
String sportIdsIncluded = prm.SportIdsIncluded.Concat(",");
|
||||||
|
if (!sportIdsIncluded.IsEmpty())
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_SportId, aliasUserSport) + " IN (" + sportIdsIncluded + ")");
|
||||||
|
|
||||||
|
// Notes.
|
||||||
|
if (!StringUtil.IsEmpty(prm.NotesPartial))
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_Notes, aliasUserSport) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||||
|
|
||||||
|
// Status.
|
||||||
|
if (prm.StatusCat == SaxUserSport.StatusCat.ActiveOnly)
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_Status, aliasUserSport) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||||
|
else if (prm.StatusCat == SaxUserSport.StatusCat.NotDeleted)
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_Status, aliasUserSport) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||||
|
|
||||||
|
if (filter.Count < 1) filter.Add("1=1");
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
// Item sort columns.
|
||||||
|
public List<String> GetUserSportSortColumns(SaxUserSport.Params prm)
|
||||||
|
{
|
||||||
|
// Sort sequence:
|
||||||
|
List<String> sortColumnNames = new List<String>();
|
||||||
|
foreach (var columnDfn in prm.SortColumns)
|
||||||
|
{
|
||||||
|
// Need to ensure correct alias used for UserSport columns in case of conflict.
|
||||||
|
String sortCol = String.Empty;
|
||||||
|
if (SaxDbDfn.GetTableForColumn((SaxDbDfn.ColumnIdx)columnDfn.DbColumn) == SaxDbDfn.TableIdx.UserSport)
|
||||||
|
{
|
||||||
|
sortCol = SaxDbDfn.GetColumnNameQual((SaxDbDfn.ColumnIdx)columnDfn.DbColumn, aliasUserSport);
|
||||||
|
}
|
||||||
|
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.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_Id, aliasUserSport) + " ASC");
|
||||||
|
}
|
||||||
|
return sortColumnNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Item count.
|
||||||
|
private long GetUserSportCount(String filter)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
return CoreDatabase.GetRowCount(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.UserSport) + " As " + aliasUserSport, filter);
|
||||||
|
}
|
||||||
|
public override long GetUserSportCount(SaxUserSport.Params prm)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
return GetUserSportCount(GetUserSportQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Item list.
|
||||||
|
public override List<SaxUserSport> GetUserSportList(SaxUserSport.Params prm)
|
||||||
|
{
|
||||||
|
List<SaxUserSport> userSports = new List<SaxUserSport>();
|
||||||
|
DbQuery qry = new DbQuery(CoreDatabase.DbmsType);
|
||||||
|
qry.Tables.Add(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.UserSport), aliasUserSport);
|
||||||
|
UserSport_Db dbUserSport = new UserSport_Db(CoreDbInfo);
|
||||||
|
qry.Columns.AddRange(dbUserSport.ExistingColumnNames);
|
||||||
|
qry.Filters.AddRange(GetUserSportQueryFilter(prm));
|
||||||
|
qry.OrderBy.AddRange(GetUserSportSortColumns(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())
|
||||||
|
{
|
||||||
|
dbUserSport = new UserSport_Db(CoreDbInfo);
|
||||||
|
dbUserSport.PopulateFrom(dbDataReader);
|
||||||
|
userSports.Add(CreateUserSport(dbUserSport));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
SaLogger.Warn(GetType().Name + ".GetUserSportList\n\tQuery: " + dbCommand.CommandText + "\n\t" + exc.GetType().Name + ": " + exc.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return userSports;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Item query execution.
|
||||||
|
public override DbResultSet ExecuteUserSportQuery(List<ColumnDfn> columns, SaxUserSport.Params prm)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// Construct query.
|
||||||
|
DbQuery query = new DbQuery(CoreDatabase.DbmsType);
|
||||||
|
query.Tables.Add(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.UserSport), aliasUserSport);
|
||||||
|
|
||||||
|
// Add columns as defined in query list.
|
||||||
|
if (columns.HasId(SaxUserSport.Column.Id))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_Id, aliasUserSport));
|
||||||
|
bool hasUserAccountCols = (columns.HasId(SaxUserSport.Column.User_EmailAddress) || columns.HasId(SaxUserSport.Column.User_DisplayName) || columns.HasId(SaxUserSport.Column.User_Title) || columns.HasId(SaxUserSport.Column.User_FirstName) || columns.HasId(SaxUserSport.Column.User_LastName));
|
||||||
|
if (columns.HasId(SaxUserSport.Column.UserAccountId) || hasUserAccountCols)
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_UserAccountId, aliasUserSport));
|
||||||
|
bool hasSportCols = (columns.HasId(SaxUserSport.Column.Sport_Name));
|
||||||
|
if (columns.HasId(SaxUserSport.Column.SportId) || hasSportCols)
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_SportId, aliasUserSport));
|
||||||
|
// Common properties.
|
||||||
|
if (columns.HasId(SaxUserSport.Column.Notes))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_Notes, aliasUserSport));
|
||||||
|
if (columns.HasId(SaxUserSport.Column.Flags))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_Flags, aliasUserSport));
|
||||||
|
if (columns.HasId(SaxUserSport.Column.Status) || columns.HasId(SaxUserSport.Column.Status_Desc) || columns.HasId(SaxUserSport.Column.Status_Ind))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_Status, aliasUserSport));
|
||||||
|
if (columns.HasId(SaxUserSport.Column.CreateOn_Date))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_CreateOn, aliasUserSport));
|
||||||
|
if (columns.HasId(SaxUserSport.Column.UpdateOn_Date))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_UpdateOn, aliasUserSport));
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// User Account.
|
||||||
|
if (hasUserAccountCols)
|
||||||
|
{
|
||||||
|
DbQueryJoin joinUserAccount = new DbQueryJoin(DbJoinType.LeftOuter);
|
||||||
|
joinUserAccount.Table = new StringPair(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.UserAccount), aliasUserSport_UserAccount);
|
||||||
|
joinUserAccount.Filters.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserAccount_Id, aliasUserSport_UserAccount) + "=" + SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_UserAccountId, aliasUserSport));
|
||||||
|
query.Joins.Add(joinUserAccount);
|
||||||
|
List<SaxDbDfn.ColumnIdx> cols = new List<SaxDbDfn.ColumnIdx>();
|
||||||
|
cols.Add(SaxDbDfn.ColumnIdx.UserAccount_EmailAddress);
|
||||||
|
cols.Add(SaxDbDfn.ColumnIdx.UserAccount_Title);
|
||||||
|
cols.Add(SaxDbDfn.ColumnIdx.UserAccount_FirstName);
|
||||||
|
cols.Add(SaxDbDfn.ColumnIdx.UserAccount_LastName);
|
||||||
|
foreach (var col in cols)
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(col, aliasUserSport_UserAccount), prefixUserSport_UserAccount + SaxDbDfn.GetColumnName(col, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// Sport.
|
||||||
|
if (hasSportCols)
|
||||||
|
{
|
||||||
|
DbQueryJoin joinSport = new DbQueryJoin(DbJoinType.LeftOuter);
|
||||||
|
joinSport.Table = new StringPair(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.Sport), aliasUserSport_Sport);
|
||||||
|
joinSport.Filters.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.Sport_Id, aliasUserSport_Sport) + "=" + SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserSport_SportId, aliasUserSport));
|
||||||
|
query.Joins.Add(joinSport);
|
||||||
|
List<SaxDbDfn.ColumnIdx> cols = new List<SaxDbDfn.ColumnIdx>();
|
||||||
|
cols.Add(SaxDbDfn.ColumnIdx.Sport_Name);
|
||||||
|
foreach (var col in cols)
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(col, aliasUserSport_Sport), prefixUserSport_Sport + SaxDbDfn.GetColumnName(col, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// Populate filter.
|
||||||
|
query.Filters.AddRange(GetUserSportQueryFilter(prm));
|
||||||
|
|
||||||
|
if (prm.IdsIncluded.Count != 1)
|
||||||
|
{
|
||||||
|
// Configure sort sequence.
|
||||||
|
foreach (String sortColumn in GetUserSportSortColumns(prm))
|
||||||
|
query.OrderBy.Add(sortColumn);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
//return new DbResultSet_DataTableReader(db, query.BuildQuery(prm.ResultsPaging));
|
||||||
|
return DbResultSet_DataReader.ExecuteQuery(CoreDatabase, query.BuildQuery(prm.ResultsPaging));
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -576,7 +576,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
|||||||
{
|
{
|
||||||
DbQueryJoin joinUserAccount = new DbQueryJoin(DbJoinType.LeftOuter);
|
DbQueryJoin joinUserAccount = new DbQueryJoin(DbJoinType.LeftOuter);
|
||||||
joinUserAccount.Table = new StringPair(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.UserAccount), aliasJournalistArticle_Journalist);
|
joinUserAccount.Table = new StringPair(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.UserAccount), aliasJournalistArticle_Journalist);
|
||||||
joinUserAccount.Filters.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserAccount_Id, aliasJournalistArticle_Journalist) + "=" + SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserRole_UserAccountId, aliasJournalistArticle));
|
joinUserAccount.Filters.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserAccount_Id, aliasJournalistArticle_Journalist) + "=" + SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.JournalistArticle_UserAccountIdJournalist, aliasJournalistArticle));
|
||||||
query.Joins.Add(joinUserAccount);
|
query.Joins.Add(joinUserAccount);
|
||||||
List<SaxDbDfn.ColumnIdx> cols = new List<SaxDbDfn.ColumnIdx>();
|
List<SaxDbDfn.ColumnIdx> cols = new List<SaxDbDfn.ColumnIdx>();
|
||||||
cols.Add(SaxDbDfn.ColumnIdx.UserAccount_Title);
|
cols.Add(SaxDbDfn.ColumnIdx.UserAccount_Title);
|
||||||
|
|||||||
@@ -0,0 +1,670 @@
|
|||||||
|
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.App;
|
||||||
|
using Saxonite.Net.Standard.Base.Bus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.Common;
|
||||||
|
using System.Text;
|
||||||
|
using Sarand.Net.Standard.Base.Utils;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
partial class SaxActivityMgr_Dbas
|
||||||
|
{
|
||||||
|
//*******************************************************************
|
||||||
|
// Activity Mgr - Organisation Opportunity
|
||||||
|
//*******************************************************************
|
||||||
|
// Utilities.
|
||||||
|
private List<StringPair> GetLogProperties(SaxOrganisationOpportunity organisationOpportunity)
|
||||||
|
{
|
||||||
|
return new List<StringPair>()
|
||||||
|
{
|
||||||
|
new StringPair("Id", SysId.ToString(organisationOpportunity.Id)),
|
||||||
|
new StringPair("OrganisationId", SysId.ToString(organisationOpportunity.OrganisationId)),
|
||||||
|
new StringPair("Position", StringUtil.Left(organisationOpportunity.Position,32)),
|
||||||
|
new StringPair("Status", organisationOpportunity.StatusCode)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Create item.
|
||||||
|
public override SaxOrganisationOpportunity CreateOrganisationOpportunity(SysId userAccountIdJournalist)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
return new SaxOrganisationOpportunity_Dbas(CoreDatabase, null, userAccountIdJournalist, 0);
|
||||||
|
}
|
||||||
|
private SaxOrganisationOpportunity_Dbas CreateOrganisationOpportunity(OrganisationOpportunity_Db dbOrganisationOpportunity)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
SaxOrganisationOpportunity_Dbas organisationOpportunity = new SaxOrganisationOpportunity_Dbas(CoreDatabase, new SysId(dbOrganisationOpportunity._Id), new SysId(dbOrganisationOpportunity._OrganisationId), (UInt16)dbOrganisationOpportunity._Flags);
|
||||||
|
PopulateFrom(dbOrganisationOpportunity, organisationOpportunity);
|
||||||
|
return organisationOpportunity;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Get item.
|
||||||
|
public override SaxOrganisationOpportunity GetOrganisationOpportunity(SaxOrganisationOpportunity.Params prm)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
return GetOrganisationOpportunity(GetOrganisationOpportunityQueryFilter(prm).Concat(" And ", "(", ")"));
|
||||||
|
}
|
||||||
|
private SaxOrganisationOpportunity GetOrganisationOpportunity(String filter)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
long count = GetOrganisationOpportunityCount(filter);
|
||||||
|
if (count == 0) return null;
|
||||||
|
if (count != 1)
|
||||||
|
{
|
||||||
|
SetErrorState("Multiple items found");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
SaxOrganisationOpportunity organisationOpportunity = null;
|
||||||
|
// Query data.
|
||||||
|
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||||
|
using (var dbCommand = dbConnection.CreateCommand())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbConnection.Open();
|
||||||
|
OrganisationOpportunity_Db dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||||
|
dbOrganisationOpportunity.PopulateFrom(dbCommand, aliasOrganisationOpportunity, filter);
|
||||||
|
organisationOpportunity = CreateOrganisationOpportunity(dbOrganisationOpportunity);
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
SetErrorState("Database query exception");
|
||||||
|
SaLogger.Warn(GetType().Name + ".GetOrganisationOpportunity\n\tQuery: " + dbCommand.CommandText + "\n\t" + exc.GetType().Name + ": " + exc.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return organisationOpportunity;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Validate item.
|
||||||
|
public override bool IsValidOrganisationOpportunityData(SaxOrganisationOpportunity.Data data, SaxOrganisationOpportunity.ErrField errField)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
if (!base.IsValidOrganisationOpportunityData(data, errField)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Insert item.
|
||||||
|
public override bool InsertOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".InsertOrganisationOpportunity";
|
||||||
|
ClearErrorState();
|
||||||
|
if (!IsValidOrganisationOpportunity(organisationOpportunity)) return false;
|
||||||
|
if (SysId.IsValid(organisationOpportunity.Id)) return SetErrorState(ErrorMessage.ValiditemId);
|
||||||
|
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||||
|
using (var dbCommand = dbConnection.CreateCommand())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbConnection.Open();
|
||||||
|
OrganisationOpportunity_Db dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||||
|
PopulateTo(dbOrganisationOpportunity, organisationOpportunity, dbUpdateInfo);
|
||||||
|
if (OrganisationOpportunity_Db.FieldsNonId.Contains("Id"))
|
||||||
|
{
|
||||||
|
// Generate next Id.
|
||||||
|
// ToDo dbOrganisationOpportunity._Id = CoreDatabase.GetNextIdFromTable("OrganisationOpportunity");
|
||||||
|
}
|
||||||
|
dbOrganisationOpportunity.ExecuteInsertCommand(dbCommand);
|
||||||
|
organisationOpportunity.Id = new SysId(dbOrganisationOpportunity._Id);
|
||||||
|
organisationOpportunity.Changed = false;
|
||||||
|
if (DebugMode) SaLogger.Debug(fn + " Inserted. " + GetLogProperties(organisationOpportunity).Concat(": ").Concat("", "\n\t"));
|
||||||
|
}
|
||||||
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
|
}
|
||||||
|
return !HasErrorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Update item.
|
||||||
|
public override bool UpdateOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".UpdateOrganisationOpportunity";
|
||||||
|
ClearErrorState();
|
||||||
|
if (!IsValidOrganisationOpportunity(organisationOpportunity)) return false;
|
||||||
|
if (!SysId.IsValid(organisationOpportunity.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||||
|
if (!organisationOpportunity.Changed)
|
||||||
|
{
|
||||||
|
if (DebugMode) SaLogger.Debug(fn + " Data not changed. " + GetLogProperties(organisationOpportunity).Concat(": ").Concat("", "\n\t"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||||
|
using (var dbCommand = dbConnection.CreateCommand())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Retrieve item.
|
||||||
|
dbConnection.Open();
|
||||||
|
OrganisationOpportunity_Db dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||||
|
dbOrganisationOpportunity.PopulateFrom(dbCommand, aliasOrganisationOpportunity, "Id=" + SysId.ToString(organisationOpportunity.Id));
|
||||||
|
// ToDo SaxUpdateLogItemMonitor_OrganisationOpportunity updateLogMonitor = new SaxUpdateLogItemMonitor_OrganisationOpportunity(SessionContext, CreateOrganisationOpportunity(dbOrganisationOpportunity), dbUpdateInfo);
|
||||||
|
// Update properties.
|
||||||
|
PopulateTo(dbOrganisationOpportunity, organisationOpportunity, dbUpdateInfo);
|
||||||
|
dbOrganisationOpportunity.ExecuteUpdateCommand(dbCommand);
|
||||||
|
organisationOpportunity.Changed = false;
|
||||||
|
if (DebugMode) SaLogger.Debug(fn + " Updated. " + GetLogProperties(organisationOpportunity).Concat(": ").Concat("", "\n\t"));
|
||||||
|
// Record updates.
|
||||||
|
// ToDo updateLogMonitor.RecordUpdatedValues(organisationOpportunity);
|
||||||
|
// ToDo updateLogMonitor.LogUpdates();
|
||||||
|
}
|
||||||
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
|
}
|
||||||
|
return !HasErrorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Delete item.
|
||||||
|
public override bool OrganisationOpportunityCanBeDeleted(SaxOrganisationOpportunity organisationOpportunity)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
if (!base.OrganisationOpportunityCanBeDeleted(organisationOpportunity)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public override bool DeleteOrganisationOpportunity(SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo)
|
||||||
|
{
|
||||||
|
String fn = GetType().Name + ".DeleteOrganisationOpportunity";
|
||||||
|
ClearErrorState();
|
||||||
|
if (!OrganisationOpportunityCanBeDeleted(organisationOpportunity)) return false;
|
||||||
|
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||||
|
using (var dbCommand = dbConnection.CreateCommand())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Retrieve organisationOpportunity.
|
||||||
|
dbConnection.Open();
|
||||||
|
OrganisationOpportunity_Db dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||||
|
dbOrganisationOpportunity.PopulateFrom(dbCommand, aliasOrganisationOpportunity, "Id=" + organisationOpportunity.Id.ToString());
|
||||||
|
// Delete organisationOpportunity.
|
||||||
|
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||||
|
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.OrganisationOpportunity) + " WHERE Id=" + SysId.ToString(organisationOpportunity.Id) + ";";
|
||||||
|
dbCommand.ExecuteNonQuery();
|
||||||
|
organisationOpportunity.Changed = false;
|
||||||
|
if (DebugMode) SaLogger.Debug(fn + " Deleted. " + GetLogProperties(organisationOpportunity).Concat(": ").Concat("", "\n\t"));
|
||||||
|
}
|
||||||
|
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||||
|
}
|
||||||
|
return !HasErrorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Copy data properties to and from database.
|
||||||
|
private void PopulateTo(OrganisationOpportunity_Db dbOrganisationOpportunity, SaxOrganisationOpportunity organisationOpportunity, DbUpdateInfo dbUpdateInfo)
|
||||||
|
{
|
||||||
|
dbOrganisationOpportunity._Id = SysId.ToInt(organisationOpportunity.Id);
|
||||||
|
dbOrganisationOpportunity._OrganisationId = SysId.ToInt(organisationOpportunity.OrganisationId);
|
||||||
|
dbOrganisationOpportunity._RegionIdPrimary = SysId.ToInt(organisationOpportunity.RegionIdPrimary);
|
||||||
|
dbOrganisationOpportunity._SportIdPrimary = SysId.ToInt(organisationOpportunity.SportIdPrimary);
|
||||||
|
dbOrganisationOpportunity._OpportunityTypeCode = OpportunityTypes.GetCodeForType(organisationOpportunity.OpportunityType);
|
||||||
|
dbOrganisationOpportunity._Position = organisationOpportunity.Position;
|
||||||
|
dbOrganisationOpportunity._Outline = organisationOpportunity.Outline;
|
||||||
|
dbOrganisationOpportunity._OpportunityData = organisationOpportunity.OpportunityData;
|
||||||
|
dbOrganisationOpportunity._PublishedAt = organisationOpportunity.PublishedAt;
|
||||||
|
dbOrganisationOpportunity._ExpiresAt = organisationOpportunity.ExpiresAt;
|
||||||
|
dbOrganisationOpportunity._Notes = organisationOpportunity.Notes;
|
||||||
|
dbOrganisationOpportunity._Status = SacsSystem.GetStatusCode(organisationOpportunity.Status);
|
||||||
|
dbOrganisationOpportunity._Flags = (short)organisationOpportunity.Flags;
|
||||||
|
if (!SysId.IsValid(organisationOpportunity.Id))
|
||||||
|
{
|
||||||
|
dbOrganisationOpportunity._CreateOn = DateTime.Now;
|
||||||
|
dbOrganisationOpportunity._CreateBy = dbUpdateInfo.UserId.ToInt();
|
||||||
|
dbOrganisationOpportunity._CreateHost = dbUpdateInfo.Host;
|
||||||
|
}
|
||||||
|
dbOrganisationOpportunity._UpdateOn = DateTime.Now;
|
||||||
|
dbOrganisationOpportunity._UpdateBy = dbUpdateInfo.UserId.ToInt();
|
||||||
|
dbOrganisationOpportunity._UpdateHost = dbUpdateInfo.Host;
|
||||||
|
}
|
||||||
|
private void PopulateFrom(OrganisationOpportunity_Db dbOrganisationOpportunity, SaxOrganisationOpportunity organisationOpportunity)
|
||||||
|
{
|
||||||
|
//organisationOpportunity.Id = new SysId(dbOrganisationOpportunity._Id);
|
||||||
|
//organisationOpportunity.OrganisationId = new SysId(dbOrganisationOpportunity._OrganisationId);
|
||||||
|
organisationOpportunity.RegionIdPrimary = new SysId(dbOrganisationOpportunity._RegionIdPrimary);
|
||||||
|
organisationOpportunity.SportIdPrimary = new SysId(dbOrganisationOpportunity._SportIdPrimary);
|
||||||
|
organisationOpportunity.OpportunityType = (Sax.OpportunityType)OpportunityTypes.GetTypeForCode(dbOrganisationOpportunity._OpportunityTypeCode);
|
||||||
|
organisationOpportunity.Position = dbOrganisationOpportunity._Position;
|
||||||
|
organisationOpportunity.Outline = dbOrganisationOpportunity._Outline;
|
||||||
|
organisationOpportunity.OpportunityData = dbOrganisationOpportunity._OpportunityData;
|
||||||
|
organisationOpportunity.PublishedAt = dbOrganisationOpportunity._PublishedAt;
|
||||||
|
organisationOpportunity.ExpiresAt = dbOrganisationOpportunity._ExpiresAt;
|
||||||
|
organisationOpportunity.Notes = dbOrganisationOpportunity._Notes;
|
||||||
|
organisationOpportunity.Status = SacsSystem.GetStatusForCode(dbOrganisationOpportunity._Status);
|
||||||
|
organisationOpportunity.SetCreateStamp(dbOrganisationOpportunity._CreateOn, new SysId(dbOrganisationOpportunity._CreateBy), dbOrganisationOpportunity._CreateHost);
|
||||||
|
organisationOpportunity.SetUpdateStamp(dbOrganisationOpportunity._UpdateOn, new SysId(dbOrganisationOpportunity._UpdateBy), dbOrganisationOpportunity._UpdateHost);
|
||||||
|
organisationOpportunity.AcceptChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Item column definitions.
|
||||||
|
private static readonly String aliasOrganisationOpportunity = "Sprt";
|
||||||
|
private static readonly String aliasOrganisationOpportunity_Organisation = "OrgOpp_Org";
|
||||||
|
private static readonly String prefixOrganisationOpportunity_Organisation = "OrgOpp_Org_";
|
||||||
|
private static readonly String aliasOrganisationOpportunity_Organisation_UserOrganisation = "OrgOpp_Org_UsrOrg";
|
||||||
|
private static readonly String aliasOrganisationOpportunity_Region = "OrgOpp_Reg";
|
||||||
|
private static readonly String prefixOrganisationOpportunity_Region = "OrgOpp_Reg_";
|
||||||
|
private static readonly String aliasOrganisationOpportunity_Sport = "OrgOpp_Spt";
|
||||||
|
private static readonly String prefixOrganisationOpportunity_Sport = "OrgOpp_Spt_";
|
||||||
|
private void SetOrganisationOpportunityColDfn
|
||||||
|
(ColumnDfn col, String caption, int width, SaxDbDfn.ColumnIdx dbCol,
|
||||||
|
ColumnAlignment align = ColumnAlignment.Default, DataValue.DataType dataType = DataValue.DataType.String,
|
||||||
|
String alias = "", String prefix = "")
|
||||||
|
{
|
||||||
|
if (String.IsNullOrEmpty(alias) && SaxDbDfn.GetTableForColumn(dbCol) == SaxDbDfn.TableIdx.OrganisationOpportunity)
|
||||||
|
alias = aliasOrganisationOpportunity;
|
||||||
|
col.Set(caption, width, (int)dbCol, prefix + SaxDbDfn.GetColumnName(dbCol, false), SaxDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||||
|
if (dataType == DataValue.DataType.String && dbCol != SaxDbDfn.ColumnIdx.Unknown)
|
||||||
|
col.MaxLength = (int)SaxDbDfn.GetColTextLen(dbCol);
|
||||||
|
}
|
||||||
|
public override ColumnDfn GetOrganisationOpportunityColumnDfn(SaxOrganisationOpportunity.Column columnId, string caption = "", int width = 0)
|
||||||
|
{
|
||||||
|
ColumnDfn columnDfn = new ColumnDfn((int)columnId, caption, width);
|
||||||
|
switch (columnId)
|
||||||
|
{
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
case SaxOrganisationOpportunity.Column.Pos:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Pos", 60, SaxDbDfn.ColumnIdx.Unknown, ColumnAlignment.Right);
|
||||||
|
columnDfn.SortMode = ColumnDfn.ColumnSortMode.Off;
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
columnDfn.Resizable = false;
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.Id:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Id", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Id, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Organisation.
|
||||||
|
case SaxOrganisationOpportunity.Column.OrganisationId:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Organisation Id", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_OrganisationId, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.Organisation_Name:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Organisation", 160, SaxDbDfn.ColumnIdx.Organisation_Name, ColumnAlignment.Left, DataValue.DataType.String, aliasOrganisationOpportunity_Organisation, prefixOrganisationOpportunity_Organisation);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Region.
|
||||||
|
case SaxOrganisationOpportunity.Column.RegionIdPrimary:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Region Id", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_RegionIdPrimary, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.Region_Name:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Region", 100, SaxDbDfn.ColumnIdx.Region_Name, ColumnAlignment.Left, DataValue.DataType.String, aliasOrganisationOpportunity_Region, prefixOrganisationOpportunity_Region);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Sport.
|
||||||
|
case SaxOrganisationOpportunity.Column.SportIdPrimary:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Sport Id", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_SportIdPrimary, ColumnAlignment.Right, DataValue.DataType.Long);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.Sport_Name:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Sport", 100, SaxDbDfn.ColumnIdx.Sport_Name, ColumnAlignment.Left, DataValue.DataType.String, aliasOrganisationOpportunity_Sport, prefixOrganisationOpportunity_Sport);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Opportunity.
|
||||||
|
case SaxOrganisationOpportunity.Column.OpportunityTypeCode:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Opportunity", 90, SaxDbDfn.ColumnIdx.OrganisationOpportunity_OpportunityTypeCode, ColumnAlignment.Center);
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.OpportunityType_Desc:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Opportunbity", 120, SaxDbDfn.ColumnIdx.OrganisationOpportunity_OpportunityTypeCode, ColumnAlignment.Center);
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.Position:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Position", 200, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position);
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.Outline:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Outline", 200, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline);
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.PublishedAt_Date:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Published", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_PublishedAt, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.PublishedAt_DateTime:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Published", 100, SaxDbDfn.ColumnIdx.OrganisationOpportunity_PublishedAt, ColumnAlignment.Center, DataValue.DataType.DateTime);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.ExpiresAt_Date:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Expires", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_ExpiresAt, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.ExpiresAt_DateTime:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Expires", 100, SaxDbDfn.ColumnIdx.OrganisationOpportunity_ExpiresAt, ColumnAlignment.Center, DataValue.DataType.DateTime);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Derived properties.
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Common properties.
|
||||||
|
case SaxOrganisationOpportunity.Column.Notes:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Notes", 240, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Notes);
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.Flags:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Flags", 60, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Flags, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.Status:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Status", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status, ColumnAlignment.Center);
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.Status_Desc:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Status", 90, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status, ColumnAlignment.Center);
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.Status_Ind:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Status", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status, ColumnAlignment.Center, DataValue.DataType.TriState);
|
||||||
|
columnDfn.TriStateFormat = ColumnTriStateFormat.Lights;
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.CreateOn_Date:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Created", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_CreateOn, ColumnAlignment.Center, DataValue.DataType.Date);
|
||||||
|
columnDfn.ReadOnly = true;
|
||||||
|
break;
|
||||||
|
case SaxOrganisationOpportunity.Column.UpdateOn_Date:
|
||||||
|
SetOrganisationOpportunityColDfn(columnDfn, "Updated", 80, SaxDbDfn.ColumnIdx.OrganisationOpportunity_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> GetOrganisationOpportunityQueryFilter(SaxOrganisationOpportunity.Params prm)
|
||||||
|
{
|
||||||
|
List<String> filter = new List<String>();
|
||||||
|
|
||||||
|
// Item Ids.
|
||||||
|
String idsIncluded = prm.IdsIncluded.Concat(",");
|
||||||
|
if (!idsIncluded.IsEmpty())
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Id, aliasOrganisationOpportunity) + " IN (" + idsIncluded + ")");
|
||||||
|
String idsExcluded = prm.IdsExcluded.Concat(",");
|
||||||
|
if (!idsExcluded.IsEmpty())
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Id, aliasOrganisationOpportunity) + " NOT IN (" + idsExcluded + ")");
|
||||||
|
|
||||||
|
// User Account Ids.
|
||||||
|
String userAccountIdsIncluded = prm.UserAccountIdsIncluded.Concat(",");
|
||||||
|
if (!userAccountIdsIncluded.IsEmpty())
|
||||||
|
{
|
||||||
|
// User Organisation.
|
||||||
|
if (!StringUtil.IsEmpty(prm.Alias_UserOrganisation))
|
||||||
|
{
|
||||||
|
// Filter directly on the joined User Organisation table.
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserOrganisation_UserAccountId, prm.Alias_UserOrganisation) + " IN (" + userAccountIdsIncluded + ")");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// User Organisation query.
|
||||||
|
String alias_UserOrganisation = aliasOrganisationOpportunity_Organisation_UserOrganisation;
|
||||||
|
DbQuery queryUserOrganisation = new DbQuery(CoreDatabase.DbmsType);
|
||||||
|
queryUserOrganisation.Tables.Add(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.UserOrganisation), alias_UserOrganisation);
|
||||||
|
queryUserOrganisation.Filters.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserOrganisation_UserAccountId, alias_UserOrganisation) + " IN (" + userAccountIdsIncluded + ")");
|
||||||
|
|
||||||
|
// Filter Organisation directly against the Organisation Opportunity.
|
||||||
|
queryUserOrganisation.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.UserOrganisation_OrganisationId, alias_UserOrganisation));
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_OrganisationId, aliasOrganisationOpportunity) + " IN (" + queryUserOrganisation.BuildQuery() + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Organisation Ids.
|
||||||
|
String organisationIdsIncluded = prm.OrganisationIdsIncluded.Concat(",");
|
||||||
|
if (!organisationIdsIncluded.IsEmpty())
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_OrganisationId, aliasOrganisationOpportunity) + " IN (" + organisationIdsIncluded + ")");
|
||||||
|
|
||||||
|
// Region Ids.
|
||||||
|
String regionIdsIncluded = prm.RegionIdsIncluded.Concat(",");
|
||||||
|
if (!regionIdsIncluded.IsEmpty())
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_RegionIdPrimary, aliasOrganisationOpportunity) + " IN (" + regionIdsIncluded + ")");
|
||||||
|
|
||||||
|
// Sport Ids.
|
||||||
|
String sportIdsIncluded = prm.SportIdsIncluded.Concat(",");
|
||||||
|
if (!sportIdsIncluded.IsEmpty())
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_SportIdPrimary, aliasOrganisationOpportunity) + " IN (" + sportIdsIncluded + ")");
|
||||||
|
|
||||||
|
// Position.
|
||||||
|
if (!StringUtil.IsEmpty(prm.PositionPartial))
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position, aliasOrganisationOpportunity) + " Like '%" + DbQuery.FormatForLike(prm.PositionPartial, true) + "%'");
|
||||||
|
|
||||||
|
// Outline.
|
||||||
|
if (!StringUtil.IsEmpty(prm.OutlinePartial))
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline, aliasOrganisationOpportunity) + " Like '%" + DbQuery.FormatForLike(prm.OutlinePartial, true) + "%'");
|
||||||
|
|
||||||
|
// Article.
|
||||||
|
if (!StringUtil.IsEmpty(prm.OpportunityFilter))
|
||||||
|
{
|
||||||
|
// Split filter into words.
|
||||||
|
List<String> filterWords = prm.OpportunityFilter.Split((char[])null).ToList();
|
||||||
|
filterWords.RemoveDuplicatesCI();
|
||||||
|
filterWords.RemoveBlanks();
|
||||||
|
foreach (String filterWord in filterWords)
|
||||||
|
{
|
||||||
|
List<String> articleFilter = new List<String>();
|
||||||
|
articleFilter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position, aliasOrganisationOpportunity) + " Like '%" + DbQuery.FormatForLike(filterWord, true) + "%'");
|
||||||
|
articleFilter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline, aliasOrganisationOpportunity) + " Like '%" + DbQuery.FormatForLike(filterWord, true) + "%'");
|
||||||
|
filter.Add(articleFilter.Concat(" OR ", "(", ")"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notes.
|
||||||
|
if (!StringUtil.IsEmpty(prm.NotesPartial))
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Notes, aliasOrganisationOpportunity) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||||
|
|
||||||
|
// Status.
|
||||||
|
if (prm.StatusCat == SaxOrganisationOpportunity.StatusCat.ActiveOnly)
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status, aliasOrganisationOpportunity) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||||
|
else if (prm.StatusCat == SaxOrganisationOpportunity.StatusCat.NotDeleted)
|
||||||
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status, aliasOrganisationOpportunity) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||||
|
|
||||||
|
if (filter.Count < 1) filter.Add("1=1");
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
// Item sort columns.
|
||||||
|
public List<String> GetOrganisationOpportunitySortColumns(SaxOrganisationOpportunity.Params prm)
|
||||||
|
{
|
||||||
|
// Sort sequence:
|
||||||
|
List<String> sortColumnNames = new List<String>();
|
||||||
|
foreach (var columnDfn in prm.SortColumns)
|
||||||
|
{
|
||||||
|
// Need to ensure correct alias used for OrganisationOpportunity columns in case of conflict.
|
||||||
|
String sortCol = String.Empty;
|
||||||
|
if (SaxDbDfn.GetTableForColumn((SaxDbDfn.ColumnIdx)columnDfn.DbColumn) == SaxDbDfn.TableIdx.OrganisationOpportunity)
|
||||||
|
{
|
||||||
|
sortCol = SaxDbDfn.GetColumnNameQual((SaxDbDfn.ColumnIdx)columnDfn.DbColumn, aliasOrganisationOpportunity);
|
||||||
|
}
|
||||||
|
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.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Id, aliasOrganisationOpportunity) + " ASC");
|
||||||
|
}
|
||||||
|
return sortColumnNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Item count.
|
||||||
|
private long GetOrganisationOpportunityCount(String filter)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
return CoreDatabase.GetRowCount(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.OrganisationOpportunity) + " As " + aliasOrganisationOpportunity, filter);
|
||||||
|
}
|
||||||
|
public override long GetOrganisationOpportunityCount(SaxOrganisationOpportunity.Params prm)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
return GetOrganisationOpportunityCount(GetOrganisationOpportunityQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Item list.
|
||||||
|
public override List<SaxOrganisationOpportunity> GetOrganisationOpportunityList(SaxOrganisationOpportunity.Params prm)
|
||||||
|
{
|
||||||
|
List<SaxOrganisationOpportunity> userActivitys = new List<SaxOrganisationOpportunity>();
|
||||||
|
DbQuery qry = new DbQuery(CoreDatabase.DbmsType);
|
||||||
|
qry.Tables.Add(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.OrganisationOpportunity), aliasOrganisationOpportunity);
|
||||||
|
OrganisationOpportunity_Db dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||||
|
qry.Columns.AddRange(dbOrganisationOpportunity.ExistingColumnNames);
|
||||||
|
qry.Filters.AddRange(GetOrganisationOpportunityQueryFilter(prm));
|
||||||
|
qry.OrderBy.AddRange(GetOrganisationOpportunitySortColumns(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())
|
||||||
|
{
|
||||||
|
dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||||
|
dbOrganisationOpportunity.PopulateFrom(dbDataReader);
|
||||||
|
userActivitys.Add(CreateOrganisationOpportunity(dbOrganisationOpportunity));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
SaLogger.Warn(GetType().Name + ".GetOrganisationOpportunityList\n\tQuery: " + dbCommand.CommandText + "\n\t" + exc.GetType().Name + ": " + exc.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return userActivitys;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Item query execution.
|
||||||
|
public override DbResultSet ExecuteOrganisationOpportunityQuery(List<ColumnDfn> columns, SaxOrganisationOpportunity.Params prm)
|
||||||
|
{
|
||||||
|
ClearErrorState();
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// Construct query.
|
||||||
|
DbQuery query = new DbQuery(CoreDatabase.DbmsType);
|
||||||
|
query.Tables.Add(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.OrganisationOpportunity), aliasOrganisationOpportunity);
|
||||||
|
|
||||||
|
// Add columns as defined in query list.
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.Id))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Id, aliasOrganisationOpportunity));
|
||||||
|
bool hasOrganisationCols = (columns.HasId(SaxOrganisationOpportunity.Column.Organisation_Name));
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.OrganisationId) || hasOrganisationCols)
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_OrganisationId, aliasOrganisationOpportunity));
|
||||||
|
bool hasRegionCols = (columns.HasId(SaxOrganisationOpportunity.Column.Region_Name));
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.RegionIdPrimary) || hasRegionCols)
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_RegionIdPrimary, aliasOrganisationOpportunity));
|
||||||
|
bool hasSportCols = (columns.HasId(SaxOrganisationOpportunity.Column.Sport_Name));
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.SportIdPrimary) || hasSportCols)
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_SportIdPrimary, aliasOrganisationOpportunity));
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.OpportunityTypeCode) || columns.HasId(SaxOrganisationOpportunity.Column.OpportunityType_Desc))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_OpportunityTypeCode, aliasOrganisationOpportunity));
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.Position))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position, aliasOrganisationOpportunity));
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.Outline))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline, aliasOrganisationOpportunity));
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.PublishedAt_Date) || columns.HasId(SaxOrganisationOpportunity.Column.PublishedAt_DateTime))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_PublishedAt, aliasOrganisationOpportunity));
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.ExpiresAt_Date) || columns.HasId(SaxOrganisationOpportunity.Column.ExpiresAt_DateTime))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_ExpiresAt, aliasOrganisationOpportunity));
|
||||||
|
// Common properties.
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.Notes))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Notes, aliasOrganisationOpportunity));
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.Flags))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Flags, aliasOrganisationOpportunity));
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.Status) || columns.HasId(SaxOrganisationOpportunity.Column.Status_Desc) || columns.HasId(SaxOrganisationOpportunity.Column.Status_Ind))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Status, aliasOrganisationOpportunity));
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.CreateOn_Date))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_CreateOn, aliasOrganisationOpportunity));
|
||||||
|
if (columns.HasId(SaxOrganisationOpportunity.Column.UpdateOn_Date))
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_UpdateOn, aliasOrganisationOpportunity));
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// Organisation.
|
||||||
|
if (hasOrganisationCols)
|
||||||
|
{
|
||||||
|
DbQueryJoin joinOrganisation = new DbQueryJoin(DbJoinType.LeftOuter);
|
||||||
|
joinOrganisation.Table = new StringPair(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.Organisation), aliasOrganisationOpportunity_Organisation);
|
||||||
|
joinOrganisation.Filters.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.Organisation_Id, aliasOrganisationOpportunity_Organisation) + "=" + SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_OrganisationId, aliasOrganisationOpportunity));
|
||||||
|
query.Joins.Add(joinOrganisation);
|
||||||
|
List<SaxDbDfn.ColumnIdx> cols = new List<SaxDbDfn.ColumnIdx>();
|
||||||
|
cols.Add(SaxDbDfn.ColumnIdx.Organisation_Name);
|
||||||
|
foreach (var col in cols)
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(col, aliasOrganisationOpportunity_Organisation), prefixOrganisationOpportunity_Organisation + SaxDbDfn.GetColumnName(col, false));
|
||||||
|
prm.Alias_Organisation = aliasOrganisationOpportunity_Organisation;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// Primary Region.
|
||||||
|
if (hasRegionCols)
|
||||||
|
{
|
||||||
|
DbQueryJoin joinRegion = new DbQueryJoin(DbJoinType.LeftOuter);
|
||||||
|
joinRegion.Table = new StringPair(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.Region), aliasOrganisationOpportunity_Region);
|
||||||
|
joinRegion.Filters.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.Region_Id, aliasOrganisationOpportunity_Region) + "=" + SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_RegionIdPrimary, aliasOrganisationOpportunity));
|
||||||
|
query.Joins.Add(joinRegion);
|
||||||
|
List<SaxDbDfn.ColumnIdx> cols = new List<SaxDbDfn.ColumnIdx>();
|
||||||
|
cols.Add(SaxDbDfn.ColumnIdx.Region_Name);
|
||||||
|
foreach (var col in cols)
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(col, aliasOrganisationOpportunity_Region), prefixOrganisationOpportunity_Region + SaxDbDfn.GetColumnName(col, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// Primary Sport.
|
||||||
|
if (hasSportCols)
|
||||||
|
{
|
||||||
|
DbQueryJoin joinSport = new DbQueryJoin(DbJoinType.LeftOuter);
|
||||||
|
joinSport.Table = new StringPair(SaxDbDfn.GetTableName(SaxDbDfn.TableIdx.Sport), aliasOrganisationOpportunity_Sport);
|
||||||
|
joinSport.Filters.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.Sport_Id, aliasOrganisationOpportunity_Sport) + "=" + SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.OrganisationOpportunity_SportIdPrimary, aliasOrganisationOpportunity));
|
||||||
|
query.Joins.Add(joinSport);
|
||||||
|
List<SaxDbDfn.ColumnIdx> cols = new List<SaxDbDfn.ColumnIdx>();
|
||||||
|
cols.Add(SaxDbDfn.ColumnIdx.Sport_Name);
|
||||||
|
foreach (var col in cols)
|
||||||
|
query.Columns.Add(SaxDbDfn.GetColumnNameQual(col, aliasOrganisationOpportunity_Sport), prefixOrganisationOpportunity_Sport + SaxDbDfn.GetColumnName(col, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// Populate filter.
|
||||||
|
query.Filters.AddRange(GetOrganisationOpportunityQueryFilter(prm));
|
||||||
|
|
||||||
|
if (prm.IdsIncluded.Count != 1)
|
||||||
|
{
|
||||||
|
// Configure sort sequence.
|
||||||
|
foreach (String sortColumn in GetOrganisationOpportunitySortColumns(prm))
|
||||||
|
query.OrderBy.Add(sortColumn);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
//return new DbResultSet_DataTableReader(db, query.BuildQuery(prm.ResultsPaging));
|
||||||
|
return DbResultSet_DataReader.ExecuteQuery(CoreDatabase, query.BuildQuery(prm.ResultsPaging));
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -306,10 +306,10 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
|||||||
List<String> filter = new List<String>();
|
List<String> filter = new List<String>();
|
||||||
|
|
||||||
// Item Ids.
|
// Item Ids.
|
||||||
String includedIds = prm.IncludedIds.Concat(",");
|
String includedIds = prm.IdsIncluded.Concat(",");
|
||||||
if (!includedIds.IsEmpty())
|
if (!includedIds.IsEmpty())
|
||||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.Sport_Id, aliasSport) + " IN (" + includedIds + ")");
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.Sport_Id, aliasSport) + " IN (" + includedIds + ")");
|
||||||
String excludedIds = prm.ExcludedIds.Concat(",");
|
String excludedIds = prm.IdsExcluded.Concat(",");
|
||||||
if (!excludedIds.IsEmpty())
|
if (!excludedIds.IsEmpty())
|
||||||
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.Sport_Id, aliasSport) + " NOT IN (" + excludedIds + ")");
|
filter.Add(SaxDbDfn.GetColumnNameQual(SaxDbDfn.ColumnIdx.Sport_Id, aliasSport) + " NOT IN (" + excludedIds + ")");
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
|||||||
// Populate filter.
|
// Populate filter.
|
||||||
query.Filters.AddRange(GetSportQueryFilter(prm));
|
query.Filters.AddRange(GetSportQueryFilter(prm));
|
||||||
|
|
||||||
if (prm.IncludedIds.Count != 1)
|
if (prm.IdsIncluded.Count != 1)
|
||||||
{
|
{
|
||||||
// Configure sort sequence.
|
// Configure sort sequence.
|
||||||
foreach (String sortColumn in GetSportSortColumns(prm))
|
foreach (String sortColumn in GetSportSortColumns(prm))
|
||||||
|
|||||||
Reference in New Issue
Block a user