v1.2.6.4
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Newtonsoft.Json;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Core.Web.Admin.App;
|
||||
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
@@ -48,6 +49,13 @@ namespace Saxonite.Net.Core.UnitTests.Web.Admin.App
|
||||
Assert.IsTrue(sessionData.ValidUserSession);
|
||||
Assert.AreNotEqual("", sessionData.User.DisplayName);
|
||||
|
||||
// Filters.
|
||||
sessionData.Filter.SportId = new SysId(2345);
|
||||
sessionData.Filter.RegionId = new SysId(6543);
|
||||
|
||||
// Encryption data.
|
||||
Assert.IsFalse(StringUtil.IsEmpty(sessionData.Base64IV_AdminApp));
|
||||
|
||||
int idx = sessionData.NextItemIdx;
|
||||
idx = sessionData.NextItemIdx;
|
||||
idx = sessionData.NextItemIdx;
|
||||
@@ -57,26 +65,35 @@ namespace Saxonite.Net.Core.UnitTests.Web.Admin.App
|
||||
Assert.AreNotEqual("", sessionDataJson);
|
||||
|
||||
// Deserialise session data using same method as base controller.
|
||||
SaxSessionData_Admin sessionDataDeserialized =
|
||||
SaxSessionData_Admin sessionDataDeserialised =
|
||||
JsonConvert.DeserializeObject<SaxSessionData_Admin>(
|
||||
sessionDataJson,
|
||||
SaxController_Base.SessionStorage.JsonDeserialisationSettings
|
||||
);
|
||||
Assert.IsNotNull(sessionDataDeserialized);
|
||||
Assert.IsNotNull(sessionDataDeserialised);
|
||||
|
||||
// Validate deserialised values.
|
||||
Assert.AreEqual(sessionData.SessionIdx, sessionDataDeserialized.SessionIdx);
|
||||
Assert.AreEqual(sessionData.ItemIdx, sessionDataDeserialized.ItemIdx);
|
||||
Assert.AreEqual(App.SessionContext.Index, sessionDataDeserialized.SessionContext.Index);
|
||||
Assert.AreEqual(Sax.Application.Admin, 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);
|
||||
Assert.AreEqual(sessionData.SessionIdx, sessionDataDeserialised.SessionIdx);
|
||||
Assert.AreEqual(sessionData.ItemIdx, sessionDataDeserialised.ItemIdx);
|
||||
Assert.AreEqual(App.SessionContext.Index, sessionDataDeserialised.SessionContext.Index);
|
||||
Assert.AreEqual(Sax.Application.Admin, sessionDataDeserialised.SessionContext.Application);
|
||||
Assert.AreEqual(SysId.ToInt(sessionDataDeserialised.User.UserAccountId), SysId.ToInt(sessionDataDeserialised.User.UserAccountId));
|
||||
Assert.AreEqual(SysId.ToInt(sessionData.User.UserAccountId), SysId.ToInt(sessionDataDeserialised.User.UserAccountId));
|
||||
Assert.AreEqual(sessionData.User.EmailAddress, sessionDataDeserialised.User.EmailAddress);
|
||||
Assert.AreEqual(sessionData.User.FirstName, sessionDataDeserialised.User.FirstName);
|
||||
Assert.AreEqual(sessionData.User.LastName, sessionDataDeserialised.User.LastName);
|
||||
Assert.AreEqual(sessionData.User.DisplayName, sessionDataDeserialised.User.DisplayName);
|
||||
// User roles.
|
||||
Assert.AreEqual(userRoles.Count, sessionDataDeserialized.User.Roles.Count);
|
||||
Assert.AreEqual(userRoles.Count, sessionDataDeserialised.User.Roles.Count);
|
||||
|
||||
// Filters.
|
||||
|
||||
// Filters.
|
||||
Assert.AreEqual(sessionData.Filter.SportId, sessionDataDeserialised.Filter.SportId);
|
||||
Assert.AreEqual(sessionData.Filter.RegionId, sessionDataDeserialised.Filter.RegionId);
|
||||
|
||||
// Encryption data.
|
||||
Assert.AreEqual(sessionData.Base64IV_AdminApp, sessionDataDeserialised.Base64IV_AdminApp);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -10,6 +10,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Net.Standard.Base.Helpers;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
|
||||
namespace Saxonite.Net.Core.UnitTests.Web.Online.App
|
||||
{
|
||||
@@ -77,6 +78,9 @@ namespace Saxonite.Net.Core.UnitTests.Web.Online.App
|
||||
sessionData.Filter.OrganisationIdMember = filterOrganisationIdMember;
|
||||
sessionData.Filter.OrganisationCaptionMember = filterOrganisationCaptionMember;
|
||||
|
||||
// Encryption data.
|
||||
Assert.IsFalse(StringUtil.IsEmpty(sessionData.Base64IV_OnlineApp));
|
||||
|
||||
int idx = sessionData.NextItemIdx;
|
||||
idx = sessionData.NextItemIdx;
|
||||
idx = sessionData.NextItemIdx;
|
||||
@@ -137,6 +141,9 @@ namespace Saxonite.Net.Core.UnitTests.Web.Online.App
|
||||
Assert.IsTrue(SysId.IsValid(sessionDataDeserialised.Filter.OrganisationIdMember));
|
||||
Assert.AreEqual(filterOrganisationIdMember, sessionDataDeserialised.Filter.OrganisationIdMember);
|
||||
Assert.AreEqual(filterOrganisationCaptionMember, sessionDataDeserialised.Filter.OrganisationCaptionMember);
|
||||
|
||||
// Encryption data.
|
||||
Assert.AreEqual(sessionData.Base64IV_OnlineApp, sessionDataDeserialised.Base64IV_OnlineApp);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -501,9 +501,10 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
|
||||
public String Line2 { get; set; }
|
||||
public String Line3 { get; set; }
|
||||
public String Town { get; set; }
|
||||
public String Province { get; set; }
|
||||
public String RegionIdProvince { get; set; }
|
||||
public String Country { get; set; }
|
||||
public String RegionNameProvince { get; set; }
|
||||
public String RegionIdCountry { get; set; }
|
||||
public String RegionNameCountry { get; set; }
|
||||
public String PostalCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Saxonite.Net.Core.Web.Base.Models
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Business components.
|
||||
protected SaxInternals Internals { get { if (internals == null) internals = new SaxInternals(SessionContext); return internals; } }
|
||||
public SaxInternals Internals { get { if (internals == null) internals = new SaxInternals(SessionContext); return internals; } }
|
||||
// Consoles.
|
||||
protected SaxDataCacheConsole DataCacheConsole { get { return Internals.DataCacheConsole; } }
|
||||
protected SaxSessionDataConsole SessionDataConsole { get { return Internals.SessionDataConsole; } }
|
||||
@@ -257,8 +257,6 @@ namespace Saxonite.Net.Core.Web.Base.Models
|
||||
return Math.Min(maxLength, 2000);
|
||||
case SaxDbDfn_Core.ColumnIdx.UserAccount_PhoneMain:
|
||||
case SaxDbDfn_Core.ColumnIdx.UserAccount_PhoneMobile:
|
||||
case SaxDbDfn_Core.ColumnIdx.Organisation_PhoneMain:
|
||||
case SaxDbDfn_Core.ColumnIdx.Organisation_PhoneAlt:
|
||||
return Math.Min(maxLength, 20);
|
||||
//case SaxDbDfn.ColumnIdx.UserAccount_Postcode:
|
||||
//case SaxDbDfn.ColumnIdx.ItemAddress_Postcode:
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Helpers;
|
||||
using Saxonite.Net.Core.Web.Admin.Controllers;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
@@ -45,6 +48,21 @@ namespace Saxonite.Net.Core.Web.Admin.App
|
||||
/// <summary>User - JSON deserialisation route.</summary>
|
||||
public new UserData User { get { return base.User; } set { SetUser(new UserData_Admin(value)); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// General filters.
|
||||
public class FilterData
|
||||
{
|
||||
// Sport.
|
||||
public SysId SportId { get; set; }
|
||||
// Region.
|
||||
public SysId RegionId { get; set; }
|
||||
}
|
||||
public FilterData Filter { get; private set; } = new FilterData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Online application encryption IV value - for consistent encryption during session.
|
||||
public String Base64IV_AdminApp { get; private set; } = SacsEncryptionHelper.InitSymmetricEncryptionIV(SaxController_Admin.Base64Key_AdminApp);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Admin Image Controller - delivers dynamic images.
|
||||
//=======================================================================
|
||||
public partial class ImageController : SaxController_Admin
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
public static String ParamName_OrganisationLogoEncrypted { get; } = "ole";
|
||||
public static String ParamName_ArticleImageEncrypted { get; } = "aie";
|
||||
public static String ParamName_OrganisationId { get; } = "ori";
|
||||
public static String ParamName_ItemImageId { get; } = "iii";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public ImageController(SaxLocaliser localiser, ILogger<HomeController> logger) :
|
||||
base(localiser, logger)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Account Contact image request.
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Get the Account Contact Image for the specified account.
|
||||
/// <para>Current User Account is used if no other specified in the encrypted parameter.</para>
|
||||
/// <para>Encrypted parameter:</para>
|
||||
/// <para>- uaie: User Account Id encrypted.</para>
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[Route("Image/Account/Contact")]
|
||||
public IActionResult GetAccountContactImage(String uaie)
|
||||
{
|
||||
String userAccountIdParam = "";// ToDo Decrypt from uaie value.
|
||||
SysId userAccountId = userAccountIdParam.ToSysId();
|
||||
if (!SysId.IsValid(userAccountId))
|
||||
userAccountId = UserAccountId;
|
||||
return GetAccountContactImage(userAccountId, Sax.ImageType.Avatar);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Account Contact Image Profile/Upload request.
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Get the current Account Profile Contact Image for the specified account.
|
||||
/// <para>Account is always current User Account - this request is only fir use from the user's own profile page.</para>
|
||||
/// <para>'Uploaded' avatar image will take precedence as this will be the latest if present.</para>
|
||||
/// <para>NB Avoid caching this image as it will change whenever a new one is uploaded.</para>
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[Route("Image/Account/Contact/Profile")]
|
||||
[Route("Image/Account/Contact/Upload")]
|
||||
[ResponseCache(NoStore = true, Location = ResponseCacheLocation.None)]
|
||||
public IActionResult GetAccountContactImage()
|
||||
{
|
||||
// Response should not be cached.
|
||||
Response.Headers[HeaderNames.CacheControl] = "no-cache, no-store, must-revalidate, max-age=0";
|
||||
Response.Headers[HeaderNames.Expires] = "-1";
|
||||
SysId userAccountId = UserAccountId;
|
||||
return GetAccountContactImage(userAccountId, Sax.ImageType.Avatar_Upload);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Get the Avatar image for the specified user account.
|
||||
/// </summary>
|
||||
/// <param name="imageTypePriority"></param>
|
||||
/// <returns></returns>
|
||||
private IActionResult GetAccountContactImage(SysId userAccountId, Sax.ImageType imageTypePriority)
|
||||
{
|
||||
String fn = GetType().Name + ".GetAccountContactImage";
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer || !ValidUserSession) return Forbid();
|
||||
ItemId userItemId = new ItemId((short)Sax.DataItemType.UserAccount, userAccountId);
|
||||
|
||||
// Retrieve account contact images.
|
||||
SaxItemImage.Params prmItemImage = new SaxItemImage.Params();
|
||||
prmItemImage.ItemIdsIncluded.Add(userItemId);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.Avatar);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.Avatar_Upload);
|
||||
prmItemImage.StatusCat = SaxItemImage.StatusCat.ActiveOnly;
|
||||
SaxItemImage itemImage = null;
|
||||
foreach (SaxItemImage itemImageCandidate in ItemDataMgr.GetItemImageList(prmItemImage))
|
||||
{
|
||||
// One of the 'Avatar' image types will take precedence.
|
||||
if (itemImage == null || itemImageCandidate.ImageType == imageTypePriority)
|
||||
itemImage = itemImageCandidate;
|
||||
}
|
||||
|
||||
if (itemImage == null)
|
||||
return NotFound();
|
||||
|
||||
// Construct response.
|
||||
return File(itemImage.ImageData, itemImage.ContentType);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation logo.
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Get the logo for the specified Organisation.
|
||||
/// <para>Method parameter name (ole) must match name of encrypted parameter.</para>
|
||||
/// <para>Encrypted parameters:</para>
|
||||
/// <para>- ori: Organisation Id.</para>
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[Route("Image/Organisation/Logo")]
|
||||
public IActionResult GetOrganisationLogo(String ole)
|
||||
{
|
||||
return GetOrganisationLogo(ole, false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Get the logo for the specified Organisation.
|
||||
/// <para>Method parameter name (ole) must match name of encrypted parameter.</para>
|
||||
/// <para>Encrypted parameters:</para>
|
||||
/// <para>- ori: Organisation Id.</para>
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[Route("Image/Organisation/Logo/Upload")]
|
||||
public IActionResult GetOrganisationLogoUpload(String ole)
|
||||
{
|
||||
return GetOrganisationLogo(ole, true);
|
||||
}
|
||||
private IActionResult GetOrganisationLogo(String encryptedParams, bool allowUploadImage)
|
||||
{
|
||||
String fn = GetType().Name + ".GetOrganisationLogo";
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer || !ValidUserSession) return Forbid();
|
||||
|
||||
// Extract encrypted parameters.
|
||||
NameValueCollection parameters = ExtractSessionParams(encryptedParams);
|
||||
if (parameters.Count < 1) return Forbid();
|
||||
|
||||
// Organisation Id.
|
||||
SysId organisationId = parameters.Get(ParamName_OrganisationId).ToSysId();
|
||||
if (!SysId.IsValid(organisationId)) return Forbid();
|
||||
ItemId organisationItemId = new ItemId((short)Sax.DataItemType.Organisation, organisationId);
|
||||
|
||||
// Query Organisation Logo images.
|
||||
SaxItemImage.Params prmItemImage = new SaxItemImage.Params();
|
||||
prmItemImage.ItemIdsIncluded.Add(organisationItemId);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.OrganisationLogo);
|
||||
if (allowUploadImage)
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.OrganisationLogo_Upload);
|
||||
prmItemImage.StatusCat = SaxItemImage.StatusCat.ActiveOnly;
|
||||
SaxItemImage itemImage = null;
|
||||
foreach (SaxItemImage itemImageCandidate in ItemDataMgr.GetItemImageList(prmItemImage))
|
||||
{
|
||||
// The 'Upload' image will take precedence if allowed.
|
||||
if (itemImage == null || itemImageCandidate.ImageType == Sax.ImageType.OrganisationLogo_Upload)
|
||||
itemImage = itemImageCandidate;
|
||||
}
|
||||
|
||||
if (itemImage == null)
|
||||
return NotFound();
|
||||
|
||||
// Construct response.
|
||||
Response.Headers[HeaderNames.CacheControl] = "no-cache, no-store, must-revalidate, max-age=0";
|
||||
Response.Headers[HeaderNames.Expires] = "-1";
|
||||
return File(itemImage.ImageData, itemImage.ContentType);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Article image.
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Get the specified Article Image.
|
||||
/// <para>Method parameter name (aie) must match name of encrypted parameter.</para>
|
||||
/// <para>Encrypted parameters:</para>
|
||||
/// <para>- iii: Item Image Id.</para>
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[Route("Image/Article")]
|
||||
public IActionResult GetArticleImage(String aie)
|
||||
{
|
||||
String fn = GetType().Name + ".GetArticleImage";
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer || !ValidUserSession) return Forbid();
|
||||
ItemId userItemId = new ItemId((short)Sax.DataItemType.UserAccount, UserAccountId);
|
||||
|
||||
// Extract encrypted parameters.
|
||||
NameValueCollection parameters = ExtractSessionParams(aie);
|
||||
if (parameters.Count < 1) return Forbid();
|
||||
|
||||
// Item Image.
|
||||
SysId itemImageId = parameters.Get(ParamName_ItemImageId).ToSysId();
|
||||
if (!SysId.IsValid(itemImageId)) return Forbid();
|
||||
SaxItemImage itemImage = ItemDataMgr.GetItemImageById(itemImageId);
|
||||
if (itemImage == null)
|
||||
return NotFound();
|
||||
|
||||
// Construct response.
|
||||
return File(itemImage.ImageData, itemImage.ContentType);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -30,13 +31,20 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public String CategoryDesc { get; set; }
|
||||
public long MemberCount { get; set; }
|
||||
// Sport.
|
||||
public long SportId { get; set; }
|
||||
public String SportId { get; set; }
|
||||
public String SportName { get; set; }
|
||||
// Region - country.
|
||||
public long RegionIdCountry { get; set; }
|
||||
public String RegionNameCountry { get; set; }
|
||||
// Primary Region.
|
||||
public class RegionData
|
||||
{
|
||||
public String Id { get; set; }
|
||||
public String Name { get; set; }
|
||||
public bool? Country { get; set; } = null;
|
||||
}
|
||||
public RegionData RegionPrimary { get; } = new RegionData();
|
||||
// Address.
|
||||
public String AddressSummary { get; set; }
|
||||
// Logo.
|
||||
public String LogoImageUrl { get; set; }
|
||||
}
|
||||
private class OrganisationItemData : OrganisationListData
|
||||
{
|
||||
@@ -55,22 +63,30 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
data.CategoryDesc = OrganisationCategoryCodes.GetDescForType(organisation.OrganisationCategory);
|
||||
data.MemberCount = AccountMgr.GetOrganisationMemberCount(organisation.Id);
|
||||
// Sport.
|
||||
data.SportId = SysId.ToLong(organisation.SportIdPrimary);
|
||||
data.SportId = SysId.ToString(organisation.SportIdPrimary, null);
|
||||
using (SaxSport sport = ReferenceMgr.GetSportById(organisation.SportIdPrimary))
|
||||
data.SportName = sport?.Name ?? "";
|
||||
// Region.
|
||||
data.RegionIdCountry = SysId.ToLong(organisation.RegionIdPrimary);
|
||||
using (SaxRegion region = ReferenceMgr.GetRegionById(organisation.RegionIdPrimary))
|
||||
data.RegionNameCountry = region?.Name ?? "";
|
||||
data.SportName = sport?.Name ?? null;
|
||||
// Primary region.
|
||||
data.RegionPrimary.Id = SysId.ToString(organisation.RegionIdPrimary, null);
|
||||
SaxRegion.Data region = Internals.GetRegion(organisation.RegionIdPrimary);
|
||||
if (region != null)
|
||||
{
|
||||
data.RegionPrimary.Name = region.Name;
|
||||
data.RegionPrimary.Country = region.RegionType == Sax.RegionType.Country ? true : (bool?)null;
|
||||
}
|
||||
// Common properties.
|
||||
data.StatusCode = organisation.StatusCode;
|
||||
data.StatusDesc = organisation.StatusDesc;
|
||||
|
||||
// Organisation Logo image url.
|
||||
if (ItemDataMgr.ItemHasActiveImage(organisation.GetItemId(), Sax.ImageType.OrganisationLogo))
|
||||
data.LogoImageUrl = GetOrganisationLogoUrl(organisation.Id, false);
|
||||
}
|
||||
private void PopulateOrganisationResponseItemData(SaxOrganisation organisation, SaxItemAddress address, OrganisationItemData data)
|
||||
{
|
||||
PopulateOrganisationResponseListData(organisation, data as OrganisationListData);
|
||||
data.About = organisation.About;
|
||||
data.Facilities = organisation.Facilities;
|
||||
PopulateOrganisationResponseListData(organisation, data);
|
||||
data.About = StringUtil.OnEmpty(organisation.About, null);
|
||||
data.Facilities = StringUtil.OnEmpty(organisation.Facilities, null);
|
||||
// Contact methods.
|
||||
SaxContactData contactData = new SaxContactData(organisation.ContactData);
|
||||
foreach (Sax.ContactMethod method in contactData.Methods)
|
||||
@@ -82,14 +98,16 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (address != null && !address.IsStatusDeleted)
|
||||
{
|
||||
data.Address = new AjaxResponse_Data.AddressData();
|
||||
data.Address.Id = address.Id.ToString();
|
||||
data.Address.Line1 = address.Line1;
|
||||
data.Address.Line2 = address.Line2;
|
||||
data.Address.Line3 = address.Line3;
|
||||
data.Address.Id = address.Id.ToString(null);
|
||||
data.Address.Line1 = StringUtil.OnEmpty(address.Line1, null);
|
||||
data.Address.Line2 = StringUtil.OnEmpty(address.Line2, null);
|
||||
data.Address.Line3 = StringUtil.OnEmpty(address.Line3, null);
|
||||
data.Address.Town = address.Town;
|
||||
data.Address.Province = address.Province;
|
||||
data.Address.Country = address.Country;
|
||||
data.Address.PostalCode = address.PostalCode;
|
||||
data.Address.RegionIdProvince = SysId.ToString(address.RegionIdProvince, null);
|
||||
data.Address.RegionNameProvince = StringUtil.OnEmpty(address.Province, null);
|
||||
data.Address.RegionIdCountry = SysId.ToString(address.RegionIdCountry, null);
|
||||
data.Address.RegionNameCountry = StringUtil.OnEmpty(address.Country, null);
|
||||
data.Address.PostalCode = StringUtil.OnEmpty(address.PostalCode, null);
|
||||
}
|
||||
// Common properties.
|
||||
data.Notes = organisation.Notes;
|
||||
@@ -136,13 +154,19 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
responseData.Statuses.Add(SacsSystem.GetStatusCode(status), Localiser.GetStatusCaption(status));
|
||||
responseData.DefaultStatusCode = SacsSystem.GetStatusCode(SaxOrganisation.DefaultStatus);
|
||||
|
||||
// Store filter values.
|
||||
SysId filterSportId = model.Filter.OrganisationSportId.ToSysId();
|
||||
SessionData_Admin.Filter.SportId = SysId.IsValid(filterSportId) ? filterSportId : null;
|
||||
SysId filterRegionId = model.Filter.OrganisationRegionId.ToSysId();
|
||||
SessionData_Admin.Filter.RegionId = SysId.IsValid(filterRegionId) ? filterRegionId : null;
|
||||
|
||||
// Item filter.
|
||||
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||
prmOrganisation.OrganisationFilter = model.Filter.Organisation;
|
||||
prmOrganisation.OrganisationType = model.FilterOrganisationType;
|
||||
prmOrganisation.OrganisationCategory = model.FilterOrganisationCategory;
|
||||
prmOrganisation.SportIdsIncluded.AddId(model.Filter.OrganisationSportId.ToSysId());
|
||||
prmOrganisation.RegionIdsIncluded.AddId(model.Filter.OrganisationRegionId.ToSysId());
|
||||
prmOrganisation.SportIdsIncluded.AddId(filterSportId);
|
||||
prmOrganisation.RegionIdsIncluded.AddId(filterRegionId);
|
||||
prmOrganisation.StatusCat = model.Filter.OrganisationStatusCategoryCode != null ? model.FilterOrganisationStatusCategory : SaxOrganisation.StatusCat.NotDeleted;
|
||||
prmOrganisation.SortColumns.Add(AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Name));
|
||||
model.Paging.ItemTotal = (ulong)AccountMgr.GetOrganisationCount(prmOrganisation);
|
||||
@@ -153,10 +177,9 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
ColumnDfn colName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Name);
|
||||
ColumnDfn colOrganisationType = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.OrganisationType);
|
||||
ColumnDfn colOrganisationCategory = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.OrganisationCategory);
|
||||
ColumnDfn colPhoneMain = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.PhoneMain);
|
||||
ColumnDfn colPhoneAlt = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.PhoneAlt);
|
||||
ColumnDfn colUserCount = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.User_Count);
|
||||
ColumnDfn colMemberCount = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Member_Count);
|
||||
ColumnDfn colLogoCount = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.LogoImage_Count);
|
||||
ColumnDfn colSportId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.SportId);
|
||||
ColumnDfn colSportName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Sport_Name);
|
||||
ColumnDfn colRegionId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.RegionId);
|
||||
@@ -168,9 +191,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
colName,
|
||||
colOrganisationType,
|
||||
colOrganisationCategory,
|
||||
colPhoneMain,
|
||||
colPhoneAlt,
|
||||
colUserCount, colMemberCount,
|
||||
colUserCount, colMemberCount, colLogoCount,
|
||||
colSportId, colSportName,
|
||||
colRegionId, colRegionName,
|
||||
colStatus
|
||||
@@ -182,22 +203,28 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
SysId organisationId = new SysId(values.GetLong(colId.DataName));
|
||||
OrganisationListData organisationData = new OrganisationListData()
|
||||
{
|
||||
Id = values.GetLong(colId.DataName).ToString(),
|
||||
Id = organisationId.ToString(),
|
||||
Name = values.GetString(colName.DataName),
|
||||
TypeCode = values.GetString(colOrganisationType.DataName),
|
||||
TypeDesc = OrganisationTypeCodes.GetDescForCode(values.GetString(colOrganisationType.DataName)),
|
||||
CategoryCode = values.GetString(colOrganisationCategory.DataName),
|
||||
CategoryDesc = OrganisationCategoryCodes.GetDescForCode(values.GetString(colOrganisationCategory.DataName)),
|
||||
MemberCount = StringUtil.ToLong(values.GetString(colMemberCount.DataName)),
|
||||
SportId = values.GetLong(colSportId.DataName),
|
||||
SportName = values.GetString(colSportName.DataName),
|
||||
RegionIdCountry = values.GetLong(colRegionId.DataName),
|
||||
RegionNameCountry = values.GetString(colRegionName.DataName),
|
||||
SportId = SysId.ToString(new SysId(values.GetLong(colSportId.DataName)), null),
|
||||
SportName = StringUtil.OnEmpty(values.GetString(colSportName.DataName), null),
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||
};
|
||||
// Logo image.
|
||||
if (StringUtil.ToLong(values.GetString(colLogoCount.DataName)) > 0)
|
||||
organisationData.LogoImageUrl = GetOrganisationLogoUrl(organisationId, false);
|
||||
// Primary region.
|
||||
organisationData.RegionPrimary.Id = SysId.ToString(new SysId(values.GetLong(colRegionId.DataName)), null);
|
||||
organisationData.RegionPrimary.Name = StringUtil.OnEmpty(values.GetString(colRegionName.DataName), null);
|
||||
// Add item to list.
|
||||
responseData.Organisations.Add(organisationData);
|
||||
}
|
||||
}
|
||||
@@ -318,8 +345,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
organisation.OrganisationCategory = model.OrganisationCategory;
|
||||
if (model.OrganisationSportId != null)
|
||||
organisation.SportIdPrimary = model.OrganisationSportId.ToSysId();
|
||||
if (model.OrganisationRegionIdCountry != null)
|
||||
organisation.RegionIdPrimary = model.OrganisationRegionIdCountry.ToSysId();
|
||||
if (model.OrganisationRegionIdPrimary != null)
|
||||
organisation.RegionIdPrimary = model.OrganisationRegionIdPrimary.ToSysId();
|
||||
if (model.OrganisationAbout != null)
|
||||
organisation.About = model.OrganisationAbout;
|
||||
if (model.OrganisationFacilities != null)
|
||||
@@ -356,7 +383,10 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (model.Address.IsPopulated())
|
||||
{
|
||||
// Organisation regions.
|
||||
SaxRegion.Data regionCountry = Internals.GetRegion(organisation.RegionIdPrimary);
|
||||
SaxRegion.Data regionCountry = Internals.GetRegion(model.Address.RegionIdCountry.ToSysId());
|
||||
if (regionCountry == null)
|
||||
// Default to Organisation's primary region.
|
||||
regionCountry = Internals.GetRegion(organisation.RegionIdPrimary);
|
||||
if (regionCountry != null && regionCountry.RegionType != Sax.RegionType.Country)
|
||||
regionCountry = null;
|
||||
SaxRegion.Data regionProvince = null;
|
||||
@@ -392,11 +422,6 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
organisationAddress.Country = regionCountry.Name;
|
||||
organisationAddress.RegionIdCountry = regionCountry.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (model.Address.Country != null)
|
||||
organisationAddress.Country = model.Address.Country;
|
||||
}
|
||||
organisationAddress.PostalCode = model.Address.PostalCode;
|
||||
organisationAddress.Status = SaxItemAddress.DefaultStatus;
|
||||
|
||||
@@ -420,7 +445,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (organisationAddress != null && !organisationAddress.IsStatusDeleted)
|
||||
{
|
||||
// Address not populated - delete it.
|
||||
if (!ItemDataMgr.DeleteItemAddress(organisationAddress, DbUpdateInfo))
|
||||
|
||||
@@ -0,0 +1,308 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
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.Helpers;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
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.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Controller: Organisation Images - Ajax
|
||||
//=======================================================================
|
||||
partial class OrganisationController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
private class OrganisationImagesData : OrganisationItemData
|
||||
{
|
||||
}
|
||||
private void PopulateOrganisationResponseImagesData(SaxOrganisation organisation, SaxItemAddress address, OrganisationImagesData data)
|
||||
{
|
||||
PopulateOrganisationResponseItemData(organisation, address, data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Organisation Images ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_OrganisationImages : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_OrganisationImages(SaxModel_Admin model) : base(model) { }
|
||||
// Organisation details.
|
||||
public OrganisationImagesData organisation { get; } = new OrganisationImagesData();
|
||||
// Reference data.
|
||||
public List<String> ImageContentTypes { get; set; }
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/GetImages")]
|
||||
[Route("Organisation/Ajax/GetItemImages")]
|
||||
public IActionResult Ajax_GetImages(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetImages";
|
||||
String messageTitle = Localiser["organisation.caption.organisation"];
|
||||
AjaxResponse_OrganisationImages responseData = new AjaxResponse_OrganisationImages(model);
|
||||
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
|
||||
// Reference data - Image content types.
|
||||
responseData.ImageContentTypes = SaxItemImage.GetValidContentTypes(Sax.DataItemType.Organisation);
|
||||
|
||||
// Identify item.
|
||||
SysId organisationId = model.OrganisationId.ToSysId();
|
||||
if (!SysId.IsValid(organisationId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
// Retrieve item.
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
disposableItems.Add(organisation);
|
||||
if (organisation == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve organisation for Id: '" + model.OrganisationId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Organisation address.
|
||||
SaxItemAddress address = ItemDataMgr.GetFirstItemAddressByItemAndType(organisation.GetItemId());
|
||||
disposableItems.Add(address);
|
||||
|
||||
// Construct response.
|
||||
PopulateOrganisationResponseImagesData(organisation, address, responseData.organisation);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
}
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Account - Upload Contact Image.
|
||||
// Ref. http://www.binaryintellect.net/articles/474dc031-087f-4b81-b994-9ca2adb949d6.aspx
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_UploadOrganisationLogoImage : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_UploadOrganisationLogoImage(SaxModel_Admin model) : base(model) { }
|
||||
// Uploaded image URL.
|
||||
public String ImageUrl { get; set; }
|
||||
// Upload message.
|
||||
public String UploadMsg { get; set; }
|
||||
}
|
||||
// Ajax request.
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/UploadLogo")]
|
||||
[Route("Organisation/Ajax/UploadLogoImage")]
|
||||
public IActionResult UploadOrganisationLogoImage(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".UploadOrganisationLogoImage";
|
||||
AjaxResponse_UploadOrganisationLogoImage responseData = new AjaxResponse_UploadOrganisationLogoImage(model);
|
||||
String messageTitle = Localiser["organisation.caption.organisation"];
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer) return Forbid();
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
// Retrieve organisation.
|
||||
SysId organisationId = model.OrganisationId.ToSysId();
|
||||
if (!SysId.IsValid(organisationId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
disposableItems.Add(organisation);
|
||||
if (organisation == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve organisation for Id: '" + model.OrganisationId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Validate number of images.
|
||||
if (model.OrganisationLogoImage.IsEmpty())
|
||||
{
|
||||
SaLogger.Warn(fn + " No image file supplied for upload");
|
||||
return Json(responseData);
|
||||
}
|
||||
if (model.OrganisationLogoImage.Count != 1)
|
||||
{
|
||||
SaLogger.Warn(fn + " Invalid number of image files uploaded: " + model.OrganisationLogoImage.Count);
|
||||
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.upload.image.single"]));
|
||||
}
|
||||
IFormFile file = model.OrganisationLogoImage[0];
|
||||
|
||||
// Image properties.
|
||||
byte[] imageData = null;
|
||||
using (MemoryStream fileStream = new MemoryStream())
|
||||
{
|
||||
file.CopyTo(fileStream);
|
||||
imageData = fileStream.ToArray();
|
||||
}
|
||||
|
||||
// Validate the image.
|
||||
ImageUtils.ImageConfig imageConfig = ImageUtils.VerifyImageData(imageData);
|
||||
if (!imageConfig.ValidImage)
|
||||
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.upload.image.invalid"]));
|
||||
|
||||
// Validate mime type.
|
||||
if (!SaxItemImage.GetValidMimeTypes(Sax.DataItemType.UserAccount).Contains(imageConfig.MimeType))
|
||||
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.upload.image.invalid.mime"]));
|
||||
|
||||
// Validate content type.
|
||||
if (StringUtil.IsEmpty(file.ContentType) || !SaxItemImage.GetValidContentTypes(Sax.DataItemType.UserAccount).ContainsCI(file.ContentType))
|
||||
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.upload.image.invalid.content.type"]));
|
||||
|
||||
// Resize the image if required.
|
||||
if (!ImageUtils.ConstrainImage(imageConfig, Sax.Config.Organisation.Logo.WidthMax, Sax.Config.Organisation.Logo.HeightMax))
|
||||
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.upload.image.resize.failed"]));
|
||||
|
||||
// Image belongs to the organisation.
|
||||
ItemId organisationItemId = organisation.GetItemId();
|
||||
|
||||
// Store uploaded image as 'Upload' Logo - awaiting confirmation that the details are to be saved.
|
||||
SaxItemImage itemImage = ItemDataMgr.GetItemImage(organisationItemId, Sax.ImageType.OrganisationLogo_Upload, SaxItemImage.StatusCat.Any);
|
||||
if (itemImage == null)
|
||||
itemImage = ItemDataMgr.CreateItemImage(organisationItemId, Sax.ImageType.OrganisationLogo_Upload);
|
||||
itemImage.Filename = file.FileName;
|
||||
itemImage.Mime = SacsContentTypeHelper.GetMimeTypeFromContentType(file.ContentType).ToString().ToLower();
|
||||
itemImage.ContentType = file.ContentType;
|
||||
itemImage.ImageData = imageConfig.ImageData;
|
||||
itemImage.Width = imageConfig.Width;
|
||||
itemImage.Height = imageConfig.Height;
|
||||
itemImage.Status = SaxItemImage.DefaultStatus;
|
||||
|
||||
if (!SysId.IsValid(itemImage.Id))
|
||||
{
|
||||
if (!ItemDataMgr.InsertItemImage(itemImage, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert uploaded image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImage, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update uploaded image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
}
|
||||
|
||||
// Return image url with response.
|
||||
responseData.ImageUrl = GetOrganisationLogoUrl(organisation.Id, true);
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
responseData.SetNotification(messageTitle, "Image uploaded.");
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Store Organisation Images ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/StoreImages")]
|
||||
public IActionResult Ajax_StoreImages(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_StoreImages";
|
||||
String messageTitle = Localiser["organisation.caption.organisation"];
|
||||
AjaxResponse_OrganisationImages responseData = new AjaxResponse_OrganisationImages(model);
|
||||
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
|
||||
// Validate item properties.
|
||||
model.ValidateOrganisationData(responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
|
||||
// Retrieve organisation.
|
||||
SysId organisationId = model.OrganisationId.ToSysId();
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
disposableItems.Add(organisation);
|
||||
if (organisation == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve organisation for Id: '" + model.OrganisationId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Organisation address.
|
||||
SaxItemAddress address = ItemDataMgr.GetFirstItemAddressByItemAndType(organisation.GetItemId());
|
||||
disposableItems.Add(address);
|
||||
|
||||
// Check for uploaded logo image.
|
||||
ItemId organisationItemId = organisation.GetItemId();
|
||||
SaxItemImage itemImageLogoUploaded = ItemDataMgr.GetItemImage(organisationItemId, Sax.ImageType.OrganisationLogo_Upload, SaxItemImage.StatusCat.ActiveOnly);
|
||||
disposableItems.Add(itemImageLogoUploaded);
|
||||
if (itemImageLogoUploaded != null)
|
||||
{
|
||||
// Retrieve current OrganisationLogo image.
|
||||
SaxItemImage itemImageLogo = ItemDataMgr.GetItemImage(organisationItemId, Sax.ImageType.OrganisationLogo, SaxItemImage.StatusCat.Any);
|
||||
if (itemImageLogo == null)
|
||||
itemImageLogo = ItemDataMgr.CreateItemImage(organisationItemId, Sax.ImageType.OrganisationLogo);
|
||||
disposableItems.Add(itemImageLogo);
|
||||
// Copy properties from uploaded image.
|
||||
itemImageLogo.Filename = itemImageLogoUploaded.Filename;
|
||||
itemImageLogo.Mime = itemImageLogoUploaded.Mime;
|
||||
itemImageLogo.ContentType = itemImageLogoUploaded.ContentType;
|
||||
itemImageLogo.Width = itemImageLogoUploaded.Width;
|
||||
itemImageLogo.Height = itemImageLogoUploaded.Height;
|
||||
itemImageLogo.ImageData = itemImageLogoUploaded.ImageData;
|
||||
itemImageLogo.Status = SaxItemImage.DefaultStatus;
|
||||
if (!SysId.IsValid(itemImageLogo.Id))
|
||||
{
|
||||
if (!ItemDataMgr.InsertItemImage(itemImageLogo, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert logo image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImageLogo, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update logo image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.update.failed"]));
|
||||
}
|
||||
}
|
||||
// Logically delete the uplaoded image.
|
||||
itemImageLogoUploaded.Status = SaStatus.Deleted;
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImageLogoUploaded, DbUpdateInfo))
|
||||
SaLogger.Warn(fn + " Failed to logically delete uploaded logo image - " + ItemDataMgr.ErrorStateMessage);
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateOrganisationResponseImagesData(organisation, address, responseData.organisation);
|
||||
}
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -32,8 +32,19 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (!ValidUserSession)
|
||||
return RedirectToAction("", "");
|
||||
|
||||
// Paging.
|
||||
// Model.
|
||||
Model_Organisation model = new Model_Organisation(Localiser);
|
||||
|
||||
// Stored Sport filter.
|
||||
model.Filter.OrganisationSportId = SessionData_Admin.Filter.SportId?.ToString() ?? null;
|
||||
using (SaxSport filterSport = ReferenceMgr.GetSportById(SessionData_Admin.Filter.SportId))
|
||||
model.Filter.OrganisationSportName = Localiser.GetSportName(SessionData_Admin.Filter.SportId, filterSport?.Name ?? "");
|
||||
// Stored Region filter.
|
||||
model.Filter.OrganisationRegionId = SessionData_Admin.Filter.RegionId?.ToString() ?? null;
|
||||
using (SaxRegion filterRegion = ReferenceMgr.GetRegionById(SessionData_Admin.Filter.RegionId))
|
||||
model.Filter.OrganisationRegionName = Localiser.GetRegionName(SessionData_Admin.Filter.RegionId, filterRegion?.Name ?? "");
|
||||
|
||||
// Paging.
|
||||
model.Paging.PageNo = 1;
|
||||
model.Paging.PageLength = 8;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// Region data.
|
||||
private class RegionListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String RegionTypeCode { get; set; }
|
||||
public int? RegionType { get; set; } = null;
|
||||
public String RegionTypeDesc { get; set; }
|
||||
public String CountryIso2Code { get; set; }
|
||||
public String Name { get; set; }
|
||||
@@ -29,12 +29,13 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
}
|
||||
private class RegionItemData : RegionListData
|
||||
{
|
||||
public String RegionTypeCode { get; set; }
|
||||
public String RegionIdParent { get; set; }
|
||||
}
|
||||
private void PopulateRegionResponseListData(SaxRegion region, RegionListData data)
|
||||
{
|
||||
data.Id = SysId.ToString(region.Id);
|
||||
data.RegionTypeCode = RegionTypeCodes.GetCodeForType(region.RegionType);
|
||||
data.RegionType = (int)region.RegionType;
|
||||
data.RegionTypeDesc = RegionTypeCodes.GetDescForType(region.RegionType);
|
||||
data.CountryIso2Code = region.CountryIso2Code;
|
||||
data.Name = region.Name;
|
||||
@@ -48,6 +49,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
private void PopulateRegionResponseItemData(SaxRegion region, RegionItemData data)
|
||||
{
|
||||
PopulateRegionResponseListData(region, data);
|
||||
data.RegionTypeCode = RegionTypeCodes.GetCodeForType(region.RegionType);
|
||||
data.RegionIdParent = SysId.ToString(region.RegionIdParent);
|
||||
}
|
||||
|
||||
@@ -121,7 +123,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
RegionListData regionData = new RegionListData()
|
||||
{
|
||||
Id = values.GetString(colId.DataName),
|
||||
RegionTypeCode = RegionTypeCodes.GetCodeForType(regionType),
|
||||
RegionType = (int)regionType,
|
||||
RegionTypeDesc = RegionTypeCodes.GetDescForType(regionType),
|
||||
CountryIso2Code = values.GetString(colIso2Code.DataName),
|
||||
Name = values.GetString(colName.DataName),
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
@@ -119,6 +120,21 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
ClearSessionData();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation utilities.
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Construct URL to display Organisation logo.
|
||||
/// <para>- Option to allow for 'Upload' image if active.</para>
|
||||
/// </summary>
|
||||
protected String GetOrganisationLogoUrl(SysId organisationId, bool uploadImage)
|
||||
{
|
||||
String imageLink = "Image/Organisation/Logo" + (uploadImage ? "/Upload" : "") + "?";
|
||||
NameValueCollection parameters = new NameValueCollection();
|
||||
parameters.Add(ImageController.ParamName_OrganisationId, SysId.ToString(organisationId));
|
||||
return imageLink + ImageController.ParamName_OrganisationLogoEncrypted + "=" + EncryptSessionParams(parameters);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Keep Logged In.
|
||||
//-------------------------------------------------------------------
|
||||
@@ -187,6 +203,25 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return keepLoggedInParams;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Parameter encryption, eg. for images.
|
||||
//-------------------------------------------------------------------
|
||||
// Encryption key is the same for all users each time the application is started,
|
||||
// but a different IV value is generated for each session so that the links/parameters cannot be shared.
|
||||
public static String Base64Key_AdminApp { get; } = SacsEncryptionHelper.EncodePlainKey("Saxonite&Admin#Encryption-"+DateTime.Today.Format("ddMMyy"), SacsEncryptionHelper.KeyLength);
|
||||
protected String EncryptSessionParams(NameValueCollection parameters)
|
||||
{
|
||||
return HttpUtility.UrlEncode(EncryptParameters(parameters, SessionData_Admin.Base64IV_AdminApp, Base64Key_AdminApp));
|
||||
}
|
||||
public static String EncryptSessionParams(SaxController_Admin controller, NameValueCollection parameters)
|
||||
{
|
||||
return controller.EncryptSessionParams(parameters);
|
||||
}
|
||||
protected NameValueCollection ExtractSessionParams(String encryptedParams)
|
||||
{
|
||||
return DecryptParameters(encryptedParams, SessionData_Admin.Base64IV_AdminApp, Base64Key_AdminApp);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -161,6 +161,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
foreach (SaStatus status in SaxUserAccount.ValidStatuses.FindAll(item => item != SaStatus.Deleted))
|
||||
responseData.Statuses.Add(SacsSystem.GetStatusCode(status), Localiser.GetStatusCaption(status));
|
||||
|
||||
// Store filter values.
|
||||
SysId filterSportId = model.Filter.UserSportId.ToSysId();
|
||||
SessionData_Admin.Filter.SportId = SysId.IsValid(filterSportId) ? filterSportId : null;
|
||||
SysId filterRegionId = model.Filter.UserRegionId.ToSysId();
|
||||
SessionData_Admin.Filter.RegionId = SysId.IsValid(filterRegionId) ? filterRegionId : null;
|
||||
|
||||
// Item filter.
|
||||
SaxUserAccount.Params prmUserAccount = new SaxUserAccount.Params();
|
||||
prmUserAccount.UserFilterPartial = model.Filter.User;
|
||||
|
||||
@@ -31,8 +31,19 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (!ValidUserSession)
|
||||
return RedirectToAction("", "");
|
||||
|
||||
// Paging.
|
||||
// Model.
|
||||
Model_User model = new Model_User(Localiser);
|
||||
|
||||
// Stored Sport filter.
|
||||
model.Filter.UserSportId = SessionData_Admin.Filter.SportId?.ToString() ?? null;
|
||||
using (SaxSport filterSport = ReferenceMgr.GetSportById(SessionData_Admin.Filter.SportId))
|
||||
model.Filter.UserSportName = Localiser.GetSportName(SessionData_Admin.Filter.SportId, filterSport?.Name ?? "");
|
||||
// Stored Region filter.
|
||||
model.Filter.UserRegionId = SessionData_Admin.Filter.RegionId?.ToString() ?? null;
|
||||
using (SaxRegion filterRegion = ReferenceMgr.GetRegionById(SessionData_Admin.Filter.RegionId))
|
||||
model.Filter.UserRegionName = Localiser.GetRegionName(SessionData_Admin.Filter.RegionId, filterRegion?.Name ?? "");
|
||||
|
||||
// Paging.
|
||||
model.Paging.PageNo = 1;
|
||||
model.Paging.PageLength = 12;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
public String Town { get; set; }
|
||||
public String Province { get; set; }
|
||||
public String RegionIdProvince { get; set; }
|
||||
public String Country { get; set; }
|
||||
public String RegionIdCountry { get; set; }
|
||||
public String PostalCode { get; set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -47,14 +47,14 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
/// <summary>Have any address values been supplied by the form.</summary>
|
||||
public bool IsSpecified()
|
||||
{
|
||||
if (Id != null || Line1 != null || Town != null || Province != null || Country != null || PostalCode != null)
|
||||
if (Id != null || Line1 != null || Town != null || Province != null || RegionIdCountry != null || PostalCode != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
/// <summary>Have any address values been populated on the form.</summary>
|
||||
public bool IsPopulated()
|
||||
{
|
||||
if (SysId.IsValid(Id.ToSysId()) || !StringUtil.IsEmpty(Line1) || !StringUtil.IsEmpty(Town) || !StringUtil.IsEmpty(Province) || !StringUtil.IsEmpty(Country) || !StringUtil.IsEmpty(PostalCode))
|
||||
if (SysId.IsValid(Id.ToSysId()) || !StringUtil.IsEmpty(Line1) || !StringUtil.IsEmpty(Town) || !StringUtil.IsEmpty(Province) || !StringUtil.IsEmpty(RegionIdCountry) || !StringUtil.IsEmpty(PostalCode))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
// Validation.
|
||||
//-------------------------------------------------------------------
|
||||
// Address.
|
||||
public bool ValidateAddressData(SaxController_Base.AjaxResponse_Data responseData)
|
||||
public bool ValidateAddressData(SaxModel_Admin model, SaxController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
// Are any properties populated.
|
||||
bool populated = IsPopulated();
|
||||
@@ -101,32 +101,37 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
// Address Town - mandatory if any value populated.
|
||||
if (Town != null)
|
||||
{
|
||||
responseData.SetControlValue(ControlNameSuffix + "Town", Town);
|
||||
String controlName = ControlNameSuffix + nameof(Town);
|
||||
responseData.SetControlValue(controlName, Town);
|
||||
if (StringUtil.IsEmpty(Town) && populated)
|
||||
responseData.SetControlError(ControlNameSuffix + "Town", Model.Localiser["msg.validation.mandatory.value"]);
|
||||
responseData.SetControlError(controlName, Model.Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(Town) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town))
|
||||
responseData.SetControlError(ControlNameSuffix + "Town", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town)]);
|
||||
responseData.SetControlError(controlName, Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town)]);
|
||||
}
|
||||
|
||||
// Address Province - optional.
|
||||
if (Province != null)
|
||||
{
|
||||
responseData.SetControlValue(ControlNameSuffix + "Province", Province);
|
||||
String controlName = ControlNameSuffix + nameof(Province);
|
||||
responseData.SetControlValue(controlName, Province);
|
||||
if (!StringUtil.IsEmpty(Province))
|
||||
{
|
||||
if (StringUtil.GetLength(Province) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Province))
|
||||
responseData.SetControlError(ControlNameSuffix + "Province", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Province)]);
|
||||
responseData.SetControlError(controlName, Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Province)]);
|
||||
}
|
||||
}
|
||||
|
||||
// Address Country - optional.
|
||||
if (Country != null)
|
||||
// Address Country - mandatory if any value populated.
|
||||
if (RegionIdCountry != null)
|
||||
{
|
||||
responseData.SetControlValue(ControlNameSuffix + "Country", Country);
|
||||
if (!StringUtil.IsEmpty(Country))
|
||||
String controlName = ControlNameSuffix + nameof(RegionIdCountry);
|
||||
if (!SysId.IsValid(RegionIdCountry.ToSysId()) && populated)
|
||||
responseData.SetControlError(controlName, Model.Localiser["msg.validation.mandatory.value"]);
|
||||
else if (SysId.IsValid(RegionIdCountry.ToSysId()))
|
||||
{
|
||||
if (StringUtil.GetLength(Country) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Country))
|
||||
responseData.SetControlError(ControlNameSuffix + "Country", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Country)]);
|
||||
SaxRegion.Data region = model.Internals.GetRegion(RegionIdCountry.ToSysId());
|
||||
if (region == null || region.RegionType != Sax.RegionType.Country)
|
||||
responseData.SetControlError(controlName, Model.Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
@@ -34,7 +35,9 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
public String OrganisationTypeCode { get; set; }
|
||||
public String OrganisationCategoryCode { get; set; }
|
||||
public String OrganisationSportId { get; set; }
|
||||
public String OrganisationSportName { get; set; }
|
||||
public String OrganisationRegionId { get; set; }
|
||||
public String OrganisationRegionName { get; set; }
|
||||
public String OrganisationStatusCategoryCode { get; set; }
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
@@ -75,7 +78,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
public String OrganisationCategoryValue { get; set; }
|
||||
public Sax.OrganisationCategory OrganisationCategory { get { return (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(OrganisationCategoryValue); } }
|
||||
public String OrganisationSportId { get; set; }
|
||||
public String OrganisationRegionIdCountry { get; set; }
|
||||
public String OrganisationRegionIdPrimary { get; set; }
|
||||
public String OrganisationAbout { get; set; }
|
||||
public String OrganisationFacilities { get; set; }
|
||||
// Common properties.
|
||||
@@ -92,6 +95,11 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
// Address.
|
||||
public ModelData_Address Address { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Images.
|
||||
public List<IFormFile> OrganisationLogoImage { get; set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
public bool IsSportMandatory()
|
||||
{
|
||||
@@ -143,15 +151,15 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
}
|
||||
}
|
||||
|
||||
// Organisation region.
|
||||
if (OrganisationRegionIdCountry != null)
|
||||
// Organisation primary region.
|
||||
if (OrganisationRegionIdPrimary != null)
|
||||
{
|
||||
using (SaxRegion region = ReferenceMgr.GetRegionById(OrganisationRegionIdCountry.ToSysId()))
|
||||
using (SaxRegion region = ReferenceMgr.GetRegionById(OrganisationRegionIdPrimary.ToSysId()))
|
||||
{
|
||||
if (region == null)
|
||||
responseData.SetControlError(nameof(OrganisationRegionIdCountry), Localiser["msg.validation.invalid.value"]);
|
||||
responseData.SetControlError(nameof(OrganisationRegionIdPrimary), Localiser["msg.validation.invalid.value"]);
|
||||
else if (region.RegionType != Sax.RegionType.Country && region.RegionType != Sax.RegionType.Continent && region.RegionType != Sax.RegionType.World)
|
||||
responseData.SetControlError(nameof(OrganisationRegionIdCountry), "Organisation region must be a country or international region");
|
||||
responseData.SetControlError(nameof(OrganisationRegionIdPrimary), "Organisation region must be a country or international region");
|
||||
}
|
||||
|
||||
if (!StringUtil.IsEmpty(OrganisationName))
|
||||
@@ -161,7 +169,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
if (SysId.IsValid(OrganisationId.ToSysId()))
|
||||
prmOrganisation.IdsExcluded.Add(OrganisationId.ToSysId());
|
||||
prmOrganisation.NameFull = OrganisationName;
|
||||
prmOrganisation.RegionIdsIncluded.Add(OrganisationRegionIdCountry.ToSysId());
|
||||
prmOrganisation.RegionIdsIncluded.Add(OrganisationRegionIdPrimary.ToSysId());
|
||||
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.Any;
|
||||
if (AccountMgr.GetOrganisationCount(prmOrganisation) > 0)
|
||||
responseData.SetControlError(nameof(OrganisationName), Localiser["msg.validation.duplicate.value"]);
|
||||
@@ -226,7 +234,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
|
||||
// Validate address fields.
|
||||
if (Address != null)
|
||||
Address.ValidateAddressData(responseData);
|
||||
Address.ValidateAddressData(this, responseData);
|
||||
|
||||
return !responseData.HasControlErrors();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,9 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
{
|
||||
public String User { get; set; }
|
||||
public String UserSportId { get; set; }
|
||||
public String UserSportName { get; set; }
|
||||
public String UserRegionId { get; set; }
|
||||
public String UserRegionName { get; set; }
|
||||
public String UserStatusCategoryCode { get; set; }
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
|
||||
@@ -120,9 +120,15 @@
|
||||
<data name="caption.contact.method" xml:space="preserve">
|
||||
<value>Contact Method</value>
|
||||
</data>
|
||||
<data name="caption.image.upload" xml:space="preserve">
|
||||
<value>Image Upload</value>
|
||||
</data>
|
||||
<data name="caption.organisation.address" xml:space="preserve">
|
||||
<value>Organisation Address</value>
|
||||
</data>
|
||||
<data name="caption.organisation.images" xml:space="preserve">
|
||||
<value>Organisation Images</value>
|
||||
</data>
|
||||
<data name="company.name" xml:space="preserve">
|
||||
<value>Sportierre</value>
|
||||
</data>
|
||||
@@ -177,6 +183,9 @@
|
||||
<data name="label.admin" xml:space="preserve">
|
||||
<value>Admin</value>
|
||||
</data>
|
||||
<data name="label.alternatively" xml:space="preserve">
|
||||
<value>Alternatively</value>
|
||||
</data>
|
||||
<data name="label.any" xml:space="preserve">
|
||||
<value>Any</value>
|
||||
</data>
|
||||
@@ -258,6 +267,9 @@
|
||||
<data name="label.forgotten.password" xml:space="preserve">
|
||||
<value>Forgotten password?</value>
|
||||
</data>
|
||||
<data name="label.image" xml:space="preserve">
|
||||
<value>Image</value>
|
||||
</data>
|
||||
<data name="label.images" xml:space="preserve">
|
||||
<value>Images</value>
|
||||
</data>
|
||||
@@ -291,6 +303,9 @@
|
||||
<data name="label.location" xml:space="preserve">
|
||||
<value>Location</value>
|
||||
</data>
|
||||
<data name="label.logo" xml:space="preserve">
|
||||
<value>Logo</value>
|
||||
</data>
|
||||
<data name="label.logs" xml:space="preserve">
|
||||
<value>Logs</value>
|
||||
</data>
|
||||
@@ -342,6 +357,9 @@
|
||||
<data name="label.online.today" xml:space="preserve">
|
||||
<value>Online today</value>
|
||||
</data>
|
||||
<data name="label.organisation" xml:space="preserve">
|
||||
<value>Organisation</value>
|
||||
</data>
|
||||
<data name="label.page.info" xml:space="preserve">
|
||||
<value>Page {0} of {1}</value>
|
||||
</data>
|
||||
@@ -441,6 +459,9 @@
|
||||
<data name="label.update" xml:space="preserve">
|
||||
<value>update</value>
|
||||
</data>
|
||||
<data name="label.upload" xml:space="preserve">
|
||||
<value>Upload</value>
|
||||
</data>
|
||||
<data name="label.user.roles" xml:space="preserve">
|
||||
<value>User roles</value>
|
||||
</data>
|
||||
@@ -462,6 +483,9 @@
|
||||
<data name="msg.data.refreshing" xml:space="preserve">
|
||||
<value>Refreshing data. Please wait ...</value>
|
||||
</data>
|
||||
<data name="msg.drag.image.here" xml:space="preserve">
|
||||
<value>Drag image here</value>
|
||||
</data>
|
||||
<data name="msg.error.data.incomplete" xml:space="preserve">
|
||||
<value>Data is incomplete</value>
|
||||
</data>
|
||||
@@ -489,6 +513,33 @@
|
||||
<data name="msg.something.gone.wrong" xml:space="preserve">
|
||||
<value>Unfortunately, something has gone wrong.\n\nYou will be returned to the home page.</value>
|
||||
</data>
|
||||
<data name="msg.upload.file.select" xml:space="preserve">
|
||||
<value>Please select a file to upload.</value>
|
||||
</data>
|
||||
<data name="msg.upload.file.size.max" xml:space="preserve">
|
||||
<value>Maximum image file size is {0}.</value>
|
||||
</data>
|
||||
<data name="msg.upload.file.type.invalid" xml:space="preserve">
|
||||
<value>Unsupported file type: {0}.</value>
|
||||
</data>
|
||||
<data name="msg.upload.file.uploading" xml:space="preserve">
|
||||
<value>Uploading {0}.</value>
|
||||
</data>
|
||||
<data name="msg.upload.image.invalid" xml:space="preserve">
|
||||
<value>Invalid image file uploaded</value>
|
||||
</data>
|
||||
<data name="msg.upload.image.invalid.content.type" xml:space="preserve">
|
||||
<value>Invalid image content type.</value>
|
||||
</data>
|
||||
<data name="msg.upload.image.invalid.mime" xml:space="preserve">
|
||||
<value>Invalid image mime type.</value>
|
||||
</data>
|
||||
<data name="msg.upload.image.resize.failed" xml:space="preserve">
|
||||
<value>Image resize failed.</value>
|
||||
</data>
|
||||
<data name="msg.upload.image.single" xml:space="preserve">
|
||||
<value>Only one image can be uploaded.</value>
|
||||
</data>
|
||||
<data name="msg.validation.duplicate.value" xml:space="preserve">
|
||||
<value>Value is already in use</value>
|
||||
</data>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control">
|
||||
<input type="text" name="ContactValue" class="ContactValue sax-input" />
|
||||
<input type="text" name="ContactValue" class="ContactValue sax-input" maxlength="200" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@@ -97,3 +97,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Address country *@
|
||||
<div class="sax-form-control AddressRegionIdCountry">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label><span>@Localiser["label.country"]</span> <span class="required">*</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control row">
|
||||
<input type="hidden" name="Address.RegionIdCountry" class="AddressRegionIdCountry" />
|
||||
<div class="col"><input type="text" class="AddressRegionNameCountry sax-input" readonly="readonly" /> </div>
|
||||
<div class="fixed"><button class="sax-button AddressRegionCountrySelect" style="min-width:auto;margin-left:4px;padding:4px 6px">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<div class="col">
|
||||
@* List of existing contact methods with actions to edit/remove. *@
|
||||
<div class="ContactMethods">
|
||||
<table class="sax-data"></table>
|
||||
<table class="sax-data fullwidth"></table>
|
||||
</div>
|
||||
<table class="sax-panel-item-template">
|
||||
<tr class="ContactMethod">
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<div class="col-sm-7">
|
||||
<div class="row">
|
||||
@Html.HiddenFor(model => model.Filter.OrganisationSportId, new { @id = "", @class = "FilterOrganisationSportId" })
|
||||
<div class="col"><input type="text" class="FilterOrganisationSportCaption sax-input" readonly="readonly" /> </div>
|
||||
<div class="col"><input type="text" class="FilterOrganisationSportCaption sax-input" readonly="readonly" value="@Model.Filter.OrganisationSportName" /> </div>
|
||||
<div class="fixed row">
|
||||
<div class="sax-action FilterSportSelect"><img src="~/img/action/search24.png" alt="@(Localiser["label.search"])" title="@(Localiser["label.search"])" /></div>
|
||||
<div class="sax-action FilterSportClear"><img src="~/img/action/delete24.png" alt="@(Localiser["label.clear"])" title="@(Localiser["label.clear"])" /></div>
|
||||
@@ -81,7 +81,7 @@
|
||||
<div class="col-sm-7">
|
||||
<div class="row">
|
||||
@Html.HiddenFor(model => model.Filter.OrganisationRegionId, new { @id = "", @class = "FilterOrganisationRegionId" })
|
||||
<div class="col"><input type="text" class="FilterOrganisationRegionCaption sax-input" readonly="readonly" /> </div>
|
||||
<div class="col"><input type="text" class="FilterOrganisationRegionCaption sax-input" readonly="readonly" value="@Model.Filter.OrganisationRegionName" /> </div>
|
||||
<div class="fixed row">
|
||||
<div class="sax-action FilterRegionSelect"><img src="~/img/action/search24.png" alt="@(Localiser["label.search"])" title="@(Localiser["label.search"])" /></div>
|
||||
<div class="sax-action FilterRegionClear"><img src="~/img/action/delete24.png" alt="@(Localiser["label.clear"])" title="@(Localiser["label.clear"])" /></div>
|
||||
@@ -144,12 +144,19 @@
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
<div class="row">
|
||||
<div class="col-6 col-sm-4"><div class="OrganisationCategory"></div></div>
|
||||
<div class="col-6 col-sm-4"><div class="OrganisationType"></div></div>
|
||||
<div class="col-6 col-sm-4 text-left text-sm-right"><div class="OrganisationRegion"></div></div>
|
||||
<div class="col-6 col-sm-4"><div class="OrganisationSport"></div></div>
|
||||
<div class="col-6 col-sm-4"><div class="OrganisationMemberCount sax-action-text">@Localiser["label.members"]: <span class="MemberCount"></span></div></div>
|
||||
<div class="col-6 col-sm-4 text-left text-sm-right"><div class="StatusDesc"></div></div>
|
||||
<div class="fixed">
|
||||
<img alt="" title="" class="OrganisationLogo" style="display:none;max-width:@(Sax.Config.Organisation.Logo.DisplayWidthMax_List + "px");max-height:@(Sax.Config.Organisation.Logo.DisplayHeightMax_List + "px");margin-right:8px;border:1px solid #c0c0c0;border-radius:2px;" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-6 col-sm-4"><div class="OrganisationCategory"></div></div>
|
||||
<div class="col-6 col-sm-4"><div class="OrganisationType"></div></div>
|
||||
<div class="col-6 col-sm-4 text-left text-sm-right"><div class="OrganisationRegion"></div></div>
|
||||
<div class="col-6 col-sm-4"><div class="OrganisationSport"></div></div>
|
||||
<div class="col-6 col-sm-4"><div class="OrganisationMemberCount sax-action-text">@Localiser["label.members"]: <span class="MemberCount"></span></div></div>
|
||||
<div class="col-6 col-sm-4 text-left text-sm-right"><div class="StatusDesc sax-note"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -162,9 +169,19 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@* Organisation Id form - used in Ajax calls to identify organisation. *@
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOrganisationId", @class = "sax-form" }))
|
||||
{
|
||||
@Html.HiddenFor(model => model.OrganisationId, new { @class = "OrganisationId" })
|
||||
}
|
||||
@* Organisation dialog and form. *@
|
||||
<partial name="Panel-OrganisationDialog.cshtml" />
|
||||
@* Organisation Activation dialog and form. *@
|
||||
<partial name="Panel-ActivationDialog.cshtml" />
|
||||
@* Organisation Address dialog, form and script. *@
|
||||
<partial name="Panel-OrganisationAddressDialog.cshtml" />
|
||||
@* Organisation Images dialog, form and script. *@
|
||||
<partial name="Panel-OrganisationImagesDialog.cshtml" />
|
||||
@* Select Item dialog and script. *@
|
||||
<partial name="~/Views/Common/SelectItem.cshtml" />
|
||||
</div>
|
||||
|
||||
<partial name="Panel-OrganisationDialog.cshtml" />
|
||||
<partial name="Panel-OrganisationAddressDialog.cshtml" />
|
||||
<partial name="~/Views/Common/SelectItem.cshtml" />
|
||||
<partial name="Panel-ActivationDialog.cshtml" />
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
/* Organisations - Organisation Address dialog panel */
|
||||
}
|
||||
|
||||
<script src="~/js/sax-org-add.js?@Model.HrefVersion"></script>
|
||||
|
||||
<div id="dlgOrganisationAddress" class="sax-dialog" title="@Localiser["caption.organisation.address"]">
|
||||
|
||||
<div class="spacer"></div>
|
||||
@@ -16,18 +18,19 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationName"><span>@Localiser["label.name"]</span> <span class="required">*</span></label>
|
||||
<label for="ifOrganisationName"><span>@Localiser["label.organisation"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control">
|
||||
@Html.TextBoxFor(model => model.OrganisationName, new { @id = "ifOrganisationName", @class = "OrganisationName sax-input", @maxlength = @Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name), disabled = true })
|
||||
<input type="text" id="ifOrganisationName" class="OrganisationName sax-input" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name)" disabled="disabled" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Address controls *@
|
||||
<partial name="~/Views/Common/Controls-ItemAddress.cshtml" />
|
||||
|
||||
}
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
sax.dlg.title.selectRegion = '@Localiser.GetJavascriptText("label.select.country")';
|
||||
sax.dlg.title.selectSport = '@Localiser.GetJavascriptText("sport.caption.sport.select")';
|
||||
</script>
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOrganisationId", @class = "sax-form" }))
|
||||
{
|
||||
@Html.HiddenFor(model => model.OrganisationId, new { @class = "OrganisationId" })
|
||||
}
|
||||
<div id="dlgOrganisation" class="sax-dialog" title="">
|
||||
|
||||
<div class="spacer"></div>
|
||||
@@ -94,19 +90,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Organisation country *@
|
||||
<div class="sax-form-control OrganisationRegionIdCountry">
|
||||
@* Organisation primary region *@
|
||||
<div class="sax-form-control OrganisationRegionIdPrimary">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationRegionCaptionCountry"><span>@Localiser["label.country"]</span> <span class="required">*</span></label>
|
||||
<label for="ifOrganisationRegionNameCountry"><span>@Localiser["label.region"]</span> <span class="required">*</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control row">
|
||||
@Html.HiddenFor(model => model.OrganisationRegionIdCountry, new { @id = "ifOrganisationRegionIdCountry", @class = "OrganisationRegionIdCountry" })
|
||||
<div class="col"><input type="text" id="ifOrganisationRegionCaptionCountry" class="OrganisationRegionCaptionCountry sax-input" readonly="readonly" /> </div>
|
||||
<div class="fixed"><button id="pbSelectRegion" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px">@Localiser["label.select"]</button></div>
|
||||
@Html.HiddenFor(model => model.OrganisationRegionIdPrimary, new { @id = "ifOrganisationRegionIdPrimary", @class = "OrganisationRegionIdPrimary" })
|
||||
<div class="col"><input type="text" id="ifOrganisationRegionNamePrimary" class="OrganisationRegionNamePrimary sax-input" readonly="readonly" /> </div>
|
||||
<div class="fixed"><button id="pbSelectOrganisationRegionPrimary" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
@model Model_Organisation
|
||||
@inject SaxLocaliser Localiser
|
||||
@{
|
||||
/* Organisations - Organisation images dialog panel */
|
||||
}
|
||||
|
||||
<style>
|
||||
#dlgOrganisationImages .sax-panel-drop.OrganisationLogoImageDrop
|
||||
{
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #808080;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
#dlgOrganisationImages .sax-panel-drop.OrganisationLogoImageDrop img
|
||||
{
|
||||
display: none;
|
||||
max-width:@(Sax.Config.Organisation.Logo.DisplayWidthMax_Item + "px");
|
||||
max-height:@(Sax.Config.Organisation.Logo.DisplayHeightMax_Item + "px");
|
||||
margin-right: 8px;
|
||||
border: 1px solid #b0b0b080;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
#dlgOrganisationImages .sax-panel-drop.OrganisationLogoImageDrop *
|
||||
{
|
||||
/*pointer-events: none;*/
|
||||
}
|
||||
|
||||
#dlgOrganisationImages .sax-panel-drop.OrganisationLogoImageDrop.sax-file-drag
|
||||
{
|
||||
background-color:#c0fff0;
|
||||
border-color: darkgreen;
|
||||
}
|
||||
</style>
|
||||
<script src="~/js/sax-org-img.js?@Model.HrefVersion"></script>
|
||||
<script type="text/javascript">
|
||||
sax.msg.uploadImageSingle = '@Localiser.GetJavascriptText("msg.upload.image.single")';
|
||||
sax.msg.uploadFileSizeMax = '@Localiser.GetJavascriptText("msg.upload.file.size.max","{0}")';
|
||||
sax.msg.uploadFileTypeInvalid = '@Localiser.GetJavascriptText("msg.upload.file.type.invalid","{0}")';
|
||||
sax.msg.uploadingFile = '@Localiser.GetJavascriptText("msg.upload.file.uploading","{0}")';
|
||||
sax.dlg.title.imageUpload = '@Localiser.GetJavascriptText("caption.image.upload")';
|
||||
sax.msg.uploadFileSelect = '@Localiser.GetJavascriptText("msg.upload.file.select")';
|
||||
</script>
|
||||
|
||||
<div id="dlgOrganisationImages" class="sax-dialog" title="@Localiser["caption.organisation.images"]">
|
||||
<div class="spacer"></div>
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOrganisationImages", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.HiddenFor(model => model.OrganisationId, new { @id = "", @class = "OrganisationId" })
|
||||
|
||||
@* Organisation name *@
|
||||
<div class="sax-form-control OrganisationName">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationName"><span>@Localiser["label.organisation"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control">
|
||||
<input type="text" id="ifOrganisationName" class="OrganisationName sax-input" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name)" disabled="disabled" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Organisation Logo *@
|
||||
<div class="sax-form-control OrganisationLogoImage">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label><span>@Localiser["label.logo"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control">
|
||||
<div class="OrganisationLogoImageDrop sax-panel-drop row">
|
||||
<div class="fixed">
|
||||
<div class=""><img src="" class="sax-contact-image OrganisationLogo" alt="" title="" /></div>
|
||||
</div>
|
||||
<div class="col">
|
||||
@Localiser["msg.drag.image.here"]
|
||||
<div class="DropMessage"></div>
|
||||
<div class="UploadMessage"></div>
|
||||
<div class="spacer4"></div>
|
||||
@Localiser["label.alternatively"]:
|
||||
<button class="SelectOrgLogoImage sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px;z-index:999;">@Localiser["label.upload"]</button>
|
||||
</div>
|
||||
<div class="fixed">
|
||||
<img id="" class="ImageUploadProgress" src="~/img/animated/progress-basketball-32.gif" style="display:none;margin:8px 4px;" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
<div class="spacer"></div>
|
||||
</div>
|
||||
|
||||
<div id="dlgSelectOrgLogoImage" class="sax-dialog" title="@Localiser.GetJavascriptText("caption.image.upload")">
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmSelectOrgLogoImage", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="spacer4"></div>
|
||||
<div class="sax-form-control AccountOrgLogoImage">
|
||||
<div class="row">
|
||||
<div class="fixed"><div style="padding:0 12px;">@Localiser["label.image"]</div></div>
|
||||
<div class="col"><input type="file" name="" class="OrganisationLogoImage fullwidth" style="" /></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
<div class="spacer2"></div>
|
||||
<div class="row">
|
||||
<div class="col"><div class="UploadMessage"></div></div>
|
||||
<div class="fixed"><img id="" class="ImageUploadProgress" src="~/img/animated/progress-basketball-32.gif" style="display:none;margin:8px 4px;" /></div>
|
||||
</div>
|
||||
<div class="spacer2"></div>
|
||||
}
|
||||
</div>
|
||||
@@ -55,7 +55,7 @@
|
||||
<div class="col-sm-7">
|
||||
<div class="row">
|
||||
@Html.HiddenFor(model => model.Filter.UserSportId, new { @id = "", @class = "FilterUserSportId" })
|
||||
<div class="col"><input type="text" class="FilterUserSportCaption sax-input" readonly="readonly" ondblclick="sax.selectFilterSport()" /> </div>
|
||||
<div class="col"><input type="text" class="FilterUserSportCaption sax-input" readonly="readonly" ondblclick="sax.selectFilterSport()" value="@Model.Filter.UserSportName" /> </div>
|
||||
<div class="fixed row">
|
||||
<div class="sax-action" onclick="sax.selectFilterSport();"><img src="~/img/action/search24.png" alt="@(Localiser["label.search"])" title="@(Localiser["label.search"])" /></div>
|
||||
<div class="sax-action" onclick="sax.clearFilterSport();"><img src="~/img/action/delete24.png" alt="@(Localiser["label.clear"])" title="@(Localiser["label.clear"])" /></div>
|
||||
@@ -69,7 +69,7 @@
|
||||
<div class="col-sm-7">
|
||||
<div class="row">
|
||||
@Html.HiddenFor(model => model.Filter.UserRegionId, new { @id = "", @class = "FilterUserRegionId" })
|
||||
<div class="col"><input type="text" class="FilterUserRegionCaption sax-input" readonly="readonly" ondblclick="sax.selectFilterRegion()" /> </div>
|
||||
<div class="col"><input type="text" class="FilterUserRegionCaption sax-input" readonly="readonly" ondblclick="sax.selectFilterRegion()" value="@Model.Filter.UserRegionName" /> </div>
|
||||
<div class="fixed row">
|
||||
<div class="sax-action" onclick="sax.selectFilterRegion();"><img src="~/img/action/search24.png" alt="@(Localiser["label.search"])" title="@(Localiser["label.search"])" /></div>
|
||||
<div class="sax-action" onclick="sax.clearFilterRegion();"><img src="~/img/action/delete24.png" alt="@(Localiser["label.clear"])" title="@(Localiser["label.clear"])" /></div>
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.sax-panel-filter .sax-header ul.nav.sax-burger
|
||||
{
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.sax-panel-filter .sax-header .sax-action
|
||||
{
|
||||
margin: 2px 0 0 8px;
|
||||
@@ -50,8 +55,8 @@
|
||||
|
||||
.sax-panel-filter .sax-content
|
||||
{
|
||||
margin: 4px 8px;
|
||||
padding: 4px 8px;
|
||||
margin: 4px 4px;
|
||||
padding: 4px 4px;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
@@ -67,6 +72,7 @@
|
||||
{
|
||||
min-width: 75%;
|
||||
max-width: 90%;
|
||||
width:90%;
|
||||
}
|
||||
|
||||
.sax-panel-filter .sax-content .sax-button
|
||||
@@ -80,7 +86,7 @@
|
||||
|
||||
.sax-results-paging
|
||||
{
|
||||
margin-right: 8px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.sax-results-paging .sax-paging-info
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
@@ -67,6 +67,11 @@
|
||||
{
|
||||
return (val || '').replace(/[[{}()*+?^$|\]\.\\]/g, "\\$&");
|
||||
}
|
||||
sax.haltEvent = function (evt)
|
||||
{
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
}
|
||||
sax.debug = sax.debugMode ? win.console.log.bind(win.console) : function () { };
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Admin - Organisation Address scripts.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let oa = sax.mdl.organisationAddress = { data: {}, ajax: {} };
|
||||
let $pnl = oa.$pnl = {}, $frm = oa.$frm = {}, $dlg = oa.$dlg = {};
|
||||
let mdlOrg = function () { return sax.mdl.organisations; }
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oa.updateItemAddress = function (item, $item)
|
||||
{
|
||||
oa.init();
|
||||
$('.OrganisationId', $frm.orgId).val(item.id);
|
||||
oa.ajax.updateItemAddr = oa.ajax.updateItemAddr || { url: sax.url.base + 'Organisation/Ajax/GetItem', formId: 'frmOrganisationId', callbackFn: oa.onUpdateItemAddress };
|
||||
sax.doAjaxRequest(oa.ajax.updateItemAddr, 50);
|
||||
}
|
||||
oa.onUpdateItemAddress = function (response)
|
||||
{
|
||||
//sax.debug('onUpdateItemAddress', response);
|
||||
if (!response.success) return;
|
||||
// Address.
|
||||
let item = response.organisation;
|
||||
let addr = item.address || {};
|
||||
let frm = $frm.orgAddr;
|
||||
$('input.OrganisationId', frm).val(item.id);
|
||||
$('.OrganisationName', frm).val(item.name);
|
||||
$('input.AddressId', frm).val(addr.id);
|
||||
$('input.AddressLine1', frm).val(addr.line1);
|
||||
$('input.AddressLine2', frm).val(addr.line2);
|
||||
$('input.AddressLine3', frm).val(addr.line3);
|
||||
$('input.AddressTown', frm).val(addr.town);
|
||||
$('input.AddressRegionIdProvince', frm).val(addr.regionIdProvince);
|
||||
$('input.AddressProvince', frm).val(addr.regionNameProvince);
|
||||
$('input.AddressPostalCode', frm).val(addr.postalCode);
|
||||
$('input.AddressRegionIdCountry, input.AddressRegionNameCountry', frm).val('');
|
||||
if (addr.regionIdCountry)
|
||||
{
|
||||
$('input.AddressRegionIdCountry', frm).val(addr.regionIdCountry);
|
||||
$('input.AddressRegionNameCountry', frm).val(addr.regionNameCountry);
|
||||
}
|
||||
else if (item.regionPrimary.country)
|
||||
{
|
||||
$('input.AddressRegionIdCountry', frm).val(item.regionPrimary.id);
|
||||
$('input.AddressRegionNameCountry', frm).val(item.regionPrimary.name);
|
||||
}
|
||||
sax.clearControlErrors(frm);
|
||||
sax.openDialog($dlg.orgAddr, 640, 480);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oa.selectOrgAddrRegionCountry = function ()
|
||||
{
|
||||
if (!mdlOrg().data.regions)
|
||||
mdlOrg().populateRegions(oa.showSelectOrgAddrRegionCountry);
|
||||
else oa.showSelectOrgAddrRegionCountry();
|
||||
}
|
||||
oa.showSelectOrgAddrRegionCountry = function ()
|
||||
{
|
||||
let regions = [];
|
||||
for (let rgn of mdlOrg().data.regions)
|
||||
if (rgn.regionType == 30) regions.push(rgn);
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectCountry, itemId: $('input.AddressRegionIdCountry', $frm.orgAddr).val(), items: regions, fnCallback: oa.onOrgAddrRegionCountrySelected });
|
||||
}
|
||||
oa.onOrgAddrRegionCountrySelected = function (rgn)
|
||||
{
|
||||
//sax.debug('onRegionSelected', rgn);
|
||||
let frm = $frm.orgAddr;
|
||||
sax.clearControlError($('input.AddressRegionIdCountry', frm).val(rgn.id));
|
||||
$('.AddressRegionNameCountry', frm).val(rgn.name);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oa.storeItemAddress = function ()
|
||||
{
|
||||
oa.ajax.storeItemAddr = oa.ajax.storeItemAddr || { url: sax.url.base + 'Organisation/Ajax/StoreItem', formId: 'frmOrganisationAddress', callbackFn: oa.onStoreItemAddress };
|
||||
sax.doAjaxRequest(oa.ajax.storeItemAddr, 50);
|
||||
}
|
||||
oa.onStoreItemAddress = function (response)
|
||||
{
|
||||
//sax.debug('onStoreItemAddress', response);
|
||||
sax.refreshControlValues(response.controlValues, $frm.orgAddr);
|
||||
if (!response.success) return;
|
||||
$dlg.orgAddr.dialog('close');
|
||||
mdlOrg().refreshItem(response.organisation);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oa.init = function ()
|
||||
{
|
||||
if ($frm.orgId) return;
|
||||
$frm.orgId = $('#frmOrganisationId');
|
||||
|
||||
// Organisation Address dialog.
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { oa.storeItemAddress(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
$dlg.orgAddr = $('#dlgOrganisationAddress').dialog(opt);
|
||||
|
||||
// Organisation Address form.
|
||||
$frm.orgAddr = $('#frmOrganisationAddress');
|
||||
$frm.orgAddr.on('input', '.sax-input, .sax-textarea', function () { sax.clearControlError(this); }).on('change', '.sax-select', function () { sax.clearControlError(this); });
|
||||
$frm.orgAddr.on('dblclick', '.AddressRegionNameCountry', oa.selectOrgAddrRegionCountry).on('click', '.AddressRegionCountrySelect', oa.selectOrgAddrRegionCountry);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Admin - Organisation Images scripts.
|
||||
*/
|
||||
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let oi = sax.mdl.organisationImages = { data: {}, ajax: {} };
|
||||
let $pnl = oi.$pnl = {}, $frm = oi.$frm = {}, $dlg = oi.$dlg = {};
|
||||
oi.classFileDrag = 'sax-file-drag';
|
||||
let mdlOrg = function () { return sax.mdl.organisations; }
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oi.updateItemImages = function (item, $item)
|
||||
{
|
||||
oi.init();
|
||||
$('.OrganisationId', $frm.orgId).val(item.id);
|
||||
oi.ajax.getOrgImages = oi.ajax.getOrgImages || { url: sax.url.base + 'Organisation/Ajax/GetImages', formId: 'frmOrganisationId', callbackFn: oi.onUpdateItemImages };
|
||||
sax.doAjaxRequest(oi.ajax.getOrgImages, 50);
|
||||
}
|
||||
oi.onUpdateItemImages = function (response)
|
||||
{
|
||||
//sax.debug('onUpdateItemImages', response);
|
||||
if (!response.success) return;
|
||||
oi.data.imageContentTypes = response.imageContentTypes;
|
||||
let item = response.organisation;
|
||||
let frm = $frm.orgImg;
|
||||
$('.OrganisationId', frm).val(item.id);
|
||||
$('.OrganisationName', frm).val(item.name);
|
||||
$('img.OrganisationLogo', frm).prop('src', item.logoImageUrl).toggle(!!item.logoImageUrl);
|
||||
|
||||
sax.clearControlErrors(frm);
|
||||
sax.openDialog($dlg.orgImg, 640, 480);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// Drop organisation logo image.
|
||||
oi.onDropOrgLogoImage = function (evt)
|
||||
{
|
||||
//sax.debug('onDropOrgLogoImage', evt);
|
||||
let files = evt.originalEvent.dataTransfer.files;
|
||||
if (files.length < 1) return;
|
||||
if (files.length > 1) return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadImageSingle);
|
||||
oi.onDropOrgLogoImageFile(files[0], $frm.orgImg);
|
||||
}
|
||||
oi.onDropOrgLogoImageFile = function (file, context)
|
||||
{
|
||||
//sax.debug('onDropOrgLogoImageFile', file, context);
|
||||
if (file.size > sax.maxProfileImageSize) return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileSizeMax.format(sax.formatFileSize(sax.maxProfileImageSize)));
|
||||
if ((oi.data.imageContentTypes || []).indexOf(file.type) < 0) return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileTypeInvalid.format(sax.getFileType(file)));
|
||||
$(".UploadMessage", context).text(sax.msg.uploadingFile.format(file.name));
|
||||
$('img.ImageUploadProgress', context).fadeIn(200);
|
||||
sax.clearControlError($pnl.orgLogoImageDrag);
|
||||
oi.data.orgLogoImageUploadContext = context;
|
||||
|
||||
oi.ajax.uploadOrgLogoImage = sax.ajax.uploadOrgLogoImage || { url: sax.url.base + 'Organisation/Ajax/UploadLogoImage', callbackFn: oi.handleOrgLogoImageUploadResponse, noWaitIcon: true };
|
||||
let ajaxData = oi.ajax.uploadOrgLogoImage.formData = new FormData();
|
||||
ajaxData.append("__RequestVerificationToken", $('#frmNavigate input[name="__RequestVerificationToken"]').val());
|
||||
ajaxData.append("OrganisationId", $('.OrganisationId', $frm.orgImg).val());
|
||||
ajaxData.append("OrganisationLogoImage", file);
|
||||
sax.doAjaxRequest(oi.ajax.uploadOrgLogoImage, 50);
|
||||
}
|
||||
oi.handleOrgLogoImageUploadResponse = function (response)
|
||||
{
|
||||
//sax.debug('handleOrgLogoImageUploadResponse', response, context);
|
||||
let context = oi.data.orgLogoImageUploadContext;
|
||||
if (!response) return;
|
||||
sax.refreshControlValues(response.controlValues, context);
|
||||
$(".UploadMessage", context).empty();
|
||||
$('img.ImageUploadProgress', context).hide();
|
||||
if (response.success)
|
||||
{
|
||||
$dlg.selectOrgLogoImage.dialog('close');
|
||||
$('img.OrganisationLogo', $pnl.orgLogo).prop('src', response.imageUrl).show();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// Select organisation logo image.
|
||||
oi.selectOrgLogoImage = function ()
|
||||
{
|
||||
let dlg = $dlg.selectOrgLogoImage;
|
||||
$('.OrganisationLogoImage', dlg).val('');
|
||||
sax.openDialog(dlg, 560, 240);
|
||||
}
|
||||
oi.uploadOrgLogoImage = function ()
|
||||
{
|
||||
let dlg = $dlg.selectOrgLogoImage;
|
||||
let $fileCtrl = $('.OrganisationLogoImage', dlg);
|
||||
if (!$fileCtrl.length || !$fileCtrl[0].files.length)
|
||||
return sax.doAlert(sax.dlg.title.imageUpload, sax.msg.uploadFileSelect);
|
||||
let file = $fileCtrl[0].files[0];
|
||||
oi.onDropOrgLogoImageFile(file, dlg);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oi.storeItemImages = function ()
|
||||
{
|
||||
oi.ajax.storeOrgImages = oi.ajax.storeOrgImages || { url: sax.url.base + 'Organisation/Ajax/StoreImages', formId: 'frmOrganisationImages', callbackFn: oi.onStoreItemImages };
|
||||
sax.doAjaxRequest(oi.ajax.storeOrgImages, 50);
|
||||
}
|
||||
oi.onStoreItemImages = function (response)
|
||||
{
|
||||
//sax.debug('onStoreItemImages', response);
|
||||
sax.refreshControlValues(response.controlValues, $frm.orgImg);
|
||||
if (!response.success) return;
|
||||
$dlg.orgImg.dialog('close');
|
||||
mdlOrg().refreshItem(response.organisation);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
oi.init = function ()
|
||||
{
|
||||
if ($frm.orgId) return;
|
||||
$frm.orgId = $('#frmOrganisationId');
|
||||
|
||||
// Organisation Images dialog and form.
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { oi.storeItemImages(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
$dlg.orgImg = $('#dlgOrganisationImages').dialog(opt);
|
||||
$frm.orgImg = $('#frmOrganisationImages', $dlg.orgImg);
|
||||
|
||||
// Organisation logo.
|
||||
$pnl.orgLogo = $('.sax-form-control.OrganisationLogoImage', $dlg.orgImg);
|
||||
$pnl.orgLogoImgDrop = $('.sax-panel-drop.OrganisationLogoImageDrop', $pnl.orgLogo)
|
||||
.on('dragenter', function (evt) { sax.haltEvent(evt); })
|
||||
.on('dragover', function (evt) { sax.haltEvent(evt); if (!$pnl.orgLogoImgDrop.hasClass(oi.classFileDrag)) $pnl.orgLogoImgDrop.addClass(oi.classFileDrag); })
|
||||
.on('dragleave', function (evt) { sax.haltEvent(evt); $pnl.orgLogoImgDrop.removeClass(oi.classFileDrag); })
|
||||
.on('drop', function (evt) { sax.haltEvent(evt); $pnl.orgLogoImgDrop.removeClass(oi.classFileDrag); oi.onDropOrgLogoImage(evt); })
|
||||
.on('click', '.sax-button.SelectOrgLogoImage', oi.selectOrgLogoImage);
|
||||
|
||||
// Select image dialog.
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { oi.uploadOrgLogoImage(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
$dlg.selectOrgLogoImage = $('#dlgSelectOrgLogoImage').dialog(opt);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -5,9 +5,8 @@
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let op = sax.mdl.organisations = sax.mdl.organisations || { data: {}, ajax: {} };
|
||||
let op = sax.mdl.organisations = { data: {}, ajax: {} };
|
||||
let $pnl = op.$pnl = {}, $frm = op.$frm = {}, $dlg = op.$dlg = {};
|
||||
sax.itemIdPrefix = 'Itm_';
|
||||
|
||||
//--------------------------------------------------------------
|
||||
op.refreshResults = function (delay)
|
||||
@@ -47,15 +46,21 @@
|
||||
$items.append(op.populateItem(op.getItemTemplate(), items[itemIdx]));
|
||||
$items.fadeIn(50);
|
||||
}
|
||||
op.getItemIdProp = function (id)
|
||||
{
|
||||
return 'Org_' + id;
|
||||
}
|
||||
op.populateItem = function ($item, item)
|
||||
{
|
||||
//sax.debug('populateItem', item);
|
||||
if (!item) return;
|
||||
$item.prop('id', sax.itemIdPrefix + item.id);
|
||||
$item.prop('id', op.getItemIdProp(item.id));
|
||||
$('img.OrganisationLogo', $item).prop('src', item.logoImageUrl).toggle(!!item.logoImageUrl);
|
||||
$('.OrganisationName', $item).text(item.name);
|
||||
$('.OrganisationType', $item).text(item.typeDesc);
|
||||
$('.OrganisationCategory', $item).text(item.categoryDesc);
|
||||
$('.OrganisationSport', $item).text(item.sportName);
|
||||
$('.OrganisationRegion', $item).text(item.regionNameCountry);
|
||||
$('.OrganisationRegion', $item).text(item.regionPrimary.name);
|
||||
$('.OrganisationMemberCount', $item).on('click', function () { op.onClickMemberCount(item.id); }).find('.MemberCount').text(item.memberCount);
|
||||
$('.StatusDesc', $item).text(item.statusDesc).addClass('sax-status-' + item.statusCode.toLowerCase());
|
||||
$('.sax-caption .sax-action').toggleClass('sax-action', !item.deleted);
|
||||
@@ -224,15 +229,15 @@
|
||||
}
|
||||
op.showSelectOrgRegion = function ()
|
||||
{
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectRegion, itemId: $('.OrganisationRegionIdCountry', $frm.org).val(), items: op.data.regions, fnCallback: op.onOrgRegionSelected });
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectRegion, itemId: $('.OrganisationRegionIdPrimary', $frm.org).val(), items: op.data.regions, fnCallback: op.onOrgRegionSelected });
|
||||
}
|
||||
op.onOrgRegionSelected = function (rgn)
|
||||
{
|
||||
//sax.debug('onRegionSelected', rgn);
|
||||
let frm = $frm.org;
|
||||
$('.OrganisationRegionIdCountry', frm).val(rgn.id);
|
||||
$('.OrganisationRegionCaptionCountry', frm).val(rgn.name);
|
||||
sax.clearControlError($('.OrganisationRegionCaptionCountry', frm));
|
||||
$('.OrganisationRegionIdPrimary', frm).val(rgn.id);
|
||||
$('.OrganisationRegionNamePrimary', frm).val(rgn.name);
|
||||
sax.clearControlError($('.OrganisationRegionIdPrimary', frm));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -251,7 +256,7 @@
|
||||
op.clearItem = function ()
|
||||
{
|
||||
let frm = $frm.org;
|
||||
$('.OrganisationId,.OrganisationSportId,.OrganisationRegionIdCountry,input[type="text"],textarea,select', frm).val('');
|
||||
$('.OrganisationId,.OrganisationSportId,.OrganisationRegionIdPrimary,input[type="text"],textarea,select', frm).val('');
|
||||
$pnl.tblconMths.empty();
|
||||
$('.OrganisationStatus', frm).val(op.data.defaultStatusCode);
|
||||
sax.clearControlErrors();
|
||||
@@ -285,8 +290,8 @@
|
||||
$('.OrganisationCategory', frm).val(item.categoryCode);
|
||||
$('.OrganisationSportId', frm).val(item.sportId);
|
||||
$('.OrganisationSportCaption', frm).val(item.sportName);
|
||||
$('.OrganisationRegionIdCountry', frm).val(item.regionIdCountry);
|
||||
$('.OrganisationRegionCaptionCountry', frm).val(item.regionNameCountry);
|
||||
$('.OrganisationRegionIdPrimary', frm).val(item.regionPrimary.id);
|
||||
$('.OrganisationRegionNamePrimary', frm).val(item.regionPrimary.name);
|
||||
$('.OrganisationAbout', frm).val(item.about);
|
||||
$('.OrganisationFacilities', frm).val(item.facilities);
|
||||
$('.OrganisationNotes', frm).val(item.notes);
|
||||
@@ -374,7 +379,7 @@
|
||||
}
|
||||
op.refreshItem = function (item)
|
||||
{
|
||||
var $item = $('#' + sax.itemIdPrefix + item.id);
|
||||
var $item = $('#' + op.getItemIdProp(item.id));
|
||||
if (!$item.length)
|
||||
{
|
||||
$item = op.getItemTemplate();
|
||||
@@ -404,7 +409,7 @@
|
||||
}
|
||||
popItemValue('.OrganisationName', item.name);
|
||||
popItemValue('.OrganisationSport', item.sportName);
|
||||
popItemValue('.OrganisationRegion', item.regionNameCountry);
|
||||
popItemValue('.OrganisationRegion', item.regionPrimary.name);
|
||||
popItemValue('.OrganisationCategory', item.categoryDesc);
|
||||
popItemValue('.OrganisationAddress', item.addressSummary);
|
||||
let $orgMbrs = $('.OrganisationMembers', $dlg.activate).empty();
|
||||
@@ -440,51 +445,12 @@
|
||||
//--------------------------------------------------------------
|
||||
op.updateItemImages = function (item, $item)
|
||||
{
|
||||
sax.debug('updateItemImages');
|
||||
sax.mdl.organisationImages.updateItemImages(item, $item)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
op.updateItemAddress = function (item, $item)
|
||||
{
|
||||
sax.debug('updateItemAddress');
|
||||
$('.OrganisationId', $frm.orgId).val(item.id);
|
||||
op.ajax.updateItemAddr = op.ajax.updateItemAddr || { url: sax.url.base + 'Organisation/Ajax/GetItem', formId: 'frmOrganisationId', callbackFn: op.onUpdateItemAddress };
|
||||
sax.doAjaxRequest(op.ajax.updateItemAddr, 50);
|
||||
}
|
||||
op.onUpdateItemAddress = function (response)
|
||||
{
|
||||
sax.debug('onUpdateItemAddress', response);
|
||||
if (!response.success) return;
|
||||
// Address.
|
||||
let item = response.organisation;
|
||||
let address = item.address || {};
|
||||
let frm = $frm.orgAddr;
|
||||
$('input.OrganisationId', frm).val(item.id);
|
||||
$('.OrganisationName', frm).val(item.name);
|
||||
$('input.AddressId', frm).val(address.id);
|
||||
$('input.AddressLine1', frm).val(address.line1);
|
||||
$('input.AddressLine2', frm).val(address.line2);
|
||||
$('input.AddressLine3', frm).val(address.line3);
|
||||
$('input.AddressTown', frm).val(address.town);
|
||||
$('input.AddressProvince', frm).val(address.province);
|
||||
$('input.AddressCountry', frm).val(address.country);
|
||||
$('input.AddressPostalCode', frm).val(address.postalCode);
|
||||
sax.clearControlErrors(frm);
|
||||
sax.openDialog($dlg.orgAddr, 640, 480);
|
||||
}
|
||||
op.storeItemAddress = function ()
|
||||
{
|
||||
sax.debug('storeItemAddress');
|
||||
op.ajax.storeItemAddr = op.ajax.storeItemAddr || { url: sax.url.base + 'Organisation/Ajax/StoreItem', formId: 'frmOrganisationAddress', callbackFn: op.onStoreItemAddress };
|
||||
sax.doAjaxRequest(op.ajax.storeItemAddr, 50);
|
||||
}
|
||||
op.onStoreItemAddress = function (response)
|
||||
{
|
||||
sax.debug('onStoreItemAddress', response);
|
||||
sax.refreshControlValues(response.controlValues, $frm.orgAddr);
|
||||
if (!response.success) return;
|
||||
$dlg.orgAddr.dialog('close');
|
||||
op.refreshItem(response.organisation);
|
||||
sax.mdl.organisationAddress.updateItemAddress(item, $item);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -512,7 +478,7 @@
|
||||
$frm.org = $('#frmOrganisation');
|
||||
$frm.org.on('input', '.sax-input, .sax-textarea', function () { sax.clearControlError(this); }).on('change', '.sax-select', function () { sax.clearControlError(this); });
|
||||
$frm.org.on('dblclick', '.OrganisationSportCaption', op.selectOrgSport).on('click', '#pbSelectSport', op.selectOrgSport).on('click', '.OrganisationSportClear', op.clearOrgSport);
|
||||
$frm.org.on('dblclick', '.OrganisationRegionCaptionCountry', op.selectOrgRegion).on('click', '#pbSelectRegion', op.selectOrgRegion);
|
||||
$frm.org.on('dblclick', '.OrganisationRegionNamePrimary', op.selectOrgRegion).on('click', '#pbSelectOrganisationRegionPrimary', op.selectOrgRegion);
|
||||
$frm.org.on('click', '.ItemContactMethods .sax-action.sax-add', op.addConMth);
|
||||
$pnl.conMths = $('.ItemContactMethods', $frm.org);
|
||||
$pnl.tblconMths = $('table.sax-data', $pnl.conMths);
|
||||
@@ -523,18 +489,10 @@
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
$dlg.activate = $('#dlgOrganisationActivation').dialog(opt);
|
||||
|
||||
// Activate Organisation Address dialog and form.
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { op.storeItemAddress(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
$dlg.orgAddr = $('#dlgOrganisationAddress').dialog(opt);
|
||||
|
||||
$frm.orgAddr = $('#frmOrganisationAddress');
|
||||
$frm.orgAddr.on('input', '.sax-input, .sax-textarea', function () { sax.clearControlError(this); }).on('change', '.sax-select', function () { sax.clearControlError(this); });
|
||||
|
||||
setTimeout(op.refreshResults, 250);
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------
|
||||
}(window, window.document));
|
||||
|
||||
/* The End */
|
||||
@@ -105,40 +105,47 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
RefreshModel(model);
|
||||
|
||||
// Reference data - Genders.
|
||||
responseData.Genders.Add("", Localiser["label.not.specified"]);
|
||||
foreach (TypeCodeDesc gender in Internals.GenderCodes)
|
||||
responseData.Genders.Add(gender.Type.ToString(), Localiser.GetGenderCaption((Sax.Gender)gender.Type));
|
||||
|
||||
// Reference data - Months.
|
||||
for (int month = 1; month <= 12; month++)
|
||||
responseData.Months.Add(month.ToString(), DateUtil.Format(new DateTime(DateTime.Today.Year, month, 1), "MMMM", SessionCulture));
|
||||
|
||||
// Profile image content types.
|
||||
responseData.ImageContentTypes = SaxItemImage.GetValidContentTypes(Sax.DataItemType.UserAccount);
|
||||
|
||||
// Retrieve user details.
|
||||
SaxUserAccount userAccount = AccountMgr.GetUserAccountById(UserAccountId);
|
||||
if (userAccount == null)
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve user account for Id: " + SysId.ToString(UserAccountId));
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
|
||||
// Reference data - Genders.
|
||||
responseData.Genders.Add("", Localiser["label.not.specified"]);
|
||||
foreach (TypeCodeDesc gender in Internals.GenderCodes)
|
||||
responseData.Genders.Add(gender.Type.ToString(), Localiser.GetGenderCaption((Sax.Gender)gender.Type));
|
||||
|
||||
// Reference data - Months.
|
||||
for (int month = 1; month <= 12; month++)
|
||||
responseData.Months.Add(month.ToString(), DateUtil.Format(new DateTime(DateTime.Today.Year, month, 1), "MMMM", SessionCulture));
|
||||
|
||||
// Reference data - Image content types.
|
||||
responseData.ImageContentTypes = SaxItemImage.GetValidContentTypes(Sax.DataItemType.UserAccount);
|
||||
|
||||
// Retrieve user details.
|
||||
SaxUserAccount userAccount = AccountMgr.GetUserAccountById(UserAccountId);
|
||||
disposableItems.Add(userAccount);
|
||||
if (userAccount == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve user account for Id: " + SysId.ToString(UserAccountId));
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
}
|
||||
|
||||
// Logically delete any previous 'Uploaded' Avatar image.
|
||||
ItemId userItemId = userAccount.GetItemId();
|
||||
SaxItemImage itemImageAvatarUploaded = ItemDataMgr.GetItemImage(userItemId, Sax.ImageType.Avatar_Upload, SaxItemImage.StatusCat.ActiveOnly);
|
||||
disposableItems.Add(itemImageAvatarUploaded);
|
||||
if (itemImageAvatarUploaded != null)
|
||||
{
|
||||
itemImageAvatarUploaded.Status = SaStatus.Deleted;
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImageAvatarUploaded, DbUpdateInfo))
|
||||
SaLogger.Warn(fn + " Failed to logically delete uploaded avatar image - " + ItemDataMgr.ErrorStateMessage);
|
||||
}
|
||||
|
||||
|
||||
// Populate data to response.
|
||||
responseData.Contact = new ContactResponseData();
|
||||
PopulateContactResponseData(model, responseData.Contact, userAccount);
|
||||
}
|
||||
|
||||
// Logically delete any previous 'Uploaded' Avatar image.
|
||||
ItemId userItemId = userAccount.GetItemId();
|
||||
SaxItemImage itemImageAvatarUploaded = ItemDataMgr.GetItemImage(userItemId, Sax.ImageType.AvatarUpload, SaxItemImage.StatusCat.ActiveOnly);
|
||||
if (itemImageAvatarUploaded != null)
|
||||
{
|
||||
itemImageAvatarUploaded.Status = SaStatus.Deleted;
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImageAvatarUploaded, DbUpdateInfo))
|
||||
SaLogger.Warn(fn + " Failed to logically delete uploaded avatar image - " + ItemDataMgr.ErrorStateMessage);
|
||||
}
|
||||
|
||||
|
||||
// Populate data to response.
|
||||
responseData.Contact = new ContactResponseData();
|
||||
PopulateContactResponseData(model, responseData.Contact, userAccount);
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
@@ -168,78 +175,84 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
RefreshModel(model);
|
||||
|
||||
// Validate number of images.
|
||||
if (model.AccountContactImage.IsEmpty())
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
SaLogger.Warn(fn + " No image file supplied for upload");
|
||||
return Json(responseData);
|
||||
}
|
||||
if (model.AccountContactImage.Count != 1)
|
||||
{
|
||||
SaLogger.Warn(fn + " Invalid number of image files uploaded: " + model.AccountContactImage.Count);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.single"]));
|
||||
}
|
||||
IFormFile file = model.AccountContactImage[0];
|
||||
|
||||
// Image properties.
|
||||
byte[] imageData = null;
|
||||
using (MemoryStream fileStream = new MemoryStream())
|
||||
{
|
||||
file.CopyTo(fileStream);
|
||||
imageData = fileStream.ToArray();
|
||||
}
|
||||
|
||||
// Validate the image.
|
||||
ImageUtils.ImageConfig imageConfig = ImageUtils.VerifyImageData(imageData);
|
||||
if (!imageConfig.ValidImage)
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.invalid"]));
|
||||
|
||||
// Validate mime type.
|
||||
if (!SaxItemImage.GetValidMimeTypes(Sax.DataItemType.UserAccount).Contains(imageConfig.MimeType))
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.invalid.mime"]));
|
||||
|
||||
// Validate content type.
|
||||
if (StringUtil.IsEmpty(file.ContentType) || !SaxItemImage.GetValidContentTypes(Sax.DataItemType.UserAccount).ContainsCI(file.ContentType))
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.invalid.content.type"]));
|
||||
|
||||
// Resize the image if required.
|
||||
if (!ImageUtils.ConstrainImage(imageConfig, Sax.Config.Online.Profile.User.Image.WidthMax, Sax.Config.Online.Profile.User.Image.HeightMax))
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.resize.failed"]));
|
||||
|
||||
// Image belongs to the user's account.
|
||||
ItemId userItemId = GetUserItemId(UserAccountId);
|
||||
|
||||
// Store uploaded image as 'Upload' Avatar - awaiting confirmation that the contact details are to be saved.
|
||||
SaxItemImage itemImage = ItemDataMgr.GetItemImage(userItemId, Sax.ImageType.AvatarUpload, SaxItemImage.StatusCat.Any);
|
||||
if (itemImage == null)
|
||||
itemImage = ItemDataMgr.CreateItemImage(userItemId, Sax.ImageType.AvatarUpload);
|
||||
itemImage.Filename = file.FileName;
|
||||
itemImage.Mime = SacsContentTypeHelper.GetMimeTypeFromContentType(file.ContentType).ToString().ToLower();
|
||||
itemImage.ContentType = file.ContentType;
|
||||
itemImage.ImageData = imageConfig.ImageData;
|
||||
itemImage.Width = imageConfig.Width;
|
||||
itemImage.Height = imageConfig.Height;
|
||||
itemImage.Status = SaxItemImage.DefaultStatus;
|
||||
|
||||
if (!SysId.IsValid(itemImage.Id))
|
||||
{
|
||||
if (!ItemDataMgr.InsertItemImage(itemImage, DbUpdateInfo))
|
||||
// Validate number of images.
|
||||
if (model.AccountContactImage.IsEmpty())
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert uploaded image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.insert.failed"]));
|
||||
SaLogger.Warn(fn + " No image file supplied for upload");
|
||||
return Json(responseData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImage, DbUpdateInfo))
|
||||
if (model.AccountContactImage.Count != 1)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update uploaded image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.insert.failed"]));
|
||||
SaLogger.Warn(fn + " Invalid number of image files uploaded: " + model.AccountContactImage.Count);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.single"]));
|
||||
}
|
||||
}
|
||||
IFormFile file = model.AccountContactImage[0];
|
||||
|
||||
// Complete response.
|
||||
//responseData.SetNotification(messageTitle, "Image uploaded.");
|
||||
// Image properties.
|
||||
byte[] imageData = null;
|
||||
using (MemoryStream fileStream = new MemoryStream())
|
||||
{
|
||||
file.CopyTo(fileStream);
|
||||
imageData = fileStream.ToArray();
|
||||
}
|
||||
|
||||
// Validate the image.
|
||||
ImageUtils.ImageConfig imageConfig = ImageUtils.VerifyImageData(imageData);
|
||||
if (!imageConfig.ValidImage)
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.invalid"]));
|
||||
|
||||
// Validate mime type.
|
||||
if (!SaxItemImage.GetValidMimeTypes(Sax.DataItemType.UserAccount).Contains(imageConfig.MimeType))
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.invalid.mime"]));
|
||||
|
||||
// Validate content type.
|
||||
if (StringUtil.IsEmpty(file.ContentType) || !SaxItemImage.GetValidContentTypes(Sax.DataItemType.UserAccount).ContainsCI(file.ContentType))
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.invalid.content.type"]));
|
||||
|
||||
// Resize the image if required.
|
||||
if (!ImageUtils.ConstrainImage(imageConfig, Sax.Config.User.Image.WidthMax, Sax.Config.User.Image.HeightMax))
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.resize.failed"]));
|
||||
|
||||
// Image belongs to the user's account.
|
||||
ItemId userItemId = GetUserItemId(UserAccountId);
|
||||
|
||||
// Store uploaded image as 'Upload' Avatar - awaiting confirmation that the contact details are to be saved.
|
||||
SaxItemImage itemImage = ItemDataMgr.GetItemImage(userItemId, Sax.ImageType.Avatar_Upload, SaxItemImage.StatusCat.Any);
|
||||
if (itemImage == null)
|
||||
itemImage = ItemDataMgr.CreateItemImage(userItemId, Sax.ImageType.Avatar_Upload);
|
||||
disposableItems.Add(itemImage);
|
||||
itemImage.Filename = file.FileName;
|
||||
itemImage.Mime = SacsContentTypeHelper.GetMimeTypeFromContentType(file.ContentType).ToString().ToLower();
|
||||
itemImage.ContentType = file.ContentType;
|
||||
itemImage.ImageData = imageConfig.ImageData;
|
||||
itemImage.Width = imageConfig.Width;
|
||||
itemImage.Height = imageConfig.Height;
|
||||
itemImage.Status = SaxItemImage.DefaultStatus;
|
||||
|
||||
if (!SysId.IsValid(itemImage.Id))
|
||||
{
|
||||
if (!ItemDataMgr.InsertItemImage(itemImage, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert uploaded image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImage, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update uploaded image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
//responseData.SetNotification(messageTitle, "Image uploaded.");
|
||||
}
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
@@ -268,118 +281,126 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
if (!ValidUserSession) return GetAjaxResult_InvalidSession(responseData);
|
||||
RefreshModel(model);
|
||||
|
||||
// Validate data.
|
||||
model.ValidateContactDetails(responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
|
||||
{
|
||||
|
||||
// Retrieve user details.
|
||||
SaxUserAccount userAccount = AccountMgr.GetUserAccountById(UserAccountId);
|
||||
if (userAccount == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve user account for Id: " + SysId.ToString(UserAccountId));
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
}
|
||||
if (!userAccount.EmailAddress.EqualsCI(SessionData.User.EmailAddress))
|
||||
{
|
||||
SaLogger.Warn(fn + " Unable to update user account '" + userAccount.EmailAddress + ". Email doesn't match session: " + SessionData.User.EmailAddress);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
}
|
||||
// Validate data.
|
||||
model.ValidateContactDetails(responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
|
||||
// Populate user properties.
|
||||
userAccount.Changed = false;
|
||||
if (model.AccountTitle != null)
|
||||
userAccount.Title = model.AccountTitle;
|
||||
if (model.AccountFirstName != null)
|
||||
userAccount.FirstName = model.AccountFirstName;
|
||||
if (model.AccountLastName != null)
|
||||
userAccount.LastName = model.AccountLastName;
|
||||
if (model.AccountAbout != null)
|
||||
userAccount.About = model.AccountAbout;
|
||||
if (model.AccountGender != null)
|
||||
userAccount.Gender = model.GetAccountGender();
|
||||
// Date of birth.
|
||||
if (model.AccountDobYear != null)
|
||||
userAccount.DateOfBirthYear = StringUtil.ToShort(model.AccountDobYear);
|
||||
if (userAccount.DateOfBirthYear > 0)
|
||||
{
|
||||
if (model.AccountDobMonth != null)
|
||||
userAccount.DateOfBirthMonth = (byte)StringUtil.ToShort(model.AccountDobMonth);
|
||||
if (userAccount.DateOfBirthMonth > 0)
|
||||
// Retrieve user details.
|
||||
SaxUserAccount userAccount = AccountMgr.GetUserAccountById(UserAccountId);
|
||||
disposableItems.Add(userAccount);
|
||||
if (userAccount == null)
|
||||
{
|
||||
if (model.AccountDobDay != null)
|
||||
userAccount.DateOfBirthDay = (byte)StringUtil.ToShort(model.AccountDobDay);
|
||||
SaLogger.Warn(fn + " Failed to retrieve user account for Id: " + SysId.ToString(UserAccountId));
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
}
|
||||
else userAccount.DateOfBirthDay = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
userAccount.DateOfBirthMonth = 0;
|
||||
userAccount.DateOfBirthDay = 0;
|
||||
}
|
||||
// Regions.
|
||||
if (model.AccountRegionIdCountry != null)
|
||||
userAccount.RegionIdCountry = model.ExtractSysId(model.AccountRegionIdCountry);
|
||||
if (model.AccountRegionIdProvince != null)
|
||||
userAccount.RegionIdProvince = model.ExtractSysId(model.AccountRegionIdProvince);
|
||||
|
||||
// Update User Account.
|
||||
if (userAccount.Changed) SaLogger.Info(fn + " Updating user account '" + userAccount.EmailAddress + "'. Id: " + SysId.ToString(userAccount.Id), true);
|
||||
if (AccountMgr.UpdateUserAccount(userAccount, DbUpdateInfo))
|
||||
{
|
||||
// ToDo Refresh Session with updated organisation details.
|
||||
}
|
||||
else
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update user account '" + userAccount.EmailAddress + "': " + AccountMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
|
||||
}
|
||||
|
||||
// Refresh profile contact details to session.
|
||||
RefreshSessionProfileContact(userAccount);
|
||||
|
||||
// Check for uploaded profile image.
|
||||
ItemId userItemId = userAccount.GetItemId();
|
||||
SaxItemImage itemImageAvatarUploaded = ItemDataMgr.GetItemImage(userItemId, Sax.ImageType.AvatarUpload, SaxItemImage.StatusCat.ActiveOnly);
|
||||
if (itemImageAvatarUploaded != null)
|
||||
{
|
||||
// Retrieve current Avatar image.
|
||||
SaxItemImage itemImageAvatar = ItemDataMgr.GetItemImage(userItemId, Sax.ImageType.Avatar, SaxItemImage.StatusCat.Any);
|
||||
if (itemImageAvatar == null)
|
||||
itemImageAvatar = ItemDataMgr.CreateItemImage(userItemId, Sax.ImageType.Avatar);
|
||||
// Copy properties from uploaded image.
|
||||
itemImageAvatar.Filename = itemImageAvatarUploaded.Filename;
|
||||
itemImageAvatar.Mime = itemImageAvatarUploaded.Mime;
|
||||
itemImageAvatar.ContentType = itemImageAvatarUploaded.ContentType;
|
||||
itemImageAvatar.Width = itemImageAvatarUploaded.Width;
|
||||
itemImageAvatar.Height = itemImageAvatarUploaded.Height;
|
||||
itemImageAvatar.ImageData = itemImageAvatarUploaded.ImageData;
|
||||
itemImageAvatar.Status = SaxItemImage.DefaultStatus;
|
||||
if (!SysId.IsValid(itemImageAvatar.Id))
|
||||
if (!userAccount.EmailAddress.EqualsCI(SessionData.User.EmailAddress))
|
||||
{
|
||||
if (!ItemDataMgr.InsertItemImage(itemImageAvatar, DbUpdateInfo))
|
||||
SaLogger.Warn(fn + " Unable to update user account '" + userAccount.EmailAddress + ". Email doesn't match session: " + SessionData.User.EmailAddress);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
}
|
||||
|
||||
// Populate user properties.
|
||||
userAccount.Changed = false;
|
||||
if (model.AccountTitle != null)
|
||||
userAccount.Title = model.AccountTitle;
|
||||
if (model.AccountFirstName != null)
|
||||
userAccount.FirstName = model.AccountFirstName;
|
||||
if (model.AccountLastName != null)
|
||||
userAccount.LastName = model.AccountLastName;
|
||||
if (model.AccountAbout != null)
|
||||
userAccount.About = model.AccountAbout;
|
||||
if (model.AccountGender != null)
|
||||
userAccount.Gender = model.GetAccountGender();
|
||||
// Date of birth.
|
||||
if (model.AccountDobYear != null)
|
||||
userAccount.DateOfBirthYear = StringUtil.ToShort(model.AccountDobYear);
|
||||
if (userAccount.DateOfBirthYear > 0)
|
||||
{
|
||||
if (model.AccountDobMonth != null)
|
||||
userAccount.DateOfBirthMonth = (byte)StringUtil.ToShort(model.AccountDobMonth);
|
||||
if (userAccount.DateOfBirthMonth > 0)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert avatar image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.insert.failed"]));
|
||||
if (model.AccountDobDay != null)
|
||||
userAccount.DateOfBirthDay = (byte)StringUtil.ToShort(model.AccountDobDay);
|
||||
}
|
||||
else userAccount.DateOfBirthDay = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImageAvatar, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update avatar image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.update.failed"]));
|
||||
}
|
||||
userAccount.DateOfBirthMonth = 0;
|
||||
userAccount.DateOfBirthDay = 0;
|
||||
}
|
||||
// Logically delete the uplaoded image.
|
||||
itemImageAvatarUploaded.Status = SaStatus.Deleted;
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImageAvatarUploaded, DbUpdateInfo))
|
||||
SaLogger.Warn(fn + " Failed to logically delete uploaded avatar image - " + ItemDataMgr.ErrorStateMessage);
|
||||
}
|
||||
// Regions.
|
||||
if (model.AccountRegionIdCountry != null)
|
||||
userAccount.RegionIdCountry = model.ExtractSysId(model.AccountRegionIdCountry);
|
||||
if (model.AccountRegionIdProvince != null)
|
||||
userAccount.RegionIdProvince = model.ExtractSysId(model.AccountRegionIdProvince);
|
||||
|
||||
// Construct response.
|
||||
responseData.Contact = new ContactResponseData();
|
||||
PopulateContactResponseData(model, responseData.Contact, userAccount);
|
||||
// Update User Account.
|
||||
if (userAccount.Changed) SaLogger.Info(fn + " Updating user account '" + userAccount.EmailAddress + "'. Id: " + SysId.ToString(userAccount.Id), true);
|
||||
if (AccountMgr.UpdateUserAccount(userAccount, DbUpdateInfo))
|
||||
{
|
||||
// ToDo Refresh Session with updated organisation details.
|
||||
}
|
||||
else
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update user account '" + userAccount.EmailAddress + "': " + AccountMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"]));
|
||||
}
|
||||
|
||||
// Refresh profile contact details to session.
|
||||
RefreshSessionProfileContact(userAccount);
|
||||
|
||||
// Check for uploaded profile image.
|
||||
ItemId userItemId = userAccount.GetItemId();
|
||||
SaxItemImage itemImageAvatarUploaded = ItemDataMgr.GetItemImage(userItemId, Sax.ImageType.Avatar_Upload, SaxItemImage.StatusCat.ActiveOnly);
|
||||
disposableItems.Add(itemImageAvatarUploaded);
|
||||
if (itemImageAvatarUploaded != null)
|
||||
{
|
||||
// Retrieve current Avatar image.
|
||||
SaxItemImage itemImageAvatar = ItemDataMgr.GetItemImage(userItemId, Sax.ImageType.Avatar, SaxItemImage.StatusCat.Any);
|
||||
if (itemImageAvatar == null)
|
||||
itemImageAvatar = ItemDataMgr.CreateItemImage(userItemId, Sax.ImageType.Avatar);
|
||||
disposableItems.Add(itemImageAvatar);
|
||||
// Copy properties from uploaded image.
|
||||
itemImageAvatar.Filename = itemImageAvatarUploaded.Filename;
|
||||
itemImageAvatar.Mime = itemImageAvatarUploaded.Mime;
|
||||
itemImageAvatar.ContentType = itemImageAvatarUploaded.ContentType;
|
||||
itemImageAvatar.Width = itemImageAvatarUploaded.Width;
|
||||
itemImageAvatar.Height = itemImageAvatarUploaded.Height;
|
||||
itemImageAvatar.ImageData = itemImageAvatarUploaded.ImageData;
|
||||
itemImageAvatar.Status = SaxItemImage.DefaultStatus;
|
||||
if (!SysId.IsValid(itemImageAvatar.Id))
|
||||
{
|
||||
if (!ItemDataMgr.InsertItemImage(itemImageAvatar, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert avatar image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.insert.failed"]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImageAvatar, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update avatar image - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.error.item.update.failed"]));
|
||||
}
|
||||
}
|
||||
// Logically delete the uplaoded image.
|
||||
itemImageAvatarUploaded.Status = SaStatus.Deleted;
|
||||
if (!ItemDataMgr.UpdateItemImage(itemImageAvatarUploaded, DbUpdateInfo))
|
||||
SaLogger.Warn(fn + " Failed to logically delete uploaded avatar image - " + ItemDataMgr.ErrorStateMessage);
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
responseData.Contact = new ContactResponseData();
|
||||
PopulateContactResponseData(model, responseData.Contact, userAccount);
|
||||
}
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
@@ -24,14 +24,23 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
partial class AccountController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Organisation properteis for list population.</summary>
|
||||
/// <summary>Organisation properties for list population.</summary>
|
||||
private class ProfileOrganisationListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String Name { get; set; }
|
||||
public String CategoryDesc { get; set; }
|
||||
public String TypeDesc { get; set; }
|
||||
public String LogoUrl { get; set; }
|
||||
public String SportName { get; set; }
|
||||
public String RegionNameCountry { get; set; }
|
||||
// Primary Region.
|
||||
public class RegionData
|
||||
{
|
||||
public String Id { get; set; }
|
||||
public String Name { get; set; }
|
||||
public bool? Country { get; set; } = null;
|
||||
}
|
||||
public RegionData RegionPrimary { get; } = new RegionData();
|
||||
// Associated properties.
|
||||
public long MemberCount { get; set; }
|
||||
public long OpportunityCount { get; set; }
|
||||
public bool? Admin { get; set; } = null;
|
||||
@@ -46,7 +55,6 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public String CategoryCode { get; set; }
|
||||
public String TypeCode { get; set; }
|
||||
public String SportId { get; set; }
|
||||
public String RegionIdCountry { get; set; }
|
||||
public String About { get; set; }
|
||||
public String Facilities { get; set; }
|
||||
public List<AjaxResponse_Data.ContactMethodData> ContactMethods { get; set; }
|
||||
@@ -58,7 +66,10 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
data.Id = model.EncryptId(organisation.Id);
|
||||
data.Name = organisation.Name;
|
||||
data.SportName = model.GetSportCaption(organisation.SportIdPrimary);
|
||||
data.RegionNameCountry = model.GetRegionCaption(organisation.RegionIdPrimary);
|
||||
data.RegionPrimary.Name = model.GetRegionCaption(organisation.RegionIdPrimary);
|
||||
// Associated properties.
|
||||
data.MemberCount = AccountMgr.GetOrganisationMemberCount(organisation.Id);
|
||||
data.OpportunityCount = AccountMgr.GetOrganisationOpportunityCount(organisation.Id);
|
||||
if (userOrganisation != null)
|
||||
{
|
||||
List<String> roleCodes = userOrganisation.GetOrganisationRoleCodes();
|
||||
@@ -73,7 +84,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
if (roleCodes.ContainsCI(OrganisationRoleCodes.GetCodeForType(Sax.OrganisationRole.ArticleAdmin)))
|
||||
data.ArticleAdmin = true;
|
||||
}
|
||||
// NB Member and Opportunity counts are only populated for the Organisation list.
|
||||
// Common properties.
|
||||
data.CreatedOnFmt = Localiser.FormatDate(organisation.CreateStamp.On);
|
||||
data.UpdatedOnFmt = Localiser.FormatDate(organisation.UpdateStamp.On);
|
||||
data.StatusCode = organisation.StatusCode;
|
||||
@@ -88,7 +99,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
data.TypeCode = OrganisationTypeCodes.GetCodeForType(organisation.OrganisationType);
|
||||
data.TypeDesc = Localiser.GetOrganisationTypeCaption(organisation.OrganisationType);
|
||||
data.SportId = model.GetEncryptedSportId(organisation.SportIdPrimary);
|
||||
data.RegionIdCountry = model.GetEncryptedRegionId(organisation.RegionIdPrimary);
|
||||
data.RegionPrimary.Id = model.GetEncryptedRegionId(organisation.RegionIdPrimary);
|
||||
data.About = organisation.About;
|
||||
data.Facilities = organisation.Facilities;
|
||||
// Contact methods.
|
||||
@@ -107,8 +118,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
data.Address.Line2 = address.Line2;
|
||||
data.Address.Line3 = address.Line3;
|
||||
data.Address.Town = address.Town;
|
||||
data.Address.Province = address.Province;
|
||||
data.Address.Country = address.Country;
|
||||
data.Address.RegionNameProvince = address.Province;
|
||||
data.Address.RegionNameCountry = address.Country;
|
||||
data.Address.PostalCode = address.PostalCode;
|
||||
}
|
||||
}
|
||||
@@ -202,13 +213,12 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
Name = values.GetString(colOrganisationName.DataName),
|
||||
CategoryDesc = Localiser.GetOrganisationCategoryCaption(organisationCategory),
|
||||
TypeDesc = Localiser.GetOrganisationTypeCaption(organisationType),
|
||||
//SportId = model.EncryptId(new SysId(values.GetLong(colOrganisationSportId.DataName))),
|
||||
SportName = values.GetString(colOrganisationSportName.DataName),
|
||||
//RegionId = model.EncryptId(new SysId(values.GetLong(colOrganisationRegionId.DataName))),
|
||||
RegionNameCountry = values.GetString(colOrganisationRegionName.DataName),
|
||||
MemberCount = values.GetLong(colMemberCount.DataName),
|
||||
OpportunityCount = values.GetLong(colOpportunityCount.DataName)
|
||||
};
|
||||
// Primary region.
|
||||
organisationData.RegionPrimary.Name = values.GetString(colOrganisationRegionName.DataName);
|
||||
// Roles.
|
||||
List<String> roleCodes = StringListUtil.Split(values.GetString(colRoleCodes.DataName), SaxUserOrganisation.UserOrgnisationRoleDelim);
|
||||
if (roleCodes.ContainsCI(OrganisationRoleCodes.GetCodeForType(Sax.OrganisationRole.Admin)))
|
||||
@@ -411,11 +421,11 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// Regions.
|
||||
SysId regionIdCountry = model.ExtractSysId(model.Organisation.RegionIdCountry);
|
||||
SysId regionIdCountry = model.ExtractSysId(model.Organisation.RegionIdPrimary);
|
||||
SaxRegion.Data regionCountry = Internals.GetRegion(regionIdCountry);
|
||||
if (SysId.IsValid(regionIdCountry) && regionCountry == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Country region not found. Id: " + model.Organisation.RegionIdCountry + ". " + GetLogSuffix());
|
||||
SaLogger.Warn(fn + " Country region not found. Id: " + model.Organisation.RegionIdPrimary + ". " + GetLogSuffix());
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
SysId regionIdAddressProvince = model.ExtractSysId(model.Organisation.Address.RegionIdProvince);
|
||||
@@ -435,8 +445,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
organisation.OrganisationCategory = model.Organisation.GetOrganisationCategory();
|
||||
if (model.Organisation.SportId != null)
|
||||
organisation.SportIdPrimary = model.ExtractSysId(model.Organisation.SportId);
|
||||
if (model.Organisation.RegionIdCountry != null)
|
||||
organisation.RegionIdPrimary = model.ExtractSysId(model.Organisation.RegionIdCountry);
|
||||
if (model.Organisation.RegionIdPrimary != null)
|
||||
organisation.RegionIdPrimary = model.ExtractSysId(model.Organisation.RegionIdPrimary);
|
||||
if (model.Organisation.About != null)
|
||||
organisation.About = model.Organisation.About;
|
||||
if (model.Organisation.Facilities != null)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data definitions.
|
||||
private class ProfileSportResponseData_List : AjaxResponse_Data.ItemData_Base
|
||||
private class ProfileSportResponseListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String SportId { get; set; }
|
||||
public String SportName { get; set; }
|
||||
@@ -33,23 +33,27 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public String SportParticipation { get; set; }
|
||||
public String SportOfficiating { get; set; }
|
||||
}
|
||||
private class ProfileSportResponseData_Item : ProfileSportResponseData_List
|
||||
private class ProfileSportResponseItemData : ProfileSportResponseListData
|
||||
{
|
||||
public String SportAbout { get; set; }
|
||||
public String SportParticipationCode { get; set; }
|
||||
public String SportOfficiatingCode { get; set; }
|
||||
}
|
||||
private void PopulateProfileSportResponseData(Model_Account model, SaxUserSport userSport, SaxSport sport, ProfileSportResponseData_Item data)
|
||||
private void PopulateProfileSportResponseListData(Model_Account model, SaxUserSport userSport, SaxSport sport, ProfileSportResponseListData data)
|
||||
{
|
||||
data.Id = model.EncryptId(userSport.Id);
|
||||
data.SportId = model.GetEncryptedSportId(userSport.SportId);
|
||||
data.SportName = sport.Name;
|
||||
data.SportSpecialityLabel = model.GetSportSpecialityLabel(userSport.SportId);
|
||||
data.SportParticipation = Localiser.GetSportParticipationCaption(userSport.Participation);
|
||||
data.SportOfficiating = Localiser.GetSportOfficiatingCaption(userSport.Officiating);
|
||||
}
|
||||
private void PopulateProfileSportResponseItemData(Model_Account model, SaxUserSport userSport, SaxSport sport, ProfileSportResponseItemData data)
|
||||
{
|
||||
PopulateProfileSportResponseListData(model, userSport, sport, data);
|
||||
data.SportAbout = userSport.About;
|
||||
data.SportParticipationCode = SportParticipationCodes.GetCodeForType(userSport.Participation);
|
||||
data.SportParticipation = Localiser.GetSportParticipationCaption(userSport.Participation);
|
||||
data.SportOfficiatingCode = SportOfficiatingCodes.GetCodeForType(userSport.Officiating);
|
||||
data.SportOfficiating = Localiser.GetSportOfficiatingCaption(userSport.Officiating);
|
||||
data.CreatedOnFmt = DateUtil.Format(userSport.CreateStamp.On, "d-MMM-yyyy");
|
||||
data.StatusCode = userSport.StatusCode;
|
||||
data.StatusDesc = userSport.StatusDesc;
|
||||
@@ -63,7 +67,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_ProfileSportsData(SaxModel_Online model) : base(model) { }
|
||||
// Sport list.
|
||||
public List<ProfileSportResponseData_List> Sports { get; } = new List<ProfileSportResponseData_List>();
|
||||
public List<ProfileSportResponseListData> Sports { get; } = new List<ProfileSportResponseListData>();
|
||||
}
|
||||
// Ajax request.
|
||||
[HttpPost]
|
||||
@@ -111,7 +115,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
SysId sportId = new SysId(values.GetLong(colSportId.DataName));
|
||||
ProfileSportResponseData_List userSportData = new ProfileSportResponseData_List()
|
||||
ProfileSportResponseListData userSportData = new ProfileSportResponseListData()
|
||||
{
|
||||
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
|
||||
SportId = model.GetEncryptedSportId(sportId),
|
||||
@@ -142,7 +146,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_ProfileSport(SaxModel_Online model) : base(model) { }
|
||||
// Sport details.
|
||||
public ProfileSportResponseData_Item Sport { get; } = new ProfileSportResponseData_Item();
|
||||
public ProfileSportResponseItemData Sport { get; } = new ProfileSportResponseItemData();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -186,7 +190,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateProfileSportResponseData(model, userSport, sport, responseData.Sport);
|
||||
PopulateProfileSportResponseItemData(model, userSport, sport, responseData.Sport);
|
||||
responseData.Success = true;
|
||||
}
|
||||
return Json(responseData);
|
||||
@@ -318,7 +322,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
RefreshSessionProfileSports();
|
||||
|
||||
// Construct response.
|
||||
PopulateProfileSportResponseData(model, userSport, sport, responseData.Sport);
|
||||
PopulateProfileSportResponseItemData(model, userSport, sport, responseData.Sport);
|
||||
responseData.Success = true;
|
||||
}
|
||||
return Json(responseData);
|
||||
|
||||
+21
-17
@@ -29,7 +29,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Common response data.
|
||||
private class SportExperienceResponseData_List : AjaxResponse_Data.ItemData_Base
|
||||
private class SportExperienceResponseListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String UserSportId { get; set; }
|
||||
public String Period { get; set; }
|
||||
@@ -45,7 +45,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public String RegionCaptionProvince { get; set; }
|
||||
public string RegionRepresentation { get; set; }
|
||||
}
|
||||
private class SportExperienceResponseData_Detail : SportExperienceResponseData_List
|
||||
private class SportExperienceResponseItemData : SportExperienceResponseListData
|
||||
{
|
||||
public String PeriodFrom_YMD { get; set; }
|
||||
public String PeriodTo_YMD { get; set; }
|
||||
@@ -53,29 +53,33 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public String RegionIdNation { get; set; }
|
||||
public String RegionIdProvince { get; set; }
|
||||
}
|
||||
private void PopulateSportExperienceResponseData(Model_UserSportExperience model, SportExperienceResponseData_Detail data, SaxUserSport userSport, SaxUserSportExperience userSportExperience)
|
||||
private void PopulateSportExperienceResponseListData(Model_UserSportExperience model, SportExperienceResponseListData data, SaxUserSport userSport, SaxUserSportExperience userSportExperience)
|
||||
{
|
||||
data.Id = model.EncryptId(userSportExperience.Id);
|
||||
data.UserSportId = model.EncryptId(userSportExperience.UserSportId);
|
||||
data.PeriodFrom_YMD = DateUtil.FormatDateForJavascript(userSportExperience.PeriodFrom);
|
||||
data.PeriodFrom = model.FormatDateForForm(userSportExperience.PeriodFrom);
|
||||
data.PeriodTo_YMD = DateUtil.FormatDateForJavascript(userSportExperience.PeriodTo);
|
||||
data.PeriodTo = model.FormatDateForForm(userSportExperience.PeriodTo);
|
||||
data.Period = data.PeriodFrom + " - " + data.PeriodTo;
|
||||
data.OrganisationId = model.EncryptId(userSportExperience.OrganisationId);
|
||||
data.OrganisationName = userSportExperience.OrganisationName;
|
||||
data.Summary = userSportExperience.Summary;
|
||||
data.Team = userSportExperience.Team;
|
||||
data.League = userSportExperience.League;
|
||||
data.Speciality = userSportExperience.Speciality;
|
||||
// Regions.
|
||||
data.RegionIdNation = model.GetEncryptedRegionId(userSportExperience.RegionIdNation);
|
||||
data.RegionIdProvince = model.GetEncryptedRegionId(userSportExperience.RegionIdProvince);
|
||||
data.RegionCaptionNation = Localiser.GetRegionName(Internals.GetRegion(userSportExperience.RegionIdNation));
|
||||
data.RegionCaptionProvince = Localiser.GetRegionName(Internals.GetRegion(userSportExperience.RegionIdProvince));
|
||||
List<String> locations = new List<string>() { data.RegionCaptionProvince, data.RegionCaptionNation };
|
||||
data.RegionRepresentation = locations.Concat(", ", "", "", true, true);
|
||||
}
|
||||
private void PopulateSportExperienceResponseItemData(Model_UserSportExperience model, SportExperienceResponseItemData data, SaxUserSport userSport, SaxUserSportExperience userSportExperience)
|
||||
{
|
||||
data.PeriodFrom_YMD = DateUtil.FormatDateForJavascript(userSportExperience.PeriodFrom);
|
||||
data.PeriodTo_YMD = DateUtil.FormatDateForJavascript(userSportExperience.PeriodTo);
|
||||
data.Period = data.PeriodFrom + " - " + data.PeriodTo;
|
||||
data.OrganisationId = model.EncryptId(userSportExperience.OrganisationId);
|
||||
// Regions.
|
||||
data.RegionIdNation = model.GetEncryptedRegionId(userSportExperience.RegionIdNation);
|
||||
data.RegionIdProvince = model.GetEncryptedRegionId(userSportExperience.RegionIdProvince);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilites.
|
||||
@@ -88,7 +92,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_UserSportExperienceList(SaxModel_Online model) : base(model) { }
|
||||
// Contact details.
|
||||
public List<SportExperienceResponseData_List> Experiences { get; } = new List<SportExperienceResponseData_List>();
|
||||
public List<SportExperienceResponseListData> Experiences { get; } = new List<SportExperienceResponseListData>();
|
||||
// Sport details.
|
||||
public class SportData
|
||||
{
|
||||
@@ -163,7 +167,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
SportExperienceResponseData_List itemData = new SportExperienceResponseData_List()
|
||||
SportExperienceResponseListData itemData = new SportExperienceResponseListData()
|
||||
{
|
||||
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
|
||||
UserSportId = model.EncryptId(new SysId(values.GetLong(colUserSportId.DataName))),
|
||||
@@ -194,7 +198,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_UserSportExperienceData(SaxModel_Online model) : base(model) { }
|
||||
// Contact details.
|
||||
public SportExperienceResponseData_Detail Experience { get; set; }
|
||||
public SportExperienceResponseItemData Experience { get; set; }
|
||||
}
|
||||
// Ajax request.
|
||||
[HttpPost]
|
||||
@@ -223,8 +227,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.something.gone.wrong"]));
|
||||
|
||||
// Populate data to response.
|
||||
responseData.Experience = new SportExperienceResponseData_Detail();
|
||||
PopulateSportExperienceResponseData(model, responseData.Experience, userSport, userSportExperience);
|
||||
responseData.Experience = new SportExperienceResponseItemData();
|
||||
PopulateSportExperienceResponseItemData(model, responseData.Experience, userSport, userSportExperience);
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
@@ -240,7 +244,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_StoreUserSportExperience(SaxModel_Online model) : base(model) { }
|
||||
// Contact details.
|
||||
public SportExperienceResponseData_Detail Experience { get; set; }
|
||||
public SportExperienceResponseItemData Experience { get; set; }
|
||||
}
|
||||
// Ajax request.
|
||||
[HttpPost]
|
||||
@@ -346,8 +350,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Populate data to response.
|
||||
responseData.Experience = new SportExperienceResponseData_Detail();
|
||||
PopulateSportExperienceResponseData(model, responseData.Experience, userSport, userSportExperience);
|
||||
responseData.Experience = new SportExperienceResponseItemData();
|
||||
PopulateSportExperienceResponseItemData(model, responseData.Experience, userSport, userSportExperience);
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public String ItemTypeClass { get; set; }
|
||||
public String ItemId { get; set; }
|
||||
public String Organisation { get; set; }
|
||||
public String OrganisationLogoUrl { get; set; }
|
||||
public String Author { get; set; }
|
||||
public String Caption { get; set; }
|
||||
public String Blurb { get; set; }
|
||||
@@ -54,6 +55,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public ActivityResponseData_Article(SaxController_Online controller, SaxModel_Online model, SaxArticle article, SaxOrganisation organisation)
|
||||
{
|
||||
Organisation = organisation?.Name ?? null;
|
||||
if (controller.ItemDataMgr.ItemHasActiveImage(organisation?.GetItemId() ?? null, Sax.ImageType.OrganisationLogo))
|
||||
OrganisationLogoUrl = controller.GetOrganisationLogoUrl(organisation.Id, false);
|
||||
Author = model.GetUserAccountDisplayName(article.UserAccountIdAuthor);
|
||||
Headline = article.Headline;
|
||||
Summary = article.Summary;
|
||||
@@ -65,6 +68,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
Content.Segments.Add(new ContentData.SegmentData(controller, segment));
|
||||
}
|
||||
public String Organisation { get; set; }
|
||||
public String OrganisationLogoUrl { get; set; }
|
||||
public String Author { get; set; }
|
||||
public String Headline { get; set; }
|
||||
public String Summary { get; set; }
|
||||
@@ -106,9 +110,11 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
/// <summary>Event activity info. </summary>
|
||||
private class ActivityResponseData_Event
|
||||
{
|
||||
public ActivityResponseData_Event(SaxModel_Online model, SaxOrganisationEvent organisationEvent)
|
||||
public ActivityResponseData_Event(SaxController_Online controller, SaxModel_Online model, SaxOrganisationEvent organisationEvent, SaxOrganisation organisation)
|
||||
{
|
||||
Organisation = model.GetOrganisationName(organisationEvent.OrganisationId);
|
||||
if (controller.ItemDataMgr.ItemHasActiveImage(organisation?.GetItemId() ?? null, Sax.ImageType.OrganisationLogo))
|
||||
OrganisationLogoUrl = controller.GetOrganisationLogoUrl(organisation.Id, false);
|
||||
EventAt = DateUtil.Format(organisationEvent.EventAt, "d-MMM-yy");
|
||||
if (organisationEvent.EventAt.Hour > 0 || organisationEvent.EventAt.Minute > 0)
|
||||
EventAt += DateUtil.Format(organisationEvent.EventAt, " HH:ss");
|
||||
@@ -119,6 +125,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
PublishedOnFmt = model.Localiser.FormatDate(organisationEvent.PublishedAt);
|
||||
}
|
||||
public String Organisation { get; set; }
|
||||
public String OrganisationLogoUrl { get; set; }
|
||||
public String EventAt { get; set; }
|
||||
public String Summary { get; set; }
|
||||
public String Details { get; set; }
|
||||
@@ -129,9 +136,11 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
/// <summary>Opportunity activity info. </summary>
|
||||
private class ActivityResponseData_Opportunity
|
||||
{
|
||||
public ActivityResponseData_Opportunity(SaxModel_Online model, SaxOrganisationOpportunity opportunity)
|
||||
public ActivityResponseData_Opportunity(SaxController_Online controller, SaxModel_Online model, SaxOrganisationOpportunity opportunity, SaxOrganisation organisation)
|
||||
{
|
||||
Organisation = model.GetOrganisationName(opportunity.OrganisationId);
|
||||
if (controller.ItemDataMgr.ItemHasActiveImage(organisation?.GetItemId() ?? null, Sax.ImageType.OrganisationLogo))
|
||||
OrganisationLogoUrl = controller.GetOrganisationLogoUrl(organisation.Id, false);
|
||||
Position = opportunity.Position;
|
||||
Outline = opportunity.Outline;
|
||||
Sport = model.GetSportCaption(opportunity.SportIdPrimary);
|
||||
@@ -139,6 +148,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
PublishedOnFmt = model.Localiser.FormatDate(opportunity.PublishedAt);
|
||||
}
|
||||
public String Organisation { get; set; }
|
||||
public String OrganisationLogoUrl { get; set; }
|
||||
public String Position { get; set; }
|
||||
public String Outline { get; set; }
|
||||
public String Sport { get; set; }
|
||||
@@ -230,6 +240,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// ToDo Mask activity index Id with cross-reference stored in session data.
|
||||
activityData.ItemId = model.EncryptId(itemData.ItemId.Id);
|
||||
activityData.Organisation = itemData.Organisation;
|
||||
// ToDo Organisation Logo URL.
|
||||
activityData.Author = itemData.Author;
|
||||
activityData.Caption = itemData.Caption;
|
||||
activityData.Blurb = itemData.Blurb;
|
||||
@@ -350,7 +361,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
SaLogger.Warn(fn + " Event not found for Activity Id: " + itemId.ToString() + "." + GetLogSuffix());
|
||||
return Json(responseData);
|
||||
}
|
||||
responseData.Event = new ActivityResponseData_Event(model, organisationEvent);
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationEvent.OrganisationId);
|
||||
disposableItems.Add(organisation);
|
||||
responseData.Event = new ActivityResponseData_Event(this, model, organisationEvent, organisation);
|
||||
}
|
||||
else if (itemType == Sax.DataItemType.OrganisationOpportunity)
|
||||
{
|
||||
@@ -362,7 +375,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
SaLogger.Warn(fn + " Opportunity not found for Activity Id: " + itemId.ToString() + "." + GetLogSuffix());
|
||||
return Json(responseData);
|
||||
}
|
||||
responseData.Opportunity = new ActivityResponseData_Opportunity(model, opportunity);
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(opportunity.OrganisationId);
|
||||
disposableItems.Add(organisation);
|
||||
responseData.Opportunity = new ActivityResponseData_Opportunity(this, model, opportunity, organisation);
|
||||
}
|
||||
|
||||
// Record activty viewing.
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Article data.
|
||||
private class ArticleData_List : AjaxResponse_Data.ItemData_Base
|
||||
private class ArticleListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String OrganisationId { get; set; }
|
||||
public String OrganisationName { get; set; }
|
||||
@@ -68,7 +68,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public String SportCaptionPrimary { get; set; }
|
||||
public String PublishedOnFmt { get; set; }
|
||||
}
|
||||
private class ArticleData_Full : ArticleData_List
|
||||
private class ArticleItemData : ArticleListData
|
||||
{
|
||||
public String RegionIdPrimary { get; set; }
|
||||
public String SportIdPrimary { get; set; }
|
||||
@@ -78,7 +78,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public String PublishedOn_Calendar { get; set; }
|
||||
public ArticleContentData Content { get; } = new ArticleContentData();
|
||||
}
|
||||
private void PopulateArticleResponseListData(Model_Article model, SaxArticle article, SaxOrganisation organisation, SaxActivityFeedback activityFeedback, ArticleData_List data)
|
||||
private void PopulateArticleResponseListData(Model_Article model, SaxArticle article, SaxOrganisation organisation, SaxActivityFeedback activityFeedback, ArticleListData data)
|
||||
{
|
||||
data.Id = model.EncryptId(article.Id);
|
||||
data.OrganisationId = SysId.ToString(article.OrganisationId);
|
||||
@@ -92,9 +92,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
data.StatusCode = article.StatusCode;
|
||||
data.StatusDesc = article.StatusDesc;
|
||||
}
|
||||
private void PopulateArticleResponseData(Model_Article model, SaxArticle article, SaxOrganisation organisation, SaxActivityFeedback activityFeedback, ArticleData_Full data)
|
||||
private void PopulateArticleResponseItemData(Model_Article model, SaxArticle article, SaxOrganisation organisation, SaxActivityFeedback activityFeedback, ArticleItemData data)
|
||||
{
|
||||
PopulateArticleResponseListData(model, article, organisation, activityFeedback, data as ArticleData_List);
|
||||
PopulateArticleResponseListData(model, article, organisation, activityFeedback, data as ArticleListData);
|
||||
data.RegionIdPrimary = model.GetEncryptedRegionId(article.RegionIdPrimary);
|
||||
data.SportIdPrimary = model.GetEncryptedSportId(article.SportIdPrimary);
|
||||
data.Published = DateUtil.IsValid(article.PublishedAt) ? true : (bool?)null;
|
||||
@@ -122,19 +122,19 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
}
|
||||
// Feedback.
|
||||
private void PopulateFeedbackResponseData(SaxActivityFeedback activityFeedback, ArticleData_Full data)
|
||||
private void PopulateFeedbackResponseData(SaxActivityFeedback activityFeedback, ArticleItemData data)
|
||||
{
|
||||
PopulateFeedbackResponseListData(activityFeedback, data);
|
||||
}
|
||||
private void PopulateFeedbackResponseListData(SaxActivityFeedback activityFeedback, ArticleData_List data)
|
||||
private void PopulateFeedbackResponseListData(SaxActivityFeedback activityFeedback, ArticleListData data)
|
||||
{
|
||||
if (activityFeedback == null) return;
|
||||
PopulateFeedbackResponseListData(activityFeedback.ViewCount, activityFeedback.FeedbackCount, activityFeedback.FeedbackTotal, activityFeedback.FeedbackAverage, data);
|
||||
}
|
||||
private void PopulateFeedbackResponseListData(long viewCount, long feedbackCount, long feedbackTotal, decimal feedbackAverage, ArticleData_List data)
|
||||
private void PopulateFeedbackResponseListData(long viewCount, long feedbackCount, long feedbackTotal, decimal feedbackAverage, ArticleListData data)
|
||||
{
|
||||
if (viewCount <= 0) return;
|
||||
data.Feedback = new ArticleData_List.FeedbackData();
|
||||
data.Feedback = new ArticleListData.FeedbackData();
|
||||
data.Feedback.Summary = feedbackCount.ToString() + "/" + viewCount.ToString();
|
||||
if (feedbackCount > 0)
|
||||
data.Feedback.Summary = feedbackAverage.ToString("N1") + " " + data.Feedback.Summary;
|
||||
@@ -152,7 +152,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_ArticleList(SaxModel_Online model) : base(model) { }
|
||||
// Article list.
|
||||
public List<ArticleData_List> Articles { get; } = new List<ArticleData_List>();
|
||||
public List<ArticleListData> Articles { get; } = new List<ArticleListData>();
|
||||
/// <summary>Organisations that the user has rights to author articles for.</summary>
|
||||
public List<OrganisationData> Organisations { get; set; }
|
||||
public ItemIdName DefaultSport { get; set; }
|
||||
@@ -283,7 +283,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
ArticleData_List articleData = new ArticleData_List()
|
||||
ArticleListData articleData = new ArticleListData()
|
||||
{
|
||||
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
|
||||
OrganisationId = model.EncryptId(new SysId(values.GetLong(colOrganisationId.DataName))),
|
||||
@@ -322,7 +322,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_Article(SaxModel_Online model) : base(model) { }
|
||||
// Article details.
|
||||
public ArticleData_Full Article { get; } = new ArticleData_Full();
|
||||
public ArticleItemData Article { get; } = new ArticleItemData();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -371,7 +371,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Delete upload images.
|
||||
SaxItemImage.Params prmItemImage = new SaxItemImage.Params();
|
||||
prmItemImage.ItemIdsIncluded.Add(new ItemId((short)Sax.DataItemType.Article, articleId));
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.ArticleUpload);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.Article_Upload);
|
||||
prmItemImage.StatusCat = SaxItemImage.StatusCat.NotDeleted;
|
||||
foreach (SaxItemImage itemImage in ItemDataMgr.GetItemImageList(prmItemImage))
|
||||
{
|
||||
@@ -387,7 +387,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
disposableItems.Add(activityFeedback);
|
||||
|
||||
// Construct response.
|
||||
PopulateArticleResponseData(model, article, organisation, activityFeedback, responseData.Article);
|
||||
PopulateArticleResponseItemData(model, article, organisation, activityFeedback, responseData.Article);
|
||||
}
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
@@ -458,7 +458,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData.SetControlError("ArticleImage", Localiser["msg.upload.image.invalid.content.type"]));
|
||||
|
||||
// Resize the image if required.
|
||||
if (!ImageUtils.ConstrainImage(imageConfig, Sax.Config.Online.Articles.Images.WidthMax, Sax.Config.Online.Articles.Images.HeightMax))
|
||||
if (!ImageUtils.ConstrainImage(imageConfig, Sax.Config.Articles.Images.WidthMax, Sax.Config.Articles.Images.HeightMax))
|
||||
return Json(responseData.SetControlError("ArticleImage", Localiser["msg.upload.image.resize.failed"]));
|
||||
|
||||
// Image belongs to the article.
|
||||
@@ -473,16 +473,16 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
SaxItemImage.Params prmItemImage = new SaxItemImage.Params();
|
||||
prmItemImage.ItemIdsIncluded.Add(imageItemId);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.Article);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.ArticleUpload);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.Article_Upload);
|
||||
prmItemImage.StatusCat = SaxItemImage.StatusCat.DeletedOnly;
|
||||
prmItemImage.ResultsPaging.PageLength = 1;
|
||||
prmItemImage.ResultsPaging.PageNo = 1;
|
||||
List<SaxItemImage> itemImages = ItemDataMgr.GetItemImageList(prmItemImage);
|
||||
SaxItemImage itemImage = !itemImages.IsEmpty() ? itemImages[0] : null;
|
||||
if (itemImage == null)
|
||||
itemImage = ItemDataMgr.CreateItemImage(imageItemId, Sax.ImageType.ArticleUpload);
|
||||
itemImage = ItemDataMgr.CreateItemImage(imageItemId, Sax.ImageType.Article_Upload);
|
||||
disposableItems.Add(itemImage);
|
||||
itemImage.ImageType = Sax.ImageType.ArticleUpload;
|
||||
itemImage.ImageType = Sax.ImageType.Article_Upload;
|
||||
itemImage.Filename = file.FileName;
|
||||
itemImage.Mime = SacsContentTypeHelper.GetMimeTypeFromContentType(file.ContentType).ToString().ToLower();
|
||||
itemImage.ContentType = file.ContentType;
|
||||
@@ -658,7 +658,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
else
|
||||
prmItemImage.ItemIdsIncluded.Add(new ItemId((short)Sax.DataItemType.UserAccount, sessionData.User.UserAccountId));
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.Article);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.ArticleUpload);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.Article_Upload);
|
||||
prmItemImage.StatusCat = SaxItemImage.StatusCat.NotDeleted;
|
||||
List<SaxItemImage> itemImages = ItemDataMgr.GetItemImageList(prmItemImage);
|
||||
disposableItems.AddRange(itemImages);
|
||||
@@ -750,7 +750,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
disposableItems.Add(activityFeedback);
|
||||
|
||||
// Construct response.
|
||||
PopulateArticleResponseData(model, article, organisation, activityFeedback, responseData.Article);
|
||||
PopulateArticleResponseItemData(model, article, organisation, activityFeedback, responseData.Article);
|
||||
responseData.Success = true;
|
||||
}
|
||||
return Json(responseData);
|
||||
|
||||
@@ -30,6 +30,10 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
public static String ParamName_OrganisationLogoEncrypted { get; } = "ole";
|
||||
public static String ParamName_ArticleImageEncrypted { get; } = "aie";
|
||||
public static String ParamName_OrganisationId { get; } = "ori";
|
||||
public static String ParamName_ItemImageId { get; } = "iii";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
@@ -78,7 +82,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
Response.Headers[HeaderNames.CacheControl] = "no-cache, no-store, must-revalidate, max-age=0";
|
||||
Response.Headers[HeaderNames.Expires] = "-1";
|
||||
SysId userAccountId = UserAccountId;
|
||||
return GetAccountContactImage(userAccountId, Sax.ImageType.AvatarUpload);
|
||||
return GetAccountContactImage(userAccountId, Sax.ImageType.Avatar_Upload);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -100,7 +104,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
SaxItemImage.Params prmItemImage = new SaxItemImage.Params();
|
||||
prmItemImage.ItemIdsIncluded.Add(userItemId);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.Avatar);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.AvatarUpload);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.Avatar_Upload);
|
||||
prmItemImage.StatusCat = SaxItemImage.StatusCat.ActiveOnly;
|
||||
SaxItemImage itemImage = null;
|
||||
foreach (SaxItemImage itemImageCandidate in ItemDataMgr.GetItemImageList(prmItemImage))
|
||||
@@ -117,11 +121,76 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return File(itemImage.ImageData, itemImage.ContentType);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation logo.
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Get the logo for the specified Organisation.
|
||||
/// <para>Method parameter name (ole) must match name of encrypted parameter.</para>
|
||||
/// <para>Encrypted parameters:</para>
|
||||
/// <para>- ori: Organisation Id.</para>
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[Route("Image/Organisation/Logo")]
|
||||
public IActionResult GetOrganisationLogo(String ole)
|
||||
{
|
||||
return GetOrganisationLogo(ole, false);
|
||||
}
|
||||
/// <summary>
|
||||
/// Get the logo for the specified Organisation.
|
||||
/// <para>Method parameter name (ole) must match name of encrypted parameter.</para>
|
||||
/// <para>Encrypted parameters:</para>
|
||||
/// <para>- ori: Organisation Id.</para>
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[Route("Image/Organisation/Logo/Upload")]
|
||||
public IActionResult GetOrganisationLogoUpload(String ole)
|
||||
{
|
||||
return GetOrganisationLogo(ole, true);
|
||||
}
|
||||
private IActionResult GetOrganisationLogo(String encryptedParams, bool allowUploadImage)
|
||||
{
|
||||
String fn = GetType().Name + ".GetOrganisationLogo";
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer || !ValidUserSession) return Forbid();
|
||||
|
||||
// Extract encrypted parameters.
|
||||
NameValueCollection parameters = ExtractOnlineParams(encryptedParams);
|
||||
if (parameters.Count < 1) return Forbid();
|
||||
|
||||
// Organisation Id.
|
||||
SysId organisationId = parameters.Get(ParamName_OrganisationId).ToSysId();
|
||||
if (!SysId.IsValid(organisationId)) return Forbid();
|
||||
ItemId organisationItemId = new ItemId((short)Sax.DataItemType.Organisation, organisationId);
|
||||
|
||||
// Query Organisation Logo images.
|
||||
SaxItemImage.Params prmItemImage = new SaxItemImage.Params();
|
||||
prmItemImage.ItemIdsIncluded.Add(organisationItemId);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.OrganisationLogo);
|
||||
if (allowUploadImage)
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.OrganisationLogo_Upload);
|
||||
prmItemImage.StatusCat = SaxItemImage.StatusCat.ActiveOnly;
|
||||
SaxItemImage itemImage = null;
|
||||
foreach (SaxItemImage itemImageCandidate in ItemDataMgr.GetItemImageList(prmItemImage))
|
||||
{
|
||||
// The 'Upload' image will take precedence if allowed.
|
||||
if (itemImage == null || itemImageCandidate.ImageType == Sax.ImageType.OrganisationLogo_Upload)
|
||||
itemImage = itemImageCandidate;
|
||||
}
|
||||
|
||||
if (itemImage == null)
|
||||
return NotFound();
|
||||
|
||||
// Construct response.
|
||||
Response.Headers[HeaderNames.CacheControl] = "no-cache, no-store, must-revalidate, max-age=0";
|
||||
Response.Headers[HeaderNames.Expires] = "-1";
|
||||
return File(itemImage.ImageData, itemImage.ContentType);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Article image
|
||||
//-------------------------------------------------------------------
|
||||
public static String ParamName_ArticleImageEncrypted { get; } = "aie";
|
||||
public static String ParamName_ItemImageId { get; } = "iii";
|
||||
/// <summary>
|
||||
/// Get the specified Article Image.
|
||||
/// <para>Method parameter name (aie) must match name of encrypted parameter.</para>
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation Event data.
|
||||
private class EventData_List : AjaxResponse_Data.ItemData_Base
|
||||
private class EventListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String EventDateFmt { get; set; }
|
||||
public String EventTimeFmt { get; set; }
|
||||
@@ -34,7 +34,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public String PublishedOnFmt { get; set; }
|
||||
public String ExpiresOnFmt { get; set; }
|
||||
}
|
||||
private class EventData_Detail : EventData_List
|
||||
private class EventItemData : EventListData
|
||||
{
|
||||
public String EventOn_Calendar { get; set; }
|
||||
public String EventOn_YYYYMMDD { get; set; }
|
||||
@@ -44,7 +44,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public String PublishedOn_YYYYMMDD { get; set; }
|
||||
public String ExpiresOn_YYYYMMDD { get; set; }
|
||||
}
|
||||
private void PopulateEventResponseData(Model_Organisation_Events model, SaxOrganisationEvent organisationEvent, EventData_List data)
|
||||
private void PopulateEventResponseListData(Model_Organisation_Events model, SaxOrganisationEvent organisationEvent, EventListData data)
|
||||
{
|
||||
data.Id = model.EncryptId(organisationEvent.Id);
|
||||
data.EventDateFmt = Localiser.FormatDate(organisationEvent.EventAt);
|
||||
@@ -61,9 +61,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
data.StatusCode = organisationEvent.StatusCode;
|
||||
data.StatusDesc = organisationEvent.StatusDesc;
|
||||
}
|
||||
private void PopulateEventResponseData(Model_Organisation_Events model, SaxOrganisationEvent organisationEvent, EventData_Detail data)
|
||||
private void PopulateEventResponseItemData(Model_Organisation_Events model, SaxOrganisationEvent organisationEvent, EventItemData data)
|
||||
{
|
||||
PopulateEventResponseData(model, organisationEvent, data as EventData_List);
|
||||
PopulateEventResponseListData(model, organisationEvent, data as EventListData);
|
||||
data.EventOn_Calendar = model.FormatDateForForm(organisationEvent.EventAt);
|
||||
data.EventOn_YYYYMMDD = DateUtil.Format(organisationEvent.EventAt, "yyyyMMdd");
|
||||
data.EventAt_HHMM = DateUtil.Format(organisationEvent.EventAt, "HH:mm");
|
||||
@@ -81,7 +81,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_EventList(SaxModel_Online model) : base(model) { }
|
||||
// Event list.
|
||||
public List<EventData_List> Events { get; } = new List<EventData_List>();
|
||||
public List<EventListData> Events { get; } = new List<EventListData>();
|
||||
// User profile.
|
||||
public class UserData
|
||||
{
|
||||
@@ -207,7 +207,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
EventData_List eventData = new EventData_List()
|
||||
EventListData eventData = new EventListData()
|
||||
{
|
||||
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
|
||||
EventDateFmt = Localiser.FormatDate(values.GetDateTime(colEventAt.DataName)),
|
||||
@@ -246,7 +246,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_Event(SaxModel_Online model) : base(model) { }
|
||||
// Event details.
|
||||
public EventData_Detail Event { get; } = new EventData_Detail();
|
||||
public EventItemData Event { get; } = new EventItemData();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -293,7 +293,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
SessionData_Online.Filter.SetMemberOrganisation(organisation);
|
||||
|
||||
// Construct response.
|
||||
PopulateEventResponseData(model, organisationEvent, responseData.Event);
|
||||
PopulateEventResponseItemData(model, organisationEvent, responseData.Event);
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
@@ -428,7 +428,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
ActivityConsole.StoreActivityIndex(organisationEvent, DbUpdateInfo);
|
||||
|
||||
// Construct response.
|
||||
PopulateEventResponseData(model, organisationEvent, responseData.Event);
|
||||
PopulateEventResponseItemData(model, organisationEvent, responseData.Event);
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation Member data.
|
||||
private class MemberData_List : AjaxResponse_Data.ItemData_Base
|
||||
private class MemberListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String UserAccountId { get; set; }
|
||||
public bool? CurrentUser { get; set; } = null;
|
||||
@@ -34,13 +34,13 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public List<CodeDesc> Roles { get; set; } = new List<CodeDesc>();
|
||||
public String AdminComment { get; set; }
|
||||
}
|
||||
private class MemberData_Full : MemberData_List
|
||||
private class MemberItemData : MemberListData
|
||||
{
|
||||
public String Title { get; set; }
|
||||
public String FirstName { get; set; }
|
||||
public String LastName { get; set; }
|
||||
}
|
||||
private void PopulateMemberResponseData(Model_Organisation_Members model, SaxUserOrganisation userOrganisation, SaxUserAccount userAccount, SaxOrganisation organisation, MemberData_List data)
|
||||
private void PopulateMemberResponseListData(Model_Organisation_Members model, SaxUserOrganisation userOrganisation, SaxUserAccount userAccount, SaxOrganisation organisation, MemberListData data)
|
||||
{
|
||||
data.Id = model.EncryptId(userOrganisation.Id);
|
||||
data.UserAccountId = model.EncryptId(userOrganisation.UserAccountId);
|
||||
@@ -64,9 +64,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
data.StatusDesc = userAccount.StatusDesc;
|
||||
data.CreatedOnFmt = Localiser.FormatDate(userOrganisation.CreateStamp.On);
|
||||
}
|
||||
private void PopulateMemberResponseData(Model_Organisation_Members model, SaxUserOrganisation userOrganisation, SaxUserAccount userAccount, SaxOrganisation organisation, MemberData_Full data)
|
||||
private void PopulateMemberResponseItemData(Model_Organisation_Members model, SaxUserOrganisation userOrganisation, SaxUserAccount userAccount, SaxOrganisation organisation, MemberItemData data)
|
||||
{
|
||||
PopulateMemberResponseData(model, userOrganisation, userAccount, organisation, data as MemberData_List);
|
||||
PopulateMemberResponseListData(model, userOrganisation, userAccount, organisation, data as MemberListData);
|
||||
data.Title = userAccount.Title;
|
||||
data.FirstName = userAccount.FirstName;
|
||||
data.LastName = userAccount.LastName;
|
||||
@@ -80,7 +80,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_MemberList(SaxModel_Online model) : base(model) { }
|
||||
// Member list.
|
||||
public List<MemberData_List> Members { get; } = new List<MemberData_List>();
|
||||
public List<MemberListData> Members { get; } = new List<MemberListData>();
|
||||
// User profile.
|
||||
public class UserData
|
||||
{
|
||||
@@ -171,7 +171,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
MemberData_List memberData = new MemberData_List()
|
||||
MemberListData memberData = new MemberListData()
|
||||
{
|
||||
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
|
||||
UserAccountId = model.EncryptId(new SysId(values.GetLong(colUserAccountId.DataName))),
|
||||
@@ -215,7 +215,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_Member(SaxModel_Online model) : base(model) { }
|
||||
// Member details.
|
||||
public MemberData_Full Member { get; } = new MemberData_Full();
|
||||
public MemberItemData Member { get; } = new MemberItemData();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -274,7 +274,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Make a note of the selected Organisation.
|
||||
SessionData_Online.Filter.SetMemberOrganisation(organisation);
|
||||
|
||||
PopulateMemberResponseData(model, userOrganisation, userAccount, organisation, responseData.Member);
|
||||
PopulateMemberResponseItemData(model, userOrganisation, userAccount, organisation, responseData.Member);
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
@@ -290,7 +290,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_StoreMember(SaxModel_Online model) : base(model) { }
|
||||
// Member details.
|
||||
public MemberData_Full Member { get; } = new MemberData_Full();
|
||||
public MemberItemData Member { get; } = new MemberItemData();
|
||||
// Feedback.
|
||||
public bool? MemberNameRequired { get; set; } = null;
|
||||
}
|
||||
@@ -507,7 +507,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateMemberResponseData(model, userOrganisation, userAccount, organisation, responseData.Member);
|
||||
PopulateMemberResponseItemData(model, userOrganisation, userAccount, organisation, responseData.Member);
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
@@ -523,7 +523,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_ActivateMember(SaxModel_Online model) : base(model) { }
|
||||
// Member details.
|
||||
public MemberData_Full Member { get; } = new MemberData_Full();
|
||||
public MemberItemData Member { get; } = new MemberItemData();
|
||||
}
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/ActivateMember")]
|
||||
@@ -607,7 +607,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateMemberResponseData(model, userOrganisation, userAccount, organisation, responseData.Member);
|
||||
PopulateMemberResponseItemData(model, userOrganisation, userAccount, organisation, responseData.Member);
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
@@ -639,7 +639,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_RemoveMember(SaxModel_Online model) : base(model) { }
|
||||
// Member details.
|
||||
public MemberData_Full Member { get; } = new MemberData_Full();
|
||||
public MemberItemData Member { get; } = new MemberItemData();
|
||||
}
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/RemoveMember")]
|
||||
@@ -713,7 +713,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateMemberResponseData(model, userOrganisation, userAccount, organisation, responseData.Member);
|
||||
PopulateMemberResponseItemData(model, userOrganisation, userAccount, organisation, responseData.Member);
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
|
||||
+10
-10
@@ -21,7 +21,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation Opportunity data.
|
||||
private class OpportunityData_List : AjaxResponse_Data.ItemData_Base
|
||||
private class OpportunityListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String TypeCode { get; set; }
|
||||
public String TypeDesc { get; set; }
|
||||
@@ -32,14 +32,14 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public String PublishedOnFmt { get; set; }
|
||||
public String ExpiresOnFmt { get; set; }
|
||||
}
|
||||
private class OpportunityData_Detail : OpportunityData_List
|
||||
private class OpportunityItemData : OpportunityListData
|
||||
{
|
||||
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)
|
||||
private void PopulateOpportunityResponseListData(Model_Organisation_Opportunities model, SaxOrganisationOpportunity opportunity, OpportunityListData data)
|
||||
{
|
||||
data.Id = model.EncryptId(opportunity.Id);
|
||||
data.TypeCode = OpportunityTypeCodes.GetCodeForType(opportunity.OpportunityType);
|
||||
@@ -54,9 +54,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
data.StatusCode = opportunity.StatusCode;
|
||||
data.StatusDesc = opportunity.StatusDesc;
|
||||
}
|
||||
private void PopulateOpportunityResponseData(Model_Organisation_Opportunities model, SaxOrganisationOpportunity opportunity, OpportunityData_Detail data)
|
||||
private void PopulateOpportunityResponseItemData(Model_Organisation_Opportunities model, SaxOrganisationOpportunity opportunity, OpportunityItemData data)
|
||||
{
|
||||
PopulateOpportunityResponseData(model, opportunity, data as OpportunityData_List);
|
||||
PopulateOpportunityResponseListData(model, opportunity, data as OpportunityListData);
|
||||
data.RegionIdPrimary = model.GetEncryptedRegionId(opportunity.RegionIdPrimary);
|
||||
data.SportIdPrimary = model.GetEncryptedSportId(opportunity.SportIdPrimary);
|
||||
data.PublishedOn_YYYYMMDD = DateUtil.Format(opportunity.PublishedAt, "yyyyMMdd");
|
||||
@@ -71,7 +71,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_OpportunityList(SaxModel_Online model) : base(model) { }
|
||||
// Opportunity list.
|
||||
public List<OpportunityData_List> Opportunities { get; } = new List<OpportunityData_List>();
|
||||
public List<OpportunityListData> Opportunities { get; } = new List<OpportunityListData>();
|
||||
// User profile.
|
||||
public class UserData
|
||||
{
|
||||
@@ -196,7 +196,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
OpportunityData_List opportunityData = new OpportunityData_List()
|
||||
OpportunityListData opportunityData = new OpportunityListData()
|
||||
{
|
||||
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
|
||||
TypeCode = values.GetString(colOpportunityTypeCode.DataName),
|
||||
@@ -233,7 +233,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_Opportunity(SaxModel_Online model) : base(model) { }
|
||||
// Opportunity details.
|
||||
public OpportunityData_Detail Opportunity { get; } = new OpportunityData_Detail();
|
||||
public OpportunityItemData Opportunity { get; } = new OpportunityItemData();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -280,7 +280,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
SessionData_Online.Filter.SetMemberOrganisation(organisation);
|
||||
|
||||
// Construct response.
|
||||
PopulateOpportunityResponseData(model, opportunity, responseData.Opportunity);
|
||||
PopulateOpportunityResponseItemData(model, opportunity, responseData.Opportunity);
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
@@ -409,7 +409,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
ActivityConsole.StoreActivityIndex(opportunity, DbUpdateInfo);
|
||||
|
||||
// Construct response.
|
||||
PopulateOpportunityResponseData(model, opportunity, responseData.Opportunity);
|
||||
PopulateOpportunityResponseItemData(model, opportunity, responseData.Opportunity);
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_RequestOrganisation(SaxModel_Online model) : base(model) { }
|
||||
// Organisation list.
|
||||
public List<OrganisationResponseData> Organisations { get; } = new List<OrganisationResponseData>();
|
||||
public List<OrganisationListData> Organisations { get; } = new List<OrganisationListData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -52,11 +52,11 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// Check Regions.
|
||||
SysId regionIdCountry = model.ExtractSysId(model.Organisation.RegionIdCountry);
|
||||
SysId regionIdCountry = model.ExtractSysId(model.Organisation.RegionIdPrimary);
|
||||
SaxRegion.Data regionCountry = Internals.GetRegion(regionIdCountry);
|
||||
if (SysId.IsValid(regionIdCountry) && regionCountry == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Country region not found. Id: " + model.Organisation.RegionIdCountry + ". " + GetLogSuffix());
|
||||
SaLogger.Warn(fn + " Country region not found. Id: " + model.Organisation.RegionIdPrimary + ". " + GetLogSuffix());
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
SysId regionIdAddressProvince = model.ExtractSysId(model.Organisation.Address.RegionIdProvince);
|
||||
@@ -150,7 +150,6 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
organisation.OrganisationCategory = model.Organisation.GetOrganisationCategory();
|
||||
organisation.SportIdPrimary = organisationSportId;
|
||||
organisation.RegionIdPrimary = regionIdCountry;
|
||||
organisation.PhoneMain = model.Organisation.PhoneMain;
|
||||
organisation.Status = SaStatus.Awaiting;
|
||||
if (!AccountMgr.InsertOrganisation(organisation, DbUpdateInfo))
|
||||
{
|
||||
|
||||
@@ -22,13 +22,14 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation data.
|
||||
private class OrganisationResponseData : AjaxResponse_Data.ItemData_Base
|
||||
private class OrganisationListData : AjaxResponse_Data.ItemData_Base
|
||||
{
|
||||
public String Name { get; set; }
|
||||
public String RegionId { get; set; }
|
||||
public String RegionName { get; set; }
|
||||
public String SportId { get; set; }
|
||||
public String SportName { get; set; }
|
||||
public String LogoUrl { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -39,7 +40,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_OrganisationList(SaxModel_Online model) : base(model) { }
|
||||
// Organisation list.
|
||||
public List<OrganisationResponseData> Organisations { get; } = new List<OrganisationResponseData>();
|
||||
public List<OrganisationListData> Organisations { get; } = new List<OrganisationListData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -62,11 +63,13 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
ColumnDfn colRegionName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Region_Name);
|
||||
ColumnDfn colSportId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.SportId);
|
||||
ColumnDfn colSportName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Sport_Name);
|
||||
ColumnDfn colLogoCount = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.LogoImage_Count);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colOrganisationId, colOrganisationName,
|
||||
colRegionId, colRegionName,
|
||||
colSportId, colSportName
|
||||
colSportId, colSportName,
|
||||
colLogoCount
|
||||
};
|
||||
|
||||
// Organisation filter.
|
||||
@@ -83,15 +86,21 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
OrganisationResponseData organisationData = new OrganisationResponseData()
|
||||
SysId organisationId = new SysId(values.GetLong(colOrganisationId.DataName));
|
||||
OrganisationListData organisationData = new OrganisationListData()
|
||||
{
|
||||
Id = model.EncryptId(new SysId(values.GetLong(colOrganisationId.DataName))),
|
||||
Id = model.EncryptId(organisationId),
|
||||
Name = values.GetString(colOrganisationName.DataName),
|
||||
RegionId = model.EncryptId(new SysId(values.GetLong(colRegionId.DataName))),
|
||||
RegionName = values.GetString(colRegionName.DataName),
|
||||
SportId = model.EncryptId(new SysId(values.GetLong(colSportId.DataName))),
|
||||
SportName = values.GetString(colSportName.DataName),
|
||||
};
|
||||
// Logo.
|
||||
if (values.GetLong(colLogoCount.DataName) > 0)
|
||||
organisationData.LogoUrl = GetOrganisationLogoUrl(organisationId, false);
|
||||
|
||||
// Add item to the list.
|
||||
responseData.Organisations.Add(organisationData);
|
||||
}
|
||||
}
|
||||
@@ -112,7 +121,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_MemberAdminOrganisationList(SaxModel_Online model) : base(model) { }
|
||||
// Organisation list.
|
||||
public List<OrganisationResponseData> Organisations { get; } = new List<OrganisationResponseData>();
|
||||
public List<OrganisationListData> Organisations { get; } = new List<OrganisationListData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -158,7 +167,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
OrganisationResponseData organisationData = new OrganisationResponseData()
|
||||
OrganisationListData organisationData = new OrganisationListData()
|
||||
{
|
||||
Id = model.EncryptId(new SysId(values.GetLong(colOrganisationId.DataName))),
|
||||
Name = values.GetString(colOrganisationName.DataName),
|
||||
@@ -187,7 +196,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_EventAdminOrganisationList(SaxModel_Online model) : base(model) { }
|
||||
// Organisation list.
|
||||
public List<OrganisationResponseData> Organisations { get; } = new List<OrganisationResponseData>();
|
||||
public List<OrganisationListData> Organisations { get; } = new List<OrganisationListData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -233,7 +242,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
OrganisationResponseData organisationData = new OrganisationResponseData()
|
||||
OrganisationListData organisationData = new OrganisationListData()
|
||||
{
|
||||
Id = model.EncryptId(new SysId(values.GetLong(colOrganisationId.DataName))),
|
||||
Name = values.GetString(colOrganisationName.DataName),
|
||||
@@ -262,7 +271,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Construction.
|
||||
public AjaxResponse_OpportunityAdminOrganisationList(SaxModel_Online model) : base(model) { }
|
||||
// Organisation list.
|
||||
public List<OrganisationResponseData> Organisations { get; } = new List<OrganisationResponseData>();
|
||||
public List<OrganisationListData> Organisations { get; } = new List<OrganisationListData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
@@ -308,7 +317,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
OrganisationResponseData organisationData = new OrganisationResponseData()
|
||||
OrganisationListData organisationData = new OrganisationListData()
|
||||
{
|
||||
Id = model.EncryptId(new SysId(values.GetLong(colOrganisationId.DataName))),
|
||||
Name = values.GetString(colOrganisationName.DataName),
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
sessionData.Profile.AddSport(sportId, status);
|
||||
}
|
||||
}
|
||||
SaLogger.Debug(fn+" Profile Sports: " + sessionData.Profile.SportCount);
|
||||
SaLogger.Debug(fn + " Profile Sports: " + sessionData.Profile.SportCount);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -169,6 +169,21 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
ClearSessionData();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation utilities.
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Construct URL to display Organisation logo.
|
||||
/// <para>- Option to allow for 'Upload' image if active.</para>
|
||||
/// </summary>
|
||||
public String GetOrganisationLogoUrl(SysId organisationId, bool uploadImage)
|
||||
{
|
||||
String imageLink = "Image/Organisation/Logo" + (uploadImage ? "/Upload" : "") + "?";
|
||||
NameValueCollection parameters = new NameValueCollection();
|
||||
parameters.Add(ImageController.ParamName_OrganisationId, SysId.ToString(organisationId));
|
||||
return imageLink + ImageController.ParamName_OrganisationLogoEncrypted + "=" + EncryptOnlineParams(parameters);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Keep Logged In.
|
||||
//-------------------------------------------------------------------
|
||||
@@ -240,8 +255,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
//-------------------------------------------------------------------
|
||||
// Parameter encryption, eg. for images.
|
||||
//-------------------------------------------------------------------
|
||||
// Encryption key is the same for all users but a different IV value is generated for each session so that the links/parameters cannot be shared.
|
||||
public static String Base64Key_OnlineApp { get; } = SacsEncryptionHelper.EncodePlainKey("<Saxonite#Online+App@Encryption>", SacsEncryptionHelper.KeyLength);
|
||||
// Encryption key is the same for all users each time the application is started,
|
||||
// but a different IV value is generated for each session so that the links/parameters cannot be shared.
|
||||
public static String Base64Key_OnlineApp { get; } = SacsEncryptionHelper.EncodePlainKey("Saxonite#Online@Encrypt+" + DateTime.Today.Format("ddMMyyyy"), SacsEncryptionHelper.KeyLength);
|
||||
protected String EncryptOnlineParams(NameValueCollection parameters)
|
||||
{
|
||||
return HttpUtility.UrlEncode(EncryptParameters(parameters, SessionData_Online.Base64IV_OnlineApp, Base64Key_OnlineApp));
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
public String CategoryDesc { get; set; }
|
||||
public String SportName { get; set; }
|
||||
public String RegionName { get; set; }
|
||||
public String LogoUrl { get; set; }
|
||||
}
|
||||
private class AjaxResponse_Search_Organisations : AjaxResponse_Data
|
||||
{
|
||||
@@ -86,11 +87,13 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
ColumnDfn colSportName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Sport_Name);
|
||||
ColumnDfn colRegionId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.RegionId);
|
||||
ColumnDfn colRegionName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Region_Name);
|
||||
ColumnDfn colLogoCount = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.LogoImage_Count);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId, colName, colCategory,
|
||||
colSportId, colSportName,
|
||||
colRegionId, colRegionName,
|
||||
colLogoCount
|
||||
};
|
||||
|
||||
// Sort columns.
|
||||
@@ -103,15 +106,21 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
SysId organisationId = new SysId(values.GetLong(colId.DataName));
|
||||
Sax.OrganisationCategory category = (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(values.GetString(colCategory.DataName));
|
||||
OrganisationListData organisationData = new OrganisationListData()
|
||||
{
|
||||
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
|
||||
Id = model.EncryptId(organisationId),
|
||||
Name = values.GetString(colName.DataName),
|
||||
CategoryDesc = Localiser.GetOrganisationCategoryCaption(category),
|
||||
SportName = values.GetString(colSportName.DataName),
|
||||
RegionName = values.GetString(colRegionName.DataName),
|
||||
};
|
||||
// Logo.
|
||||
if (values.GetLong(colLogoCount.DataName) > 0)
|
||||
organisationData.LogoUrl = GetOrganisationLogoUrl(organisationId, false);
|
||||
|
||||
// Add item to the list.
|
||||
responseData.Organisations.Add(organisationData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,18 +34,18 @@ namespace Saxonite.Net.Core.Web.Online.Helpers
|
||||
case Sax.ContactMethod.Email:
|
||||
return "<a href='mailto:" + value + "'>" + ConstructImageElement("action/mail24.png") + value + " </a>";
|
||||
case Sax.ContactMethod.Website:
|
||||
return "<a href='" + url + "' target='" + Sax.Config.Online.Links.Targets.Website + "'>" + ConstructImageElement("icon/contact/www-24.png") + value + " </a>";
|
||||
return "<a href='" + url + "' target='" + Sax.Config.Links.Targets.Website + "'>" + ConstructImageElement("icon/contact/www-24.png") + value + " </a>";
|
||||
case Sax.ContactMethod.Wikipedia:
|
||||
return "<a href='" + url + "' target='" + Sax.Config.Online.Links.Targets.Wikipedia + "'>" + ConstructImageElement("icon/contact/wikipedia-24.png") + value + " </a>";
|
||||
return "<a href='" + url + "' target='" + Sax.Config.Links.Targets.Wikipedia + "'>" + ConstructImageElement("icon/contact/wikipedia-24.png") + value + " </a>";
|
||||
// Social media.
|
||||
case Sax.ContactMethod.LinkedIn:
|
||||
return "<a href='" + url + "' target='" + Sax.Config.Online.Links.Targets.LinkedIn + "'>" + ConstructImageElement("icon/contact/linkedin-24.png") + value + " </a>";
|
||||
return "<a href='" + url + "' target='" + Sax.Config.Links.Targets.LinkedIn + "'>" + ConstructImageElement("icon/contact/linkedin-24.png") + value + " </a>";
|
||||
case Sax.ContactMethod.Twitter:
|
||||
return "<a href='" + url + "' target='" + Sax.Config.Online.Links.Targets.Twitter + "'>" + ConstructImageElement("icon/contact/twitter-24.png") + value + " </a>";
|
||||
return "<a href='" + url + "' target='" + Sax.Config.Links.Targets.Twitter + "'>" + ConstructImageElement("icon/contact/twitter-24.png") + value + " </a>";
|
||||
case Sax.ContactMethod.Facebook:
|
||||
return "<a href='" + url + "' target='" + Sax.Config.Online.Links.Targets.Facebook + "'>" + ConstructImageElement("icon/contact/facebook-24.png") + value + " </a>";
|
||||
return "<a href='" + url + "' target='" + Sax.Config.Links.Targets.Facebook + "'>" + ConstructImageElement("icon/contact/facebook-24.png") + value + " </a>";
|
||||
case Sax.ContactMethod.Instagram:
|
||||
return "<a href='" + url + "' target='" + Sax.Config.Online.Links.Targets.Instagram + "'>" + ConstructImageElement("icon/contact/instagram-24.png") + value + " </a>";
|
||||
return "<a href='" + url + "' target='" + Sax.Config.Links.Targets.Instagram + "'>" + ConstructImageElement("icon/contact/instagram-24.png") + value + " </a>";
|
||||
}
|
||||
return method.ToString() + ": " + value;
|
||||
}
|
||||
|
||||
@@ -37,10 +37,9 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
public String Category { get; set; }
|
||||
public Sax.OrganisationCategory GetOrganisationCategory() { return (Sax.OrganisationCategory)Model.OrganisationCategoryCodes.GetTypeForCode(Category); }
|
||||
public String SportId { get; set; }
|
||||
public String RegionIdCountry { get; set; }
|
||||
public String RegionIdPrimary { get; set; }
|
||||
public String About { get; set; }
|
||||
public String Facilities { get; set; }
|
||||
public String PhoneMain { get; set; }
|
||||
// Contact Methods.
|
||||
/// <summary>Placeholder field value to indicate the number of Contact Methods in form (even if none are populated).</summary>
|
||||
public String ContactMethods { get; set; }
|
||||
@@ -60,53 +59,53 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
String fn = this.GetType().Name + ".ValidateOrganisationData";
|
||||
|
||||
// Name - mandatory.
|
||||
responseData.SetControlValue(ControlNameSuffix + "Name", Name);
|
||||
responseData.SetControlValue(ControlNameSuffix + nameof(Name), Name);
|
||||
if (StringUtil.IsEmpty(Name))
|
||||
responseData.SetControlError(ControlNameSuffix + "Name", Model.Localiser["msg.validation.mandatory.value"]);
|
||||
responseData.SetControlError(ControlNameSuffix + nameof(Name), Model.Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(Name) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name))
|
||||
responseData.SetControlError(ControlNameSuffix + "Name", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name)]);
|
||||
else if (SysId.IsValid(Model.ExtractSysId(RegionIdCountry)))
|
||||
responseData.SetControlError(ControlNameSuffix + nameof(Name), Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name)]);
|
||||
else if (SysId.IsValid(Model.ExtractSysId(RegionIdPrimary)))
|
||||
{
|
||||
// Ensure that the organisation name is unique within the country.
|
||||
// Ensure that the organisation name is unique within the region.
|
||||
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||
if (SysId.IsValid(Model.ExtractSysId(Id)))
|
||||
prmOrganisation.IdsExcluded.Add(Model.ExtractSysId(Id));
|
||||
prmOrganisation.NameFull = Name;
|
||||
prmOrganisation.RegionIdsIncluded.Add(Model.ExtractSysId(RegionIdCountry));
|
||||
prmOrganisation.RegionIdsIncluded.Add(Model.ExtractSysId(RegionIdPrimary));
|
||||
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.Any;
|
||||
if (Model.AccountMgr.GetOrganisationCount(prmOrganisation) > 0)
|
||||
responseData.SetControlError(ControlNameSuffix + "Name", Model.Localiser["msg.validation.duplicate.value"]);
|
||||
responseData.SetControlError(ControlNameSuffix + nameof(Name), Model.Localiser["msg.validation.duplicate.value"]);
|
||||
}
|
||||
|
||||
// Organisation Category - mandatory.
|
||||
if (StringUtil.IsEmpty(Category))
|
||||
responseData.SetControlError(ControlNameSuffix + "Category", Model.Localiser["msg.validation.mandatory.value"]);
|
||||
responseData.SetControlError(ControlNameSuffix + nameof(Category), Model.Localiser["msg.validation.mandatory.value"]);
|
||||
|
||||
// Organisation Type - mandatory.
|
||||
if (StringUtil.IsEmpty(Type))
|
||||
responseData.SetControlError(ControlNameSuffix + "Type", Model.Localiser["msg.validation.mandatory.value"]);
|
||||
responseData.SetControlError(ControlNameSuffix + nameof(Type), Model.Localiser["msg.validation.mandatory.value"]);
|
||||
|
||||
// Sport - mandatory for certain organisation categories.
|
||||
if (StringUtil.IsEmpty(SportId) && SaxOrganisation.IsSportMandatory(GetOrganisationCategory()))
|
||||
responseData.SetControlError(ControlNameSuffix + "SportId", Model.Localiser["msg.validation.mandatory.value"]);
|
||||
responseData.SetControlError(ControlNameSuffix + nameof(SportId), Model.Localiser["msg.validation.mandatory.value"]);
|
||||
else if (!StringUtil.IsEmpty(SportId) && !SysId.IsValid(Model.ExtractSysId(SportId)))
|
||||
responseData.SetControlError(ControlNameSuffix + "SportId", Model.Localiser["msg.validation.invalid.value"]);
|
||||
responseData.SetControlError(ControlNameSuffix + nameof(SportId), Model.Localiser["msg.validation.invalid.value"]);
|
||||
|
||||
// Region Country - mandatory.
|
||||
if (StringUtil.IsEmpty(RegionIdCountry))
|
||||
responseData.SetControlError(ControlNameSuffix + "RegionIdCountry", Model.Localiser["msg.validation.mandatory.value"]);
|
||||
else if (!SysId.IsValid(Model.ExtractSysId(RegionIdCountry)))
|
||||
responseData.SetControlError(ControlNameSuffix + "RegionIdCountry", Model.Localiser["msg.validation.invalid.value"]);
|
||||
// Primary Region - mandatory.
|
||||
if (StringUtil.IsEmpty(RegionIdPrimary))
|
||||
responseData.SetControlError(ControlNameSuffix + nameof(RegionIdPrimary), Model.Localiser["msg.validation.mandatory.value"]);
|
||||
else if (!SysId.IsValid(Model.ExtractSysId(RegionIdPrimary)))
|
||||
responseData.SetControlError(ControlNameSuffix + nameof(RegionIdPrimary), Model.Localiser["msg.validation.invalid.value"]);
|
||||
|
||||
// About - optional.
|
||||
responseData.SetControlValue(ControlNameSuffix + "About", About);
|
||||
responseData.SetControlValue(ControlNameSuffix + nameof(About), About);
|
||||
if (StringUtil.GetLength(About) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_About))
|
||||
responseData.SetControlError(ControlNameSuffix + "About", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_About)]);
|
||||
responseData.SetControlError(ControlNameSuffix + nameof(About), Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_About)]);
|
||||
|
||||
// Facilities - optional.
|
||||
responseData.SetControlValue(ControlNameSuffix + "Facilities", Facilities);
|
||||
responseData.SetControlValue(ControlNameSuffix + nameof(Facilities), Facilities);
|
||||
if (StringUtil.GetLength(Facilities) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Facilities))
|
||||
responseData.SetControlError(ControlNameSuffix + "Facilities", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Facilities)]);
|
||||
responseData.SetControlError(ControlNameSuffix + nameof(Facilities), Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Facilities)]);
|
||||
|
||||
// Contact Methods.
|
||||
if (ContactMethods != null)
|
||||
@@ -131,19 +130,6 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
}
|
||||
}
|
||||
|
||||
// Phone Main - optional.
|
||||
if (PhoneMain != null)
|
||||
{
|
||||
responseData.SetControlValue(ControlNameSuffix + "PhoneMain", PhoneMain);
|
||||
if (!StringUtil.IsEmpty(PhoneMain))
|
||||
{
|
||||
if (!SacsDataValidationHelper.IsValidPhone(PhoneMain))
|
||||
responseData.SetControlError(ControlNameSuffix + "PhoneMain", Model.Localiser["msg.validation.invalid.value"]);
|
||||
else if (StringUtil.GetLength(PhoneMain) > Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_PhoneMain))
|
||||
responseData.SetControlError(ControlNameSuffix + "PhoneMain", Model.Localiser["msg.validation.maximum.length", Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_PhoneMain)]);
|
||||
}
|
||||
}
|
||||
|
||||
// Address.
|
||||
Address.ValidateAddressData(responseData);
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
|
||||
else if (!DateUtil.IsValid(publishedOn))
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
|
||||
else if (publishedOn.CompareTo(DateUtil.IncrementDate(DateTime.Today, Sax.Config.Online.Articles.PublishMaxDaysAhead)) > 0)
|
||||
else if (publishedOn.CompareTo(DateUtil.IncrementDate(DateTime.Today, Sax.Config.Articles.PublishMaxDaysAhead)) > 0)
|
||||
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<div class="sax-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-6"><div class="OrganisationSport sax-note"></div></div>
|
||||
<div class="col-sm-6 text-sm-right"><div class="OrganisationRegionCountry sax-note"></div></div>
|
||||
<div class="col-sm-6 text-sm-right"><div class="OrganisationRegionPrimary sax-note"></div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6"><div class="OrganisationMemberCount sax-note sa-action">@Localiser["label.members"]: <span class="MemberCount"></span></div></div>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="sax-panel Articles">
|
||||
|
||||
<script type="text/javascript">
|
||||
sax.articlePublish = { maxDaysBefore: '@(Sax.Config.Online.Articles.PublishMaxDaysBefore)', maxDaysAhead: '@(Sax.Config.Online.Articles.PublishMaxDaysAhead)' };
|
||||
sax.articlePublish = { maxDaysBefore: '@(Sax.Config.Articles.PublishMaxDaysBefore)', maxDaysAhead: '@(Sax.Config.Articles.PublishMaxDaysAhead)' };
|
||||
sax.lbl.edit = '@(Localiser.GetJavascriptText("label.edit"))';
|
||||
sax.lbl.remove = '@(Localiser.GetJavascriptText("label.remove"))';
|
||||
</script>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control">
|
||||
<input type="text" name="ContactValue" class="ContactValue sax-input" />
|
||||
<input type="text" name="ContactValue" class="ContactValue sax-input" maxlength="200" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<div class="col">
|
||||
@* List of existing contact methods with actions to edit/remove. *@
|
||||
<div class="ContactMethods">
|
||||
<table class="sax-data"></table>
|
||||
<table class="sax-data fullwidth"></table>
|
||||
</div>
|
||||
<table class="sax-panel-item-template">
|
||||
<tr class="ContactMethod">
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control row">
|
||||
<input type="hidden" name="Organisation.SportId" OrganisationSportId"" class="OrganisationSportId" />
|
||||
<input type="hidden" name="Organisation.SportId" class="OrganisationSportId" />
|
||||
<div class="col"><input type="text" class="OrganisationSportCaption sax-input" readonly="readonly" /> </div>
|
||||
<div class="fixed"><button class="SelectSport sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
@@ -73,18 +73,18 @@
|
||||
</div>
|
||||
|
||||
@* Organisation primary region *@
|
||||
<div class="sax-form-control OrganisationRegionIdCountry">
|
||||
<div class="sax-form-control OrganisationRegionIdPrimary">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="sax-label">
|
||||
<label for=""><span>@Localiser["label.country"]</span><span class="required"> *</span></label>
|
||||
<label for=""><span>@Localiser["label.region"]</span><span class="required"> *</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="sax-control row">
|
||||
<input type="hidden" name="Organisation.RegionIdCountry" OrganisationRegionIdCountry"" class="OrganisationRegionIdCountry" />
|
||||
<div class="col"><input type="text" class="OrganisationRegionCaptionCountry sax-input" readonly="readonly" /> </div>
|
||||
<div class="fixed"><button class="SelectRegionCountry sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px">@Localiser["label.select"]</button></div>
|
||||
<input type="hidden" name="Organisation.RegionIdPrimary" class="OrganisationRegionIdPrimary" />
|
||||
<div class="col"><input type="text" class="OrganisationRegionNamePrimary sax-input" readonly="readonly" /> </div>
|
||||
<div class="fixed"><button class="SelectOrganisationRegionPrimary sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@@ -106,8 +106,13 @@ else
|
||||
</div>
|
||||
<div class="sax-panel-item-template">
|
||||
<div class="sax-panel-item Article">
|
||||
<div class="ArticleHeadline"></div>
|
||||
<div class="ArticleSummary"></div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="ArticleHeadline"></div>
|
||||
<div class="ArticleSummary"></div>
|
||||
</div>
|
||||
<div class="fixed"><img src="" class="ArticleOrganisationLogo" alt="" title="" /></div>
|
||||
</div>
|
||||
<div class="ArticleOrigin">
|
||||
<div class="row">
|
||||
<div class="col"><div class="ArticleAuthor"></div></div>
|
||||
|
||||
@@ -117,29 +117,36 @@
|
||||
|
||||
@* Item template *@
|
||||
<div class="sax-panel-item Organisation">
|
||||
<div class="sax-header row">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@* Organisation caption *@
|
||||
<div class="sax-caption"><div class="sax-action"><span class="OrganisationName"></span></div></div>
|
||||
</div>
|
||||
<div class="fixed">
|
||||
<div class="OrganisationCategory"></div>
|
||||
</div>
|
||||
<div class="fixed sax-actions">
|
||||
@* Burger menu *@
|
||||
<ul class="nav navbar-nav navbar-light navbar-right sax-burger">
|
||||
<li class="dropdown-toggle caret-off">
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="navbar-toggler-icon"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sax-dropdown-menu">@* Menu items will be inserted here. *@</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-6"><div class="OrganisationSport"></div></div>
|
||||
<div class="col-sm-6 text-sm-right"><div class="OrganisationLocation"></div></div>
|
||||
<div class="sax-header row">
|
||||
<div class="col">
|
||||
@* Organisation caption *@
|
||||
<div class="sax-caption"><div class="sax-action"><span class="OrganisationName"></span></div></div>
|
||||
</div>
|
||||
<div class="fixed">
|
||||
<div class="OrganisationCategory"></div>
|
||||
</div>
|
||||
<div class="fixed sax-actions">
|
||||
@* Burger menu *@
|
||||
<ul class="nav navbar-nav navbar-light navbar-right sax-burger">
|
||||
<li class="dropdown-toggle caret-off">
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="navbar-toggler-icon"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sax-dropdown-menu">@* Menu items will be inserted here. *@</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-sm-6"><div class="OrganisationSport"></div></div>
|
||||
<div class="col-sm-6 text-sm-right"><div class="OrganisationLocation"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fixed"><img src="" class="OrganisationLogo" alt="" title=""></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
.sax-results-paging
|
||||
{
|
||||
margin-right: 8px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.sax-results-paging .sax-paging-info
|
||||
@@ -236,7 +236,8 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sax-panel-item > .sax-header
|
||||
.sax-panel-item > .sax-header,
|
||||
.sax-panel-item > .row > .col > .sax-header
|
||||
{
|
||||
padding: 2px 8px;
|
||||
min-height: 24px;
|
||||
@@ -244,14 +245,16 @@
|
||||
border-bottom: solid 1px #979797;
|
||||
}
|
||||
|
||||
.sax-panel-item > .sax-header .sax-caption
|
||||
.sax-panel-item > .sax-header .sax-caption,
|
||||
.sax-panel-item > .row > .col > .sax-header .sax-caption
|
||||
{
|
||||
margin: 4px 0;
|
||||
font-size: 1.2rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.sax-panel-item > .sax-content
|
||||
.sax-panel-item > .sax-content,
|
||||
.sax-panel-item > .row > .col > .sax-content
|
||||
{
|
||||
margin: 4px 8px 2px 8px;
|
||||
padding: 2px 2px;
|
||||
@@ -271,18 +274,21 @@
|
||||
border-bottom-right-radius: 8px;
|
||||
}
|
||||
|
||||
.sax-alpha .sax-panel-item > .sax-header
|
||||
.sax-alpha .sax-panel-item > .sax-header,
|
||||
.sax-alpha .sax-panel-item > .row > .col > .sax-header
|
||||
{
|
||||
margin: 0 8px;
|
||||
padding: 4px 0;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.sax-alpha .sax-panel-item > .sax-header .sax-caption
|
||||
.sax-alpha .sax-panel-item > .sax-header .sax-caption,
|
||||
.sax-alpha .sax-panel-item > .row > .col > .sax-header .sax-caption
|
||||
{
|
||||
}
|
||||
|
||||
.sax-alpha .sax-panel-item > .sax-content
|
||||
.sax-alpha .sax-panel-item > .sax-content,
|
||||
.sax-alpha .sax-panel-item > .row > .col > .sax-content
|
||||
{
|
||||
background-color: #fff;
|
||||
}
|
||||
@@ -325,17 +331,25 @@
|
||||
/* Organisations */
|
||||
|
||||
.sax-panel-item.Organisation,
|
||||
.sax-panel-item.Organisation > .sax-header
|
||||
.sax-panel-item.Organisation .sax-header
|
||||
{
|
||||
border-color: var(--color-alt3);
|
||||
}
|
||||
|
||||
.sax-alpha .sax-panel-item.Organisation,
|
||||
.sax-alpha .sax-panel-item.Organisation > .sax-header
|
||||
.sax-alpha .sax-panel-item.Organisation .sax-header
|
||||
{
|
||||
border-color: #b0b0b0;
|
||||
}
|
||||
|
||||
.sax-panel-item-list .sax-panel-item.Organisation img.OrganisationLogo
|
||||
{
|
||||
max-width: 48px;
|
||||
max-height: 48px;
|
||||
margin:4px 4px 2px 0;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* Members */
|
||||
|
||||
.sax-panel-item.Member,
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
{
|
||||
min-width: 84px;
|
||||
padding: 0 0 0 4px;
|
||||
vertical-align:top;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.sax-panel-item.Activity .ActivityReaction img
|
||||
{
|
||||
vertical-align:top;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.sax-panel-item.Activity.sax-activity-reaction-1 .sax-header
|
||||
@@ -67,7 +67,6 @@
|
||||
border-bottom: 1px solid #b0b0b0;
|
||||
}
|
||||
|
||||
#dlgActivity .sax-panel-item.Article .ArticleSummary,
|
||||
#dlgActivity .sax-panel-item.Event .EventAt,
|
||||
#dlgActivity .sax-panel-item.Event .EventSummary,
|
||||
#dlgActivity .sax-panel-item.Opportunity .OpportunityOrganisation,
|
||||
@@ -80,14 +79,29 @@
|
||||
border-bottom: 1px solid #b0b0b0;
|
||||
}
|
||||
|
||||
#dlgActivity .sax-panel-item.Article .ArticleSummary
|
||||
{
|
||||
margin: 0;
|
||||
padding: 8px 8px;
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#dlgActivity .sax-panel-item.Article .ArticleOrigin
|
||||
{
|
||||
padding: 4px 8px;
|
||||
padding: 6px 8px 2px 8px;
|
||||
font-weight: bold;
|
||||
background-color: #f8f8f8;
|
||||
border-top: 1px solid #b0b0b0;
|
||||
border-bottom: 1px solid #b0b0b0;
|
||||
}
|
||||
|
||||
#dlgActivity .sax-panel-item.Article img.ArticleOrganisationLogo
|
||||
{
|
||||
max-width:64px;
|
||||
max-height:64px;
|
||||
}
|
||||
|
||||
#dlgActivity .sax-panel-item.Event .EventDetails,
|
||||
#dlgActivity .sax-panel-item.Opportunity .OpportunityOutline
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
}
|
||||
sax.showActivityDetails = function (response)
|
||||
{
|
||||
//sax.debug('showActivityDetails', response);
|
||||
sax.debug('showActivityDetails', response);
|
||||
let $act = $('.sax-content', sax.$dlg.activity).empty();
|
||||
let $ar = $('.ActivityReaction', sax.$dlg.activity.parent()).hide();
|
||||
let item;
|
||||
@@ -103,6 +103,7 @@
|
||||
$('.ArticleSummary', $itm).text(item.summary).toggle(!!item.summary);
|
||||
$('.ArticleAuthor', $itm).text(item.author);
|
||||
$('.ArticleOrganisation', $itm).text(item.organisation);
|
||||
$('img.ArticleOrganisationLogo', $itm).prop('src', item.organisationLogoUrl);
|
||||
$('.ArticleOrigin', $itm).toggle(!!(item.author || item.organisation));
|
||||
let segs = item.content.segments;
|
||||
for (let segIdx = 0; segIdx < segs.length; segIdx++)
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
{
|
||||
if (!item) return;
|
||||
$('.sax-panel-messages', $pnl.results).hide().empty();
|
||||
$('img.OrganisationLogo', $item).prop('src', item.logoUrl).toggle(!!item.logoUrl);
|
||||
$('.OrganisationName', $item).text(item.name);
|
||||
$('.OrganisationCategory', $item).text(item.categoryDesc);
|
||||
$('.OrganisationSport', $item).text(item.sportName);
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
if (!item) return;
|
||||
$('.OrganisationName', $item).text(item.name);
|
||||
$('.OrganisationSport', $item).text(item.sportName);
|
||||
$('.OrganisationRegionCountry', $item).text(item.regionNameCountry);
|
||||
$('.OrganisationRegionPrimary', $item).text(item.regionPrimary.name);
|
||||
$('.OrganisationMemberCount', $item).toggle(!!item.memberCount).find('.MemberCount').text(item.memberCount);
|
||||
$('.OrganisationOpportunityCount', $item).toggle(!!item.opportunityCount).find('.MemberCount').text(item.opportunityCount);
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
{
|
||||
//sax.debug('po.updateOrganisation', $item, item);
|
||||
$('.OrganisationId', $frm.orgId).val(item.id);
|
||||
|
||||
po.data.$item = $item; po.data.item = item;
|
||||
po.ajax.profileOrganisation = po.ajax.profileOrganisation || { url: sax.url.base + 'Account/Ajax/GetProfileOrganisation', formId: 'frmProfileOrganisationId', callbackFn: po.doUpdateOrganisation };
|
||||
sax.doAjaxRequest(po.ajax.profileOrganisation, 50);
|
||||
}
|
||||
@@ -112,8 +112,8 @@
|
||||
$('.OrganisationType', $frm.org).val(item.typeCode);
|
||||
$('.OrganisationSportId', $frm.org).val(item.sportId);
|
||||
$('.OrganisationSportCaption', $frm.org).val(item.sportName);
|
||||
$('.OrganisationRegionIdCountry', $frm.org).val(item.regionIdCountry);
|
||||
$('.OrganisationRegionCaptionCountry', $frm.org).val(item.regionNameCountry);
|
||||
$('.OrganisationRegionIdPrimary', $frm.org).val(item.regionPrimary.id);
|
||||
$('.OrganisationRegionNamePrimary', $frm.org).val(item.regionPrimary.name);
|
||||
$('.OrganisationAbout', $frm.org).val(item.about);
|
||||
$('.OrganisationFacilities', $frm.org).val(item.facilities);
|
||||
$pnl.tblconMths.empty();
|
||||
@@ -130,8 +130,8 @@
|
||||
$('input.OrganisationAddressLine2', $frm.org).val(address.line2);
|
||||
$('input.OrganisationAddressLine3', $frm.org).val(address.line3);
|
||||
$('input.OrganisationAddressTown', $frm.org).val(address.town);
|
||||
$('input.OrganisationAddressProvince', $frm.org).val(address.province);
|
||||
$('input.OrganisationAddressCountry', $frm.org).val(address.country);
|
||||
$('input.OrganisationAddressProvince', $frm.org).val(address.regionNameProvince);
|
||||
$('input.OrganisationAddressCountry', $frm.org).val(address.regionNameCountry);
|
||||
$('input.OrganisationAddressPostalCode', $frm.org).val(address.postalCode);
|
||||
sax.openDialog($dlg.org, 720, 840);
|
||||
}
|
||||
@@ -143,6 +143,7 @@
|
||||
if (!response) return;
|
||||
sax.refreshControlValues(response.controlValues, $frm.org);
|
||||
if (!response.success) return;
|
||||
po.populateItem(po.data.$item, response.organisation);
|
||||
$dlg.org.dialog('close');
|
||||
po.cleanUp();
|
||||
}
|
||||
@@ -151,6 +152,8 @@
|
||||
}
|
||||
po.cleanUp = function ()
|
||||
{
|
||||
delete po.data.item;
|
||||
delete po.data.$item;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -165,14 +168,14 @@
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
po.selectOrgRegionCountry = function ()
|
||||
po.selectOrgRegionPrimary = function ()
|
||||
{
|
||||
sax.mdl.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('.OrganisationRegionIdCountry', $frm.org).val(), typesInc: [30], fnCallback: po.onSelectOrgRegionCountry })
|
||||
sax.mdl.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('.OrganisationRegionIdCountry', $frm.org).val(), typesInc: [30], fnCallback: po.onSelectOrgRegionPrimary })
|
||||
}
|
||||
po.onSelectOrgRegionCountry = function (region)
|
||||
po.onSelectOrgRegionPrimary = function (region)
|
||||
{
|
||||
sax.clearControlError($('.OrganisationRegionIdCountry', $frm.org).val(region.id));
|
||||
$('.OrganisationRegionCaptionCountry', $frm.org).val(region ? region.name : '');
|
||||
sax.clearControlError($('.OrganisationRegionIdPrimary', $frm.org).val(region.id));
|
||||
$('.OrganisationRegionNamePrimary', $frm.org).val(region ? region.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -240,7 +243,7 @@
|
||||
$dlg.org = $('#dlgProfileOrganisation').dialog(opt);
|
||||
$frm.org = $('#frmProfileOrganisation', $dlg.org);
|
||||
$frm.org.on('dblclick', 'input.OrganisationSportCaption', po.selectOrgSport).on('click', 'button.SelectSport', po.selectOrgSport);
|
||||
$frm.org.on('dblclick', 'input.OrganisationRegionCaptionCountry', po.selectOrgRegionCountry).on('click', 'button.SelectRegionCountry', po.selectOrgRegionCountry);
|
||||
$frm.org.on('dblclick', 'input.OrganisationRegionNameCountry', po.selectOrgRegionPrimary).on('click', 'button.SelectOrganisationRegionPrimary', po.selectOrgRegionPrimary);
|
||||
$frm.org.on('click', '.OrganisationContactMethods .sax-action.sax-add', po.addConMth);
|
||||
$pnl.conMths = $('.OrganisationContactMethods', $frm.org);
|
||||
$pnl.tblconMths = $('table.sax-data', $pnl.conMths);
|
||||
|
||||
@@ -43,6 +43,46 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
}
|
||||
}
|
||||
}
|
||||
public static class User
|
||||
{
|
||||
public static class Image
|
||||
{
|
||||
// Physical image maximum dimensions - reduced on upload.
|
||||
public static ushort WidthMax { get; } = 240;
|
||||
public static ushort HeightMax { get; } = 320;
|
||||
}
|
||||
}
|
||||
public static class Organisation
|
||||
{
|
||||
public static class Logo
|
||||
{
|
||||
// Physical image maximum dimensions - reduced on upload.
|
||||
public static ushort WidthMax { get; } = 240;
|
||||
public static ushort HeightMax { get; } = 240;
|
||||
// Maximum image display dimensions - organisation list.
|
||||
public static ushort DisplayWidthMax_List { get; } = 48;
|
||||
public static ushort DisplayHeightMax_List { get; } = 48;
|
||||
// Maximum image display dimensions - organisation edit etc.
|
||||
public static ushort DisplayWidthMax_Item { get; } = 120;
|
||||
public static ushort DisplayHeightMax_Item { get; } = 120;
|
||||
}
|
||||
}
|
||||
public static class Articles
|
||||
{
|
||||
public static class Segments
|
||||
{
|
||||
public static ushort Max { get; } = 12;
|
||||
public static ushort CharsMax { get; } = 8000;
|
||||
}
|
||||
public static class Images
|
||||
{
|
||||
// Physical image maximum dimensions - reduced on upload.
|
||||
public static ushort WidthMax { get; } = 800;
|
||||
public static ushort HeightMax { get; } = 640;
|
||||
}
|
||||
public static ushort PublishMaxDaysBefore { get; } = 7;
|
||||
public static ushort PublishMaxDaysAhead { get; } = 10;
|
||||
}
|
||||
public class Online
|
||||
{
|
||||
public static class Session
|
||||
@@ -73,45 +113,6 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public static int Periodic { get; } = SacsSystem.DebugMode ? 120 : 1800;
|
||||
}
|
||||
}
|
||||
public static class Profile
|
||||
{
|
||||
public static class User
|
||||
{
|
||||
public static class Image
|
||||
{
|
||||
public static ushort WidthMax { get; } = 320;
|
||||
public static ushort HeightMax { get; } = 400;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static class Links
|
||||
{
|
||||
public static class Targets
|
||||
{
|
||||
public static String Website { get; } = "sax-lnk-web";
|
||||
public static String Wikipedia { get; } = "sax-lnk-wikip";
|
||||
public static String Facebook { get; } = "sax-lnk-fbook";
|
||||
public static String Twitter { get; } = "sax-lnk-twit";
|
||||
public static String Instagram { get; } = "sax-lnk-insta";
|
||||
public static String LinkedIn { get; } = "sax-lnk-lnkin";
|
||||
public static String Article { get; } = "sax-art-lnk";
|
||||
}
|
||||
}
|
||||
public static class Articles
|
||||
{
|
||||
public static class Segments
|
||||
{
|
||||
public static ushort Max { get; } = 12;
|
||||
public static ushort CharsMax { get; } = 8000;
|
||||
}
|
||||
public static class Images
|
||||
{
|
||||
public static ushort WidthMax { get; } = 800;
|
||||
public static ushort HeightMax { get; } = 640;
|
||||
}
|
||||
public static ushort PublishMaxDaysBefore { get; } = 7;
|
||||
public static ushort PublishMaxDaysAhead { get; } = 10;
|
||||
}
|
||||
public static class Search
|
||||
{
|
||||
public static class Users
|
||||
@@ -140,6 +141,19 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
}
|
||||
}
|
||||
}
|
||||
public static class Links
|
||||
{
|
||||
public static class Targets
|
||||
{
|
||||
public static String Website { get; } = "sax-lnk-web";
|
||||
public static String Wikipedia { get; } = "sax-lnk-wikip";
|
||||
public static String Facebook { get; } = "sax-lnk-fbook";
|
||||
public static String Twitter { get; } = "sax-lnk-twit";
|
||||
public static String Instagram { get; } = "sax-lnk-insta";
|
||||
public static String LinkedIn { get; } = "sax-lnk-lnkin";
|
||||
public static String Article { get; } = "sax-art-lnk";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.2.6.3";
|
||||
private static String version { get; } = "1.2.6.4";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
|
||||
@@ -191,11 +191,15 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
/// <summary>User's profile image.</summary>
|
||||
Avatar = 100,
|
||||
/// <summary>User's profile image, uploaded awaiting confirmation.</summary>
|
||||
AvatarUpload = 101,
|
||||
Avatar_Upload = 101,
|
||||
/// <summary>Organisation's main logo.</summary>
|
||||
OrganisationLogo = 120,
|
||||
/// <summary>Organisation's main logo, uploaded awaiting confirmation.</summary>
|
||||
OrganisationLogo_Upload = 121,
|
||||
/// <summary>Article image.</summary>
|
||||
Article = 200,
|
||||
/// <summary>Article image uploaded, awaiting confirmation.</summary>
|
||||
ArticleUpload = 201,
|
||||
Article_Upload = 201,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Base.App
|
||||
{
|
||||
@@ -164,8 +164,6 @@ namespace Saxonite.Base.App
|
||||
Organisation_Facilities,
|
||||
Organisation_ContactData,
|
||||
Organisation_CountryIso2Code,
|
||||
Organisation_PhoneMain,
|
||||
Organisation_PhoneAlt,
|
||||
Organisation_Notes,
|
||||
Organisation_Flags,
|
||||
Organisation_Status,
|
||||
@@ -380,7 +378,7 @@ namespace Saxonite.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 19;
|
||||
private static readonly int columnCount = 332;
|
||||
private static readonly int columnCount = 330;
|
||||
private static ulong maxTextLen = 0;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -692,8 +690,6 @@ namespace Saxonite.Base.App
|
||||
new ColumnDfn(7,"Facilities",0,-9,false,2000),
|
||||
new ColumnDfn(7,"ContactData",0,-9,false,0),
|
||||
new ColumnDfn(7,"CountryIso2Code",0,12,false,2),
|
||||
new ColumnDfn(7,"PhoneMain",0,-9,false,50),
|
||||
new ColumnDfn(7,"PhoneAlt",0,-9,false,50),
|
||||
new ColumnDfn(7,"Notes",0,-9,false,2000),
|
||||
new ColumnDfn(7,"Flags",3,5,false,5),
|
||||
new ColumnDfn(7,"Status",0,12,false,3),
|
||||
|
||||
@@ -171,9 +171,11 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//---------------------------------------------------------------
|
||||
// Image types.
|
||||
imageTypeCodes.Add(Sax.ImageType.Avatar, "Avatar", "Avatar");
|
||||
imageTypeCodes.Add(Sax.ImageType.AvatarUpload, "AvatarUpload", "Avatar - upload");
|
||||
imageTypeCodes.Add(Sax.ImageType.Avatar_Upload, "AvatarUpload", "Avatar - upload");
|
||||
imageTypeCodes.Add(Sax.ImageType.OrganisationLogo, "OrganisationLogo", "Organisation logo");
|
||||
imageTypeCodes.Add(Sax.ImageType.OrganisationLogo_Upload, "OrganisationLogoUpload", "Organisation logo - upload");
|
||||
imageTypeCodes.Add(Sax.ImageType.Article, "Article", "Article");
|
||||
imageTypeCodes.Add(Sax.ImageType.ArticleUpload, "ArticleUpload", "Article - upload");
|
||||
imageTypeCodes.Add(Sax.ImageType.Article_Upload, "ArticleUpload", "Article - upload");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Organisation types.
|
||||
|
||||
@@ -25,8 +25,6 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
OrganisationType_Desc,
|
||||
OrganisationCategory,
|
||||
OrganisationCategory_Desc,
|
||||
PhoneMain,
|
||||
PhoneAlt,
|
||||
// Sport.
|
||||
SportId,
|
||||
Sport_Name,
|
||||
@@ -38,6 +36,8 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
User_Count,
|
||||
/// <summary>Number of users who are 'members' of the organisation.</summary>
|
||||
Member_Count,
|
||||
/// <summary>Number of active logo images.</summary>
|
||||
LogoImage_Count,
|
||||
// Common.
|
||||
Notes,
|
||||
Flags,
|
||||
@@ -60,8 +60,6 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public String About { get; set; } = String.Empty;
|
||||
public String Facilities { get; set; } = String.Empty;
|
||||
public String ContactData { get; set; } = String.Empty;
|
||||
public String PhoneMain { get; set; } = String.Empty;
|
||||
public String PhoneAlt { get; set; } = String.Empty;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -116,16 +114,6 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
get { return data.ContactData; }
|
||||
set { CheckChanged(data.ContactData, value); data.ContactData = value; }
|
||||
}
|
||||
public String PhoneMain
|
||||
{
|
||||
get { return data.PhoneMain; }
|
||||
set { CheckChanged(data.PhoneMain, value); data.PhoneMain = value; }
|
||||
}
|
||||
public String PhoneAlt
|
||||
{
|
||||
get { return data.PhoneAlt; }
|
||||
set { CheckChanged(data.PhoneAlt, value); data.PhoneAlt = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
@@ -137,8 +125,6 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
About = data.About;
|
||||
Facilities = data.Facilities;
|
||||
ContactData = data.ContactData;
|
||||
PhoneMain = data.PhoneMain;
|
||||
PhoneAlt = data.PhoneAlt;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
@@ -162,8 +148,6 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public ValidValue About { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Facilities { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ContactData { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PhoneMain { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PhoneAlt { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -280,16 +264,6 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
get { return data.ContactData; }
|
||||
set { data.ContactData = value; }
|
||||
}
|
||||
public String PhoneMain
|
||||
{
|
||||
get { return data.PhoneMain; }
|
||||
set { data.PhoneMain = value; }
|
||||
}
|
||||
public String PhoneAlt
|
||||
{
|
||||
get { return data.PhoneAlt; }
|
||||
set { data.PhoneAlt = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags - positions 1-16 available.
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
// Account Mgr - Organisation
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
/// <summary>Get number of active members for Organisation.</summary>
|
||||
public long GetOrganisationMemberCount(SysId organisationId)
|
||||
{
|
||||
if (!SysId.IsValid(organisationId)) return 0;
|
||||
@@ -28,6 +29,15 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
|
||||
return GetUserOrganisationCount(prmUserOrganisation);
|
||||
}
|
||||
/// <summary>Get number of active opportunities for organisation.</summary>
|
||||
public long GetOrganisationOpportunityCount(SysId organisationId)
|
||||
{
|
||||
if (!SysId.IsValid(organisationId)) return 0;
|
||||
SaxOrganisationOpportunity.Params prmOrganisationOpportunity = new SaxOrganisationOpportunity.Params();
|
||||
prmOrganisationOpportunity.OrganisationIdsIncluded.Add(organisationId);
|
||||
prmOrganisationOpportunity.StatusCat = SaxOrganisationOpportunity.StatusCat.ActiveOnly;
|
||||
return ActivityMgr.GetOrganisationOpportunityCount(prmOrganisationOpportunity);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
@@ -114,7 +124,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
return SetErrorState("Sport must be specified.");
|
||||
}
|
||||
}
|
||||
// Region.
|
||||
// Primary Region.
|
||||
if (errField.RegionIdPrimary != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!SysId.IsValid(data.RegionIdPrimary))
|
||||
@@ -123,6 +133,7 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
return SetErrorState("Region must be specified.");
|
||||
}
|
||||
}
|
||||
|
||||
// About.
|
||||
if (errField.About != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.About, "about", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.Organisation_About)))
|
||||
{
|
||||
@@ -135,18 +146,8 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
errField.Facilities = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Main phone.
|
||||
if (errField.PhoneMain != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PhoneMain, "phone", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.Organisation_PhoneMain)))
|
||||
{
|
||||
errField.PhoneMain = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
// Alt phone.
|
||||
if (errField.PhoneAlt != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PhoneAlt, "alt. phone", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.Organisation_PhoneAlt)))
|
||||
{
|
||||
errField.PhoneAlt = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Contact data.
|
||||
|
||||
// Common properties.
|
||||
if (errField.Notes != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Notes, "notes", (long)SaxDbDfn_Core.GetColTextLen(SaxDbDfn_Core.ColumnIdx.Organisation_Notes)))
|
||||
|
||||
@@ -19,6 +19,16 @@ namespace Saxonite.Net.Standard.Base.Mgr
|
||||
// Item Data Mgr - Item Image
|
||||
//*******************************************************************
|
||||
// Utilities.
|
||||
public bool ItemHasActiveImage(ItemId itemId, Sax.ImageType imageType)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!ItemId.IsValid(itemId) || (int)imageType < 1) return false;
|
||||
SaxItemImage.Params prmItemImage = new SaxItemImage.Params();
|
||||
prmItemImage.ItemIdsIncluded.Add(itemId);
|
||||
prmItemImage.ImageTypesIncluded.Add(imageType);
|
||||
prmItemImage.StatusCat = SaxItemImage.StatusCat.ActiveOnly;
|
||||
return GetItemImageCount(prmItemImage) == 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
@@ -29,8 +29,6 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
public ColumnDataString _Facilities { get; } = new ColumnDataString("Facilities");
|
||||
public ColumnDataString _ContactData { get; } = new ColumnDataString("ContactData");
|
||||
public ColumnDataString _CountryIso2Code { get; } = new ColumnDataString("CountryIso2Code");
|
||||
public ColumnDataString _PhoneMain { get; } = new ColumnDataString("PhoneMain");
|
||||
public ColumnDataString _PhoneAlt { get; } = new ColumnDataString("PhoneAlt");
|
||||
public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
|
||||
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
|
||||
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
|
||||
@@ -56,8 +54,6 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
"Facilities",
|
||||
"ContactData",
|
||||
"CountryIso2Code",
|
||||
"PhoneMain",
|
||||
"PhoneAlt",
|
||||
"Notes",
|
||||
"Flags",
|
||||
"Status",
|
||||
@@ -109,8 +105,6 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
public String _Facilities { get { return Cols._Facilities.Value; } set { Cols._Facilities.Value = value; } }
|
||||
public String _ContactData { get { return Cols._ContactData.Value; } set { Cols._ContactData.Value = value; } }
|
||||
public String _CountryIso2Code { get { return Cols._CountryIso2Code.Value; } set { Cols._CountryIso2Code.Value = value; } }
|
||||
public String _PhoneMain { get { return Cols._PhoneMain.Value; } set { Cols._PhoneMain.Value = value; } }
|
||||
public String _PhoneAlt { get { return Cols._PhoneAlt.Value; } set { Cols._PhoneAlt.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; } }
|
||||
@@ -151,8 +145,6 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
_Facilities = GetFieldString(dbDataReader, "Facilities", _Facilities);
|
||||
_ContactData = GetFieldString(dbDataReader, "ContactData", _ContactData);
|
||||
_CountryIso2Code = GetFieldString(dbDataReader, "CountryIso2Code", _CountryIso2Code);
|
||||
_PhoneMain = GetFieldString(dbDataReader, "PhoneMain", _PhoneMain);
|
||||
_PhoneAlt = GetFieldString(dbDataReader, "PhoneAlt", _PhoneAlt);
|
||||
_Notes = GetFieldString(dbDataReader, "Notes", _Notes);
|
||||
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
|
||||
_Status = GetFieldString(dbDataReader, "Status", _Status);
|
||||
@@ -192,8 +184,6 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
if (columnNames.ContainsCI("Facilities")) AddCommandParameter(dbCommand, "@Facilities", _Facilities);
|
||||
if (columnNames.ContainsCI("ContactData")) AddCommandParameter(dbCommand, "@ContactData", _ContactData);
|
||||
if (columnNames.ContainsCI("CountryIso2Code")) AddCommandParameter(dbCommand, "@CountryIso2Code", _CountryIso2Code);
|
||||
if (columnNames.ContainsCI("PhoneMain")) AddCommandParameter(dbCommand, "@PhoneMain", _PhoneMain);
|
||||
if (columnNames.ContainsCI("PhoneAlt")) AddCommandParameter(dbCommand, "@PhoneAlt", _PhoneAlt);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
@@ -248,8 +238,6 @@ namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
if (columnNames.ContainsCI("Facilities")) AddCommandParameter(dbCommand, "@Facilities", _Facilities);
|
||||
if (columnNames.ContainsCI("ContactData")) AddCommandParameter(dbCommand, "@ContactData", _ContactData);
|
||||
if (columnNames.ContainsCI("CountryIso2Code")) AddCommandParameter(dbCommand, "@CountryIso2Code", _CountryIso2Code);
|
||||
if (columnNames.ContainsCI("PhoneMain")) AddCommandParameter(dbCommand, "@PhoneMain", _PhoneMain);
|
||||
if (columnNames.ContainsCI("PhoneAlt")) AddCommandParameter(dbCommand, "@PhoneAlt", _PhoneAlt);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ using System.Data.Common;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Wed 18-May-2022 18:33:47
|
||||
// Code generated by Sarand Database Utilities Wed 25-May-2022 20:26:17
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Saxonite.Net.Standard.Dbas.Internal
|
||||
{
|
||||
|
||||
@@ -219,8 +219,6 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
dbOrganisation._About = StringUtil.EmptyOnNull(organisation.About);
|
||||
dbOrganisation._Facilities = StringUtil.EmptyOnNull(organisation.Facilities);
|
||||
dbOrganisation._ContactData = StringUtil.EmptyOnNull(organisation.ContactData);
|
||||
dbOrganisation._PhoneMain = StringUtil.EmptyOnNull(organisation.PhoneMain);
|
||||
dbOrganisation._PhoneAlt = StringUtil.EmptyOnNull(organisation.PhoneAlt);
|
||||
dbOrganisation._Notes = StringUtil.EmptyOnNull(organisation.Notes);
|
||||
dbOrganisation._Status = SacsSystem.GetStatusCode(organisation.Status);
|
||||
dbOrganisation._Flags = (short)organisation.Flags;
|
||||
@@ -246,8 +244,6 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
organisation.About = dbOrganisation._About;
|
||||
organisation.Facilities = dbOrganisation._Facilities;
|
||||
organisation.ContactData = dbOrganisation._ContactData;
|
||||
organisation.PhoneMain = dbOrganisation._PhoneMain;
|
||||
organisation.PhoneAlt = dbOrganisation._PhoneAlt;
|
||||
organisation.Notes = dbOrganisation._Notes;
|
||||
organisation.Status = SacsSystem.GetStatusForCode(dbOrganisation._Status);
|
||||
organisation.SetCreateStamp(dbOrganisation._CreateOn, new SysId(dbOrganisation._CreateBy), dbOrganisation._CreateHost);
|
||||
@@ -264,6 +260,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
private static readonly String prefixOrganisation_Region = "Org_Rgn_";
|
||||
private static readonly String colOrganisation_User_Count = "Org_Usr_Count";
|
||||
private static readonly String colOrganisation_Member_Count = "Org_Mbr_Count";
|
||||
private static readonly String colOrganisation_LogoImage_Count = "Org_LogoImg_Count";
|
||||
private void SetOrganisationColDfn
|
||||
(ColumnDfn col, String caption, int width, SaxDbDfn_Core.ColumnIdx dbCol,
|
||||
ColumnAlignment align = ColumnAlignment.Default, DataValue.DataType dataType = DataValue.DataType.String,
|
||||
@@ -306,12 +303,6 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
case SaxOrganisation.Column.OrganisationCategory_Desc:
|
||||
SetOrganisationColDfn(columnDfn, "Category", 80, SaxDbDfn_Core.ColumnIdx.Organisation_OrganisationCategory, ColumnAlignment.Center, DataValue.DataType.String);
|
||||
break;
|
||||
case SaxOrganisation.Column.PhoneMain:
|
||||
SetOrganisationColDfn(columnDfn, "Phone", 100, SaxDbDfn_Core.ColumnIdx.Organisation_PhoneMain);
|
||||
break;
|
||||
case SaxOrganisation.Column.PhoneAlt:
|
||||
SetOrganisationColDfn(columnDfn, "Alt. phone", 100, SaxDbDfn_Core.ColumnIdx.Organisation_PhoneAlt);
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Sport.
|
||||
@@ -343,6 +334,10 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
SetOrganisationColDfn(columnDfn, "Members", 80, SaxDbDfn_Core.ColumnIdx.Unknown, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
columnDfn.DataName = colOrganisation_Member_Count;
|
||||
break;
|
||||
case SaxOrganisation.Column.LogoImage_Count:
|
||||
SetOrganisationColDfn(columnDfn, "Logos", 80, SaxDbDfn_Core.ColumnIdx.Unknown, ColumnAlignment.Center, DataValue.DataType.Long);
|
||||
columnDfn.DataName = colOrganisation_LogoImage_Count;
|
||||
break;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Common properties.
|
||||
@@ -606,10 +601,6 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_Id, aliasOrganisation));
|
||||
if (columns.HasId(SaxOrganisation.Column.Name))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_Name, aliasOrganisation));
|
||||
if (columns.HasId(SaxOrganisation.Column.PhoneMain))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_PhoneMain, aliasOrganisation));
|
||||
if (columns.HasId(SaxOrganisation.Column.PhoneAlt))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_PhoneAlt, aliasOrganisation));
|
||||
if (columns.HasId(SaxOrganisation.Column.OrganisationType) || columns.HasId(SaxOrganisation.Column.OrganisationType_Desc))
|
||||
query.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_OrganisationType, aliasOrganisation));
|
||||
if (columns.HasId(SaxOrganisation.Column.OrganisationCategory) || columns.HasId(SaxOrganisation.Column.OrganisationCategory_Desc))
|
||||
@@ -674,6 +665,14 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
queryUserCount.Columns.Add("Count(*)");
|
||||
queryUserCount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_OrganisationId, aliasUserCount) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_Id, aliasOrganisation));
|
||||
queryUserCount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_Status, aliasUserCount) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
// Join to User Account.
|
||||
String aliasUserAccount = "aUsrOrg_UsrAcc";
|
||||
DbQueryJoin joinUserAccount = new DbQueryJoin(DbJoinType.Inner);
|
||||
joinUserAccount.Table = new StringPair(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserAccount), aliasUserAccount);
|
||||
joinUserAccount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Id, aliasUserAccount) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_UserAccountId, aliasUserCount));
|
||||
joinUserAccount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Status, aliasUserAccount) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
queryUserCount.Joins.Add(joinUserAccount);
|
||||
// Construct sub-query.
|
||||
query.Columns.Add("(" + queryUserCount.BuildQuery() + ")", colOrganisation_User_Count);
|
||||
}
|
||||
|
||||
@@ -688,9 +687,32 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
queryMemberCount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_OrganisationId, aliasMemberCount) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_Id, aliasOrganisation));
|
||||
queryMemberCount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_OrganisationRoleCount, aliasMemberCount) + ">0");
|
||||
queryMemberCount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_Status, aliasMemberCount) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
// Join to User Account.
|
||||
String aliasUserAccount = "aUsrOrg_UsrAcc";
|
||||
DbQueryJoin joinUserAccount = new DbQueryJoin(DbJoinType.Inner);
|
||||
joinUserAccount.Table = new StringPair(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserAccount), aliasUserAccount);
|
||||
joinUserAccount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Id, aliasUserAccount) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_UserAccountId, aliasMemberCount));
|
||||
joinUserAccount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Status, aliasUserAccount) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
queryMemberCount.Joins.Add(joinUserAccount);
|
||||
// Construct sub-query.
|
||||
query.Columns.Add("(" + queryMemberCount.BuildQuery() + ")", colOrganisation_Member_Count);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Logo Image count.
|
||||
if (columns.HasId(SaxOrganisation.Column.LogoImage_Count))
|
||||
{
|
||||
String aliasLogoCount = "aImg_Logo";
|
||||
DbQuery queryLogoCount = new DbQuery(CoreDatabase.DbmsType);
|
||||
queryLogoCount.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemImage), aliasLogoCount);
|
||||
queryLogoCount.Columns.Add("Count(*)");
|
||||
queryLogoCount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_ItemType, aliasLogoCount) + "=" + (int)Sax.DataItemType.Organisation);
|
||||
queryLogoCount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_ItemId, aliasLogoCount) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_Id, aliasOrganisation));
|
||||
queryLogoCount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Status, aliasLogoCount) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
// Construct sub-query.
|
||||
query.Columns.Add("(" + queryLogoCount.BuildQuery() + ")", colOrganisation_LogoImage_Count);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Populate filter.
|
||||
query.Filters.AddRange(GetOrganisationQueryFilter(prm));
|
||||
|
||||
@@ -760,6 +760,15 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
qryOrgMbr.Columns.Add("Count(*)");
|
||||
qryOrgMbr.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_OrganisationId, aliasOrgMbr) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_OrganisationId, aliasUserOrganisation));
|
||||
qryOrgMbr.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_OrganisationRoleCount, aliasOrgMbr) + ">0");
|
||||
qryOrgMbr.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_Status, aliasOrgMbr) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
// Join to User Account.
|
||||
String aliasUserAccount = "aUsrOrg_UsrAcc";
|
||||
DbQueryJoin joinUserAccount = new DbQueryJoin(DbJoinType.Inner);
|
||||
joinUserAccount.Table = new StringPair(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserAccount), aliasUserAccount);
|
||||
joinUserAccount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Id, aliasUserAccount) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_UserAccountId, aliasOrgMbr));
|
||||
joinUserAccount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Status, aliasUserAccount) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
qryOrgMbr.Joins.Add(joinUserAccount);
|
||||
// Construct sub-query.
|
||||
query.Columns.Add("(" + qryOrgMbr.BuildQuery() + ")", dataName_UserOrganisation_Organisation_Member_Count);
|
||||
}
|
||||
|
||||
|
||||
@@ -1555,7 +1555,7 @@
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>9</UniqueValues>
|
||||
<UniqueValues>11</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
@@ -2571,40 +2571,6 @@
|
||||
<Schema>dbo</Schema>
|
||||
<Table>Organisation</Table>
|
||||
<Pos>11</Pos>
|
||||
<Name>PhoneMain</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>50</Size>
|
||||
<BufferLen>100</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>Organisation</Table>
|
||||
<Pos>12</Pos>
|
||||
<Name>PhoneAlt</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>50</Size>
|
||||
<BufferLen>100</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>Organisation</Table>
|
||||
<Pos>13</Pos>
|
||||
<Name>Notes</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -2621,7 +2587,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>Organisation</Table>
|
||||
<Pos>14</Pos>
|
||||
<Pos>12</Pos>
|
||||
<Name>Flags</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
@@ -2638,7 +2604,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>Organisation</Table>
|
||||
<Pos>15</Pos>
|
||||
<Pos>13</Pos>
|
||||
<Name>Status</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -2655,7 +2621,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>Organisation</Table>
|
||||
<Pos>16</Pos>
|
||||
<Pos>14</Pos>
|
||||
<Name>CreateOn</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
@@ -2672,7 +2638,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>Organisation</Table>
|
||||
<Pos>17</Pos>
|
||||
<Pos>15</Pos>
|
||||
<Name>CreateBy</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
@@ -2689,7 +2655,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>Organisation</Table>
|
||||
<Pos>18</Pos>
|
||||
<Pos>16</Pos>
|
||||
<Name>CreateHost</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -2706,7 +2672,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>Organisation</Table>
|
||||
<Pos>19</Pos>
|
||||
<Pos>17</Pos>
|
||||
<Name>UpdateOn</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
@@ -2723,7 +2689,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>Organisation</Table>
|
||||
<Pos>20</Pos>
|
||||
<Pos>18</Pos>
|
||||
<Name>UpdateBy</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
@@ -2740,7 +2706,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>Organisation</Table>
|
||||
<Pos>21</Pos>
|
||||
<Pos>19</Pos>
|
||||
<Name>UpdateHost</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -2765,8 +2731,8 @@
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>14</UniqueValues>
|
||||
<Pages>2</Pages>
|
||||
<UniqueValues>16</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
@@ -5823,7 +5789,7 @@
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>16</UniqueValues>
|
||||
<UniqueValues>20</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
|
||||
Reference in New Issue
Block a user