v1.1.2.0
This commit is contained in:
@@ -69,6 +69,8 @@ namespace Saxonite.Net.Core.Web.Base.App
|
||||
applicationParams.Add("Documents root", SessionConfig.Documents.RootFolder);
|
||||
applicationParams.Add("Email context", SessionConfig.Email.Context + (!StringUtil.IsEmpty(EmailConfig.SMTP.Server) ? " [" + EmailConfig.SMTP.Server + "]" : ""));
|
||||
SaLogger.Info(fn + " Application start." + applicationParams.Select(item => StringUtil.PadRight(item.Item1 + ":", 20, ' ') + item.Item2).Concat("", "\n\t"), true);
|
||||
if (StringUtil.IsEmpty(EmailConfig.SMTP.Server) || StringUtil.IsEmpty(EmailConfig.Message.AddressFrom))
|
||||
SaLogger.Warn(fn + " Incomplete email configuration.", true);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -40,6 +40,16 @@ namespace Saxonite.Net.Core.Web.Base.App
|
||||
foreach (ConfigurationSection environment in configSection.GetSection("Environments").GetChildren())
|
||||
environments.Add(StringUtil.TrimAll(environment.Value));
|
||||
Instance = StringUtil.OnEmpty(configSection["Instance"], Instance);
|
||||
// URLs.
|
||||
IConfigurationSection urls = configSection.GetSection("URLs");
|
||||
if (urls.Exists())
|
||||
{
|
||||
IConfigurationSection onlineUrls = urls.GetSection("Online");
|
||||
if (onlineUrls.Exists())
|
||||
{
|
||||
URL.Online.Root = onlineUrls["Root"];
|
||||
}
|
||||
}
|
||||
// Security.
|
||||
IConfigurationSection security = configSection.GetSection("Security");
|
||||
if (security.Exists())
|
||||
@@ -124,6 +134,16 @@ namespace Saxonite.Net.Core.Web.Base.App
|
||||
public String Context { get; }
|
||||
public List<String> Environments { get { return new List<String>(environments); } }
|
||||
public String Instance { get; set; } = "";
|
||||
// URLs.
|
||||
public class URLConfig
|
||||
{
|
||||
public class OnlineConfig
|
||||
{
|
||||
public String Root { get; set; }
|
||||
}
|
||||
public OnlineConfig Online { get; } = new OnlineConfig();
|
||||
}
|
||||
public URLConfig URL { get; } = new URLConfig();
|
||||
// Security.
|
||||
public class SecurityConfig
|
||||
{
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Saxonite.Net.Core.Web.Base.App
|
||||
{
|
||||
internal class SaxyAuthenticationHandler
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -109,13 +109,13 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
|
||||
// Redirection locations.
|
||||
//-------------------------------------------------------------------
|
||||
public static readonly String ParamName_SessionExpired = "SessionExpired";
|
||||
protected enum RedirectLocation
|
||||
public enum RedirectLocation
|
||||
{
|
||||
WebAppBase,
|
||||
WebAppHome,
|
||||
WebAppHome_SessionExpired,
|
||||
}
|
||||
protected String GetRedirectLocation(RedirectLocation redirectLocation)
|
||||
public String GetRedirectLocation(RedirectLocation redirectLocation)
|
||||
{
|
||||
string protocol = Request.Scheme;
|
||||
var parameters = new RouteValueDictionary();
|
||||
@@ -481,7 +481,7 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
|
||||
public class PagingData
|
||||
{
|
||||
public PagingData(SaxModel_Base model) :
|
||||
this(model.DataPageNo, model.DataPageLength, model.DataItemCount, model.DataItemTotal)
|
||||
this(model.Paging.PageNo, model.Paging.PageLength, model.Paging.ItemCount, model.Paging.ItemTotal)
|
||||
{ }
|
||||
public PagingData(uint pageNo, ushort pageLength, ushort itemCount, ulong itemTotal)
|
||||
{
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace Saxonite.Net.Core.Web.Base.Models
|
||||
{
|
||||
return Internals.GetUserAccountDisplayName(userAccountId);
|
||||
}
|
||||
// User Accounts.
|
||||
// Organisations.
|
||||
public SaxOrganisation GetOrganisation(SysId organisationId)
|
||||
{
|
||||
return Internals.GetOrganisation(organisationId);
|
||||
@@ -292,15 +292,20 @@ namespace Saxonite.Net.Core.Web.Base.Models
|
||||
public ushort PageLength { get { return paging.PageLength; } set { paging.PageLength = value; } }
|
||||
public uint PageCount { get { return (PageLength > 0 ? (uint)Math.Ceiling((decimal)ItemTotal / PageLength) : 0); } }
|
||||
public ushort ItemCount { get; set; }
|
||||
public ulong ItemTotal { get; set; }
|
||||
private ulong itemTotal = 0;
|
||||
public ulong ItemTotal
|
||||
{
|
||||
get { return itemTotal; }
|
||||
set
|
||||
{
|
||||
itemTotal = value;
|
||||
// Check whether the total number of items is less than the current page and reduce page no if needed.
|
||||
if (IsPaged && (PageNo - 1) * PageLength > itemTotal)
|
||||
PageNo = (uint)((itemTotal - 1) / PageLength + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
public DataPaging Paging { get; } = new DataPaging();
|
||||
public bool DataPaged { get { return Paging.IsPaged; } }
|
||||
public uint DataPageNo { get { return Paging.PageNo; } set { Paging.PageNo = value; } }
|
||||
public ushort DataPageLength { get { return Paging.PageLength; } set { Paging.PageLength = value; } }
|
||||
public uint DataPageCount { get { return (DataPageLength > 0 ? (uint)Math.Ceiling((decimal)DataItemTotal / DataPageLength) : 0); } }
|
||||
public ushort DataItemCount { get; set; }
|
||||
public ulong DataItemTotal { get; set; }
|
||||
public void PopulatePagingTo(DbQuery.Paging resultsPaging)
|
||||
{
|
||||
Paging.PopulatePagingTo(resultsPaging);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.13" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.16" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
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.Email;
|
||||
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 Saxonite.Net.Standard.Base.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Controller: Organisation - Activation - Ajax
|
||||
//=======================================================================
|
||||
partial class OrganisationController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Get Organisation Activation Info ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_OrganisationActivationInfo : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_OrganisationActivationInfo(SaxModel_Admin model) : base(model) { }
|
||||
// Organisation details.
|
||||
public OrganisationData_Full organisation { get; } = new OrganisationData_Full();
|
||||
// Member awaiting activation.
|
||||
public List<MemberData_List> Members { get; } = new List<MemberData_List>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/GetActivationInfo")]
|
||||
public IActionResult Ajax_GetActivationInfo(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetActivationInfo";
|
||||
String messageTitle = Localiser["organisation.caption.organisation"];
|
||||
AjaxResponse_OrganisationActivationInfo responseData = new AjaxResponse_OrganisationActivationInfo(model);
|
||||
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
if (StringUtil.IsEmpty(SessionConfig.URL.Online.Root))
|
||||
return Json(responseData.SetMessage(messageTitle, "Root online URL not specified."));
|
||||
|
||||
// Identify item.
|
||||
SysId organisationId = model.OrganisationId.ToSysId();
|
||||
if (!SysId.IsValid(organisationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Request to get activation info without valid organisation Id.");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
}
|
||||
|
||||
// Retrieve item.
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
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"]));
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateOrganisationResponseData(organisation, responseData.organisation);
|
||||
GetOrganisationMembers(model, organisationId, responseData.Members);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Activate Organisation ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/Activate")]
|
||||
[Route("Organisation/Ajax/ActivateItem")]
|
||||
public IActionResult Ajax_Activate(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_Activate";
|
||||
String messageTitle = Localiser["organisation.caption.organisation"];
|
||||
AjaxResponse_Organisation responseData = new AjaxResponse_Organisation(model);
|
||||
|
||||
// Validate session.
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Validate item properties.
|
||||
model.ValidateOrganisationData(responseData);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
|
||||
// Retrieve existing item.
|
||||
SysId organisationId = model.OrganisationId.ToSysId();
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
if (organisation == null && SysId.IsValid(organisationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve organisation for Id: '" + model.OrganisationId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Activate organisation.
|
||||
organisation.Status = Sarand.Net.Standard.Base.Core.SaStatus.Active;
|
||||
if (!AccountMgr.UpdateOrganisation(organisation, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update organisation [Id:" + SysId.ToString(organisation.Id) + "]: " + AccountMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.update.failed"] + "\n\n" + AccountMgr.ErrorStateMessage));
|
||||
}
|
||||
|
||||
// Activate awaiting members and send welcome email to each.
|
||||
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||
prmUserOrganisation.OrganisationIdsIncluded.Add(organisationId);
|
||||
prmUserOrganisation.UserAccountStatusCat = SaxUserAccount.StatusCat.AwaitingOnly;
|
||||
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
|
||||
List<SaxUserOrganisation> userOrganisations = new List<SaxUserOrganisation>();
|
||||
foreach (SaxUserOrganisation userOrganisation in userOrganisations)
|
||||
{
|
||||
using (SaxUserAccount userAccount = AccountMgr.GetUserAccountById(userOrganisation.UserAccountId))
|
||||
{
|
||||
if (userAccount == null) continue;
|
||||
userAccount.Status = SaStatus.Active;
|
||||
if (AccountMgr.UpdateUserAccount(userAccount, DbUpdateInfo))
|
||||
{
|
||||
// Send welcome email.
|
||||
SaEmailData emailData = new SaEmailData();
|
||||
emailData.Config = EmailConfig;
|
||||
emailData.AddressesTo.Add(userAccount.EmailAddress);
|
||||
emailData.Subject = Localiser["security.caption.request.password"];
|
||||
PopulateAccountActivatedEmailBody(emailData, userAccount);
|
||||
if (EmailConsole.SendEmail(emailData))
|
||||
SaLogger.Info(fn + " Password request email sent to " + userAccount.EmailAddress, true);
|
||||
else SaLogger.Warn(fn + " Failed to send password request email to " + userAccount.EmailAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update organisation [Id:" + SysId.ToString(organisation.Id) + "]: " + AccountMgr.ErrorStateMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
PopulateOrganisationResponseData(organisation, responseData.organisation);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private void PopulateAccountActivatedEmailBody(SaEmailData emailData, SaxUserAccount userAccount)
|
||||
{
|
||||
// Will need to handle culture (language/country) as and when introduced.
|
||||
emailData.MessageBody = SaxResourceHelper.GetTextResource(SaxResourceHelper.TextResource.Email_Security_AccountActivated_Html);
|
||||
emailData.HtmlBody = true;
|
||||
|
||||
// Replace dynamic tags.
|
||||
EmailConsole.ReplaceDynamicEmailBodyTags(emailData, null, userAccount);
|
||||
|
||||
// Replace dynamic tag for link back to change password page.
|
||||
SaEmailConsole.ReplaceDynamicEmailTag(emailData, "[#Link.RequestPassword]", SecurityController.GenerateRequestPasswordLink(this, userAccount.Id, userAccount.EmailAddress, "", SessionConfig.URL.Online.Root));
|
||||
SaEmailConsole.ReplaceDynamicEmailTag(emailData, "[#Link.ExpiresMinutes]", SecurityController.GetRequestPasswordEmailLinkExpiresMinutes(this).ToString());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
@@ -36,9 +36,14 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// Region - country.
|
||||
public long RegionIdCountry { get; set; }
|
||||
public String RegionNameCountry { get; set; }
|
||||
// Address.
|
||||
public String AddressSummary { get; set; }
|
||||
// Common properties.
|
||||
public String StatusCode { get; set; }
|
||||
public String StatusDesc { get; set; }
|
||||
public Boolean Awaiting { get { return StatusCode.EqualsCI(SacsSystem.GetStatusCode(SaStatus.Awaiting)); } }
|
||||
public Boolean Active { get { return StatusCode.EqualsCI(SacsSystem.GetStatusCode(SaStatus.Active)); } }
|
||||
public Boolean Deleted { get { return StatusCode.EqualsCI(SacsSystem.GetStatusCode(SaStatus.Deleted)); } }
|
||||
}
|
||||
private class OrganisationData_Full : OrganisationData_List
|
||||
{
|
||||
@@ -103,8 +108,13 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// Item filter.
|
||||
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||
prmOrganisation.OrganisationFilter = model.Filter.Organisation;
|
||||
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.NotDeleted;
|
||||
model.DataItemTotal = (ulong)AccountMgr.GetOrganisationCount(prmOrganisation);
|
||||
prmOrganisation.OrganisationType = model.FilterOrganisationType;
|
||||
prmOrganisation.OrganisationCategory = model.FilterOrganisationCategory;
|
||||
prmOrganisation.SportIdsIncluded.AddId(model.Filter.OrganisationSportId.ToSysId());
|
||||
prmOrganisation.RegionIdsIncluded.AddId(model.Filter.OrganisationRegionId.ToSysId());
|
||||
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);
|
||||
model.PopulatePagingTo(prmOrganisation.ResultsPaging);
|
||||
|
||||
// Item columns.
|
||||
@@ -136,12 +146,10 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
};
|
||||
|
||||
// Query items.
|
||||
model.DataItemCount = 0;
|
||||
using (DbResultSet resultSet = AccountMgr.ExecuteOrganisationQuery(columns, prmOrganisation))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
model.DataItemCount++;
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
OrganisationData_List organisationData = new OrganisationData_List()
|
||||
{
|
||||
@@ -162,11 +170,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
responseData.Organisations.Add(organisationData);
|
||||
}
|
||||
}
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Organisations.Count;
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
@@ -194,7 +203,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Identify item.
|
||||
SysId organisationId = new SysId(StringUtil.ToLong(model.OrganisationId));
|
||||
SysId organisationId = model.OrganisationId.ToSysId();
|
||||
if (!SysId.IsValid(organisationId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
@@ -236,7 +245,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// Retrieve existing item.
|
||||
SysId organisationId = new SysId(StringUtil.ToLong(model.OrganisationId));
|
||||
SysId organisationId = model.OrganisationId.ToSysId();
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
if (organisation == null && SysId.IsValid(organisationId))
|
||||
{
|
||||
|
||||
@@ -85,8 +85,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Organisation Id filter is mandatory.
|
||||
SysId filterOrganisationId = new SysId(StringUtil.ToLong(model.Filter.OrganisationId));
|
||||
if (!SysId.IsValid(filterOrganisationId))
|
||||
SysId organisationId = model.Filter.OrganisationId.ToSysId();
|
||||
if (!SysId.IsValid(organisationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Request to retrieve members without valid organisation Id.");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
@@ -102,12 +102,25 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
responseData.Statuses.Add(SacsSystem.GetStatusCode(status), Localiser.GetStatusCaption(status));
|
||||
responseData.DefaultStatusCode = SacsSystem.GetStatusCode(SaxUserOrganisation.DefaultStatus);
|
||||
|
||||
// Get organisation members.
|
||||
GetOrganisationMembers(model, organisationId, responseData.Members);
|
||||
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Members.Count;
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
private void GetOrganisationMembers (SaxModel_Admin model, SysId organisationId, List<MemberData_List> members)
|
||||
{
|
||||
// Item filter.
|
||||
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
|
||||
prmUserOrganisation.OrganisationIdsIncluded.Add(filterOrganisationId);
|
||||
prmUserOrganisation.OrganisationIdsIncluded.Add(organisationId);
|
||||
prmUserOrganisation.OrganisationMembersOnly = true;
|
||||
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.NotDeleted;
|
||||
model.DataItemTotal = (ulong)AccountMgr.GetUserOrganisationCount(prmUserOrganisation);
|
||||
model.Paging.ItemTotal = (ulong)AccountMgr.GetUserOrganisationCount(prmUserOrganisation);
|
||||
model.PopulatePagingTo(prmUserOrganisation.ResultsPaging);
|
||||
|
||||
// Item columns.
|
||||
@@ -134,12 +147,10 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
};
|
||||
|
||||
// Query items.
|
||||
model.DataItemCount = 0;
|
||||
using (DbResultSet resultSet = AccountMgr.ExecuteUserOrganisationQuery(columns, prmUserOrganisation))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
model.DataItemCount++;
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
MemberData_List memberData = new MemberData_List()
|
||||
{
|
||||
@@ -154,15 +165,9 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||
};
|
||||
responseData.Members.Add(memberData);
|
||||
members.Add(memberData);
|
||||
}
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -189,7 +194,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Identify item.
|
||||
SysId userOrganisationId = new SysId(StringUtil.ToLong(model.UserOrganisationId));
|
||||
SysId userOrganisationId = model.UserOrganisationId.ToSysId();
|
||||
if (!SysId.IsValid(userOrganisationId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
@@ -244,7 +249,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// User account.
|
||||
SysId userAccountId = new SysId(StringUtil.ToLong(model.MemberUserAccountId));
|
||||
SysId userAccountId = model.MemberUserAccountId.ToSysId();
|
||||
SaxUserAccount userAccount = null;
|
||||
if (!SysId.IsValid(userAccountId) && !StringUtil.IsEmpty(model.MemberUserEmailAddress))
|
||||
{
|
||||
@@ -258,7 +263,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
}
|
||||
|
||||
// Organisation.
|
||||
SysId organisationId = new SysId(StringUtil.ToLong(model.MemberOrganisationId));
|
||||
SysId organisationId = model.MemberOrganisationId.ToSysId();
|
||||
SaxOrganisation organisation = null;
|
||||
if (!SysId.IsValid(organisationId))
|
||||
{
|
||||
@@ -267,7 +272,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
}
|
||||
|
||||
// Retrieve existing item.
|
||||
SysId userOrganisationId = new SysId(StringUtil.ToLong(model.UserOrganisationId));
|
||||
SysId userOrganisationId = model.UserOrganisationId.ToSysId();
|
||||
SaxUserOrganisation userOrganisation = AccountMgr.GetUserOrganisationById(userOrganisationId);
|
||||
if (userOrganisation == null && SysId.IsValid(userOrganisationId))
|
||||
{
|
||||
|
||||
@@ -32,7 +32,11 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (!ValidUserSession)
|
||||
return RedirectToAction("", "");
|
||||
|
||||
// Paging.
|
||||
Model_Organisation model = new Model_Organisation(Localiser);
|
||||
model.Paging.PageNo = 1;
|
||||
model.Paging.PageLength = 6;
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
@@ -49,11 +53,15 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return RedirectToAction("", "");
|
||||
|
||||
// Retrieve organisation.
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(new SysId(StringUtil.ToLong(model.Filter.OrganisationId)));
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(model.Filter.OrganisationId.ToSysId());
|
||||
if (organisation == null)
|
||||
RedirectToAction("", "Organisation");
|
||||
model.MemberOrganisationName = organisation?.Name;
|
||||
|
||||
// Paging.
|
||||
model.Paging.PageNo = 1;
|
||||
model.Paging.PageLength = 12;
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (model.Filter.RegionTypeCode != null)
|
||||
prmRegion.RegionType = model.FilterRegionType;
|
||||
prmRegion.StatusCat = SaxRegion.StatusCat.NotDeleted;
|
||||
model.DataItemTotal = (ulong)ReferenceMgr.GetRegionCount(prmRegion);
|
||||
model.Paging.ItemTotal = (ulong)ReferenceMgr.GetRegionCount(prmRegion);
|
||||
model.PopulatePagingTo(prmRegion.ResultsPaging);
|
||||
|
||||
// Item columns.
|
||||
@@ -115,12 +115,10 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
prmRegion.SortColumns.Add(colName);
|
||||
|
||||
// Query items.
|
||||
model.DataItemCount = 0;
|
||||
using (DbResultSet resultSet = ReferenceMgr.ExecuteRegionQuery(columns, prmRegion))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
model.DataItemCount++;
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
Sax.RegionType regionType = (Sax.RegionType)values.GetLong(colType.DataName);
|
||||
RegionData_List regionData = new RegionData_List()
|
||||
@@ -137,11 +135,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
responseData.Regions.Add(regionData);
|
||||
}
|
||||
}
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Regions.Count;
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
|
||||
// Paging.
|
||||
Model_Region model = new Model_Region(Localiser);
|
||||
model.DataPageNo = 1;
|
||||
model.DataPageLength = 12;
|
||||
model.Paging.PageNo = 1;
|
||||
model.Paging.PageLength = 12;
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
@@ -357,15 +357,15 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
private void PopulateRequestPasswordEmailBody(SaEmailData emailData, SaxUserAccount userAccount)
|
||||
{
|
||||
// Will need to handle culture (language/country) as and when introduced.
|
||||
emailData.MessageBody = SaxResourceHelper.GetTextResource(SaxResourceHelper.TextResource.Email_RequestPassword_Html);
|
||||
emailData.MessageBody = SaxResourceHelper.GetTextResource(SaxResourceHelper.TextResource.Email_Security_RequestPassword_Html);
|
||||
emailData.HtmlBody = true;
|
||||
|
||||
// Replace dynamic tags.
|
||||
EmailConsole.ReplaceDynamicEmailBodyTags(emailData, null, userAccount);
|
||||
|
||||
// Replace dynamic tag for link back to change password page.
|
||||
SaEmailConsole.ReplaceDynamicEmailTag(emailData, "[#Link.RequestPassword]", GenerateRequestPasswordLink(userAccount.Id, userAccount.EmailAddress, ""));
|
||||
SaEmailConsole.ReplaceDynamicEmailTag(emailData, "[#Link.ExpiresMinutes]", GetRequestPasswordEmailLinkExpiresMinutes().ToString());
|
||||
SaEmailConsole.ReplaceDynamicEmailTag(emailData, "[#Link.RequestPassword]", GenerateRequestPasswordLink(this, userAccount.Id, userAccount.EmailAddress, "", GetRedirectLocation(RedirectLocation.WebAppBase)));
|
||||
SaEmailConsole.ReplaceDynamicEmailTag(emailData, "[#Link.ExpiresMinutes]", GetRequestPasswordEmailLinkExpiresMinutes(this).ToString());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -380,21 +380,21 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
private static String Base64Key_RequestPassword { get; } = SacsEncryptionHelper.EncodePlainKey("{~Saxonite@@Request^Password=}", SacsEncryptionHelper.KeyLength);
|
||||
private static String Base64IV_RequestPassword_Generated { get; } = SacsEncryptionHelper.InitSymmetricEncryptionIV(Base64Key_RequestPassword);
|
||||
private static String Base64IV_RequestPassword { get; } = "1VAWYTW6d72n/6HDNhbqow==";
|
||||
private String GenerateRequestPasswordLink(SysId userAccountId, String emailAddress, String requestPasswordToken)
|
||||
internal static String GenerateRequestPasswordLink(SaxController_Admin controller, SysId userAccountId, String emailAddress, String requestPasswordToken, String baseUrl)
|
||||
{
|
||||
NameValueCollection parameters = new NameValueCollection();
|
||||
parameters.Add(ParamName_UserAccountId, SysId.ToString(userAccountId));
|
||||
parameters.Add(ParamName_EmailAddress, emailAddress);
|
||||
parameters.Add(ParamName_ExpiresAt, DateUtil.Format(DateTime.Now.AddMinutes(GetRequestPasswordEmailLinkExpiresMinutes()), DateUtil.Format_XmlDateTime));
|
||||
parameters.Add(ParamName_ExpiresAt, DateUtil.Format(DateTime.Now.AddMinutes(GetRequestPasswordEmailLinkExpiresMinutes(controller)), DateUtil.Format_XmlDateTime));
|
||||
parameters.Add(ParamName_Token, requestPasswordToken);
|
||||
String link =
|
||||
GetRedirectLocation(RedirectLocation.WebAppBase) + "Security/ChangePassword?" +
|
||||
ParamName_RequestPasswordEncrypted + "=" + HttpUtility.UrlEncode(EncryptParameters(parameters, Base64IV_RequestPassword, Base64Key_RequestPassword));
|
||||
baseUrl + "Security/ChangePassword?" +
|
||||
ParamName_RequestPasswordEncrypted + "=" + HttpUtility.UrlEncode(controller.EncryptParameters(parameters, Base64IV_RequestPassword, Base64Key_RequestPassword));
|
||||
return link;
|
||||
}
|
||||
private int GetRequestPasswordEmailLinkExpiresMinutes()
|
||||
internal static int GetRequestPasswordEmailLinkExpiresMinutes(SaxController_Admin controller)
|
||||
{
|
||||
int expiresMinutes = SessionConfig.Security.SignIn.PasswordRequest.EmailLinkExpiresMins;
|
||||
int expiresMinutes = controller.SessionConfig.Security.SignIn.PasswordRequest.EmailLinkExpiresMins;
|
||||
int expiresMinutes_Min = Sax.Config.Security.SignIn.PasswordRequest.EmailLinkExpiresMins_Min;
|
||||
int expiresMinutes_Max = Sax.Config.Security.SignIn.PasswordRequest.EmailLinkExpiresMins_Max;
|
||||
return Math.Max(expiresMinutes_Min, Math.Min(expiresMinutes_Max, expiresMinutes));
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
SaxSport.Params prmSport = new SaxSport.Params();
|
||||
prmSport.SportFilter = model.Filter.Sport;
|
||||
prmSport.StatusCat = SaxSport.StatusCat.NotDeleted;
|
||||
model.DataItemTotal = (ulong)ReferenceMgr.GetSportCount(prmSport);
|
||||
model.Paging.ItemTotal = (ulong)ReferenceMgr.GetSportCount(prmSport);
|
||||
model.PopulatePagingTo(prmSport.ResultsPaging);
|
||||
|
||||
// Item columns.
|
||||
@@ -94,12 +94,10 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
prmSport.SortColumns.Add(colName);
|
||||
|
||||
// Query items.
|
||||
model.DataItemCount = 0;
|
||||
using (DbResultSet resultSet = ReferenceMgr.ExecuteSportQuery(columns, prmSport))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
model.DataItemCount++;
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
SportData_List sportData = new SportData_List()
|
||||
{
|
||||
@@ -111,11 +109,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
responseData.Sports.Add(sportData);
|
||||
}
|
||||
}
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Sports.Count;
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,11 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (!ValidUserSession)
|
||||
return RedirectToAction("", "");
|
||||
|
||||
// Paging.
|
||||
Model_Sport model = new Model_Sport(Localiser);
|
||||
model.Paging.PageNo = 1;
|
||||
model.Paging.PageLength = 12;
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
SaxUserAccount.Params prmUserAccount = new SaxUserAccount.Params();
|
||||
prmUserAccount.UserAccountFilter = model.Filter.User;
|
||||
prmUserAccount.StatusCat = SaxUserAccount.StatusCat.NotDeleted;
|
||||
model.DataItemTotal = (ulong)AccountMgr.GetUserAccountCount(prmUserAccount);
|
||||
model.Paging.ItemTotal = (ulong)AccountMgr.GetUserAccountCount(prmUserAccount);
|
||||
model.PopulatePagingTo(prmUserAccount.ResultsPaging);
|
||||
|
||||
// Item columns.
|
||||
@@ -137,12 +137,10 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
};
|
||||
|
||||
// Query items.
|
||||
model.DataItemCount = 0;
|
||||
using (DbResultSet resultSet = AccountMgr.ExecuteUserAccountQuery(columns, prmUserAccount))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
model.DataItemCount++;
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
UserData_List userData = new UserData_List()
|
||||
{
|
||||
@@ -160,6 +158,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
responseData.Users.Add(userData);
|
||||
}
|
||||
}
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Users.Count;
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
|
||||
@@ -29,7 +29,11 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (!ValidUserSession)
|
||||
return RedirectToAction("", "");
|
||||
|
||||
// Paging.
|
||||
Model_User model = new Model_User(Localiser);
|
||||
model.Paging.PageNo = 1;
|
||||
model.Paging.PageLength = 12;
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -33,6 +34,9 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
public String Organisation { get; set; }
|
||||
public String OrganisationTypeCode { get; set; }
|
||||
public String OrganisationCategoryCode { get; set; }
|
||||
public String OrganisationSportId { get; set; }
|
||||
public String OrganisationRegionId { get; set; }
|
||||
public String OrganisationStatusCategoryCode { get; set; }
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
public Sax.OrganisationType FilterOrganisationType
|
||||
@@ -43,6 +47,25 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
{
|
||||
get { return (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(Filter.OrganisationCategoryCode); }
|
||||
}
|
||||
public SaxOrganisation.StatusCat FilterOrganisationStatusCategory
|
||||
{
|
||||
get { return EnumUtil.ParseEnum(Filter.OrganisationStatusCategoryCode, SaxOrganisation.StatusCat.Any); }
|
||||
}
|
||||
/// <summary>Organisation Status Categories for filter.</summary>
|
||||
public IEnumerable<SelectListItem> OrganisationFilterStatusCategoriesForSelect
|
||||
{
|
||||
get
|
||||
{
|
||||
List<CodeDesc> statusCategories = new List<CodeDesc>();
|
||||
statusCategories.Add(SaxOrganisation.StatusCat.Any.ToString(), Localiser["label.any"]);
|
||||
statusCategories.Add(SaxOrganisation.StatusCat.AwaitingOnly.ToString(), "Awaiting");
|
||||
statusCategories.Add(SaxOrganisation.StatusCat.ActiveOnly.ToString(), "Active");
|
||||
statusCategories.Add(SaxOrganisation.StatusCat.InactiveOnly.ToString(), "Inactive");
|
||||
statusCategories.Add(SaxOrganisation.StatusCat.NotDeleted.ToString(), "Not deleted");
|
||||
statusCategories.Add(SaxOrganisation.StatusCat.DeletedOnly.ToString(), "Deleted");
|
||||
return new SelectList(statusCategories, "Code", "Desc", SaxOrganisation.StatusCat.Any.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation properties.
|
||||
@@ -62,9 +85,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
// Utilities.
|
||||
public bool IsSportMandatory()
|
||||
{
|
||||
if (OrganisationCategory == Sax.OrganisationCategory.Club) return true;
|
||||
if (OrganisationCategory == Sax.OrganisationCategory.Association) return true;
|
||||
return false;
|
||||
return SaxOrganisation.IsSportMandatory(OrganisationCategory);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
// User Account.
|
||||
if (MemberUserAccountId != null)
|
||||
{
|
||||
SysId memberUserAccountId = new SysId(StringUtil.ToLong(MemberUserAccountId));
|
||||
SysId memberUserAccountId = MemberUserAccountId.ToSysId();
|
||||
if (!SysId.IsValid(memberUserAccountId))
|
||||
responseData.SetControlError(nameof(MemberUserAccountId), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
@@ -144,6 +144,9 @@
|
||||
<data name="label.accounts" xml:space="preserve">
|
||||
<value>Accounts</value>
|
||||
</data>
|
||||
<data name="label.any" xml:space="preserve">
|
||||
<value>Any</value>
|
||||
</data>
|
||||
<data name="label.cancel" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
@@ -156,6 +159,9 @@
|
||||
<data name="label.characters.one" xml:space="preserve">
|
||||
<value>1 character</value>
|
||||
</data>
|
||||
<data name="label.clear" xml:space="preserve">
|
||||
<value>Clear</value>
|
||||
</data>
|
||||
<data name="label.close" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
@@ -393,6 +399,9 @@
|
||||
<data name="organisation.caption.organisation" xml:space="preserve">
|
||||
<value>Organisation</value>
|
||||
</data>
|
||||
<data name="organisation.caption.organisation.activate" xml:space="preserve">
|
||||
<value>Activate Organisation</value>
|
||||
</data>
|
||||
<data name="organisation.caption.organisation.create" xml:space="preserve">
|
||||
<value>Create Organisation</value>
|
||||
</data>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="jQuery.UI.Combined" Version="1.12.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.13" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.16" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -10,22 +10,27 @@
|
||||
<div id="dlgSelectOrganisation" class="sax-dialog sax-form">
|
||||
|
||||
@* Filter *@
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmSelectOrganisationFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="sax-panel-filter">
|
||||
|
||||
<div class="sax-content">
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmSelectOrganisationFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["organisation.caption.organisation"]</div>
|
||||
<div class="col-sm-7"><input type="text" class="sax-input FilterOrganisation" name="Filter.Organisation" maxlength="32" /></div>
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["label.search"]</div>
|
||||
<div class="col-sm-7"><input type="search" class="sax-input FilterOrganisation" name="Filter.Organisation" autocomplete="off" maxlength="32" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col center">
|
||||
<partial name="~/Views/Common/ResultsPaging.cshtml" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="">
|
||||
|
||||
@* Organisations *@
|
||||
|
||||
@@ -5,38 +5,123 @@
|
||||
ViewData["Title"] = "Organisations";
|
||||
}
|
||||
|
||||
<div class="">
|
||||
<div class="sax-page-organisations">
|
||||
|
||||
<script type="text/javascript">
|
||||
sax.lbl.edit = 'Edit';
|
||||
sax.lbl.activate = 'Activate';
|
||||
</script>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-5 row">
|
||||
|
||||
<div class="col">
|
||||
|
||||
@* Filter Panel *@
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOrganisationFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="sax-panel-filter">
|
||||
<div class="sax-header row">
|
||||
@* Header - Page caption, paging controls, actions. *@
|
||||
<div class="sax-header">
|
||||
<div class="row">
|
||||
<div class="col"><div class="sax-caption">@Localiser["organisation.caption.organisations"]</div></div>
|
||||
<div class="fixed row">
|
||||
<div class="col">
|
||||
<partial name="~/Views/Common/ResultsPaging.cshtml" />
|
||||
</div>
|
||||
<div class="fixed row">
|
||||
<div class="sax-action sax-results-refresh"><img src="~/img/action/refresh24.png" alt="@(Localiser["label.refresh"])" title="@(Localiser["label.refresh"])" /></div>
|
||||
<div class="sax-action sax-item-create"><img src="~/img/action/add24.png" alt="@(Localiser["label.create"])" title="@(Localiser["label.create"])" /></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOrganisationFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@* Organisation filter - name etc. *@
|
||||
<div class="row pb4">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["label.search"]</div>
|
||||
<div class="col-sm-7">
|
||||
@Html.TextBoxFor(model => model.Filter.Organisation, new { @id = "", @class = "FilterOrganisation", @maxlength = "32" })
|
||||
</div>
|
||||
</div>
|
||||
@* Organisation Category *@
|
||||
<div class="row pb4">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["label.category"]</div>
|
||||
<div class="col-sm-7">
|
||||
@Html.DropDownListFor(model => model.Filter.OrganisationCategoryCode, Model.OrganisationCategoriesForSelect, Localiser["label.any"], new { @id = "", @class = "FilterOrganisationCategory sax-select" })
|
||||
</div>
|
||||
</div>
|
||||
@* Organisation sport *@
|
||||
<div class="row pb4">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["label.sport"]</div>
|
||||
<div class="col-sm-7">
|
||||
<div class="row">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["organisation.caption.organisation"]</div>
|
||||
<div class="col-sm-7">@Html.TextBoxFor(model => model.Filter.Organisation, new { @id = "ifFilterOrganisation", @class = "FilterOrganisation", @maxlength = "32" })</div>
|
||||
@Html.HiddenFor(model => model.Filter.OrganisationSportId, new { @id = "", @class = "FilterOrganisationSportId" })
|
||||
<div class="col"><input type="text" class="FilterOrganisationSportCaption sax-input" readonly="readonly" ondblclick="sax.selectFilterSport()" /> </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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* Organisation region *@
|
||||
<div class="row pb4">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["label.region"]</div>
|
||||
<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" ondblclick="sax.selectFilterRegion()" /> </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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* Organisation Status *@
|
||||
<div class="row pb4">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["label.status"]</div>
|
||||
<div class="col-sm-7">
|
||||
@Html.DropDownListFor(model => model.Filter.OrganisationStatusCategoryCode, Model.OrganisationFilterStatusCategoriesForSelect, new { @id = "", @class = "FilterOrganisationStatusCategory sax-select" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@* Separate filter from results when alondside each other. *@
|
||||
<div class="fixed"><div class="d-none d-md-block" style="width:8px;"></div></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-7">
|
||||
|
||||
@* Results Panel *@
|
||||
<div class="sax-panel-results">
|
||||
<div class="sax-panel-messages"></div>
|
||||
<div class="sax-panel-item-list"></div>
|
||||
|
||||
@* element templates *@
|
||||
<div class="sax-panel-item-template">
|
||||
@* Organisation item template *@
|
||||
<div class="sax-panel-item Organisation">
|
||||
<div class="sax-header row">
|
||||
<div class="col">
|
||||
<div class="sax-caption"><div class="sax-action OrganisationName">Organisation name</div></div>
|
||||
@* Organisation caption *@
|
||||
<div class="sax-caption"><div class="sax-action sax-item-update OrganisationName">Organisation name</div></div>
|
||||
</div>
|
||||
<div class="fixed sax-actions">
|
||||
<div class="fixed sax-action sax-item-update"><img src="~/img/action/edit24.png" alt="@(Localiser["label.update"])" title="@(Localiser["label.update"])" /></div>
|
||||
@* 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">
|
||||
@@ -52,9 +137,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@* Burger dropdown item template - ul is ignored *@
|
||||
<ul class="sax-dropdown-menu Organisation">
|
||||
<li class="sax-dropdown-item sax-action"><div class="sax-label">XXX</div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<partial name="Panel-OrganisationDialog.cshtml" />
|
||||
|
||||
@@ -7,17 +7,20 @@
|
||||
|
||||
<div class="">
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmMemberFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="sax-panel-filter OrganisationMembers">
|
||||
<div class="sax-header row">
|
||||
<div class="col"><div class="sax-caption">@Localiser["organisation.caption.members"]</div></div>
|
||||
<div class="fixed row">
|
||||
<div>
|
||||
<partial name="~/Views/Common/ResultsPaging.cshtml" />
|
||||
</div>
|
||||
<div class="fixed sax-action sax-results-refresh"><img src="~/img/action/refresh24.png" alt="@(Localiser["label.refresh"])" title="@(Localiser["label.refresh"])" /></div>
|
||||
<div class="fixed sax-action sax-item-create"><img src="~/img/action/add24.png" alt="@(Localiser["label.create"])" title="@(Localiser["label.create"])" /></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmMemberFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-3 sax-label text-left text-sm-right">@Localiser["organisation.caption.organisation"]</div>
|
||||
<div class="col-sm-9">
|
||||
@@ -30,9 +33,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-results">
|
||||
<div class="sax-panel-messages"></div>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
@model Model_Organisation
|
||||
@inject SaxLocaliser Localiser
|
||||
@{
|
||||
/* Organisations - Organisation dialog panel */
|
||||
}
|
||||
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
<div id="dlgOrganisationActivation" class="sax-dialog" title="@Localiser.GetJavascriptText("organisation.caption.organisation.activate")">
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOrganisationActivation", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
@Html.HiddenFor(model => model.OrganisationId, new { @id = "", @class = "OrganisationId" })
|
||||
|
||||
<div>Introduction</div>
|
||||
|
||||
<div>Organisation details.</div>
|
||||
|
||||
<div>Members awaiting activation.</div>
|
||||
|
||||
}
|
||||
|
||||
<partial name="~/Views/Common/SelectItem.cshtml" />
|
||||
|
||||
</div>
|
||||
@@ -31,6 +31,25 @@
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Organisation category *@
|
||||
<div class="sax-form-control OrganisationCategory pr4">
|
||||
<div class="sax-label">
|
||||
<label for="cbOrganisationCategory"><span><span class="required">*</span> @Localiser["label.category"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.DropDownListFor(model => model.OrganisationCategoryValue, Model.OrganisationCategoriesForSelect, Localiser["label.select"], new { @id = "cbOrganisationCategory", @class = "OrganisationCategory sax-select" })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Organisation type *@
|
||||
<div class="sax-form-control OrganisationType">
|
||||
<div class="sax-label">
|
||||
@@ -42,15 +61,8 @@
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation category *@
|
||||
<div class="sax-form-control OrganisationCategory">
|
||||
<div class="sax-label">
|
||||
<label for="cbOrganisationCategory"><span><span class="required">*</span> @Localiser["label.category"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.DropDownListFor(model => model.OrganisationCategoryValue, Model.OrganisationCategoriesForSelect, Localiser["label.select"], new { @id = "cbOrganisationCategory", @class = "OrganisationCategory sax-select" })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
|
||||
</div>
|
||||
|
||||
@* Organisation sport *@
|
||||
@@ -93,5 +105,6 @@
|
||||
}
|
||||
|
||||
<partial name="~/Views/Common/SelectItem.cshtml" />
|
||||
<partial name="Panel-ActivationDialog.cshtml" />
|
||||
|
||||
</div>
|
||||
|
||||
@@ -7,24 +7,27 @@
|
||||
|
||||
<div class="">
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmSportFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="sax-panel-filter">
|
||||
<div class="sax-header row">
|
||||
<div class="col"><div class="sax-caption">@Localiser["sport.caption.sports"]</div></div>
|
||||
<div class="fixed row">
|
||||
<div>
|
||||
<partial name="~/Views/Common/ResultsPaging.cshtml" />
|
||||
</div>
|
||||
<div class="sax-action sax-results-refresh"><img src="~/img/action/refresh24.png" alt="@(Localiser["label.refresh"])" title="@(Localiser["label.refresh"])" /></div>
|
||||
<div class="sax-action sax-item-create"><img src="~/img/action/add24.png" alt="@(Localiser["label.create"])" title="@(Localiser["label.create"])" /></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmSportFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["sport.caption.sport"]</div>
|
||||
<div class="col-sm-7">@Html.TextBoxFor(model => model.Filter.Sport, new { @id = "ifFilterSport", @class = "FilterSport", @maxlength = "32" })</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-results">
|
||||
<div class="sax-panel-messages"></div>
|
||||
|
||||
@@ -7,24 +7,27 @@
|
||||
|
||||
<div class="">
|
||||
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmUserFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="sax-panel-filter">
|
||||
<div class="sax-header row">
|
||||
<div class="col"><div class="sax-caption">@Localiser["user.caption.users"]</div></div>
|
||||
<div class="fixed row">
|
||||
<div>
|
||||
<partial name="~/Views/Common/ResultsPaging.cshtml" />
|
||||
</div>
|
||||
<div class="sax-action sax-results-refresh"><img src="~/img/action/refresh24.png" alt="@(Localiser["label.refresh"])" title="@(Localiser["label.refresh"])" /></div>
|
||||
<div class="sax-action sax-item-create"><img src="~/img/action/add24.png" alt="@(Localiser["label.create"])" title="@(Localiser["label.create"])" /></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sax-content">
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmUserFilter", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-5 sax-label text-left text-sm-right">@Localiser["user.caption.user"]</div>
|
||||
<div class="col-sm-7">@Html.TextBoxFor(model => model.Filter.User, new { @id = "ifFilterUser", @class = "FilterUser", @maxlength = "32" })</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sax-panel-results">
|
||||
<div class="sax-panel-messages"></div>
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
"Saxonite-Dev": {
|
||||
"Environments": [ "Development" ],
|
||||
"Instance": "Dev",
|
||||
"URLs": {
|
||||
"Online": {
|
||||
"Root": "https://localhost:44351/"
|
||||
}
|
||||
},
|
||||
"CoreDatabase": {
|
||||
"Location": "MsSql:Sarand107\\SQL2016.Saxonite_Dev",
|
||||
"User": "saxonite",
|
||||
@@ -33,7 +38,7 @@
|
||||
"Context": "SAX-SF-Dev",
|
||||
"ContactUs": {
|
||||
"AddressesTo": [ "qc@solumforti.com" ],
|
||||
"AddressesBcc": [ ]
|
||||
"AddressesBcc": []
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
"SAX-Prod": {
|
||||
"Environments": [ "Production" ],
|
||||
"Instance": "",
|
||||
"URLs": {
|
||||
"Online": {
|
||||
"Root": "https://sarand.cloudapp.net:55443/"
|
||||
}
|
||||
},
|
||||
"CoreDatabase": {
|
||||
"Location": "MsSql:.\\SQLExpress2012.Saxonite_Core_Demo",
|
||||
"User": "sax-demo-user",
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
.sax-panel-filter
|
||||
{
|
||||
margin: 8px auto;
|
||||
border: solid 2px #979797;
|
||||
background-color: #f8f8f8;
|
||||
border: solid 1px #979797;
|
||||
border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
-moz-border-radius: 6px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@media (min-width: 576px)
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
.sax-panel-filter .sax-header
|
||||
{
|
||||
padding: 2px 8px;
|
||||
padding: 1px 8px 2px 8px;
|
||||
min-height: 24px;
|
||||
color: #f0f0f0;
|
||||
background-color: #979797;
|
||||
@@ -52,6 +52,7 @@
|
||||
{
|
||||
margin: 4px 8px;
|
||||
padding: 4px 8px;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
.sax-panel-filter .sax-content .sax-label
|
||||
@@ -64,8 +65,8 @@
|
||||
.sax-panel-filter .sax-content input[type="text"],
|
||||
.sax-panel-filter .sax-content select
|
||||
{
|
||||
min-width:75%;
|
||||
max-width:90%;
|
||||
min-width: 75%;
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
.sax-panel-filter .sax-content .sax-button
|
||||
@@ -132,7 +133,7 @@
|
||||
.sax-panel-item
|
||||
{
|
||||
margin: 8px auto;
|
||||
border: solid 2px #979797;
|
||||
border: solid 1px #979797;
|
||||
border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
-moz-border-radius: 6px;
|
||||
@@ -193,4 +194,31 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Item statuses */
|
||||
|
||||
.sax-status-awa
|
||||
{
|
||||
color: darkorange;
|
||||
}
|
||||
|
||||
.sax-status-atv
|
||||
{
|
||||
color: green;
|
||||
}
|
||||
|
||||
.sax-status-ina
|
||||
{
|
||||
color: darkred;
|
||||
}
|
||||
|
||||
.sax-status-hld
|
||||
{
|
||||
color: dodgerblue;
|
||||
}
|
||||
|
||||
.sax-status-del
|
||||
{
|
||||
color: purple;
|
||||
}
|
||||
|
||||
/* The End */
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
|
||||
.sax-form .sax-input.sax-calendar
|
||||
{
|
||||
max-width:180px;
|
||||
max-width: 180px;
|
||||
}
|
||||
|
||||
.sax-form .sax-textarea, .sax-form .sax-select[multiple="multiple"]
|
||||
|
||||
@@ -39,7 +39,31 @@ body
|
||||
|
||||
body > .container
|
||||
{
|
||||
padding: 0 1%;
|
||||
padding: 0 0.5%;
|
||||
}
|
||||
|
||||
@media (min-width: 992px)
|
||||
{
|
||||
.container
|
||||
{
|
||||
max-width: 1200px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px)
|
||||
{
|
||||
.container
|
||||
{
|
||||
max-width: 1200px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 576px)
|
||||
{
|
||||
.container
|
||||
{
|
||||
max-width: 1200px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sticky footer styles */
|
||||
@@ -61,7 +85,7 @@ body
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
padding:0 2%;
|
||||
padding: 0 2%;
|
||||
white-space: nowrap;
|
||||
/* Set the fixed height of the footer here */
|
||||
height: 60px;
|
||||
@@ -265,6 +289,14 @@ a:focus
|
||||
background: rgba(250,250,250,.25) url('../img/animated/InProgress-01.gif') 50% 50% no-repeat;
|
||||
}
|
||||
|
||||
/* Drop down menus */
|
||||
|
||||
.dropdown-toggle.caret-off::before,
|
||||
.dropdown-toggle.caret-off::after
|
||||
{
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Dialogs */
|
||||
.sax-dialog
|
||||
{
|
||||
|
||||
@@ -114,6 +114,15 @@
|
||||
var sel = $(':selected', $sel).length;
|
||||
$('.sax-select-items-selected', $sel.closest('.sax-form-control')).text(sel == 0 ? sax.lbl.noneSelected : sax.lbl.numberSelected.replace(/\{0\}/g, sel));
|
||||
}
|
||||
sax.initCalendars = function (sel)
|
||||
{
|
||||
return $(sel).datepicker();
|
||||
}
|
||||
sax.refreshPaging = function (response, context, refreshFn)
|
||||
{
|
||||
if (sax.resultsPaging.fn.refreshPaging)
|
||||
sax.resultsPaging.fn.refreshPaging(response.paging, context, refreshFn);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// Page navigation.
|
||||
@@ -190,7 +199,7 @@
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { $(this).dialog('close'); if (onOk) onOk(); };
|
||||
sax.$dlg.alert = $('<div id="dlgAlert"><div id="dlgAlertMsg"></div></div>').dialog(opt);
|
||||
}
|
||||
$('#dlgAlertMsg', sax.$dlg.alert).html(msg.replace("\n","<br>"));
|
||||
$('#dlgAlertMsg', sax.$dlg.alert).html(msg.replace("\n", "<br>"));
|
||||
sax.$dlg.alert.dialog('option', { title: title || sax.dlg.title.alert });
|
||||
sax.openDialog(sax.$dlg.alert);
|
||||
}
|
||||
@@ -494,6 +503,19 @@
|
||||
sax.configureKeepLoggedIn();
|
||||
else if (!sax.awaitingLogin)
|
||||
sax.configureSessionRefresh();
|
||||
|
||||
$.datepicker.setDefaults({
|
||||
showOn: 'both',
|
||||
buttonImageOnly: true,
|
||||
buttonImage: '../img/action/calendar32.png',
|
||||
buttonText: sax.lbl.calendar,
|
||||
dateFormat: sax.form.calendarDateFormat,
|
||||
changeMonth: true,
|
||||
changeYear: false,
|
||||
yearRange: '-14:+01',
|
||||
firstDay: 1,
|
||||
//defaultDate: 0,
|
||||
});
|
||||
});
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
@@ -6,29 +6,37 @@
|
||||
{
|
||||
"use strict";
|
||||
sax.itemIdPrefix = 'Itm_';
|
||||
var $results;
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.refreshResults = function (delay)
|
||||
{
|
||||
var $results = $('.sax-panel-results');
|
||||
if (!sax.awaitingRefreshResponse)
|
||||
{
|
||||
var $items = $('.sax-panel-item-list', $results).fadeOut(200).empty();
|
||||
var $msgs = $('.sax-panel-messages', $results).hide().empty().append($('<div class="sax-message">' + sax.msg.dataQuerying + '</div>')).fadeIn(200);
|
||||
}
|
||||
sax.ajaxRefreshResults = sax.ajaxRefreshResults || { url: sax.url.base + 'Organisation/Ajax/GetList', formId: 'frmOrganisationFilter', callbackFn: sax.doRefreshResults };
|
||||
sax.doAjaxRequest(sax.ajaxRefreshResults, delay || 50);
|
||||
sax.ajax.refreshResults = sax.ajax.refreshResults || { url: sax.url.base + 'Organisation/Ajax/GetList', formId: 'frmOrganisationFilter', callbackFn: sax.doRefreshResults };
|
||||
sax.doAjaxRequest(sax.ajax.refreshResults, delay || 50);
|
||||
sax.awaitingRefreshResponse = true;
|
||||
}
|
||||
sax.getItemTemplate = function ()
|
||||
{
|
||||
return $('.sax-panel-item-template .sax-panel-item.Organisation', $results);
|
||||
}
|
||||
sax.getDropdownItemTemplate = function ()
|
||||
{
|
||||
return $('.sax-panel-item-template .sax-dropdown-menu.Organisation li.sax-dropdown-item', $results);
|
||||
}
|
||||
sax.doRefreshResults = function (response)
|
||||
{
|
||||
//sax.debug('doRefreshResults', response);
|
||||
delete sax.awaitingRefreshResponse;
|
||||
sax.refreshControlValues(response.controlValues);
|
||||
var $results = $('.sax-panel-results');
|
||||
var $msgs = $('.sax-panel-messages', $results).hide().empty();
|
||||
var $items = $('.sax-panel-item-list', $results).hide().empty();
|
||||
var $tmpl = $('.sax-panel-item-template .sax-panel-item.Organisation', $results);
|
||||
var $tmpl = sax.getItemTemplate();
|
||||
sax.refreshPaging(response, '#frmOrganisationFilter', sax.refreshResults);
|
||||
if (!response.success) return;
|
||||
// Reference data - Statuses.
|
||||
if (response.defaultStatusCode) sax.data.defaultStatusCode = response.defaultStatusCode;
|
||||
@@ -57,10 +65,20 @@
|
||||
$('.OrganisationSport', $item).text(item.sportName);
|
||||
$('.OrganisationRegion', $item).text(item.regionName);
|
||||
$('.OrganisationMemberCount', $item).on('click', function () { sax.onClickMemberCount(item.id); }).find('.MemberCount').text(item.memberCount);
|
||||
$('.StatusDesc', $item).text(item.statusDesc);
|
||||
$('.sax-caption .sax-action, .sax-actions .sax-action.sax-item-update', $item).off('click').on('click', function () { sax.updateItem(item.id) })
|
||||
$item.off('dblclick').on('dblclick', function () { sax.updateItem(item.id) })
|
||||
$('.sax-panel-results .sax-panel-messages').hide().empty();
|
||||
$('.StatusDesc', $item).text(item.statusDesc).addClass('sax-status-' + item.statusCode.toLowerCase());
|
||||
$('.sax-caption .sax-action').toggleClass('sax-action', !item.deleted);
|
||||
if (!item.deleted)
|
||||
{
|
||||
let $mnu = $('ul.sax-dropdown-menu', $item);
|
||||
$mnu.append(sax.getDropdownItemTemplate().clone().find('div.sax-label').text(sax.lbl.edit).end().on('click', function () { sax.updateItem(item.id) }));
|
||||
if (item.awaiting)
|
||||
$mnu.append(sax.getDropdownItemTemplate().clone().find('div.sax-label').text(sax.lbl.activate).end().on('click', function () { sax.activateItem(item.id) }));
|
||||
$('.sax-header .sax-action.sax-item-update', $item).off('click').on('click', function () { sax.updateItem(item.id) });
|
||||
$item.off('dblclick').on('dblclick', function () { sax.updateItem(item.id) });
|
||||
}
|
||||
$('.sax-burger', $item).toggle(!!$('.sax-burger .sax-dropdown-menu .sax-dropdown-item', $item).length);
|
||||
$('.sax-panel-messages', $results).hide().empty();
|
||||
return $item;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -74,8 +92,8 @@
|
||||
sax.data.sports = response.sports;
|
||||
sax.showSelectSport();
|
||||
}
|
||||
sax.ajaxSports = sax.ajaxSports || { url: sax.url.base + 'Sport/Ajax/GetList', formId: 'frmNavigate', callbackFn: handleSportsResponse };
|
||||
sax.doAjaxRequest(sax.ajaxSports, 50);
|
||||
sax.ajax.sports = sax.ajax.sports || { url: sax.url.base + 'Sport/Ajax/GetList', formId: 'frmNavigate', callbackFn: handleSportsResponse };
|
||||
sax.doAjaxRequest(sax.ajax.sports, 50);
|
||||
}
|
||||
else sax.showSelectSport();
|
||||
}
|
||||
@@ -83,15 +101,48 @@
|
||||
{
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectSport, items: sax.data.sports, fnCallback: sax.onSportSelected });
|
||||
}
|
||||
sax.onSportSelected = function (rgn)
|
||||
sax.onSportSelected = function (spt)
|
||||
{
|
||||
//sax.debug('onSportSelected', rgn);
|
||||
let $frm = sax.$frm.organisation;
|
||||
$('.OrganisationSportId', $frm).val(rgn.id);
|
||||
$('.OrganisationSportCaption', $frm).val(rgn.name);
|
||||
$('.OrganisationSportId', $frm).val(spt.id);
|
||||
$('.OrganisationSportCaption', $frm).val(spt.name);
|
||||
sax.clearControlError($('.OrganisationSportCaption', $frm));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectFilterSport = function ()
|
||||
{
|
||||
if (!sax.data.sports)
|
||||
{
|
||||
let handleFilterSportsResponse = function (response)
|
||||
{
|
||||
if (response && response.success && response.sports)
|
||||
sax.data.sports = response.sports;
|
||||
sax.showSelectFilterSport();
|
||||
}
|
||||
sax.ajax.filterSports = sax.ajax.filterSports || { url: sax.url.base + 'Sport/Ajax/GetList', formId: 'frmNavigate', callbackFn: handleFilterSportsResponse };
|
||||
sax.doAjaxRequest(sax.ajax.filterSports, 50);
|
||||
}
|
||||
else sax.showSelectFilterSport();
|
||||
}
|
||||
sax.showSelectFilterSport = function ()
|
||||
{
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectSport, items: sax.data.sports, fnCallback: sax.onFilterSportSelected });
|
||||
}
|
||||
sax.onFilterSportSelected = function (spt)
|
||||
{
|
||||
//sax.debug('onFilterSportSelected', sax.$frm.filter)
|
||||
let $frm = sax.$frm.filter;
|
||||
$('.FilterOrganisationSportId', $frm).val(spt.id);
|
||||
$('.FilterOrganisationSportCaption', $frm).val(spt.name);
|
||||
sax.refreshResults();
|
||||
}
|
||||
sax.clearFilterSport = function ()
|
||||
{
|
||||
$('.FilterOrganisationSportId,.FilterOrganisationSportCaption', sax.$frm.filter).val('');
|
||||
sax.refreshResults();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectRegion = function ()
|
||||
{
|
||||
@@ -103,8 +154,8 @@
|
||||
sax.data.regions = response.regions;
|
||||
sax.showSelectRegion();
|
||||
}
|
||||
sax.ajaxRegions = sax.ajaxRegions || { url: sax.url.base + 'Region/Ajax/GetList', formId: 'frmNavigate', callbackFn: handleRegionsResponse };
|
||||
sax.doAjaxRequest(sax.ajaxRegions, 50);
|
||||
sax.ajax.regions = sax.ajax.regions || { url: sax.url.base + 'Region/Ajax/GetList', formId: 'frmNavigate', callbackFn: handleRegionsResponse };
|
||||
sax.doAjaxRequest(sax.ajax.regions, 50);
|
||||
}
|
||||
else sax.showSelectRegion();
|
||||
}
|
||||
@@ -121,6 +172,40 @@
|
||||
sax.clearControlError($('.OrganisationRegionCaptionCountry', $frm));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectFilterRegion = function ()
|
||||
{
|
||||
if (!sax.data.regions)
|
||||
{
|
||||
let handleFilterRegionsResponse = function (response)
|
||||
{
|
||||
if (response && response.success && response.regions)
|
||||
sax.data.regions = response.regions;
|
||||
sax.showSelectFilterRegion();
|
||||
}
|
||||
sax.ajax.regions = sax.ajax.regions || { url: sax.url.base + 'Region/Ajax/GetList', formId: 'frmNavigate', callbackFn: handleFilterRegionsResponse };
|
||||
sax.doAjaxRequest(sax.ajax.regions, 50);
|
||||
}
|
||||
else sax.showSelectFilterRegion();
|
||||
}
|
||||
sax.showSelectFilterRegion = function ()
|
||||
{
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectFilterRegion, items: sax.data.regions, fnCallback: sax.onFilterRegionSelected });
|
||||
}
|
||||
sax.onFilterRegionSelected = function (rgn)
|
||||
{
|
||||
//sax.debug('onFilterRegionSelected', rgn);
|
||||
let $frm = sax.$frm.filter;
|
||||
$('.FilterOrganisationRegionId', $frm).val(rgn.id);
|
||||
$('.FilterOrganisationRegionCaption', $frm).val(rgn.name);
|
||||
sax.refreshResults();
|
||||
}
|
||||
sax.clearFilterRegion = function ()
|
||||
{
|
||||
$('.FilterOrganisationRegionId,.FilterOrganisationRegionCaption', sax.$frm.filter).val('');
|
||||
sax.refreshResults();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.createItem = function ()
|
||||
{
|
||||
@@ -140,8 +225,8 @@
|
||||
sax.updateItem = function (id)
|
||||
{
|
||||
$('.OrganisationId', sax.$frm.organisationId).val(id);
|
||||
sax.ajaxUpdateItem = sax.ajaxUpdateItem || { url: sax.url.base + 'Organisation/Ajax/GetItem', formId: 'frmOrganisationId', callbackFn: sax.onUpdateItem };
|
||||
sax.doAjaxRequest(sax.ajaxUpdateItem, 50);
|
||||
sax.ajax.updateItem = sax.ajax.updateItem || { url: sax.url.base + 'Organisation/Ajax/GetItem', formId: 'frmOrganisationId', callbackFn: sax.onUpdateItem };
|
||||
sax.doAjaxRequest(sax.ajax.updateItem, 50);
|
||||
}
|
||||
sax.onUpdateItem = function (response)
|
||||
{
|
||||
@@ -171,8 +256,8 @@
|
||||
//--------------------------------------------------------------
|
||||
sax.storeItem = function ()
|
||||
{
|
||||
sax.ajaxStoreItem = sax.ajaxStoreItem || { url: sax.url.base + 'Organisation/Ajax/StoreItem', formId: 'frmOrganisation', callbackFn: sax.onStoreItem };
|
||||
sax.doAjaxRequest(sax.ajaxStoreItem, 50);
|
||||
sax.ajax.storeItem = sax.ajax.storeItem || { url: sax.url.base + 'Organisation/Ajax/StoreItem', formId: 'frmOrganisation', callbackFn: sax.onStoreItem };
|
||||
sax.doAjaxRequest(sax.ajax.storeItem, 50);
|
||||
}
|
||||
sax.onStoreItem = function (response)
|
||||
{
|
||||
@@ -185,11 +270,31 @@
|
||||
var $item = $('#' + sax.itemIdPrefix + item.id);
|
||||
if (!$item.length)
|
||||
{
|
||||
var $results = $('.sax-panel-results');
|
||||
$item = $('.sax-panel-item-template .sax-panel-item.Organisation', $results).clone();
|
||||
$('.sax-panel-item-list', $results).prepend($item).show();
|
||||
}
|
||||
sax.populateItem($item, item)
|
||||
$item.replaceWith(sax.populateItem(sax.getItemTemplate(), item));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.activateItem = function (id)
|
||||
{
|
||||
//sax.debug('activateItem(' + id + ')')
|
||||
$('.OrganisationId', sax.$frm.organisationId).val(id);
|
||||
sax.ajax.getActivationInfo = sax.ajax.getActivationInfo || { url: sax.url.base + 'Organisation/Ajax/GetActivationInfo', formId: 'frmOrganisationId', callbackFn: sax.showActivationInfo };
|
||||
sax.doAjaxRequest(sax.ajax.getActivationInfo, 50);
|
||||
}
|
||||
sax.showActivationInfo = function (response)
|
||||
{
|
||||
sax.debug('showActivationInfo', response);
|
||||
let $frm = $('#frmOrganisationActivation');
|
||||
|
||||
$('.OrganisationId', $frm).val($('.OrganisationId', sax.$frm.organisationId).val());
|
||||
sax.openDialog(sax.$dlg.activate, 480, 640);
|
||||
}
|
||||
sax.axctivateOrganisation = function ()
|
||||
{
|
||||
let $frm = $('#frmOrganisationActivation');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -207,19 +312,26 @@
|
||||
{
|
||||
$('.sax-panel-filter .sax-action.sax-item-create').on('click', function () { sax.createItem(); });
|
||||
$('.sax-panel-filter .sax-action.sax-results-refresh').on('click', function () { sax.refreshResults(); });
|
||||
$('.sax-input').on('input', function () { sax.clearControlError(this); });
|
||||
$('.sax-input, .sax-textarea').on('input', function () { sax.clearControlError(this); });
|
||||
$('.sax-select').on('change', function () { sax.clearControlError(this); });
|
||||
|
||||
sax.$frm.filter = $('#frmOrganisationFilter');
|
||||
$('.FilterOrganisation', sax.$frm.filter).on('input', function () { sax.refreshResults(250); });
|
||||
$('.FilterOrganisationCategory,.FilterOrganisationStatusCategory', sax.$frm.filter).on('change', function () { sax.refreshResults(50); });
|
||||
sax.$frm.organisationId = $('#frmOrganisationId');
|
||||
sax.$frm.organisation = $('#frmOrganisation');
|
||||
$results = $('.sax-panel-results');
|
||||
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { sax.doCreateItem(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
sax.$dlg.organisation = $('#dlgOrganisation').dialog(opt);
|
||||
|
||||
var opt = sax.dlgOpts();
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { sax.axctivateOrganisation(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
|
||||
sax.$dlg.activate = $('#dlgOrganisationActivation').dialog(opt);
|
||||
|
||||
setTimeout(sax.refreshResults, 250);
|
||||
});
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
var $msgs = $('.sax-panel-messages', $results).hide().empty();
|
||||
var $items = $('.sax-panel-item-list', $results).hide().empty();
|
||||
var $tmpl = $('.sax-panel-item-template .sax-panel-item.Member', $results);
|
||||
sax.refreshPaging(response, '#frmMemberFilter', sax.refreshResults);
|
||||
if (!response.success) return;
|
||||
// Reference data - roles.
|
||||
if (response.memberRoles && response.memberRoles.length)
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
var $msgs = $('.sax-panel-messages', $results).hide().empty();
|
||||
var $items = $('.sax-panel-item-list', $results).hide().empty();
|
||||
var $tmpl = $('.sax-panel-item-template .sax-panel-item.Region', $results);
|
||||
sax.refreshPaging(response, '#frmRegionFilter', sax.refreshResults);
|
||||
if (!response.success) return;
|
||||
sax.refreshPaging(response);
|
||||
// Reference data - Statuses.
|
||||
if (response.defaultStatusCode) sax.data.defaultStatusCode = response.defaultStatusCode;
|
||||
if (response.statuses)
|
||||
@@ -61,10 +61,6 @@
|
||||
$item.off('dblclick').on('dblclick', function () { sax.updateItem(item.id) })
|
||||
$('.sax-panel-results .sax-panel-messages').hide().empty();
|
||||
}
|
||||
sax.refreshPaging = function (response)
|
||||
{
|
||||
sax.resultsPaging.fn.refreshPaging(response.paging);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.selectParentRegion = function ()
|
||||
|
||||
@@ -5,58 +5,77 @@
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let rp = sax.resultsPaging = sax.resultsPaging || { fn: {}, msg: {} };
|
||||
let rp = sax.resultsPaging = sax.resultsPaging || { fn: {}, msg: {}, contexts: [] };
|
||||
|
||||
//--------------------------------------------------------------
|
||||
rp.fn.refreshPaging = function (paging)
|
||||
rp.fn.refreshPaging = function (paging, contextSel, refreshFn)
|
||||
{
|
||||
rp.fn.init();
|
||||
rp.paging = paging = paging || {};
|
||||
rp.$rp.toggle(paging.paged);
|
||||
$('.sax-paging-info', rp.$rp).text(sax.resultsPaging.msg.pageInfo.format(paging.pageNo, paging.pageCount));
|
||||
$('.sax-paging-first,.sax-paging-prev', rp.$rp).toggle(paging.pageNo > 1);
|
||||
$('.sax-paging-next,.sax-paging-last', rp.$rp).toggle(paging.pageNo < paging.pageCount);
|
||||
let context = rp.fn.getContext(contextSel, refreshFn);
|
||||
rp.fn.init(context);
|
||||
context.paging = paging = paging || {};
|
||||
context.$rp.toggle(paging.paged);
|
||||
context.$pageNo.val(paging.pageNo);
|
||||
context.$pageLen.val(paging.pageLength);
|
||||
$('.sax-paging-info', context.$rp).text(sax.resultsPaging.msg.pageInfo.format(paging.pageNo, paging.pageCount));
|
||||
//$('.sax-paging-first,.sax-paging-prev', context.$rp).toggle(paging.pageNo > 1);
|
||||
//$('.sax-paging-next,.sax-paging-last', context.$rp).toggle(paging.pageNo < paging.pageCount);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
rp.fn.firstPage = function ()
|
||||
rp.fn.getContext = function (contextSel, refreshFn)
|
||||
{
|
||||
let page = rp.$pageNo.val() * 1;
|
||||
for (let idx = 0; idx < rp.contexts.length; idx++)
|
||||
{
|
||||
if (rp.contexts[idx].sel == contextSel) return rp.contexts[idx];
|
||||
}
|
||||
//sax.debug('getContext Creating new context for: ', contextSel);
|
||||
let context = { sel: contextSel, refreshFn: refreshFn }
|
||||
rp.contexts.push(context);
|
||||
return context;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
rp.fn.firstPage = function (context)
|
||||
{
|
||||
let page = context.$pageNo.val() * 1;
|
||||
if (page < 2) return;
|
||||
rp.$pageNo.val(1);
|
||||
sax.refreshResults();
|
||||
context.$pageNo.val(1);
|
||||
context.refreshFn();
|
||||
}
|
||||
rp.fn.prevPage = function ()
|
||||
rp.fn.prevPage = function (context)
|
||||
{
|
||||
let page = rp.$pageNo.val() * 1;
|
||||
let page = context.$pageNo.val() * 1;
|
||||
if (page < 2) return;
|
||||
rp.$pageNo.val(page - 1);
|
||||
sax.refreshResults();
|
||||
context.$pageNo.val(page - 1);
|
||||
context.refreshFn();
|
||||
}
|
||||
rp.fn.nextPage = function ()
|
||||
rp.fn.nextPage = function (context)
|
||||
{
|
||||
let page = rp.$pageNo.val() * 1;
|
||||
if (page > rp.paging.pageCount - 1) return;
|
||||
rp.$pageNo.val(page + 1);
|
||||
sax.refreshResults();
|
||||
let page = context.$pageNo.val() * 1;
|
||||
if (page > context.paging.pageCount - 1) return;
|
||||
context.$pageNo.val(page + 1);
|
||||
context.refreshFn();
|
||||
}
|
||||
rp.fn.lastPage = function ()
|
||||
rp.fn.lastPage = function (context)
|
||||
{
|
||||
let page = rp.$pageNo.val() * 1;
|
||||
if (page > rp.paging.pageCount - 1) return;
|
||||
rp.$pageNo.val(rp.paging.pageCount);
|
||||
sax.refreshResults();
|
||||
let page = context.$pageNo.val() * 1;
|
||||
if (page > context.paging.pageCount - 1) return;
|
||||
context.$pageNo.val(context.paging.pageCount);
|
||||
context.refreshFn();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
rp.fn.init = function ()
|
||||
rp.fn.init = function (context)
|
||||
{
|
||||
rp.$rp = $('.sax-results-paging');
|
||||
rp.$pageNo = $('.PagingPageNo', rp.$rp);
|
||||
$('.sax-paging-first', rp.$rp).on('click',rp.fn.firstPage);
|
||||
$('.sax-paging-prev', rp.$rp).on('click', rp.fn.prevPage);
|
||||
$('.sax-paging-next', rp.$rp).on('click', rp.fn.nextPage);
|
||||
$('.sax-paging-last', rp.$rp).on('click', rp.fn.lastPage);
|
||||
if (context.$rp) return;
|
||||
//sax.debug('resultsPaging.init Initialising Paging.', context);
|
||||
context.$rp = $('.sax-results-paging', $(context.sel));
|
||||
context.$pageNo = $('.PagingPageNo', context.$rp);
|
||||
context.$pageLen = $('.PagingPageLength', context.$rp);
|
||||
$('.sax-paging-first', context.$rp).off('click').on('click', function () { rp.fn.firstPage(context); });
|
||||
$('.sax-paging-prev', context.$rp).off('click').on('click', function () { rp.fn.prevPage(context); });
|
||||
$('.sax-paging-next', context.$rp).off('click').on('click', function () { rp.fn.nextPage(context); });
|
||||
$('.sax-paging-last', context.$rp).off('click').on('click', function () { rp.fn.lastPage(context); });
|
||||
}
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
}
|
||||
so.fn.doRefreshResults = function (response)
|
||||
{
|
||||
//sax.debug('so.doRefreshResults', response);
|
||||
sax.debug('so.doRefreshResults', response);
|
||||
sax.refreshPaging(response, '#frmSelectOrganisationFilter', so.fn.refreshOrganisations);
|
||||
if (!response.success) return;
|
||||
let $results = $('.sax-selection-results.Organisations', so.$dlg).empty().hide();
|
||||
let $tmpl = $('.sax-panel-item-template .sax-panel-item.Organisation', so.$dlg);
|
||||
@@ -87,6 +88,8 @@
|
||||
so.$dlg = $('#dlgSelectOrganisation').dialog(opt);
|
||||
|
||||
$('.sax-input.FilterOrganisation', so.$dlg).on('input', function () { sax.selectOrganisation.fn.refreshOrganisations(250); });
|
||||
$('.PagingPageNo', so.$dlg).val(1);
|
||||
$('.PagingPageLength', so.$dlg).val(16);
|
||||
}
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
var $msgs = $('.sax-panel-messages', $results).hide().empty();
|
||||
var $items = $('.sax-panel-item-list', $results).hide().empty();
|
||||
var $tmpl = $('.sax-panel-item-template .sax-panel-item.Sport', $results);
|
||||
sax.refreshPaging(response, '#frmSportFilter', sax.refreshResults);
|
||||
if (!response.success) return;
|
||||
// Reference data - Statuses.
|
||||
if (response.defaultStatusCode) sax.data.defaultStatusCode = response.defaultStatusCode;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
var $msgs = $('.sax-panel-messages', $results).hide().empty();
|
||||
var $items = $('.sax-panel-item-list', $results).hide().empty();
|
||||
var $tmpl = $('.sax-panel-item-template .sax-panel-item.User', $results);
|
||||
sax.refreshPaging(response, '#frmUserFilter', sax.refreshResults);
|
||||
if (!response.success) return;
|
||||
// Reference data - Roles.
|
||||
if (response.userRoles && response.userRoles.length)
|
||||
|
||||
@@ -177,6 +177,15 @@
|
||||
<data name="home.caption.welcome" xml:space="preserve">
|
||||
<value>Welcome</value>
|
||||
</data>
|
||||
<data name="home.organisation.request.action" xml:space="preserve">
|
||||
<value>Register Your Organisation</value>
|
||||
</data>
|
||||
<data name="home.organisation.request.para1" xml:space="preserve">
|
||||
<value>Do you belong to a club or association that would benefit from participating on this platform?</value>
|
||||
</data>
|
||||
<data name="home.organisation.request.para2" xml:space="preserve">
|
||||
<value>Sign-up now with a few details and we'll let you know when you can login and get going.</value>
|
||||
</data>
|
||||
<data name="journalist.caption.article" xml:space="preserve">
|
||||
<value>Article</value>
|
||||
</data>
|
||||
@@ -195,6 +204,9 @@
|
||||
<data name="label.add" xml:space="preserve">
|
||||
<value>Add</value>
|
||||
</data>
|
||||
<data name="label.address" xml:space="preserve">
|
||||
<value>Address</value>
|
||||
</data>
|
||||
<data name="label.article" xml:space="preserve">
|
||||
<value>Article</value>
|
||||
</data>
|
||||
@@ -216,6 +228,9 @@
|
||||
<data name="label.close" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
<data name="label.contact.details" xml:space="preserve">
|
||||
<value>Contact details</value>
|
||||
</data>
|
||||
<data name="label.country" xml:space="preserve">
|
||||
<value>Country</value>
|
||||
</data>
|
||||
@@ -285,6 +300,12 @@
|
||||
<data name="label.organisation" xml:space="preserve">
|
||||
<value>Organisation</value>
|
||||
</data>
|
||||
<data name="label.organisation.address" xml:space="preserve">
|
||||
<value>Organisation address</value>
|
||||
</data>
|
||||
<data name="label.organsiation.details" xml:space="preserve">
|
||||
<value>Organisation details</value>
|
||||
</data>
|
||||
<data name="label.outline" xml:space="preserve">
|
||||
<value>Outline</value>
|
||||
</data>
|
||||
@@ -303,9 +324,15 @@
|
||||
<data name="label.password.current" xml:space="preserve">
|
||||
<value>Current password</value>
|
||||
</data>
|
||||
<data name="label.phone" xml:space="preserve">
|
||||
<value>Phone</value>
|
||||
</data>
|
||||
<data name="label.position" xml:space="preserve">
|
||||
<value>Position</value>
|
||||
</data>
|
||||
<data name="label.postalCode" xml:space="preserve">
|
||||
<value>Postal code</value>
|
||||
</data>
|
||||
<data name="label.province" xml:space="preserve">
|
||||
<value>Province</value>
|
||||
</data>
|
||||
@@ -369,6 +396,9 @@
|
||||
<data name="label.title" xml:space="preserve">
|
||||
<value>Title</value>
|
||||
</data>
|
||||
<data name="label.town" xml:space="preserve">
|
||||
<value>Town</value>
|
||||
</data>
|
||||
<data name="label.type" xml:space="preserve">
|
||||
<value>Type</value>
|
||||
</data>
|
||||
@@ -411,8 +441,10 @@
|
||||
<data name="msg.error.system" xml:space="preserve">
|
||||
<value>System error encountered.</value>
|
||||
</data>
|
||||
<data name="msg.signout.confirm" xml:space="preserve">
|
||||
<value>Are you sure that you want to sign-out?</value>
|
||||
<data name="msg.organisation.request.success" xml:space="preserve">
|
||||
<value>Thank you for registering your organisation.
|
||||
You will be contacted by email once the details have been confirmed.
|
||||
You will then be able to publicise your sporting activities.</value>
|
||||
</data>
|
||||
<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>
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace Saxonite.Net.Core.Web.Online.App
|
||||
// JSON Deserialisation.
|
||||
[JsonExtensionData]
|
||||
#pragma warning disable IDE0044 // Add readonly modifier
|
||||
private IDictionary<string, JToken> _additionalData;
|
||||
private IDictionary<string, JToken> _additionalData = null;
|
||||
#pragma warning restore IDE0044 // Add readonly modifier
|
||||
[OnDeserialized]
|
||||
private void OnDeserialized(StreamingContext context)
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||
prmUserSport.UserAccountIdsIncluded.Add(SessionData.User.UserAccountId);
|
||||
prmUserSport.StatusCat = SaxUserSport.StatusCat.NotDeleted;
|
||||
model.DataItemTotal = (ulong)AccountMgr.GetUserSportCount(prmUserSport);
|
||||
model.Paging.ItemTotal = (ulong)AccountMgr.GetUserSportCount(prmUserSport);
|
||||
model.PopulatePagingTo(prmUserSport.ResultsPaging);
|
||||
|
||||
// Item columns.
|
||||
@@ -106,12 +106,10 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
prmUserSport.SortColumns.Add(colSportName);
|
||||
|
||||
// Query items.
|
||||
model.DataItemCount = 0;
|
||||
using (DbResultSet resultSet = AccountMgr.ExecuteUserSportQuery(columns, prmUserSport))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
model.DataItemCount++;
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
ProfileSportResponseData_List userSportData = new ProfileSportResponseData_List()
|
||||
{
|
||||
@@ -126,6 +124,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
responseData.Sports.Add(userSportData);
|
||||
}
|
||||
}
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Sports.Count;
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
prmArticle.UserAccountIdsJournalistIncluded.Add(sessionData.User.UserAccountId);
|
||||
prmArticle.ArticleFilter = model.Filter.Article;
|
||||
prmArticle.StatusCat = SaxJournalistArticle.StatusCat.NotDeleted;
|
||||
model.DataItemTotal = (ulong)ActivityMgr.GetJournalistArticleCount(prmArticle);
|
||||
model.Paging.ItemTotal = (ulong)ActivityMgr.GetJournalistArticleCount(prmArticle);
|
||||
model.PopulatePagingTo(prmArticle.ResultsPaging);
|
||||
|
||||
// Item columns.
|
||||
@@ -165,12 +165,10 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
prmArticle.SortColumns.Add(colCreatedOn);
|
||||
|
||||
// Query items.
|
||||
model.DataItemCount = 0;
|
||||
using (DbResultSet resultSet = ActivityMgr.ExecuteJournalistArticleQuery(columns, prmArticle))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
model.DataItemCount++;
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
ArticleData_List articleData = new ArticleData_List()
|
||||
{
|
||||
@@ -187,6 +185,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
responseData.Articles.Add(articleData);
|
||||
}
|
||||
}
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Articles.Count;
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
@@ -317,7 +317,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
prmItemImage.ItemIdsIncluded.Add(imageItemId);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.Article);
|
||||
prmItemImage.ImageTypesIncluded.Add(Sax.ImageType.ArticleUpload);
|
||||
prmItemImage.StatusCat = SaxItemImage.StatusCat.Deleted;
|
||||
prmItemImage.StatusCat = SaxItemImage.StatusCat.DeletedOnly;
|
||||
prmItemImage.ResultsPaging.PageLength = 1;
|
||||
prmItemImage.ResultsPaging.PageNo = 1;
|
||||
List<SaxItemImage> itemImages = ItemDataMgr.GetItemImageList(prmItemImage);
|
||||
|
||||
@@ -45,8 +45,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
|
||||
// Paging.
|
||||
Model_Journalist model = new Model_Journalist(Localiser);
|
||||
model.DataPageNo = 1;
|
||||
model.DataPageLength = 6;
|
||||
model.Paging.PageNo = 1;
|
||||
model.Paging.PageLength = 6;
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
+3
-3
@@ -135,7 +135,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
prmOpportunity.OrganisationIdsIncluded.Add(organisationId);
|
||||
prmOpportunity.OpportunityFilter = model.Filter.Opportunity;
|
||||
prmOpportunity.StatusCat = SaxOrganisationOpportunity.StatusCat.NotDeleted;
|
||||
model.DataItemTotal = (ulong)ActivityMgr.GetOrganisationOpportunityCount(prmOpportunity);
|
||||
model.Paging.ItemTotal = (ulong)ActivityMgr.GetOrganisationOpportunityCount(prmOpportunity);
|
||||
model.PopulatePagingTo(prmOpportunity.ResultsPaging);
|
||||
|
||||
// Item columns.
|
||||
@@ -164,12 +164,10 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
prmOpportunity.SortColumns.Add(colCreatedOn);
|
||||
|
||||
// Query items.
|
||||
model.DataItemCount = 0;
|
||||
using (DbResultSet resultSet = ActivityMgr.ExecuteOrganisationOpportunityQuery(columns, prmOpportunity))
|
||||
{
|
||||
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
|
||||
{
|
||||
model.DataItemCount++;
|
||||
NamedValue.Map values = resultSet.GetRecordValues();
|
||||
OpportunityData_List opportunityData = new OpportunityData_List()
|
||||
{
|
||||
@@ -190,6 +188,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Opportunities.Count;
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
|
||||
@@ -4,6 +4,7 @@ using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Core.Web.Online.App;
|
||||
using Saxonite.Net.Core.Web.Online.Models;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
@@ -77,7 +78,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
prmOrganisation.SportIdsIncluded.AddId(model.Filter.SportId.ToSysId());
|
||||
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.ActiveOnly;
|
||||
prmOrganisation.SortColumns.Add(colOrganisationName);
|
||||
model.DataItemTotal = (ulong)AccountMgr.GetOrganisationCount(prmOrganisation);
|
||||
model.Paging.ItemTotal = (ulong)AccountMgr.GetOrganisationCount(prmOrganisation);
|
||||
model.PopulatePagingTo(prmOrganisation.ResultsPaging);
|
||||
using (DbResultSet resultSet = AccountMgr.ExecuteOrganisationQuery(columns, prmOrganisation))
|
||||
{
|
||||
@@ -96,6 +97,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
responseData.Organisations.Add(organisationData);
|
||||
}
|
||||
}
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Organisations.Count;
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
@@ -103,6 +106,169 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Request Organisation ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
private class AjaxResponse_RequestOrganisation : AjaxResponse_Data
|
||||
{
|
||||
// Construction.
|
||||
public AjaxResponse_RequestOrganisation(SaxModel_Online model) : base(model) { }
|
||||
// Organisation list.
|
||||
public List<OrganisationResponseData> Organisations { get; } = new List<OrganisationResponseData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Organisation/Ajax/RequestOrganisation")]
|
||||
public IActionResult Ajax_RequestOrganisation(Model_Organisation model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_RequestOrganisation";
|
||||
String messageTitle = Localiser["organisation.caption.organisation.request"];
|
||||
AjaxResponse_RequestOrganisation responseData = new AjaxResponse_RequestOrganisation(model);
|
||||
|
||||
// Validate session and referrer. User does not need to be logged in.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
SaxSessionData_Online sessionData = SessionData_Online;
|
||||
|
||||
if (!model.ValidateOrganisationRequestData(responseData))
|
||||
return Json(responseData);
|
||||
|
||||
// Check Regions.
|
||||
SaxRegion regionCountry = Internals.GetRegion(model.OrganisationRegionIdCountry.ToSysId());
|
||||
if (SysId.IsValid(model.OrganisationRegionIdCountry.ToSysId()) && regionCountry == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Country region not found. Id: " + model.OrganisationRegionIdCountry + ". " + getLogSuffix());
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
SaxRegion regionProvince = Internals.GetRegion(model.OrganisationAddressRegionIdProvince.ToSysId());
|
||||
if (SysId.IsValid(model.OrganisationAddressRegionIdProvince.ToSysId()) && regionProvince == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Province region not found. Id: " + model.OrganisationAddressRegionIdProvince + ". " + getLogSuffix());
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// User does not need to be logged in, but user details must be supplied if not.
|
||||
SaxUserAccount userAccount = null;
|
||||
if (ValidUserSession)
|
||||
{
|
||||
// Check that an email address hasn't been supplied.
|
||||
// NB Shouldn't happen as contact controls aren't displayed if user is logged in,
|
||||
// hence 'System' error response and nothing more specific.
|
||||
if (!StringUtil.IsEmpty(model.ContactEmailAddress))
|
||||
{
|
||||
SaLogger.Warn(fn + " Contact Email supplied when user logged in. " + getLogSuffix());
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
// Retrieve user account.
|
||||
userAccount = AccountMgr.GetUserAccountById(sessionData.User.UserAccountId);
|
||||
if (userAccount == null)
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Double check that contact details have been supplied - validated by model above.
|
||||
if (StringUtil.IsEmpty(model.ContactEmailAddress) || StringUtil.IsEmpty(model.ContactFirstName) || StringUtil.IsEmpty(model.ContactLastName))
|
||||
{
|
||||
SaLogger.Warn(fn + " Incomplete contact details supplied.");
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
// Check that the email doesn't exist.
|
||||
// NB This is validated by the model and shouldn't be required here.
|
||||
userAccount = AccountMgr.GetUserAccountByEmailAddress(model.ContactEmailAddress);
|
||||
if (userAccount != null)
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
userAccount = AccountMgr.CreateUserAccount();
|
||||
userAccount.EmailAddress = model.ContactEmailAddress;
|
||||
userAccount.FirstName = model.ContactFirstName;
|
||||
userAccount.LastName = model.ContactLastName;
|
||||
if (!AccountMgr.InsertUserAccount(userAccount, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert user contact - " + AccountMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
}
|
||||
|
||||
if (SysId.IsValid(model.OrganisationSportId.ToSysId()))
|
||||
{
|
||||
// Add User Sport if not already present.
|
||||
// NB This will also reactivate an inactive or deleted User Sport.
|
||||
SaxUserSport.Params prmUserSport = new SaxUserSport.Params();
|
||||
prmUserSport.UserAccountIdsIncluded.Add(userAccount.Id);
|
||||
prmUserSport.SportIdsIncluded.Add(model.OrganisationSportId.ToSysId());
|
||||
prmUserSport.StatusCat = SaxUserSport.StatusCat.Any;
|
||||
SaxUserSport userSport = AccountMgr.GetUserSport(prmUserSport);
|
||||
if (userSport == null)
|
||||
userSport = AccountMgr.CreateUserSport(userAccount.Id, model.OrganisationSportId.ToSysId());
|
||||
userSport.Status = SaxUserSport.DefaultStatus;
|
||||
if (!SysId.IsValid(userSport.Id))
|
||||
{
|
||||
if (!AccountMgr.InsertUserSport(userSport, DbUpdateInfo))
|
||||
{
|
||||
// Logg error but don't abort the request.
|
||||
SaLogger.Warn(fn + " Failed to insert User Sport: " + AccountMgr.ErrorStateMessage);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!AccountMgr.UpdateUserSport(userSport, DbUpdateInfo))
|
||||
{
|
||||
// Logg error but don't abort the request.
|
||||
SaLogger.Warn(fn + " Failed to update User Sport: " + AccountMgr.ErrorStateMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create Organisation.
|
||||
SaxOrganisation organisation = AccountMgr.CreateOrganisation();
|
||||
organisation.Name = model.OrganisationName;
|
||||
organisation.OrganisationType = model.GetOrganisationType();
|
||||
organisation.OrganisationCategory = model.GetOrganisationCategory();
|
||||
organisation.SportIdPrimary = model.OrganisationSportId.ToSysId();
|
||||
organisation.RegionIdPrimary = model.OrganisationRegionIdCountry.ToSysId();
|
||||
organisation.PhoneMain = model.OrganisationPhoneMain;
|
||||
organisation.Status = SaStatus.Awaiting;
|
||||
if (!AccountMgr.InsertOrganisation(organisation, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert organisation - " + AccountMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Add user as member of organisation.
|
||||
SaxUserOrganisation userOrganisation = AccountMgr.CreateUserOrganisation(userAccount.Id, organisation.Id);
|
||||
userOrganisation.OrganisationRoles.Add(Sax.OrganisationRole.Member);
|
||||
if (!AccountMgr.InsertUserOrganisation(userOrganisation, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert user organisation - " + AccountMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Create Organisation address.
|
||||
SaxItemAddress organisationAddress = ItemDataMgr.CreateItemAddress(organisation.GetItemId(), Sax.AddressType.Office);
|
||||
organisationAddress.Line1 = model.OrganisationAddressLine1;
|
||||
organisationAddress.Line2 = model.OrganisationAddressLine2;
|
||||
organisationAddress.Line3 = model.OrganisationAddressLine3;
|
||||
organisationAddress.Town = model.OrganisationAddressTown;
|
||||
organisationAddress.Province = model.OrganisationAddressProvince;
|
||||
organisationAddress.RegionIdProvince = model.OrganisationAddressRegionIdProvince.ToSysId();
|
||||
if (SysId.IsValid(regionCountry.Id))
|
||||
{
|
||||
organisationAddress.Country = regionCountry.Name;
|
||||
organisationAddress.RegionIdCountry = regionCountry.Id;
|
||||
}
|
||||
else organisationAddress.Country = model.OrganisationAddressCountry;
|
||||
organisationAddress.PostalCode = model.OrganisationAddressPostalCode;
|
||||
if (!ItemDataMgr.InsertItemAddress(organisationAddress, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to insert organisation address - " + ItemDataMgr.ErrorStateMessage);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
responseData.SetMessage(messageTitle, Localiser["msg.organisation.request.success"].ToString().ReplaceAll("\n", "<br>"));
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Member Organisation List ajax request.
|
||||
//-------------------------------------------------------------------
|
||||
@@ -148,7 +314,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
prmUserOrganisation.OrganisationMembersOnly = true;
|
||||
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
|
||||
prmUserOrganisation.SortColumns.Add(colOrganisationName);
|
||||
model.DataItemTotal = (ulong)AccountMgr.GetUserOrganisationCount(prmUserOrganisation);
|
||||
model.Paging.ItemTotal = (ulong)AccountMgr.GetUserOrganisationCount(prmUserOrganisation);
|
||||
model.PopulatePagingTo(prmUserOrganisation.ResultsPaging);
|
||||
using (DbResultSet resultSet = AccountMgr.ExecuteUserOrganisationQuery(columns, prmUserOrganisation))
|
||||
{
|
||||
@@ -167,6 +333,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
responseData.Organisations.Add(organisationData);
|
||||
}
|
||||
}
|
||||
if (model.Paging.IsPaged)
|
||||
model.Paging.ItemCount = (ushort)responseData.Organisations.Count;
|
||||
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
|
||||
@@ -360,15 +360,15 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
private void PopulateRequestPasswordEmailBody(SaEmailData emailData, SaxUserAccount userAccount)
|
||||
{
|
||||
// Will need to handle culture (language/country) as and when introduced.
|
||||
emailData.MessageBody = SaxResourceHelper.GetTextResource(SaxResourceHelper.TextResource.Email_RequestPassword_Html);
|
||||
emailData.MessageBody = SaxResourceHelper.GetTextResource(SaxResourceHelper.TextResource.Email_Security_RequestPassword_Html);
|
||||
emailData.HtmlBody = true;
|
||||
|
||||
// Replace dynamic tags.
|
||||
EmailConsole.ReplaceDynamicEmailBodyTags(emailData, null, userAccount);
|
||||
|
||||
// Replace dynamic tag for link back to change password page.
|
||||
SaEmailConsole.ReplaceDynamicEmailTag(emailData, "[#Link.RequestPassword]", GenerateRequestPasswordLink(userAccount.Id, userAccount.EmailAddress, ""));
|
||||
SaEmailConsole.ReplaceDynamicEmailTag(emailData, "[#Link.ExpiresMinutes]", GetRequestPasswordEmailLinkExpiresMinutes().ToString());
|
||||
SaEmailConsole.ReplaceDynamicEmailTag(emailData, "[#Link.RequestPassword]", GenerateRequestPasswordLink(this, userAccount.Id, userAccount.EmailAddress, ""));
|
||||
SaEmailConsole.ReplaceDynamicEmailTag(emailData, "[#Link.ExpiresMinutes]", GetRequestPasswordEmailLinkExpiresMinutes(this).ToString());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -383,21 +383,21 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
private static String Base64Key_RequestPassword { get; } = SacsEncryptionHelper.EncodePlainKey("{~Saxonite@@Request^Password=}", SacsEncryptionHelper.KeyLength);
|
||||
private static String Base64IV_RequestPassword_Generated { get; } = SacsEncryptionHelper.InitSymmetricEncryptionIV(Base64Key_RequestPassword);
|
||||
private static String Base64IV_RequestPassword { get; } = "1VAWYTW6d72n/6HDNhbqow==";
|
||||
private String GenerateRequestPasswordLink(SysId userAccountId, String emailAddress, String requestPasswordToken)
|
||||
internal static String GenerateRequestPasswordLink(SaxController_Online controller, SysId userAccountId, String emailAddress, String requestPasswordToken)
|
||||
{
|
||||
NameValueCollection parameters = new NameValueCollection();
|
||||
parameters.Add(ParamName_UserAccountId, SysId.ToString(userAccountId));
|
||||
parameters.Add(ParamName_EmailAddress, emailAddress);
|
||||
parameters.Add(ParamName_ExpiresAt, DateUtil.Format(DateTime.Now.AddMinutes(GetRequestPasswordEmailLinkExpiresMinutes()), DateUtil.Format_XmlDateTime));
|
||||
parameters.Add(ParamName_ExpiresAt, DateUtil.Format(DateTime.Now.AddMinutes(GetRequestPasswordEmailLinkExpiresMinutes(controller)), DateUtil.Format_XmlDateTime));
|
||||
parameters.Add(ParamName_Token, requestPasswordToken);
|
||||
String link =
|
||||
GetRedirectLocation(RedirectLocation.WebAppBase) + "Security/ChangePassword?" +
|
||||
ParamName_RequestPasswordEncrypted + "=" + HttpUtility.UrlEncode(EncryptParameters(parameters, Base64IV_RequestPassword, Base64Key_RequestPassword));
|
||||
controller.GetRedirectLocation(RedirectLocation.WebAppBase) + "Security/ChangePassword?" +
|
||||
ParamName_RequestPasswordEncrypted + "=" + HttpUtility.UrlEncode(controller.EncryptParameters(parameters, Base64IV_RequestPassword, Base64Key_RequestPassword));
|
||||
return link;
|
||||
}
|
||||
private int GetRequestPasswordEmailLinkExpiresMinutes()
|
||||
internal static int GetRequestPasswordEmailLinkExpiresMinutes(SaxController_Online controller)
|
||||
{
|
||||
int expiresMinutes = SessionConfig.Security.SignIn.PasswordRequest.EmailLinkExpiresMins;
|
||||
int expiresMinutes = controller.SessionConfig.Security.SignIn.PasswordRequest.EmailLinkExpiresMins;
|
||||
int expiresMinutes_Min = Sax.Config.Security.SignIn.PasswordRequest.EmailLinkExpiresMins_Min;
|
||||
int expiresMinutes_Max = Sax.Config.Security.SignIn.PasswordRequest.EmailLinkExpiresMins_Max;
|
||||
return Math.Max(expiresMinutes_Min, Math.Min(expiresMinutes_Max, expiresMinutes));
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
if (StringUtil.IsEmpty(AccountTitle))
|
||||
responseData.SetControlError(nameof(AccountTitle), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(AccountTitle) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_Title))
|
||||
responseData.SetControlError(nameof(AccountTitle), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.JournalistArticle_Headline)]);
|
||||
responseData.SetControlError(nameof(AccountTitle), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_Title)]);
|
||||
}
|
||||
|
||||
// First Name.
|
||||
@@ -79,7 +79,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
if (StringUtil.IsEmpty(AccountFirstName))
|
||||
responseData.SetControlError(nameof(AccountFirstName), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(AccountFirstName) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_FirstName))
|
||||
responseData.SetControlError(nameof(AccountFirstName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.JournalistArticle_Headline)]);
|
||||
responseData.SetControlError(nameof(AccountFirstName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_FirstName)]);
|
||||
}
|
||||
|
||||
// Last Name.
|
||||
@@ -89,7 +89,7 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
if (StringUtil.IsEmpty(AccountLastName))
|
||||
responseData.SetControlError(nameof(AccountLastName), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(AccountLastName) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_LastName))
|
||||
responseData.SetControlError(nameof(AccountLastName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.JournalistArticle_Headline)]);
|
||||
responseData.SetControlError(nameof(AccountLastName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_LastName)]);
|
||||
}
|
||||
|
||||
// Country Region.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Helpers;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
@@ -39,19 +40,186 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation properties.
|
||||
public String OrganisationName { get; set; }
|
||||
public String OrganisationTypeValue { get; set; }
|
||||
public Sax.OrganisationType OrganisationType { get { return (Sax.OrganisationType)OrganisationTypeCodes.GetTypeForCode(OrganisationTypeValue); } }
|
||||
public String OrganisationCategoryValue { get; set; }
|
||||
public Sax.OrganisationCategory OrganisationCategory { get { return (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(OrganisationCategoryValue); } }
|
||||
public String OrganisationType { get; set; }
|
||||
public Sax.OrganisationType GetOrganisationType() { return (Sax.OrganisationType)OrganisationTypeCodes.GetTypeForCode(OrganisationType); }
|
||||
public String OrganisationCategory { get; set; }
|
||||
public Sax.OrganisationCategory GetOrganisationCategory() { return (Sax.OrganisationCategory)OrganisationCategoryCodes.GetTypeForCode(OrganisationCategory); }
|
||||
public String OrganisationSportId { get; set; }
|
||||
public String OrganisationRegionId { get; set; }
|
||||
public String OrganisationRegionIdCountry { get; set; }
|
||||
public String OrganisationPhoneMain { get; set; }
|
||||
// Organisation address
|
||||
public String OrganisationAddressLine1 { get; set; }
|
||||
public String OrganisationAddressLine2 { get; set; }
|
||||
public String OrganisationAddressLine3 { get; set; }
|
||||
public String OrganisationAddressTown { get; set; }
|
||||
public String OrganisationAddressProvince { get; set; }
|
||||
public String OrganisationAddressRegionIdProvince { get; set; }
|
||||
public String OrganisationAddressCountry { get; set; }
|
||||
public String OrganisationAddressPostalCode { get; set; }
|
||||
// User - for organisation request.
|
||||
public String ContactEmailAddress { get; set; }
|
||||
public String ContactFirstName { get; set; }
|
||||
public String ContactLastName { get; set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validation.
|
||||
//-------------------------------------------------------------------
|
||||
// Organisation.
|
||||
public bool ValidateOrganisationData(SaxController_Base.AjaxResponse_Data responseData)
|
||||
public bool ValidateOrganisationRequestData(SaxController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
// User Email Address - mandatory when supplied.
|
||||
if (ContactEmailAddress != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(ContactEmailAddress), ContactEmailAddress);
|
||||
if (StringUtil.IsEmpty(ContactEmailAddress))
|
||||
responseData.SetControlError(nameof(ContactEmailAddress), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (!SacsDataValidationHelper.IsValidEmailAddress(ContactEmailAddress))
|
||||
responseData.SetControlError(nameof(ContactEmailAddress), Localiser["msg.validation.invalid.value"]);
|
||||
else if (StringUtil.GetLength(ContactEmailAddress) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_EmailAddress))
|
||||
responseData.SetControlError(nameof(ContactEmailAddress), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_EmailAddress)]);
|
||||
else if (AccountMgr.UserAccountExistsByEmailAddress(ContactEmailAddress))
|
||||
responseData.SetControlError(nameof(ContactEmailAddress), Localiser["msg.validation.duplicate.value"]);
|
||||
}
|
||||
|
||||
// User First Name - mandatory when supplied.
|
||||
if (ContactFirstName != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(ContactFirstName), ContactFirstName);
|
||||
if (StringUtil.IsEmpty(ContactFirstName))
|
||||
responseData.SetControlError(nameof(ContactFirstName), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(ContactFirstName) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_FirstName))
|
||||
responseData.SetControlError(nameof(ContactFirstName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_FirstName)]);
|
||||
}
|
||||
|
||||
// User Last Name - mandatory when supplied.
|
||||
if (ContactLastName != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(ContactLastName), ContactLastName);
|
||||
if (StringUtil.IsEmpty(ContactLastName))
|
||||
responseData.SetControlError(nameof(ContactLastName), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(ContactLastName) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_LastName))
|
||||
responseData.SetControlError(nameof(ContactLastName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_LastName)]);
|
||||
}
|
||||
|
||||
// Organisation Name - mandatory.
|
||||
responseData.SetControlValue(nameof(OrganisationName), OrganisationName);
|
||||
if (StringUtil.IsEmpty(OrganisationName))
|
||||
responseData.SetControlError(nameof(OrganisationName), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(OrganisationName) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name))
|
||||
responseData.SetControlError(nameof(OrganisationName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name)]);
|
||||
else if (SysId.IsValid(OrganisationRegionIdCountry.ToSysId()))
|
||||
{
|
||||
// Ensure that the organisation name is unique within the country.
|
||||
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
|
||||
prmOrganisation.NameFull = OrganisationName;
|
||||
prmOrganisation.RegionIdsIncluded.Add(OrganisationRegionIdCountry.ToSysId());
|
||||
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.Any;
|
||||
if (AccountMgr.GetOrganisationCount(prmOrganisation) > 0)
|
||||
responseData.SetControlError(nameof(OrganisationName), Localiser["msg.validation.duplicate.value"]);
|
||||
}
|
||||
|
||||
// Organisation Category - mandatory.
|
||||
if (StringUtil.IsEmpty(OrganisationCategory))
|
||||
responseData.SetControlError(nameof(OrganisationCategory), Localiser["msg.validation.mandatory.value"]);
|
||||
|
||||
// Organisation Type - mandatory.
|
||||
if (StringUtil.IsEmpty(OrganisationType))
|
||||
responseData.SetControlError(nameof(OrganisationType), Localiser["msg.validation.mandatory.value"]);
|
||||
|
||||
// Organisation Sport - mandatory for certain organisation categories.
|
||||
if (StringUtil.IsEmpty(OrganisationSportId) && SaxOrganisation.IsSportMandatory(GetOrganisationCategory()))
|
||||
responseData.SetControlError(nameof(OrganisationSportId), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (!StringUtil.IsEmpty(OrganisationSportId) && !SysId.IsValid(OrganisationSportId.ToSysId()))
|
||||
responseData.SetControlError(nameof(OrganisationSportId), Localiser["msg.validation.invalid.value"]);
|
||||
|
||||
// Organisation Region Country - mandatory.
|
||||
if (StringUtil.IsEmpty(OrganisationRegionIdCountry))
|
||||
responseData.SetControlError(nameof(OrganisationRegionIdCountry), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (!SysId.IsValid(OrganisationRegionIdCountry.ToSysId()))
|
||||
responseData.SetControlError(nameof(OrganisationRegionIdCountry), Localiser["msg.validation.invalid.value"]);
|
||||
|
||||
// Organisation Address Line 1 - mandatory.
|
||||
responseData.SetControlValue(nameof(OrganisationAddressLine1), OrganisationAddressLine1);
|
||||
if (StringUtil.IsEmpty(OrganisationAddressLine1))
|
||||
responseData.SetControlError(nameof(OrganisationAddressLine1), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(OrganisationAddressLine1) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line1))
|
||||
responseData.SetControlError(nameof(OrganisationAddressLine1), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line1)]);
|
||||
|
||||
// Organisation Address Line 2 - optional.
|
||||
if (OrganisationAddressLine2 != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(OrganisationAddressLine2), OrganisationAddressLine2);
|
||||
if (!StringUtil.IsEmpty(OrganisationAddressLine2))
|
||||
{
|
||||
if (StringUtil.GetLength(OrganisationAddressLine2) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line2))
|
||||
responseData.SetControlError(nameof(OrganisationAddressLine2), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line2)]);
|
||||
}
|
||||
}
|
||||
|
||||
// Organisation Address Line 3 - optional.
|
||||
if (OrganisationAddressLine3 != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(OrganisationAddressLine3), OrganisationAddressLine3);
|
||||
if (!StringUtil.IsEmpty(OrganisationAddressLine3))
|
||||
{
|
||||
if (StringUtil.GetLength(OrganisationAddressLine3) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line3))
|
||||
responseData.SetControlError(nameof(OrganisationAddressLine3), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line3)]);
|
||||
}
|
||||
}
|
||||
|
||||
// Organisation Address Town - mandatory.
|
||||
responseData.SetControlValue(nameof(OrganisationAddressTown), OrganisationAddressTown);
|
||||
if (StringUtil.IsEmpty(OrganisationAddressTown))
|
||||
responseData.SetControlError(nameof(OrganisationAddressTown), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(OrganisationAddressTown) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town))
|
||||
responseData.SetControlError(nameof(OrganisationAddressTown), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town)]);
|
||||
|
||||
// Organisation Address Province - optional.
|
||||
if (OrganisationAddressProvince != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(OrganisationAddressProvince), OrganisationAddressProvince);
|
||||
if (!StringUtil.IsEmpty(OrganisationAddressProvince))
|
||||
{
|
||||
if (StringUtil.GetLength(OrganisationAddressProvince) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Province))
|
||||
responseData.SetControlError(nameof(OrganisationAddressProvince), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Province)]);
|
||||
}
|
||||
}
|
||||
|
||||
// Organisation Address Country - optional.
|
||||
if (OrganisationAddressCountry != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(OrganisationAddressCountry), OrganisationAddressCountry);
|
||||
if (!StringUtil.IsEmpty(OrganisationAddressCountry))
|
||||
{
|
||||
if (StringUtil.GetLength(OrganisationAddressCountry) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Country))
|
||||
responseData.SetControlError(nameof(OrganisationAddressCountry), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Country)]);
|
||||
}
|
||||
}
|
||||
|
||||
// Organisation Address PostalCode - optional.
|
||||
if (OrganisationAddressPostalCode != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(OrganisationAddressPostalCode), OrganisationAddressPostalCode);
|
||||
if (!StringUtil.IsEmpty(OrganisationAddressPostalCode))
|
||||
{
|
||||
if (StringUtil.GetLength(OrganisationAddressPostalCode) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_PostalCode))
|
||||
responseData.SetControlError(nameof(OrganisationAddressPostalCode), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_PostalCode)]);
|
||||
}
|
||||
}
|
||||
|
||||
// Organisation Phone Main - optional.
|
||||
if (OrganisationPhoneMain != null)
|
||||
{
|
||||
responseData.SetControlValue(nameof(OrganisationPhoneMain), OrganisationPhoneMain);
|
||||
if (!StringUtil.IsEmpty(OrganisationPhoneMain))
|
||||
{
|
||||
if (!SacsDataValidationHelper.IsValidPhone(OrganisationPhoneMain))
|
||||
responseData.SetControlError(nameof(OrganisationPhoneMain), Localiser["msg.validation.invalid.value"]);
|
||||
else if (StringUtil.GetLength(OrganisationPhoneMain) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_PhoneMain))
|
||||
responseData.SetControlError(nameof(OrganisationPhoneMain), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_PhoneMain)]);
|
||||
}
|
||||
}
|
||||
|
||||
return !responseData.HasControlErrors();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="jQuery.UI.Combined" Version="1.12.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.13" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.16" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -9,7 +9,14 @@
|
||||
<div class="row">
|
||||
<div class="col"><div class="sax-caption">@Localiser["account.caption.profile.organisations"]</div></div>
|
||||
<div class="fixed">
|
||||
<!-- <div class="sax-action sax-edit"><img src="~/img/action/edit24.png" alt="@(Localiser["label.update"])" title="@(Localiser["label.update"])" /></div> -->
|
||||
<ul class="nav navbar-nav navbar-light navbar-right sax-burger">
|
||||
<li class="dropdown-toggle caret-off">
|
||||
<a href="#" class="dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="navbar-toggler-icon"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right sax-dropdown-menu">
|
||||
<li><div class="sax-action sax-dropdown-item" onclick="sax.orgReq.fn.requestOrganisation();">@Localiser["organisation.caption.organisation.request"]</div></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -56,3 +63,5 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<partial name="~/Views/Common/OrganisationRequest.cshtml" />
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
@model SaxModel_Online
|
||||
@inject SaxLocaliser Localiser
|
||||
|
||||
@{
|
||||
int regionIdCountry = Model.ValidUserSession ? Model.SessionData.User.RegionIdCountry.ToInt() : 0;
|
||||
String regionNameCountry = Model.ValidUserSession ? Localiser.EscapeJavascriptText(Model.GetRegionCaption(Model.SessionData.User.RegionIdCountry)) : "";
|
||||
}
|
||||
<script type="text/javascript">
|
||||
sax.orgReq = {};
|
||||
sax.orgReq.dlgTitleRequestOrganisation = '@Localiser.GetJavascriptText("organisation.caption.organisation.request")';
|
||||
let or = sax.orgReq = {};
|
||||
or.dlgTitleRequestOrganisation = '@Localiser.GetJavascriptText("organisation.caption.organisation.request")';
|
||||
sax.data.regionIdCountryDefault = @regionIdCountry;
|
||||
sax.data.regionNameCountryDefault = '@regionNameCountry';
|
||||
</script>
|
||||
|
||||
<div id="dlgOrganisationRequest" class="sax-dialog sax-form">
|
||||
@@ -11,65 +16,213 @@
|
||||
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmOrganisationRequest", @class = "sax-form", @onSubmit = "return false;" }))
|
||||
{
|
||||
|
||||
@* Contact details are only required when user not logged in. *@
|
||||
@if (!Model.ValidUserSession)
|
||||
{
|
||||
|
||||
<div class="sax-form-control pt8">
|
||||
<div class="sax-caption">
|
||||
<label for="ifContactEmailAddress"><span>@Localiser["label.contact.details"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Contact Email Address *@
|
||||
<div class="sax-form-control ContactEmailAddress">
|
||||
<div class="sax-label">
|
||||
<label for="ifContactEmailAddress"><span><span class="required">*</span> @Localiser["label.email"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
<input type="text" id="ifContactEmailAddress" name="ContactEmailAddress" class="ContactEmailAddress sax-input" autocomplete="off" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_EmailAddress)" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Contact First Name *@
|
||||
<div class="sax-form-control ContactFirstName pr4">
|
||||
<div class="sax-label">
|
||||
<label for="cbContactFirstName"><span><span class="required">*</span> @Localiser["label.first.name"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
<input type="text" id="ifContactFirstName" name="ContactFirstName" class="ContactFirstName sax-input" autocomplete="off" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_FirstName)" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Contact Last Name *@
|
||||
<div class="sax-form-control ContactLastName pr4">
|
||||
<div class="sax-label">
|
||||
<label for="cbContactLastName"><span><span class="required">*</span> @Localiser["label.last.name"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
<input type="text" id="ifContactLastName" name="ContactLastName" class="ContactLastName sax-input" autocomplete="off" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_LastName)" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
<div class="sax-form-control">
|
||||
<div class="sax-caption">
|
||||
<label for="ifContactEmailAddress"><span>@Localiser["label.organsiation.details"]</span></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Organisation name *@
|
||||
<div class="sax-form-control OrganisationName">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationName"><span><span class="required">*</span> @Localiser["label.name"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
<input type="text" id="ifOrganisationName" name="OrganisationName" class="OrganisationName sax-input" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name)" />
|
||||
<input type="text" id="ifOrganisationName" name="OrganisationName" class="OrganisationName sax-input" autocomplete="off" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Organisation_Name)" />
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Organisation category *@
|
||||
<div class="sax-form-control OrganisationCategory pr4">
|
||||
<div class="sax-label">
|
||||
<label for="cbOrganisationCategory"><span><span class="required">*</span> @Localiser["label.category"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.DropDownList("", Model.OrganisationCategoriesForSelect, Localiser["label.select"], new { @id = "cbOrganisationCategory", @name = "OrganisationCategory", @class = "OrganisationCategory sax-select" })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
|
||||
@* Organisation type *@
|
||||
<div class="sax-form-control OrganisationType">
|
||||
<div class="sax-label">
|
||||
<label for="cbOrganisationType"><span><span class="required">*</span> @Localiser["label.type"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.DropDownList("", Model.OrganisationTypesForSelect, Localiser["label.select"], new { @id = "cbOrganisationType", @name = "OrganisationTypeValue", @class = "OrganisationType sax-select" })
|
||||
@Html.DropDownList("", Model.OrganisationTypesForSelect, Localiser["label.select"], new { @id = "cbOrganisationType", @name = "OrganisationType", @class = "OrganisationType sax-select" })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation category *@
|
||||
<div class="sax-form-control OrganisationCategory">
|
||||
<div class="sax-label">
|
||||
<label for="cbOrganisationCategory"><span><span class="required">*</span> @Localiser["label.category"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control">
|
||||
@Html.DropDownList("", Model.OrganisationCategoriesForSelect, Localiser["label.select"], new { @id = "cbOrganisationCategory", @name = "OrganisationCategoryValue", @class = "OrganisationCategory sax-select" })
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
|
||||
</div>
|
||||
|
||||
@* Organisation sport *@
|
||||
<div class="sax-form-control OrganisationSportId">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationSportId"><span><span class="required">*</span> @Localiser["label.sport"]</span></label>
|
||||
<label for="ifOrganisationSportCaption"><span><span class="required">*</span> @Localiser["label.sport"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
<input type="hidden" id="ifOrganisationSportId" name="" OrganisationSportId"" class="OrganisationSportId" />
|
||||
<input type="hidden" id="ifOrganisationSportId" name="OrganisationSportId" OrganisationSportId"" class="OrganisationSportId" />
|
||||
<div class="col"><input type="text" id="ifOrganisationSportCaption" class="OrganisationSportCaption sax-input" readonly="readonly" ondblclick="sax.selectSport()" /> </div>
|
||||
<div class="fixed"><button id="pbSelectSport" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectOrgSport()">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation region *@
|
||||
<div class="sax-form-control OrganisationRegionId">
|
||||
@* Organisation country *@
|
||||
<div class="sax-form-control OrganisationRegionIdCountry">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationRegionId"><span><span class="required">*</span> @Localiser["label.region"]</span></label>
|
||||
<label for="ifOrganisationRegionCaption"><span><span class="required">*</span> @Localiser["label.country"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
<input type="hidden" id="ifOrganisationRegionId" name="" OrganisationRegionId"" class="OrganisationRegionId" />
|
||||
<div class="col"><input type="text" id="ifOrganisationRegionCaption" class="OrganisationRegionCaption sax-input" readonly="readonly" ondblclick="sax.selectRegion()" /> </div>
|
||||
<input type="hidden" id="ifOrganisationRegionIdCountry" name="OrganisationRegionIdCountry" OrganisationRegionIdCountry"" class="OrganisationRegionIdCountry" />
|
||||
<div class="col"><input type="text" id="ifOrganisationRegionCaptionCountry" class="OrganisationRegionCaptionCountry sax-input" readonly="readonly" ondblclick="sax.selectRegion()" /> </div>
|
||||
<div class="fixed"><button id="pbSelectRegion" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px" onclick="sax.selectOrgRegion()">@Localiser["label.select"]</button></div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation address - Line 1 *@
|
||||
<div class="sax-form-control OrganisationAddressLine1">
|
||||
<div class="sax-caption">
|
||||
<label for="ifOrganisationAddressLine1"><span><span class="required">*</span> @Localiser["label.organisation.address"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
<div class="col"><input type="text" id="ifOrganisationAddressLine1" name="OrganisationAddressLine1" class="OrganisationAddressLine1 sax-input" autocomplete="off" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line1)" /> </div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation address - Line 2 *@
|
||||
<div class="sax-form-control OrganisationAddressLine2">
|
||||
<div class="sax-control row">
|
||||
<div class="col"><input type="text" id="ifOrganisationAddressLine2" name="OrganisationAddressLine2" class="OrganisationAddressLine2 sax-input" autocomplete="off" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line2)" /> </div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation address - Line 3 *@
|
||||
<div class="sax-form-control OrganisationAddressLine3">
|
||||
<div class="sax-control row">
|
||||
<div class="col"><input type="text" id="ifOrganisationAddressLine3" name="OrganisationAddressLine3" class="OrganisationAddressLine3 sax-input" autocomplete="off" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Line3)" /> </div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation address - Town *@
|
||||
<div class="sax-form-control OrganisationAddressTown">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationAddressTown"><span><span class="required">*</span> @Localiser["label.town"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
<div class="col"><input type="text" id="ifOrganisationAddressTown" name="OrganisationAddressTown" class="OrganisationAddressTown sax-input" autocomplete="off" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Town)" /> </div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation address - Province *@
|
||||
<div class="sax-form-control OrganisationAddressProvince">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationAddressProvince"><span><span class="required">*</span> @Localiser["label.province"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
<div class="col"><input type="text" id="ifOrganisationAddressProvince" name="OrganisationAddressProvince" class="OrganisationAddressProvince sax-input" autocomplete="off" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_Province)" /> </div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation address - PostalCode *@
|
||||
<div class="sax-form-control OrganisationAddressPostalCode">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationAddressPostalCode"><span><span class="required">*</span> @Localiser["label.postalCode"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
<div class="col"><input type="text" id="ifOrganisationAddressPostalCode" name="OrganisationAddressPostalCode" class="OrganisationAddressPostalCode sax-input" autocomplete="off" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.ItemAddress_PostalCode)" /> </div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
|
||||
@* Organisation PhoneMain *@
|
||||
@*
|
||||
<div class="sax-form-control OrganisationPhoneMain">
|
||||
<div class="sax-label">
|
||||
<label for="ifOrganisationPhoneMain"><span><span class="required">*</span> @Localiser["label.phone"]</span></label>
|
||||
</div>
|
||||
<div class="sax-control row">
|
||||
<div class="col"><input type="text" id="ifOrganisationPhoneMain" name="OrganisationPhoneMain" class="OrganisationPhoneMain sax-input" autocomplete="off" maxlength="@Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Item_PhoneMain)" /> </div>
|
||||
</div>
|
||||
<div class="sax-message"></div>
|
||||
</div>
|
||||
*@
|
||||
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
<div class="spacer8"></div>
|
||||
|
||||
@* Register Organisation *@
|
||||
@if (false)
|
||||
@if (true)
|
||||
{
|
||||
<div class="sax-panel-info">
|
||||
<div class="sax-content">
|
||||
<div class="sax-para">Do you belong to a club or association that would benefit from participating on this platform?</div>
|
||||
<div class="sax-para">Sign-up now with a few details and we'll let you know when you can login and get going.</div>
|
||||
<div class="sax-para center"><div class="sax-button-cta" onclick="sax.orgReq.fn.requestOrganisation()">Register Your Organisation</div></div>
|
||||
<div class="sax-para">@Localiser["home.organisation.request.para1"]</div>
|
||||
<div class="sax-para">@Localiser["home.organisation.request.para2"]</div>
|
||||
<div class="sax-para center"><div class="sax-button-cta" onclick="sax.orgReq.fn.requestOrganisation()">@Localiser["home.organisation.request.action"]</div></div>
|
||||
</div>
|
||||
</div>
|
||||
<partial name="~/Views/Common/OrganisationRequest.cshtml" />
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
},
|
||||
"Email": {
|
||||
"Context": "SWP-Email-Prod",
|
||||
"Context": "SAX-SF-Prod",
|
||||
"ContactUs": {
|
||||
"AddressesTo": [],
|
||||
"AddressesBcc": [ "dev@solumforti.com" ]
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
}
|
||||
},
|
||||
"Email": {
|
||||
"Context": "SWP-Email-Prod",
|
||||
"Context": "SAX-SF-Prod",
|
||||
"ContactUs": {
|
||||
"AddressesTo": [ ],
|
||||
"AddressesTo": [],
|
||||
"AddressesBcc": [ "dev@solumforti.com" ]
|
||||
},
|
||||
"Signup": {
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
.sax-panel-form > .sax-header .sax-caption
|
||||
{
|
||||
color:#f0f0f0;
|
||||
color: #f0f0f0;
|
||||
}
|
||||
|
||||
.sax-panel-info > .sax-header .sax-action img:hover,
|
||||
@@ -66,6 +66,24 @@
|
||||
box-shadow: 2px 2px 4px 0 #80808080;
|
||||
}
|
||||
|
||||
.sax-panel-info > .sax-header .dropdown-menu,
|
||||
.sax-panel-form > .sax-header .dropdown-menu
|
||||
{
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
.sax-panel-info > .sax-header ul.nav,
|
||||
.sax-panel-form > .sax-header ul.nav
|
||||
{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sax-panel-info > .sax-header .dropdown-menu .sax-action,
|
||||
.sax-panel-form > .sax-header .dropdown-menu .sax-action
|
||||
{
|
||||
font-size: .8rem;
|
||||
}
|
||||
|
||||
.sax-panel-info > .sax-content,
|
||||
.sax-panel-form > .sax-content
|
||||
{
|
||||
@@ -110,6 +128,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
.sax-form .sax-form-control .sax-caption,
|
||||
.sax-form .sax-form-control .sax-label
|
||||
{
|
||||
margin: 0 0 4px 0;
|
||||
@@ -117,6 +136,12 @@
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.sax-form .sax-form-control .sax-caption
|
||||
{
|
||||
font-size: 1.1rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.sax-form .sax-form-control .sax-label-text
|
||||
{
|
||||
font-size: 1rem;
|
||||
@@ -151,7 +176,7 @@
|
||||
|
||||
.sax-form .sax-input.sax-calendar
|
||||
{
|
||||
max-width:180px;
|
||||
max-width: 180px;
|
||||
}
|
||||
|
||||
.sax-form .sax-textarea, .sax-form .sax-select[multiple="multiple"]
|
||||
|
||||
@@ -143,7 +143,7 @@ a:focus
|
||||
.sax-action-link
|
||||
{
|
||||
display: inline-block;
|
||||
font-size: 16px;
|
||||
font-size: 1rem;
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
cursor: pointer;
|
||||
@@ -254,6 +254,7 @@ a:focus
|
||||
}
|
||||
|
||||
/* --- Modal Please wait --- */
|
||||
|
||||
#sax-please-wait
|
||||
{
|
||||
display: none;
|
||||
@@ -267,7 +268,16 @@ a:focus
|
||||
background: rgba(250,250,250,.25) url('../img/animated/InProgress-01.gif') 50% 50% no-repeat;
|
||||
}
|
||||
|
||||
/* Drop down menus */
|
||||
|
||||
.dropdown-toggle.caret-off::before,
|
||||
.dropdown-toggle.caret-off::after
|
||||
{
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Dialogs */
|
||||
|
||||
.sax-dialog
|
||||
{
|
||||
display: none;
|
||||
@@ -301,7 +311,7 @@ a:focus
|
||||
|
||||
.ui-dialog.ui-widget.sax-dialog-rounding-none.ui-widget-content.ui-corner-all
|
||||
{
|
||||
border-radius:0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.ui-dialog.ui-widget .ui-widget-header
|
||||
@@ -349,7 +359,7 @@ a:focus
|
||||
{
|
||||
float: none;
|
||||
width: 100%;
|
||||
text-align:right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.ui-dialog .ui-dialog-buttonpane button
|
||||
|
||||
@@ -62,10 +62,6 @@
|
||||
$item.off('dblclick').on('dblclick', function () { sax.updateItem(item.id) })
|
||||
$('.sax-panel-results .sax-panel-messages').hide().empty();
|
||||
}
|
||||
sax.refreshPaging = function (response)
|
||||
{
|
||||
sax.resultsPaging.fn.refreshPaging(response.paging);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
sax.segmentId = function (idx)
|
||||
|
||||
@@ -108,6 +108,11 @@
|
||||
{
|
||||
return $(sel).datepicker();
|
||||
}
|
||||
sax.refreshPaging = function (response, context, refreshFn)
|
||||
{
|
||||
if (sax.resultsPaging.fn.refreshPaging)
|
||||
sax.resultsPaging.fn.refreshPaging(response.paging, context, refreshFn);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// Page navigation.
|
||||
@@ -380,9 +385,9 @@
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// Data entry.
|
||||
sax.clearControlErrors = function ()
|
||||
sax.clearControlErrors = function (context)
|
||||
{
|
||||
var $ctrls = $('.sax-form-control').removeClass('sax-error');
|
||||
var $ctrls = $('.sax-form-control', $(context)).removeClass('sax-error');
|
||||
$('.sax-message', $ctrls).empty();
|
||||
}
|
||||
sax.clearControlError = function (sel)
|
||||
@@ -397,7 +402,7 @@
|
||||
}
|
||||
sax.refreshControlValues = function (controlValues, context)
|
||||
{
|
||||
var $frmCtrls = $('.sax-form-control', context).removeClass('sax-error');
|
||||
var $frmCtrls = $('.sax-form-control', $(context)).removeClass('sax-error');
|
||||
sax.clearControlErrors();
|
||||
var values = (controlValues || []);
|
||||
var valuesLen = values.length;
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
or.fn.requestOrganisation = function ()
|
||||
{
|
||||
or.fn.init();
|
||||
$('input[type="text"],textarea,select,.OrganisationSportId,.OrganisationRegionIdCountry', or.$frm).val('');
|
||||
$('.OrganisationRegionIdCountry', or.$frm).val(sax.data.regionIdCountryDefault);
|
||||
$('.OrganisationRegionCaptionCountry', or.$frm).val(sax.data.regionNameCountryDefault);
|
||||
sax.clearControlErrors(or.$frm);
|
||||
sax.openDialog(or.$dlg, 640, 760);
|
||||
}
|
||||
or.fn.storeOrganisation = function ()
|
||||
@@ -23,8 +27,11 @@
|
||||
or.fn.handleRequestOrganisationResponse = function (response)
|
||||
{
|
||||
sax.debug('or.handleRequestOrganisationResponse', response);
|
||||
if (!response) return;
|
||||
sax.refreshControlValues(response.controlValues, or.$frm);
|
||||
if (!response.success) return;
|
||||
|
||||
or.$dlg.dialog('close');
|
||||
or.fn.cleanUp();
|
||||
}
|
||||
or.fn.cleanUp = function ()
|
||||
{
|
||||
@@ -44,12 +51,12 @@
|
||||
//--------------------------------------------------------------
|
||||
sax.selectOrgRegion = function ()
|
||||
{
|
||||
sax.data.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('.OrganisationRegionId', or.$frm).val(), typesInc:[30], fnCallback: sax.onSelectOrgRegion })
|
||||
sax.data.selectRegion.fn.selectRegion({ caption: sax.dlg.title.selectRegion, regionId: $('.OrganisationRegionIdCountry', or.$frm).val(), typesInc:[30], fnCallback: sax.onSelectOrgRegion })
|
||||
}
|
||||
sax.onSelectOrgRegion = function (region)
|
||||
{
|
||||
sax.clearControlError($('.OrganisationRegionId', or.$frm).val(region.id));
|
||||
$('.OrganisationRegionCaption', or.$frm).val(region ? region.name : '');
|
||||
sax.clearControlError($('.OrganisationRegionIdCountry', or.$frm).val(region.id));
|
||||
$('.OrganisationRegionCaptionCountry', or.$frm).val(region ? region.name : '');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
@@ -59,9 +66,11 @@
|
||||
var opt = sax.dlgOpts();
|
||||
opt.title = sax.orgReq.dlgTitleRequestOrganisation;
|
||||
opt.buttons[sax.dlg.btn.ok] = function () { or.fn.storeOrganisation(); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { or.fn.cleanUp(); $(this).dialog('close'); };
|
||||
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); or.fn.cleanUp(); };
|
||||
or.$dlg = $('#dlgOrganisationRequest').dialog(opt);
|
||||
or.$frm = $('#frmOrganisationRequest', or.$dlg);
|
||||
$('.sax-input, .sax-textarea', or.$frm).on('input', function () { sax.clearControlError(this); });
|
||||
$('.sax-select', or.$frm).on('change', function () { sax.clearControlError(this); });
|
||||
}
|
||||
|
||||
}(window, window.document));
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static class Version
|
||||
{
|
||||
private static String version { get; } = "1.1.1.0";
|
||||
private static String version { get; } = "1.1.2.0";
|
||||
// Retrieve version.
|
||||
public static String GetFullVersion () { return version; }
|
||||
public static String GetAppVersion ()
|
||||
@@ -40,8 +40,11 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
// Version history.
|
||||
//-------------------------------------------------------------------
|
||||
// 1.1.2 ??-Jul-2021 Organisation Request.
|
||||
// 1.1.3 ??-Jul-2021 Organisation Activation.
|
||||
// - Admin organisation activation.
|
||||
// 1.1.2 10-Jul-2021 Organisation Request.
|
||||
// - Online Organisation Request.
|
||||
// - Admin data maintenance paging, organisations filter.
|
||||
// 1.1.1 2-Jul-2021 Add User fix.
|
||||
// - Admin fix Internals Region cache issue on null value.
|
||||
// - Optional user title.
|
||||
|
||||
@@ -274,11 +274,12 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
public enum OrganisationRole
|
||||
{
|
||||
Unknown = 0,
|
||||
/* Do not change the values - tied to database. */
|
||||
/* Do not change the values/codes - tied to database. */
|
||||
Member,
|
||||
MemberAdmin,
|
||||
ScheduleAdmin,
|
||||
OpportunityAdmin,
|
||||
ArticleAdmin,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -130,6 +130,7 @@ namespace Saxonite.Net.Standard.Base.App
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.MemberAdmin, "MBA", "Member Admin");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.ScheduleAdmin, "SCA", "Schedule Admin");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.OpportunityAdmin, "OPA", "Opportunity Admin");
|
||||
organisationRoleCodes.Add(Sax.OrganisationRole.ArticleAdmin, "ARA", "Article Admin");
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Opportunity types.
|
||||
|
||||
@@ -441,9 +441,10 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -455,6 +456,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
public List<ItemId> ItemIdsIncluded { get; } = new List<ItemId>();
|
||||
public String AddressPartial { get; set; }
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
@@ -296,10 +296,10 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
Deleted,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -311,6 +311,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
public List<ItemId> ItemIdsIncluded { get; } = new List<ItemId>();
|
||||
public List<Sax.ImageType> ImageTypesIncluded { get; } = new List<Sax.ImageType>();
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
@@ -184,9 +184,10 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -198,6 +199,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
public List<ItemId> ItemIdsIncluded { get; } = new List<ItemId>();
|
||||
public List<SysId> SportIdsIncluded { get; } = new List<SysId>();
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
@@ -241,9 +241,10 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -260,6 +261,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public String SummaryPartial { get; set; }
|
||||
/// <summary>General filter value - headline, summary, sport, body etc. </summary>
|
||||
public String ArticleFilter { get; set; }
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
// Data members.
|
||||
private readonly DataProperties data = new DataProperties();
|
||||
// Construction.
|
||||
public Data ()
|
||||
public Data()
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
set { CheckChanged(data.RegionIdPrimary, value); data.RegionIdPrimary = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom (Data data)
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
Name = data.Name;
|
||||
OrganisationType = data.OrganisationType;
|
||||
@@ -118,7 +118,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
RegionIdPrimary = data.RegionIdPrimary;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone ()
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
@@ -146,7 +146,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SaxOrganisation (SysId id) : base(id)
|
||||
protected SaxOrganisation(SysId id) : base(id)
|
||||
{
|
||||
base.SetData(data);
|
||||
Status = DefaultStatus;
|
||||
@@ -156,6 +156,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
// Status.
|
||||
private static readonly List<SaStatus> validStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Awaiting,
|
||||
SaStatus.Active,
|
||||
SaStatus.OnHold,
|
||||
SaStatus.Inactive,
|
||||
@@ -163,7 +164,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Active; } }
|
||||
public static List<SaStatus> ValidStatuses { get { return new List<SaStatus>(validStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState (SaStatus status)
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
if (status == SaStatus.Active) return DataValue.TriStateType.Green;
|
||||
if (status == SaStatus.OnHold) return DataValue.TriStateType.Amber;
|
||||
@@ -174,15 +175,23 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
public ItemId GetItemId ()
|
||||
public ItemId GetItemId()
|
||||
{
|
||||
return new ItemId((short)Sax.DataItemType.Organisation, Id);
|
||||
}
|
||||
// Sport is mandatory for certain organisation categories.
|
||||
public static bool IsSportMandatory(Sax.OrganisationCategory organisationCategory)
|
||||
{
|
||||
if (organisationCategory == Sax.OrganisationCategory.Club) return true;
|
||||
if (organisationCategory == Sax.OrganisationCategory.Association) return true;
|
||||
if (organisationCategory == Sax.OrganisationCategory.Education) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData () { return data.Clone(); }
|
||||
public void SetData (Data data)
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
@@ -240,9 +249,11 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
AwaitingOnly,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -254,6 +265,8 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
public String NameFull { get; set; }
|
||||
public String NamePartial { get; set; }
|
||||
public Sax.OrganisationCategory OrganisationCategory { get; set; } = Sax.OrganisationCategory.Unknown;
|
||||
public Sax.OrganisationType OrganisationType { get; set; } = Sax.OrganisationType.Unknown;
|
||||
/// <summary>Partial match on a number of fields, including name, sport, address, etc.</summary>
|
||||
public String OrganisationFilter { get; set; }
|
||||
public List<SysId> SportIdsIncluded { get; } = new List<SysId>();
|
||||
|
||||
@@ -268,9 +268,10 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
|
||||
@@ -257,9 +257,10 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -277,6 +278,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public String RegionFilter { get; set; }
|
||||
public String NameFull { get; set; }
|
||||
public String NamePartial { get; set; }
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
|
||||
}
|
||||
|
||||
@@ -144,9 +144,10 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -160,6 +161,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public String SportFilter { get; set; }
|
||||
public String NameFull { get; set; }
|
||||
public String NamePartial { get; set; }
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
|
||||
}
|
||||
|
||||
@@ -420,9 +420,11 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
AwaitingOnly,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -437,6 +439,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
/// <summary>Partial match on various user account properties including name, countries etc.</summary>
|
||||
public String UserAccountFilter { get; set; }
|
||||
public List<Sax.UserRole> ActiveRoles { get; } = new List<Sax.UserRole>();
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
|
||||
}
|
||||
|
||||
@@ -298,9 +298,10 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -312,9 +313,10 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
|
||||
public List<ItemId> ItemIdsIncluded { get; } = new List<ItemId>();
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Table aliases - blank if not linked.
|
||||
// Table aliases - blank if not specified/linked.
|
||||
public String Alias_UserActivity { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -238,9 +238,10 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -251,12 +252,18 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public List<SysId> IdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
|
||||
public SaxUserAccount.StatusCat UserAccountStatusCat { get; set; } = SaxUserAccount.StatusCat.Any;
|
||||
public List<SysId> OrganisationIdsIncluded { get; } = new List<SysId>();
|
||||
/// <summary>Set true to restruct to User Organisations with at least one Organisation Role.</summary>
|
||||
public bool OrganisationMembersOnly { get; set; }
|
||||
public List<Sax.OrganisationRole> OrganisationRoles { get; } = new List<Sax.OrganisationRole>();
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
// Table aliases - blank if not specified/linked.
|
||||
public String Alias_UserOrganisation{ get; set; }
|
||||
public String Alias_UserAccount { get; set; }
|
||||
public String Alias_Organisation { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -178,9 +178,10 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -192,6 +193,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
|
||||
public List<Sax.UserRole> UserRolesIncluded { get; } = new List<Sax.UserRole>();
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
@@ -217,9 +217,10 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
NotDeleted,
|
||||
ActiveOnly,
|
||||
InctiveOnly,
|
||||
InactiveOnly,
|
||||
NotDeleted,
|
||||
DeletedOnly,
|
||||
}
|
||||
/// <summary>
|
||||
/// Item list parameters.
|
||||
@@ -231,6 +232,7 @@ namespace Saxonite.Net.Standard.Base.Bus
|
||||
public List<SysId> IdsExcluded { get; } = new List<SysId>();
|
||||
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
|
||||
public List<SysId> SportIdsIncluded { get; } = new List<SysId>();
|
||||
// Common properties.
|
||||
public String NotesPartial { get; set; }
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,8 @@ namespace Saxonite.Net.Standard.Base.Helpers
|
||||
Email_Header_Html,
|
||||
Email_Footer_Html,
|
||||
// Email templates.
|
||||
Email_ContactUs_Html,
|
||||
Email_Signup_Activate_Html,
|
||||
Email_Signup_Welcome_Html,
|
||||
Email_RequestPassword_Html,
|
||||
Email_Security_AccountActivated_Html,
|
||||
Email_Security_RequestPassword_Html,
|
||||
// Data - countries etc.
|
||||
Data_CountriesWithRegions_Txt,
|
||||
}
|
||||
@@ -53,16 +51,10 @@ namespace Saxonite.Net.Standard.Base.Helpers
|
||||
resourceFilename = "sax-email-footer.html";
|
||||
break;
|
||||
// Email templates.
|
||||
case TextResource.Email_ContactUs_Html:
|
||||
resourceFilename = "sax-email-contact-us.html";
|
||||
case TextResource.Email_Security_AccountActivated_Html:
|
||||
resourceFilename = "sax-email-account-activated.html";
|
||||
break;
|
||||
case TextResource.Email_Signup_Activate_Html:
|
||||
resourceFilename = "sax-email-signup-activate.html";
|
||||
break;
|
||||
case TextResource.Email_Signup_Welcome_Html:
|
||||
resourceFilename = "sax-email-signup-welcome.html";
|
||||
break;
|
||||
case TextResource.Email_RequestPassword_Html:
|
||||
case TextResource.Email_Security_RequestPassword_Html:
|
||||
resourceFilename = "sax-email-request-password.html";
|
||||
break;
|
||||
// Data.
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Account Activated</title>
|
||||
[#Email.MainStylesheet]
|
||||
</head>
|
||||
<body>
|
||||
[#Email.Header]
|
||||
<div class="sax-email-body">
|
||||
<div class="sax-email-panel-caption">
|
||||
<div class="sax-caption">Account Activated</div>
|
||||
</div>
|
||||
<div class="sax-email-panel-content">
|
||||
<div class="sax-para">Congratulations - yoru account has been activated.</div>
|
||||
<div class="sax-para">Follow <span style="font-weight:bold;"><a href="[#Link.RequestPassword]">this link</a></span> to set a password against your account.</div>
|
||||
<div class="sax-para">Once that's been done you'll be able to sign-in and participate on the platform.</div>
|
||||
<div class="sax-para">The link will expire in [#Link.ExpiresMinutes] minutes.</div>
|
||||
<div class="sax-para">Thank you.</div>
|
||||
</div>
|
||||
</div>
|
||||
[#Email.Footer]
|
||||
</body>
|
||||
</html>
|
||||
@@ -24,6 +24,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Resources\Email\Security\sax-email-account-activated.html" />
|
||||
<None Remove="Resources\Email\Shared\sax-email-footer.html" />
|
||||
<None Remove="Resources\Email\Shared\sax-email-header.html" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Saxonite.Net.Standard.Dbas.App
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
public static readonly string messageTitle = "Saxonite database definition generator";
|
||||
//public static readonly string messageTitle = "Saxonite database definition generator";
|
||||
public enum DatabaseInstance
|
||||
{
|
||||
Core
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
Organisation_Db dbOrganisation = new Organisation_Db(CoreDbInfo);
|
||||
dbOrganisation.PopulateFrom(dbCommand, aliasOrganisation, "Id=" + SysId.ToString(organisation.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_Organisation updateLogMonitor = new SaxUpdateLogItemMonitor_Organisation(SessionContext, CreateOrganisation(dbOrganisation), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbOrganisation, organisation, dbUpdateInfo);
|
||||
dbOrganisation.ExecuteUpdateCommand(dbCommand);
|
||||
organisation.Changed = false;
|
||||
@@ -177,16 +177,23 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteOrganisation";
|
||||
ClearErrorState();
|
||||
if (!OrganisationCanBeDeleted(organisation)) return false;
|
||||
|
||||
// Organisations are logically deleted by changing the status.
|
||||
organisation.Status = SaStatus.Deleted;
|
||||
return UpdateOrganisation(organisation, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve organisation.
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
Organisation_Db dbOrganisation = new Organisation_Db(CoreDbInfo);
|
||||
dbOrganisation.PopulateFrom(dbCommand, aliasOrganisation, "Id=" + organisation.Id.ToString());
|
||||
// Delete organisation.
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.Organisation) + " WHERE Id=" + SysId.ToString(organisation.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
@@ -196,6 +203,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -204,15 +212,13 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
{
|
||||
dbOrganisation._Id = SysId.ToInt(organisation.Id);
|
||||
dbOrganisation._Name = organisation.Name;
|
||||
dbOrganisation._PhoneMain = organisation.PhoneMain;
|
||||
dbOrganisation._PhoneAlt = organisation.PhoneAlt;
|
||||
dbOrganisation._OrganisationType = OrganisationTypeCodes.GetCodeForType(organisation.OrganisationType);
|
||||
dbOrganisation._OrganisationCategory = OrganisationCategoryCodes.GetCodeForType(organisation.OrganisationCategory);
|
||||
dbOrganisation._PhoneMain = organisation.PhoneMain;
|
||||
dbOrganisation._PhoneAlt = organisation.PhoneAlt;
|
||||
dbOrganisation._SportIdPrimary = SysId.ToInt(organisation.SportIdPrimary);
|
||||
dbOrganisation._RegionIdPrimary = SysId.ToInt(organisation.RegionIdPrimary);
|
||||
dbOrganisation._Notes = organisation.Notes;
|
||||
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;
|
||||
if (!SysId.IsValid(organisation.Id))
|
||||
@@ -390,6 +396,14 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
if (!StringUtil.IsEmpty(prm.NamePartial))
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_Name, aliasOrganisation) + " Like '%" + DbQuery.FormatForLike(prm.NamePartial, true) + "%'");
|
||||
|
||||
// Organisation Type.
|
||||
if (prm.OrganisationType > 0)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_OrganisationType, aliasOrganisation) + "='" + OrganisationTypeCodes.GetCodeForType(prm.OrganisationType) + "'");
|
||||
|
||||
// Organisation Category.
|
||||
if (prm.OrganisationCategory > 0)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_OrganisationCategory, aliasOrganisation) + "='" + OrganisationCategoryCodes.GetCodeForType(prm.OrganisationCategory) + "'");
|
||||
|
||||
// Organisation filter.
|
||||
if (!StringUtil.IsEmpty(prm.OrganisationFilter))
|
||||
{
|
||||
@@ -420,14 +434,26 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_Notes, aliasOrganisation) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxOrganisation.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_Status, aliasOrganisation) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxOrganisation.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_Status, aliasOrganisation) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
if (prm.StatusCat != SaxOrganisation.StatusCat.Any)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_Status, aliasOrganisation) + GetOrganisationStatusCatFilterCondition(prm.StatusCat));
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetOrganisationStatusCatFilterCondition(SaxOrganisation.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SaxOrganisation.StatusCat.AwaitingOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Awaiting) + "'";
|
||||
if (statusCat == SaxOrganisation.StatusCat.ActiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'";
|
||||
if (statusCat == SaxOrganisation.StatusCat.InactiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'";
|
||||
if (statusCat == SaxOrganisation.StatusCat.NotDeleted)
|
||||
return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
if (statusCat == SaxOrganisation.StatusCat.DeletedOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
return "";
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetOrganisationSortColumns(SaxOrganisation.Params prm)
|
||||
{
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
UserAccount_Db dbUserAccount = new UserAccount_Db(CoreDbInfo);
|
||||
dbUserAccount.PopulateFrom(dbCommand, aliasUserAccount, "Id=" + SysId.ToString(userAccount.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_UserAccount updateLogMonitor = new SaxUpdateLogItemMonitor_UserAccount(SessionContext, CreateUserAccount(dbUserAccount), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbUserAccount, userAccount, dbUpdateInfo);
|
||||
dbUserAccount.ExecuteUpdateCommand(dbCommand);
|
||||
userAccount.Changed = false;
|
||||
@@ -177,16 +177,23 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteUserAccount";
|
||||
ClearErrorState();
|
||||
if (!UserAccountCanBeDeleted(userAccount)) return false;
|
||||
|
||||
// User Accounts are logically deleted by changing the status.
|
||||
userAccount.Status = SaStatus.Deleted;
|
||||
return UpdateUserAccount(userAccount, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve userAccount.
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
UserAccount_Db dbUserAccount = new UserAccount_Db(CoreDbInfo);
|
||||
dbUserAccount.PopulateFrom(dbCommand, aliasUserAccount, "Id=" + userAccount.Id.ToString());
|
||||
// Delete userAccount.
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserAccount) + " WHERE Id=" + SysId.ToString(userAccount.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
@@ -196,6 +203,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -208,8 +216,8 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
dbUserAccount._FirstName = userAccount.FirstName;
|
||||
dbUserAccount._Initials = userAccount.Initials;
|
||||
dbUserAccount._LastName = userAccount.LastName;
|
||||
dbUserAccount._PhoneMain = userAccount.PhoneMain;
|
||||
dbUserAccount._PhoneMobile = userAccount.PhoneMobile;
|
||||
dbUserAccount._PhoneMain = StringUtil.EmptyOnNull(userAccount.PhoneMain);
|
||||
dbUserAccount._PhoneMobile = StringUtil.EmptyOnNull(userAccount.PhoneMobile);
|
||||
dbUserAccount._DateOfBirth = userAccount.DateOfBirth;
|
||||
dbUserAccount._RegionIdCountry = SysId.ToInt(userAccount.RegionIdCountry);
|
||||
dbUserAccount._RegionIdProvince = SysId.ToInt(userAccount.RegionIdProvince);
|
||||
@@ -485,14 +493,26 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Notes, aliasUserAccount) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxUserAccount.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Status, aliasUserAccount) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxUserAccount.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Status, aliasUserAccount) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
if (prm.StatusCat != SaxUserAccount.StatusCat.Any)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Status, aliasUserAccount) + GetUserAccountStatusCatFilterCondition(prm.StatusCat));
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetUserAccountStatusCatFilterCondition (SaxUserAccount.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SaxUserAccount.StatusCat.AwaitingOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Awaiting) + "'";
|
||||
if (statusCat == SaxUserAccount.StatusCat.ActiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'";
|
||||
if (statusCat == SaxUserAccount.StatusCat.InactiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'";
|
||||
if (statusCat == SaxUserAccount.StatusCat.NotDeleted)
|
||||
return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
if (statusCat == SaxUserAccount.StatusCat.DeletedOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
return "";
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetUserAccountSortColumns(SaxUserAccount.Params prm)
|
||||
{
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
UserOrganisation_Db dbUserOrganisation = new UserOrganisation_Db(CoreDbInfo);
|
||||
dbUserOrganisation.PopulateFrom(dbCommand, aliasUserOrganisation, "Id=" + SysId.ToString(userOrganisation.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_UserOrganisation updateLogMonitor = new SaxUpdateLogItemMonitor_UserOrganisation(SessionContext, CreateUserOrganisation(dbUserOrganisation), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbUserOrganisation, userOrganisation, dbUpdateInfo);
|
||||
dbUserOrganisation.ExecuteUpdateCommand(dbCommand);
|
||||
userOrganisation.Changed = false;
|
||||
@@ -179,16 +179,23 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteUserOrganisation";
|
||||
ClearErrorState();
|
||||
if (!UserOrganisationCanBeDeleted(userOrganisation)) return false;
|
||||
|
||||
// User Organisations are logically deleted by changing the status.
|
||||
userOrganisation.Status = SaStatus.Deleted;
|
||||
return UpdateUserOrganisation(userOrganisation, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve userOrganisation.
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
UserOrganisation_Db dbUserOrganisation = new UserOrganisation_Db(CoreDbInfo);
|
||||
dbUserOrganisation.PopulateFrom(dbCommand, aliasUserOrganisation, "Id=" + userOrganisation.Id.ToString());
|
||||
// Delete userOrganisation.
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserOrganisation) + " WHERE Id=" + SysId.ToString(userOrganisation.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
@@ -198,6 +205,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -388,20 +396,41 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
public override List<string> GetUserOrganisationQueryFilter(SaxUserOrganisation.Params prm)
|
||||
{
|
||||
List<String> filter = new List<String>();
|
||||
String aliasUserOrganisation = StringUtil.OnEmpty(prm.Alias_UserOrganisation, SaxAccountMgr_Dbas.aliasUserOrganisation);
|
||||
|
||||
// Item Ids.
|
||||
String colUserOrganisation_Id = SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_Id, aliasUserOrganisation);
|
||||
String idsIncluded = prm.IdsIncluded.Concat(",");
|
||||
if (!idsIncluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_Id, aliasUserOrganisation) + " IN (" + idsIncluded + ")");
|
||||
filter.Add(colUserOrganisation_Id + " IN (" + idsIncluded + ")");
|
||||
String idsxcluded = prm.IdsExcluded.Concat(",");
|
||||
if (!idsxcluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_Id, aliasUserOrganisation) + " NOT IN (" + idsxcluded + ")");
|
||||
filter.Add(colUserOrganisation_Id + " NOT IN (" + idsxcluded + ")");
|
||||
|
||||
// User accounts.
|
||||
String userAccountIdsIncluded = prm.UserAccountIdsIncluded.Concat(",");
|
||||
if (!userAccountIdsIncluded.IsEmpty())
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_UserAccountId, aliasUserOrganisation) + " IN (" + userAccountIdsIncluded + ")");
|
||||
|
||||
// User Account status.
|
||||
if (prm.UserAccountStatusCat != SaxUserAccount.StatusCat.Any)
|
||||
{
|
||||
String aliasUserOrganisation_UserAccount = StringUtil.OnEmpty(prm.Alias_UserAccount, SaxAccountMgr_Dbas.aliasUserOrganisation_UserAccount);
|
||||
if (StringUtil.IsEmpty(prm.Alias_UserAccount))
|
||||
{
|
||||
// User Account table isn't linked.
|
||||
DbQuery qry = new DbQuery(CoreDatabase.DbmsType);
|
||||
qry.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserAccount), aliasUserOrganisation_UserAccount);
|
||||
qry.Columns.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Id, aliasUserOrganisation_UserAccount));
|
||||
qry.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Id, aliasUserOrganisation_UserAccount) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_UserAccountId, aliasUserOrganisation));
|
||||
qry.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Status, aliasUserOrganisation_UserAccount) + GetUserAccountStatusCatFilterCondition(prm.UserAccountStatusCat));
|
||||
filter.Add("Exists (" + qry.BuildQuery() + ")");
|
||||
}
|
||||
else
|
||||
// User Account table is linked - filter directly.
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Status, aliasUserOrganisation_UserAccount) + GetUserAccountStatusCatFilterCondition(prm.UserAccountStatusCat));
|
||||
}
|
||||
|
||||
// Organisations.
|
||||
String organisationIdsIncluded = prm.OrganisationIdsIncluded.Concat(",");
|
||||
if (!organisationIdsIncluded.IsEmpty())
|
||||
@@ -426,14 +455,24 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_Notes, aliasUserOrganisation) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxUserOrganisation.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_Status, aliasUserOrganisation) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxUserOrganisation.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_Status, aliasUserOrganisation) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
if (prm.StatusCat != SaxUserOrganisation.StatusCat.Any)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_Status, aliasUserOrganisation) + GetUserOrganisationStatusCatFilterCondition(prm.StatusCat));
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetUserOrganisationStatusCatFilterCondition(SaxUserOrganisation.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SaxUserOrganisation.StatusCat.ActiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'";
|
||||
if (statusCat == SaxUserOrganisation.StatusCat.InactiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'";
|
||||
if (statusCat == SaxUserOrganisation.StatusCat.NotDeleted)
|
||||
return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
if (statusCat == SaxUserOrganisation.StatusCat.DeletedOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
return "";
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetUserOrganisationSortColumns(SaxUserOrganisation.Params prm)
|
||||
{
|
||||
@@ -528,6 +567,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
// Construct query.
|
||||
DbQuery query = new DbQuery(CoreDatabase.DbmsType);
|
||||
query.Tables.Add(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserOrganisation), aliasUserOrganisation);
|
||||
prm.Alias_UserOrganisation = aliasUserOrganisation;
|
||||
|
||||
// Add columns as defined in query list.
|
||||
if (columns.HasId(SaxUserOrganisation.Column.Id))
|
||||
@@ -560,6 +600,9 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
// User Account.
|
||||
if (hasUserAccountCols)
|
||||
{
|
||||
// Inform the parameters that the User Account table is linked.
|
||||
prm.Alias_UserAccount = aliasUserOrganisation_UserAccount;
|
||||
// User Account join.
|
||||
DbQueryJoin joinUserAccount = new DbQueryJoin(DbJoinType.LeftOuter);
|
||||
joinUserAccount.Table = new StringPair(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserAccount), aliasUserOrganisation_UserAccount);
|
||||
joinUserAccount.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserAccount_Id, aliasUserOrganisation_UserAccount) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_UserAccountId, aliasUserOrganisation));
|
||||
@@ -577,6 +620,9 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
// Organisation.
|
||||
if (hasOrganisationCols || hasOrganisationRegionCols || hasOrganisationSportCols)
|
||||
{
|
||||
// Inform the parameters that the Organisation table is linked.
|
||||
prm.Alias_Organisation = aliasUserOrganisation_Organisation;
|
||||
// Organisation join.
|
||||
DbQueryJoin joinOrganisation = new DbQueryJoin(DbJoinType.LeftOuter);
|
||||
joinOrganisation.Table = new StringPair(SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.Organisation), aliasUserOrganisation_Organisation);
|
||||
joinOrganisation.Filters.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Organisation_Id, aliasUserOrganisation_Organisation) + "=" + SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserOrganisation_OrganisationId, aliasUserOrganisation));
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
UserRole_Db dbUserRole = new UserRole_Db(CoreDbInfo);
|
||||
dbUserRole.PopulateFrom(dbCommand, aliasUserRole, "Id=" + SysId.ToString(userRole.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_UserRole updateLogMonitor = new SaxUpdateLogItemMonitor_UserRole(SessionContext, CreateUserRole(dbUserRole), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbUserRole, userRole, dbUpdateInfo);
|
||||
dbUserRole.ExecuteUpdateCommand(dbCommand);
|
||||
userRole.Changed = false;
|
||||
@@ -178,16 +178,23 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteUserRole";
|
||||
ClearErrorState();
|
||||
if (!UserRoleCanBeDeleted(userRole)) return false;
|
||||
|
||||
// User Roles are logically deleted by changing the status.
|
||||
userRole.Status = SaStatus.Deleted;
|
||||
return UpdateUserRole(userRole, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve userRole.
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
UserRole_Db dbUserRole = new UserRole_Db(CoreDbInfo);
|
||||
dbUserRole.PopulateFrom(dbCommand, aliasUserRole, "Id=" + userRole.Id.ToString());
|
||||
// Delete userRole.
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserRole) + " WHERE Id=" + SysId.ToString(userRole.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
@@ -197,6 +204,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -365,14 +373,24 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_Notes, aliasUserRole) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxUserRole.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_Status, aliasUserRole) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxUserRole.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_Status, aliasUserRole) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
if (prm.StatusCat != SaxUserRole.StatusCat.Any)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserRole_Status, aliasUserRole) + GetUserRoleStatusCatFilterCondition(prm.StatusCat));
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetUserRoleStatusCatFilterCondition(SaxUserRole.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SaxUserRole.StatusCat.ActiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'";
|
||||
if (statusCat == SaxUserRole.StatusCat.InactiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'";
|
||||
if (statusCat == SaxUserRole.StatusCat.NotDeleted)
|
||||
return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
if (statusCat == SaxUserRole.StatusCat.DeletedOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
return "";
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetUserRoleSortColumns(SaxUserRole.Params prm)
|
||||
{
|
||||
|
||||
@@ -171,16 +171,23 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteUserSession";
|
||||
ClearErrorState();
|
||||
if (!UserSessionCanBeDeleted(userSession)) return false;
|
||||
|
||||
// User Sessions are logically deleted by changing the status.
|
||||
userSession.Status = SaStatus.Deleted;
|
||||
return UpdateUserSession(userSession, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve userSession.
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
UserSession_Db dbUserSession = new UserSession_Db(CoreDbInfo);
|
||||
dbUserSession.PopulateFrom(dbCommand, aliasUserSession, "UserAccountId=" + SysId.ToString(userSession.UserAccountId));
|
||||
// Delete userSession.
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserSession) + " WHERE UserAccountId=" + SysId.ToString(userSession.UserAccountId) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
@@ -190,6 +197,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
UserSport_Db dbUserSport = new UserSport_Db(CoreDbInfo);
|
||||
dbUserSport.PopulateFrom(dbCommand, aliasUserSport, "Id=" + SysId.ToString(userSport.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_UserSport updateLogMonitor = new SaxUpdateLogItemMonitor_UserSport(SessionContext, CreateUserSport(dbUserSport), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbUserSport, userSport, dbUpdateInfo);
|
||||
dbUserSport.ExecuteUpdateCommand(dbCommand);
|
||||
userSport.Changed = false;
|
||||
@@ -178,16 +178,23 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteUserSport";
|
||||
ClearErrorState();
|
||||
if (!UserSportCanBeDeleted(userSport)) return false;
|
||||
|
||||
// User Sports are logically deleted by changing the status.
|
||||
userSport.Status = SaStatus.Deleted;
|
||||
return UpdateUserSport(userSport, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve userSport.
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
UserSport_Db dbUserSport = new UserSport_Db(CoreDbInfo);
|
||||
dbUserSport.PopulateFrom(dbCommand, aliasUserSport, "Id=" + userSport.Id.ToString());
|
||||
// Delete userSport.
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.UserSport) + " WHERE Id=" + SysId.ToString(userSport.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
@@ -197,6 +204,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -401,14 +409,24 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserSport_Notes, aliasUserSport) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxUserSport.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserSport_Status, aliasUserSport) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxUserSport.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserSport_Status, aliasUserSport) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
if (prm.StatusCat != SaxUserSport.StatusCat.Any)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.UserSport_Status, aliasUserSport) + GetUserSportStatusCatFilterCondition(prm.StatusCat));
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetUserSportStatusCatFilterCondition(SaxUserSport.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SaxUserSport.StatusCat.ActiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'";
|
||||
if (statusCat == SaxUserSport.StatusCat.InactiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'";
|
||||
if (statusCat == SaxUserSport.StatusCat.NotDeleted)
|
||||
return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
if (statusCat == SaxUserSport.StatusCat.DeletedOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
return "";
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetUserSportSortColumns(SaxUserSport.Params prm)
|
||||
{
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
ActivityIndex_Db dbActivityIndex = new ActivityIndex_Db(CoreDbInfo);
|
||||
dbActivityIndex.PopulateFrom(dbCommand, aliasActivityIndex, GetActivityIndexQueryFilter(activityIndex, aliasActivityIndex).Concat(" AND ", "(", ")"));
|
||||
// ToDo SaxUpdateLogItemMonitor_ActivityIndex updateLogMonitor = new SaxUpdateLogItemMonitor_ActivityIndex(SessionContext, CreateActivityIndex(dbActivityIndex), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbActivityIndex, activityIndex, dbUpdateInfo);
|
||||
dbActivityIndex.ExecuteUpdateCommand(dbCommand);
|
||||
activityIndex.Changed = false;
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
JournalistArticle_Db dbJournalistArticle = new JournalistArticle_Db(CoreDbInfo);
|
||||
dbJournalistArticle.PopulateFrom(dbCommand, aliasJournalistArticle, "Id=" + SysId.ToString(journalistArticle.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_JournalistArticle updateLogMonitor = new SaxUpdateLogItemMonitor_JournalistArticle(SessionContext, CreateJournalistArticle(dbJournalistArticle), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbJournalistArticle, journalistArticle, dbUpdateInfo);
|
||||
dbJournalistArticle.ExecuteUpdateCommand(dbCommand);
|
||||
journalistArticle.Changed = false;
|
||||
@@ -178,16 +178,23 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteJournalistArticle";
|
||||
ClearErrorState();
|
||||
if (!JournalistArticleCanBeDeleted(journalistArticle)) return false;
|
||||
|
||||
// Journalist Articles are logically deleted by changing the status.
|
||||
journalistArticle.Status = SaStatus.Deleted;
|
||||
return UpdateJournalistArticle(journalistArticle, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve journalistArticle.
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
JournalistArticle_Db dbJournalistArticle = new JournalistArticle_Db(CoreDbInfo);
|
||||
dbJournalistArticle.PopulateFrom(dbCommand, aliasJournalistArticle, "Id=" + journalistArticle.Id.ToString());
|
||||
// Delete journalistArticle.
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.JournalistArticle) + " WHERE Id=" + SysId.ToString(journalistArticle.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
@@ -197,6 +204,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -437,14 +445,24 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.JournalistArticle_Notes, aliasJournalistArticle) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxJournalistArticle.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.JournalistArticle_Status, aliasJournalistArticle) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxJournalistArticle.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.JournalistArticle_Status, aliasJournalistArticle) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
if (prm.StatusCat != SaxJournalistArticle.StatusCat.Any)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.JournalistArticle_Status, aliasJournalistArticle) + GetJournalistArticleStatusCatFilterCondition(prm.StatusCat));
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetJournalistArticleStatusCatFilterCondition(SaxJournalistArticle.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SaxJournalistArticle.StatusCat.ActiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'";
|
||||
if (statusCat == SaxJournalistArticle.StatusCat.InactiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'";
|
||||
if (statusCat == SaxJournalistArticle.StatusCat.NotDeleted)
|
||||
return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
if (statusCat == SaxJournalistArticle.StatusCat.DeletedOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
return "";
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetJournalistArticleSortColumns(SaxJournalistArticle.Params prm)
|
||||
{
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
OrganisationOpportunity_Db dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||
dbOrganisationOpportunity.PopulateFrom(dbCommand, aliasOrganisationOpportunity, "Id=" + SysId.ToString(organisationOpportunity.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_OrganisationOpportunity updateLogMonitor = new SaxUpdateLogItemMonitor_OrganisationOpportunity(SessionContext, CreateOrganisationOpportunity(dbOrganisationOpportunity), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbOrganisationOpportunity, organisationOpportunity, dbUpdateInfo);
|
||||
dbOrganisationOpportunity.ExecuteUpdateCommand(dbCommand);
|
||||
organisationOpportunity.Changed = false;
|
||||
@@ -178,16 +178,23 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteOrganisationOpportunity";
|
||||
ClearErrorState();
|
||||
if (!OrganisationOpportunityCanBeDeleted(organisationOpportunity)) return false;
|
||||
|
||||
// Organisation Opportunities are logically deleted by changing the status.
|
||||
organisationOpportunity.Status = SaStatus.Deleted;
|
||||
return UpdateOrganisationOpportunity(organisationOpportunity, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve organisationOpportunity.
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
OrganisationOpportunity_Db dbOrganisationOpportunity = new OrganisationOpportunity_Db(CoreDbInfo);
|
||||
dbOrganisationOpportunity.PopulateFrom(dbCommand, aliasOrganisationOpportunity, "Id=" + organisationOpportunity.Id.ToString());
|
||||
// Delete organisationOpportunity.
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.OrganisationOpportunity) + " WHERE Id=" + SysId.ToString(organisationOpportunity.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
@@ -197,6 +204,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -468,14 +476,24 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.OrganisationOpportunity_Notes, aliasOrganisationOpportunity) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxOrganisationOpportunity.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.OrganisationOpportunity_Status, aliasOrganisationOpportunity) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxOrganisationOpportunity.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.OrganisationOpportunity_Status, aliasOrganisationOpportunity) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
if (prm.StatusCat != SaxOrganisationOpportunity.StatusCat.Any)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.OrganisationOpportunity_Status, aliasOrganisationOpportunity) + GetOrganisationOpportunityStatusCatFilterCondition(prm.StatusCat));
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetOrganisationOpportunityStatusCatFilterCondition(SaxOrganisationOpportunity.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SaxOrganisationOpportunity.StatusCat.ActiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'";
|
||||
if (statusCat == SaxOrganisationOpportunity.StatusCat.InactiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'";
|
||||
if (statusCat == SaxOrganisationOpportunity.StatusCat.NotDeleted)
|
||||
return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
if (statusCat == SaxOrganisationOpportunity.StatusCat.DeletedOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
return "";
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetOrganisationOpportunitySortColumns(SaxOrganisationOpportunity.Params prm)
|
||||
{
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
UserActivity_Db dbUserActivity = new UserActivity_Db(CoreDbInfo);
|
||||
dbUserActivity.PopulateFrom(dbCommand, aliasUserActivity, "Id=" + SysId.ToString(userActivity.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_UserActivity updateLogMonitor = new SaxUpdateLogItemMonitor_UserActivity(SessionContext, CreateUserActivity(dbUserActivity), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbUserActivity, userActivity, dbUpdateInfo);
|
||||
dbUserActivity.ExecuteUpdateCommand(dbCommand);
|
||||
userActivity.Changed = false;
|
||||
@@ -178,6 +178,13 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteUserActivity";
|
||||
ClearErrorState();
|
||||
if (!UserActivityCanBeDeleted(userActivity)) return false;
|
||||
|
||||
// User Activities are logically deleted by changing the status.
|
||||
userActivity.Status = SaStatus.Deleted;
|
||||
return UpdateUserActivity(userActivity, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
@@ -197,6 +204,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
ItemAddress_Db dbItemAddress = new ItemAddress_Db(CoreDbInfo);
|
||||
dbItemAddress.PopulateFrom(dbCommand, aliasItemAddress, "Id=" + SysId.ToString(itemAddress.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_ItemAddress updateLogMonitor = new SaxUpdateLogItemMonitor_ItemAddress(SessionContext, CreateItemAddress(dbItemAddress), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbItemAddress, itemAddress, dbUpdateInfo);
|
||||
dbItemAddress.ExecuteUpdateCommand(dbCommand);
|
||||
itemAddress.Changed = false;
|
||||
@@ -179,16 +179,23 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteItemAddress";
|
||||
ClearErrorState();
|
||||
if (!ItemAddressCanBeDeleted(itemAddress)) return false;
|
||||
|
||||
// Item Addresses are logically deleted by changing the status.
|
||||
itemAddress.Status = SaStatus.Deleted;
|
||||
return UpdateItemAddress(itemAddress, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve itemAddress.
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
ItemAddress_Db dbItemAddress = new ItemAddress_Db(CoreDbInfo);
|
||||
dbItemAddress.PopulateFrom(dbCommand, aliasItemAddress, "Id=" + itemAddress.Id.ToString());
|
||||
// Delete itemAddress.
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemAddress) + " WHERE Id=" + SysId.ToString(itemAddress.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
@@ -198,6 +205,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -208,26 +216,26 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
dbItemAddress._ItemType = itemAddress.ItemId.Type;
|
||||
dbItemAddress._ItemId = SysId.ToInt(itemAddress.ItemId.Id);
|
||||
dbItemAddress._AddressType = (short)itemAddress.AddressType;
|
||||
dbItemAddress._Caption = itemAddress.Caption;
|
||||
dbItemAddress._Line1 = itemAddress.Line1;
|
||||
dbItemAddress._Line2 = itemAddress.Line2;
|
||||
dbItemAddress._Line3 = itemAddress.Line3;
|
||||
dbItemAddress._Town = itemAddress.Town;
|
||||
dbItemAddress._Province = itemAddress.Province;
|
||||
dbItemAddress._Caption = StringUtil.EmptyOnNull(itemAddress.Caption);
|
||||
dbItemAddress._Line1 = StringUtil.EmptyOnNull(itemAddress.Line1);
|
||||
dbItemAddress._Line2 = StringUtil.EmptyOnNull(itemAddress.Line2);
|
||||
dbItemAddress._Line3 = StringUtil.EmptyOnNull(itemAddress.Line3);
|
||||
dbItemAddress._Town = StringUtil.EmptyOnNull(itemAddress.Town);
|
||||
dbItemAddress._Province = StringUtil.EmptyOnNull(itemAddress.Province);
|
||||
dbItemAddress._RegionIdProvince = SysId.ToInt(itemAddress.RegionIdProvince);
|
||||
dbItemAddress._Country = itemAddress.Country;
|
||||
dbItemAddress._Country = StringUtil.EmptyOnNull(itemAddress.Country);
|
||||
dbItemAddress._RegionIdCountry = SysId.ToInt(itemAddress.RegionIdCountry);
|
||||
// Location.
|
||||
dbItemAddress._LocationSource = itemAddress.LocationSource;
|
||||
dbItemAddress._LocationSource = StringUtil.EmptyOnNull(itemAddress.LocationSource);
|
||||
dbItemAddress._LocationStoredAt = itemAddress.LocationStoredAt;
|
||||
dbItemAddress._LocationUpdateRequired = itemAddress.LocationUpdateRequired;
|
||||
dbItemAddress._LocationData = itemAddress.LocationData;
|
||||
dbItemAddress._LocationFormattedAddress = itemAddress.LocationFormattedAddress;
|
||||
dbItemAddress._LocationData = StringUtil.EmptyOnNull(itemAddress.LocationData);
|
||||
dbItemAddress._LocationFormattedAddress = StringUtil.EmptyOnNull(itemAddress.LocationFormattedAddress);
|
||||
dbItemAddress._LocationLatitude = itemAddress.LocationLatitude;
|
||||
dbItemAddress._LocationLongitude = itemAddress.LocationLongitude;
|
||||
dbItemAddress._LocationAltitude = itemAddress.LocationAltitude;
|
||||
// Common.
|
||||
dbItemAddress._Notes = itemAddress.Notes;
|
||||
dbItemAddress._Notes = StringUtil.EmptyOnNull(itemAddress.Notes);
|
||||
dbItemAddress._Status = SacsSystem.GetStatusCode(itemAddress.Status);
|
||||
dbItemAddress._Flags = (short)itemAddress.Flags;
|
||||
if (!SysId.IsValid(itemAddress.Id))
|
||||
@@ -433,14 +441,24 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Notes, aliasItemAddress) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxItemAddress.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Status, aliasItemAddress) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxItemAddress.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Status, aliasItemAddress) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
if (prm.StatusCat != SaxItemAddress.StatusCat.Any)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemAddress_Status, aliasItemAddress) + GetItemAddressStatusCatFilterCondition(prm.StatusCat));
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetItemAddressStatusCatFilterCondition(SaxItemAddress.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SaxItemAddress.StatusCat.ActiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'";
|
||||
if (statusCat == SaxItemAddress.StatusCat.InactiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'";
|
||||
if (statusCat == SaxItemAddress.StatusCat.NotDeleted)
|
||||
return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
if (statusCat == SaxItemAddress.StatusCat.DeletedOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
return "";
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetItemAddressSortColumns(SaxItemAddress.Params prm)
|
||||
{
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
ItemImage_Db dbItemImage = new ItemImage_Db(CoreDbInfo);
|
||||
dbItemImage.PopulateFrom(dbCommand, aliasItemImage, "Id=" + SysId.ToString(itemImage.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_ItemImage updateLogMonitor = new SaxUpdateLogItemMonitor_ItemImage(SessionContext, CreateItemImage(dbItemImage), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbItemImage, itemImage, dbUpdateInfo);
|
||||
dbItemImage.ExecuteUpdateCommand(dbCommand);
|
||||
itemImage.Changed = false;
|
||||
@@ -179,16 +179,27 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteItemImage";
|
||||
ClearErrorState();
|
||||
if (!ItemImageCanBeDeleted(itemImage)) return false;
|
||||
bool logicalDelete = true;
|
||||
|
||||
if (logicalDelete)
|
||||
{
|
||||
// Logical deletion.
|
||||
itemImage.Status = SaStatus.Deleted;
|
||||
return UpdateItemImage(itemImage, dbUpdateInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve itemImage.
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
ItemImage_Db dbItemImage = new ItemImage_Db(CoreDbInfo);
|
||||
dbItemImage.PopulateFrom(dbCommand, aliasItemImage, "Id=" + itemImage.Id.ToString());
|
||||
// Delete itemImage.
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemImage) + " WHERE Id=" + SysId.ToString(itemImage.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
@@ -199,6 +210,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
}
|
||||
return !HasErrorState();
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copy data properties to and from database.
|
||||
@@ -409,18 +421,24 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Notes, aliasItemImage) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxItemImage.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Status, aliasItemImage) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxItemImage.StatusCat.InctiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Status, aliasItemImage) + "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'");
|
||||
else if (prm.StatusCat == SaxItemImage.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Status, aliasItemImage) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
else if (prm.StatusCat == SaxItemImage.StatusCat.Deleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Status, aliasItemImage) + "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
if (prm.StatusCat != SaxItemImage.StatusCat.Any)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemImage_Status, aliasItemImage) + GetItemImageStatusCatFilterCondition(prm.StatusCat));
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetItemImageStatusCatFilterCondition(SaxItemImage.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SaxItemImage.StatusCat.ActiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'";
|
||||
if (statusCat == SaxItemImage.StatusCat.InactiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'";
|
||||
if (statusCat == SaxItemImage.StatusCat.NotDeleted)
|
||||
return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
if (statusCat == SaxItemImage.StatusCat.DeletedOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
return "";
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetItemImageSortColumns(SaxItemImage.Params prm)
|
||||
{
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
ItemSport_Db dbItemSport = new ItemSport_Db(CoreDbInfo);
|
||||
dbItemSport.PopulateFrom(dbCommand, aliasItemSport, "Id=" + SysId.ToString(itemSport.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_ItemSport updateLogMonitor = new SaxUpdateLogItemMonitor_ItemSport(SessionContext, CreateItemSport(dbItemSport), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbItemSport, itemSport, dbUpdateInfo);
|
||||
dbItemSport.ExecuteUpdateCommand(dbCommand);
|
||||
itemSport.Changed = false;
|
||||
@@ -178,16 +178,23 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteItemSport";
|
||||
ClearErrorState();
|
||||
if (!ItemSportCanBeDeleted(itemSport)) return false;
|
||||
|
||||
// Item Sports are logically deleted by changing the status.
|
||||
itemSport.Status = SaStatus.Deleted;
|
||||
return UpdateItemSport(itemSport, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve itemSport.
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
ItemSport_Db dbItemSport = new ItemSport_Db(CoreDbInfo);
|
||||
dbItemSport.PopulateFrom(dbCommand, aliasItemSport, "Id=" + itemSport.Id.ToString());
|
||||
// Delete itemSport.
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.ItemSport) + " WHERE Id=" + SysId.ToString(itemSport.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
@@ -197,6 +204,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -374,14 +382,24 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemSport_Notes, aliasItemSport) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxItemSport.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemSport_Status, aliasItemSport) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxItemSport.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemSport_Status, aliasItemSport) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
if (prm.StatusCat != SaxItemSport.StatusCat.Any)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.ItemSport_Status, aliasItemSport) + GetItemSportStatusCatFilterCondition(prm.StatusCat));
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetItemSportStatusCatFilterCondition(SaxItemSport.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SaxItemSport.StatusCat.ActiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'";
|
||||
if (statusCat == SaxItemSport.StatusCat.InactiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'";
|
||||
if (statusCat == SaxItemSport.StatusCat.NotDeleted)
|
||||
return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
if (statusCat == SaxItemSport.StatusCat.DeletedOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
return "";
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetItemSportSortColumns(SaxItemSport.Params prm)
|
||||
{
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
Region_Db dbRegion = new Region_Db(CoreDbInfo);
|
||||
dbRegion.PopulateFrom(dbCommand, aliasRegion, "Id=" + SysId.ToString(region.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_Region updateLogMonitor = new SaxUpdateLogItemMonitor_Region(SessionContext, CreateRegion(dbRegion), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbRegion, region, dbUpdateInfo);
|
||||
dbRegion.ExecuteUpdateCommand(dbCommand);
|
||||
region.Changed = false;
|
||||
@@ -178,16 +178,23 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteRegion";
|
||||
ClearErrorState();
|
||||
if (!RegionCanBeDeleted(region)) return false;
|
||||
|
||||
// Regions are logically deleted by changing the status.
|
||||
region.Status = SaStatus.Deleted;
|
||||
return UpdateRegion(region, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve region.
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
Region_Db dbRegion = new Region_Db(CoreDbInfo);
|
||||
dbRegion.PopulateFrom(dbCommand, aliasRegion, "Id=" + region.Id.ToString());
|
||||
// Delete region.
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.Region) + " WHERE Id=" + SysId.ToString(region.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
@@ -197,6 +204,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -402,14 +410,24 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Region_Notes, aliasRegion) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxRegion.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Region_Status, aliasRegion) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxRegion.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Region_Status, aliasRegion) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
if (prm.StatusCat != SaxRegion.StatusCat.Any)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Region_Status, aliasRegion) + GetRegionStatusCatFilterCondition(prm.StatusCat));
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetRegionStatusCatFilterCondition(SaxRegion.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SaxRegion.StatusCat.ActiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'";
|
||||
if (statusCat == SaxRegion.StatusCat.InactiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'";
|
||||
if (statusCat == SaxRegion.StatusCat.NotDeleted)
|
||||
return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
if (statusCat == SaxRegion.StatusCat.DeletedOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
return "";
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetRegionSortColumns(SaxRegion.Params prm)
|
||||
{
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
Sport_Db dbSport = new Sport_Db(CoreDbInfo);
|
||||
dbSport.PopulateFrom(dbCommand, aliasSport, "Id=" + SysId.ToString(sport.Id));
|
||||
// ToDo SaxUpdateLogItemMonitor_Sport updateLogMonitor = new SaxUpdateLogItemMonitor_Sport(SessionContext, CreateSport(dbSport), dbUpdateInfo);
|
||||
// Update properties.
|
||||
// Update item.
|
||||
PopulateTo(dbSport, sport, dbUpdateInfo);
|
||||
dbSport.ExecuteUpdateCommand(dbCommand);
|
||||
sport.Changed = false;
|
||||
@@ -177,16 +177,23 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
String fn = GetType().Name + ".DeleteSport";
|
||||
ClearErrorState();
|
||||
if (!SportCanBeDeleted(sport)) return false;
|
||||
|
||||
// Sports are logically deleted by changing the status.
|
||||
sport.Status = SaStatus.Deleted;
|
||||
return UpdateSport(sport, dbUpdateInfo);
|
||||
|
||||
/*
|
||||
* Physical deletion.
|
||||
using (var dbConnection = CoreDatabase.CreateConnection())
|
||||
using (var dbCommand = dbConnection.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Retrieve sport.
|
||||
// Retrieve item.
|
||||
dbConnection.Open();
|
||||
Sport_Db dbSport = new Sport_Db(CoreDbInfo);
|
||||
dbSport.PopulateFrom(dbCommand, aliasSport, "Id=" + sport.Id.ToString());
|
||||
// Delete sport.
|
||||
// Delete item.
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + SaxDbDfn_Core.GetTableName(SaxDbDfn_Core.TableIdx.Sport) + " WHERE Id=" + SysId.ToString(sport.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
@@ -196,6 +203,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -339,14 +347,24 @@ namespace Saxonite.Net.Standard.Dbas.Mgr
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Sport_Notes, aliasSport) + " LIKE '%" + DbQuery.FormatForLike(prm.NotesPartial) + "%'");
|
||||
|
||||
// Status.
|
||||
if (prm.StatusCat == SaxSport.StatusCat.ActiveOnly)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Sport_Status, aliasSport) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'");
|
||||
else if (prm.StatusCat == SaxSport.StatusCat.NotDeleted)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Sport_Status, aliasSport) + "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'");
|
||||
if (prm.StatusCat != SaxSport.StatusCat.Any)
|
||||
filter.Add(SaxDbDfn_Core.GetColumnNameQual(SaxDbDfn_Core.ColumnIdx.Sport_Status, aliasSport) + GetSportStatusCatFilterCondition(prm.StatusCat));
|
||||
|
||||
if (filter.Count < 1) filter.Add("1=1");
|
||||
return filter;
|
||||
}
|
||||
internal static String GetSportStatusCatFilterCondition(SaxSport.StatusCat statusCat)
|
||||
{
|
||||
if (statusCat == SaxSport.StatusCat.ActiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'";
|
||||
if (statusCat == SaxSport.StatusCat.InactiveOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Inactive) + "'";
|
||||
if (statusCat == SaxSport.StatusCat.NotDeleted)
|
||||
return "!='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
if (statusCat == SaxSport.StatusCat.DeletedOnly)
|
||||
return "='" + SacsSystem.GetStatusCode(SaStatus.Deleted) + "'";
|
||||
return "";
|
||||
}
|
||||
// Item sort columns.
|
||||
public List<String> GetSportSortColumns(SaxSport.Params prm)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user