v1.0.5.0
Activity Index. User Account country. Internals regions.
This commit is contained in:
@@ -137,7 +137,7 @@ namespace Saxonite.Net.Core.Web.Online.App
|
||||
sessionContexts.Add(sessionContextData.SessionContext.Index, sessionContextData);
|
||||
SessionContext = sessionContextData.SessionContext;
|
||||
|
||||
// Data Cache console - to initialise refresh.
|
||||
// Data Cache console - to initialise refresh. Must be done for every Session Context.
|
||||
SaxDataCacheConsole dataCacheConsole = SaxGlobals.ConsoleHelper.GetDataCacheConsole(SessionContext);
|
||||
}
|
||||
catch (Exception exc)
|
||||
|
||||
@@ -40,12 +40,34 @@ namespace Saxonite.Net.Core.Web.Online.App
|
||||
public SysId OrganisationId { get; set; }
|
||||
/// <summary>Display text for currently selected Organisation.</summary>
|
||||
public String OrganisationCaption { get; set; }
|
||||
/// <summary>
|
||||
/// Store the properties for the currently selected Organisation.
|
||||
/// </summary>
|
||||
public bool SetOrganisation(SaxOrganisation organisation)
|
||||
{
|
||||
if (organisation == null) return false;
|
||||
if (!organisation.IsStatusActive) return false;
|
||||
OrganisationId = organisation.Id;
|
||||
OrganisationCaption = organisation.Name;
|
||||
return true;
|
||||
}
|
||||
/// <summary>Id for currently selected Organisation of which the user is a member.</summary>
|
||||
public SysId OrganisationIdMember { get; set; }
|
||||
/// <summary>Display text for currently selected Organisation of which the user is a member.</summary>
|
||||
public String OrganisationCaptionMember { get; set; }
|
||||
/// <summary>
|
||||
/// Store the properties for the currently selected Organisation for which the User is a member.
|
||||
/// </summary>
|
||||
public bool SetMemberOrganisation(SaxOrganisation organisation)
|
||||
{
|
||||
if (organisation == null) return false;
|
||||
if (!organisation.IsStatusActive) return false;
|
||||
OrganisationIdMember = organisation.Id;
|
||||
OrganisationCaptionMember = organisation.Name;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
public FilterData Filter { get; private set; } = new FilterData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.Consoles;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Consoles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public class SaxActivityConsole_Online : SaxActivityConsole_Web
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public SaxActivityConsole_Online(SaxSessionContext sessionContext) :
|
||||
base(sessionContext)
|
||||
{
|
||||
String fn = GetType().Name + ".CTR";
|
||||
SaLogger.Info(fn + "");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -37,6 +37,13 @@ namespace Saxonite.Net.Core.Web.Online.Consoles
|
||||
return dataCacheConsole;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Activity console.
|
||||
public override SaxActivityConsole CreateActivityConsole(SaxSessionContext sessionContext)
|
||||
{
|
||||
return new SaxActivityConsole_Online(sessionContext);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Email console.
|
||||
public override SaxEmailConsole CreateEmailConsole(SaxSessionContext sessionContext)
|
||||
|
||||
@@ -20,25 +20,43 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
//=======================================================================
|
||||
partial class AccountController
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Account - Get Contact Details.
|
||||
//-------------------------------------------------------------------
|
||||
public class ContactResponseData
|
||||
{
|
||||
public ContactResponseData(SaxUserAccount userAccount)
|
||||
{
|
||||
EmailAddress = userAccount.EmailAddress;
|
||||
DisplayName = userAccount.GetDisplayName();
|
||||
Title = userAccount.Title;
|
||||
FirstName = userAccount.FirstName;
|
||||
LastName = userAccount.LastName;
|
||||
}
|
||||
public String EmailAddress { get; }
|
||||
public String DisplayName { get; }
|
||||
public String Title { get; }
|
||||
public String FirstName { get; }
|
||||
public String LastName { get; }
|
||||
public String EmailAddress { get; set; }
|
||||
public String DisplayName { get; set; }
|
||||
public String Title { get; set; }
|
||||
public String FirstName { get; set; }
|
||||
public String LastName { get; set; }
|
||||
// Regions.
|
||||
public int RegionIdCountry { get; set; }
|
||||
public String RegionCaptionCountry { get; set; }
|
||||
public int RegionIdProvince { get; set; }
|
||||
public String RegionCaptionProvince { get; set; }
|
||||
public String LocationCaption { get; set; }
|
||||
}
|
||||
private void PopulateContactResponseData(ContactResponseData data, SaxUserAccount userAccount)
|
||||
{
|
||||
data.EmailAddress = userAccount.EmailAddress;
|
||||
data.DisplayName = userAccount.GetDisplayName();
|
||||
data.Title = userAccount.Title;
|
||||
data.FirstName = userAccount.FirstName;
|
||||
data.LastName = userAccount.LastName;
|
||||
data.RegionIdCountry = SysId.ToInt(userAccount.RegionIdCountry);
|
||||
data.RegionIdProvince = SysId.ToInt(userAccount.RegionIdProvince);
|
||||
using (SaxRegion regionCountry = Internals.GetRegion(userAccount.RegionIdCountry))
|
||||
using (SaxRegion regionProvince = Internals.GetRegion(userAccount.RegionIdProvince))
|
||||
{
|
||||
data.RegionCaptionCountry = Localiser.GetRegionName(regionCountry);
|
||||
data.RegionCaptionProvince = Localiser.GetRegionName(regionProvince);
|
||||
List<String> locations = new List<string>() { data.RegionCaptionProvince, data.RegionCaptionCountry };
|
||||
data.LocationCaption = locations.Concat(", ", "", "", true, true);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Account - Get Contact Details.
|
||||
//-------------------------------------------------------------------
|
||||
public class AjaxResponse_AccountContactData : AjaxResponse_Data
|
||||
{
|
||||
public ContactResponseData Contact { get; set; }
|
||||
@@ -67,9 +85,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Populate data to response.
|
||||
responseData.Contact = new ContactResponseData(userAccount);
|
||||
responseData.Contact = new ContactResponseData();
|
||||
PopulateContactResponseData(responseData.Contact, userAccount);
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
@@ -121,6 +139,11 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
userAccount.FirstName = model.AccountFirstName;
|
||||
if (model.AccountLastName != null)
|
||||
userAccount.LastName = model.AccountLastName;
|
||||
// Regions.
|
||||
if (model.AccountRegionIdCountry != null)
|
||||
userAccount.RegionIdCountry = model.AccountRegionIdCountry.ToSysId();
|
||||
if (model.AccountRegionIdProvince != null)
|
||||
userAccount.RegionIdProvince = model.AccountRegionIdProvince.ToSysId();
|
||||
|
||||
// Update User Account.
|
||||
if (userAccount.Changed) SaLogger.Info(fn + " Updating user account '" + userAccount.EmailAddress + "'. Id: " + SysId.ToString(userAccount.Id), true);
|
||||
@@ -135,9 +158,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
|
||||
// Construct response.
|
||||
responseData.Contact = new ContactResponseData(userAccount);
|
||||
responseData.Contact = new ContactResponseData();
|
||||
PopulateContactResponseData(responseData.Contact, userAccount);
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Online.Models;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using Saxonite.Net.Standard.Base.Consoles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Online Activity Controller - Ajax actions only.
|
||||
//=======================================================================
|
||||
public partial class ActivityController : SaxController_Online
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public ActivityController(SaxLocaliser localiser, ILogger<HomeController> logger) :
|
||||
base(localiser, logger)
|
||||
{}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data definitions.
|
||||
public class ActivityResponseData
|
||||
{
|
||||
public short ItemType { get; set; }
|
||||
// NB Need to mask the Item Id by storing with XRef to alternative generated value in User's session.
|
||||
public int ItemIdx { get; set; }
|
||||
public String Caption{ get; set; }
|
||||
}
|
||||
public class ArticleActivityResponseData : ActivityResponseData
|
||||
{
|
||||
public String Headline { get; set; }
|
||||
public String Summary { get; set; }
|
||||
}
|
||||
public class OpportunityActivityResponseData : ActivityResponseData
|
||||
{
|
||||
public String Position { get; set; }
|
||||
public String Outline { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Activities
|
||||
//-------------------------------------------------------------------
|
||||
public class AjaxResponse_ActivityList : AjaxResponse_Base
|
||||
{
|
||||
public List<SaxModel_Online.RegionData> Regions { get; } = new List<SaxModel_Online.RegionData>();
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
[HttpPost]
|
||||
[Route("Activity/Ajax/GetList")]
|
||||
[Route("Activity/Ajax/GetActivityList")]
|
||||
[Route("Activity/Ajax/GetActivities")]
|
||||
public IActionResult Ajax_GetActivityList(Model_Activity model)
|
||||
{
|
||||
String fn = GetType().Name + ".Ajax_GetActivityList";
|
||||
String messageTitle = Localiser["activity.caption.activities"];
|
||||
AjaxResponse_ActivityList responseData = new AjaxResponse_ActivityList();
|
||||
|
||||
// Validate session and referrer.
|
||||
if (!ValidReferer)
|
||||
return Forbid();
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Populate activities.
|
||||
SaxActivityConsole.IndexContext indexContext = new SaxActivityConsole.IndexContext();
|
||||
SaxActivityConsole.IndexResults indexResults = ActivityConsole.QueryIndex(indexContext);
|
||||
foreach (SaxActivityConsole.IndexResults.ItemData itemData in indexResults.Items)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -7,6 +7,7 @@ using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Core.Web.Online.Models;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using Saxonite.Net.Standard.Base.Consoles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -138,7 +139,6 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Complete response.
|
||||
responseData.SetPaging(model);
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
@@ -181,10 +181,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
|
||||
// Construct response.
|
||||
PopulateArticleResponseData(model, article, responseData.Article);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
@@ -268,12 +265,12 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
// Store Article Activity Index data.
|
||||
ActivityConsole.StoreActivityIndex(article, DbUpdateInfo);
|
||||
|
||||
// Construct response.
|
||||
PopulateArticleResponseData(model, article, responseData.Article);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
|
||||
+34
-9
@@ -101,12 +101,16 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
// Organisation.
|
||||
SysId organisationId = model.Filter.OrganisationId.ToSysId();
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
if (organisation == null || !organisation.IsStatusActive)
|
||||
{
|
||||
SaLogger.Warn(fn + " " + (organisation == null ? "Invalid" : "Inactive") + " organisation for Opportunity list. OrganisationId: '" + model.Filter.OrganisationId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
if (organisation != null)
|
||||
{
|
||||
// Store filter data.
|
||||
SessionData_Online.Filter.OrganisationIdMember = organisation.Id;
|
||||
SessionData_Online.Filter.OrganisationCaptionMember = organisation.Name;
|
||||
SessionData_Online.Filter.SetMemberOrganisation(organisation);
|
||||
|
||||
// Reference data - opportunity types.
|
||||
foreach (TypeCodeDesc opportunityType in OpportunityTypes)
|
||||
@@ -225,12 +229,20 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Validate organisation.
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(opportunity.OrganisationId);
|
||||
if (organisation == null || !organisation.IsStatusActive)
|
||||
{
|
||||
SaLogger.Warn(fn + " " + (organisation == null ? "Invalid" : "Inactive") + " organisation for Opportunity. OrganisationId: '" + opportunity.OrganisationId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Make a note of the selected Organisation.
|
||||
SessionData_Online.Filter.SetMemberOrganisation(organisation);
|
||||
|
||||
// Construct response.
|
||||
PopulateOpportunityResponseData(model, opportunity, responseData.Opportunity);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
@@ -278,19 +290,32 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
// Validate the Organisation Id.
|
||||
// Validate the Organisation.
|
||||
SysId organisationId = model.OpportunityOrganisationId.ToSysId();
|
||||
if (!SysId.IsValid(organisationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Organisation Id not specified for Opportunity.");
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
if (organisation == null || !organisation.IsStatusActive)
|
||||
{
|
||||
SaLogger.Warn(fn + " " + (organisation == null ? "Invalid" : "Inactive") + " organisation for Opportunity. OrganisationId: '" + model.OpportunityOrganisationId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
if (opportunity != null && !opportunity.OrganisationId.Equals(organisationId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Inconsistent Organisation Id specified for Opportunity. Expected: " + opportunity.OrganisationId + ". Found: " + organisationId);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Ensure that the user has the correct role to update Opportunities for this organisation.
|
||||
if (!AccountMgr.UserHasOrganisationRole(SessionData.User.UserAccountId, organisationId, Sax.OrganisationRole.OpportunityAdmin))
|
||||
{
|
||||
SaLogger.Warn(fn + " User doesn not have 'Opportunity Admin' role for Organisation Id: " + organisationId);
|
||||
return Json(responseData.SetGoHome(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
|
||||
// Create new item if required.
|
||||
if (opportunity == null)
|
||||
opportunity = ActivityMgr.CreateOrganisationOpportunity(organisationId);
|
||||
@@ -327,12 +352,12 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
// Store Opportunity Activity Index data.
|
||||
ActivityConsole.StoreActivityIndex(opportunity, DbUpdateInfo);
|
||||
|
||||
// Construct response.
|
||||
PopulateOpportunityResponseData(model, opportunity, responseData.Opportunity);
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ using System.Threading.Tasks;
|
||||
namespace Saxonite.Net.Core.Web.Online.Controllers
|
||||
{
|
||||
//=======================================================================
|
||||
// Online Reference Controller - Ajax actions.
|
||||
// Online Reference Controller - Ajax actions only.
|
||||
//=======================================================================
|
||||
public partial class ReferenceController : SaxController_Online
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using Saxonite.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||
using Saxonite.Net.Core.Web.Base.Models;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -29,6 +30,11 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
public String AccountTitle { get; set; }
|
||||
public String AccountFirstName { get; set; }
|
||||
public String AccountLastName { get; set; }
|
||||
// Regions.
|
||||
public String AccountRegionIdCountry { get; set; }
|
||||
public String AccountRegionCaptionCountry { get; }
|
||||
public String AccountRegionIdProvince { get; set; }
|
||||
public String AccountRegionCaptionProvince { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Sport properties.
|
||||
@@ -45,8 +51,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
responseData.SetControlValue(nameof(AccountTitle), AccountTitle);
|
||||
if (StringUtil.IsEmpty(AccountTitle))
|
||||
responseData.SetControlError(nameof(AccountTitle), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(AccountTitle) > GetControlMaxLength(SaxDbDfn.ColumnIdx.UserAccount_Title))
|
||||
responseData.SetControlError(nameof(AccountTitle), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.JournalistArticle_Headline)]);
|
||||
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)]);
|
||||
}
|
||||
|
||||
// First Name.
|
||||
@@ -55,8 +61,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
responseData.SetControlValue(nameof(AccountFirstName), AccountFirstName);
|
||||
if (StringUtil.IsEmpty(AccountFirstName))
|
||||
responseData.SetControlError(nameof(AccountFirstName), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(AccountFirstName) > GetControlMaxLength(SaxDbDfn.ColumnIdx.UserAccount_FirstName))
|
||||
responseData.SetControlError(nameof(AccountFirstName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.JournalistArticle_Headline)]);
|
||||
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)]);
|
||||
}
|
||||
|
||||
// Last Name.
|
||||
@@ -65,8 +71,24 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
responseData.SetControlValue(nameof(AccountLastName), AccountLastName);
|
||||
if (StringUtil.IsEmpty(AccountLastName))
|
||||
responseData.SetControlError(nameof(AccountLastName), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(AccountLastName) > GetControlMaxLength(SaxDbDfn.ColumnIdx.UserAccount_LastName))
|
||||
responseData.SetControlError(nameof(AccountLastName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.JournalistArticle_Headline)]);
|
||||
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)]);
|
||||
}
|
||||
|
||||
// Country Region.
|
||||
if (AccountRegionIdCountry != null && SysId.IsValid(AccountRegionIdCountry.ToSysId()))
|
||||
{
|
||||
SaxRegion regionCountry = Internals.GetRegion(AccountRegionIdCountry.ToSysId());
|
||||
if (regionCountry == null)
|
||||
responseData.SetControlError(nameof(AccountRegionIdCountry), Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
|
||||
// Province Region.
|
||||
if (AccountRegionIdProvince != null)
|
||||
{
|
||||
SaxRegion regionProvince = Internals.GetRegion(AccountRegionIdProvince.ToSysId());
|
||||
if (regionProvince == null)
|
||||
responseData.SetControlError(nameof(AccountRegionIdProvince), Localiser["msg.validation.invalid.value"]);
|
||||
}
|
||||
|
||||
return !responseData.HasControlErrors();
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.App;
|
||||
using Saxonite.Net.Core.Web.Base.Controllers;
|
||||
using Saxonite.Net.Core.Web.Base.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Online.Models
|
||||
{
|
||||
//=======================================================================
|
||||
public class Model_Activity: SaxModel_Online
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public Model_Activity(SaxLocaliser localiser) :
|
||||
base(localiser)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Activity filter.
|
||||
public class FilterData
|
||||
{
|
||||
public String Activity { get; set; }
|
||||
}
|
||||
public FilterData Filter { get; } = new FilterData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -37,12 +37,12 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
// Article properties.
|
||||
public String ArticleId { get; set; }
|
||||
public String ArticleExists { get; set; }
|
||||
// Region.
|
||||
public String ArticleRegionId { get; set; }
|
||||
public String ArticleRegionCaption { get; }
|
||||
// Sport.
|
||||
public String ArticleSportId { get; set; }
|
||||
public String ArticleSportCaption { get; set; }
|
||||
// Region.
|
||||
public String ArticleRegionId { get; set; }
|
||||
public String ArticleRegionCaption { get; }
|
||||
// Article Content.
|
||||
public String ArticleHeadline { get; set; }
|
||||
public String ArticleSummary { get; set; }
|
||||
@@ -61,8 +61,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
responseData.SetControlValue(nameof(ArticleHeadline), ArticleHeadline);
|
||||
if (StringUtil.IsEmpty(ArticleHeadline))
|
||||
responseData.SetControlError(nameof(ArticleHeadline), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(ArticleHeadline) > GetControlMaxLength(SaxDbDfn.ColumnIdx.JournalistArticle_Headline))
|
||||
responseData.SetControlError(nameof(ArticleHeadline), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.JournalistArticle_Headline)]);
|
||||
else if (StringUtil.GetLength(ArticleHeadline) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.JournalistArticle_Headline))
|
||||
responseData.SetControlError(nameof(ArticleHeadline), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.JournalistArticle_Headline)]);
|
||||
}
|
||||
|
||||
// Article summary.
|
||||
@@ -71,16 +71,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
responseData.SetControlValue(nameof(ArticleSummary), ArticleSummary);
|
||||
if (StringUtil.IsEmpty(ArticleSummary))
|
||||
responseData.SetControlError(nameof(ArticleSummary), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(ArticleSummary) > GetControlMaxLength(SaxDbDfn.ColumnIdx.JournalistArticle_Summary))
|
||||
responseData.SetControlError(nameof(ArticleSummary), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.JournalistArticle_Summary)]);
|
||||
}
|
||||
|
||||
// Article region.
|
||||
if (ArticleRegionId != null)
|
||||
{
|
||||
SysId articleRegionId = ArticleRegionId.ToSysId();
|
||||
if (!SysId.IsValid(articleRegionId))
|
||||
responseData.SetControlError(nameof(ArticleRegionId), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(ArticleSummary) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.JournalistArticle_Summary))
|
||||
responseData.SetControlError(nameof(ArticleSummary), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.JournalistArticle_Summary)]);
|
||||
}
|
||||
|
||||
// Article sport.
|
||||
@@ -91,6 +83,14 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
responseData.SetControlError(nameof(ArticleSportId), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
// Article region.
|
||||
if (ArticleRegionId != null)
|
||||
{
|
||||
SysId articleRegionId = ArticleRegionId.ToSysId();
|
||||
if (!SysId.IsValid(articleRegionId))
|
||||
responseData.SetControlError(nameof(ArticleRegionId), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
// Article status.
|
||||
if (ArticleStatusCode != null)
|
||||
{
|
||||
|
||||
@@ -41,10 +41,10 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
public String OpportunityExists { get; set; }
|
||||
// Opportunity properties.
|
||||
public String OpportunityOrganisationId { get; set; }
|
||||
// Region.
|
||||
public String OpportunityRegionId { get; set; }
|
||||
// Sport.
|
||||
public String OpportunitySportId { get; set; }
|
||||
// Region.
|
||||
public String OpportunityRegionId { get; set; }
|
||||
// Opportunity Content.
|
||||
public String OpportunityTypeCode { get; set; }
|
||||
public String OpportunityPosition { get; set; }
|
||||
@@ -71,8 +71,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
responseData.SetControlValue(nameof(OpportunityPosition), OpportunityPosition);
|
||||
if (StringUtil.IsEmpty(OpportunityPosition))
|
||||
responseData.SetControlError(nameof(OpportunityPosition), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(OpportunityPosition) > GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position))
|
||||
responseData.SetControlError(nameof(OpportunityPosition), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Position)]);
|
||||
else if (StringUtil.GetLength(OpportunityPosition) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationOpportunity_Position))
|
||||
responseData.SetControlError(nameof(OpportunityPosition), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationOpportunity_Position)]);
|
||||
}
|
||||
|
||||
// Opportunity outline.
|
||||
@@ -81,16 +81,8 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
responseData.SetControlValue(nameof(OpportunityOutline), OpportunityOutline);
|
||||
if (StringUtil.IsEmpty(OpportunityOutline))
|
||||
responseData.SetControlError(nameof(OpportunityOutline), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(OpportunityOutline) > GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline))
|
||||
responseData.SetControlError(nameof(OpportunityOutline), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.OrganisationOpportunity_Outline)]);
|
||||
}
|
||||
|
||||
// Opportunity region.
|
||||
if (OpportunityRegionId != null)
|
||||
{
|
||||
SysId articleRegionId = OpportunityRegionId.ToSysId();
|
||||
if (!SysId.IsValid(articleRegionId))
|
||||
responseData.SetControlError(nameof(OpportunityRegionId), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(OpportunityOutline) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationOpportunity_Outline))
|
||||
responseData.SetControlError(nameof(OpportunityOutline), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationOpportunity_Outline)]);
|
||||
}
|
||||
|
||||
// Opportunity sport.
|
||||
@@ -101,6 +93,14 @@ namespace Saxonite.Net.Core.Web.Online.Models
|
||||
responseData.SetControlError(nameof(OpportunitySportId), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
// Opportunity region.
|
||||
if (OpportunityRegionId != null)
|
||||
{
|
||||
SysId articleRegionId = OpportunityRegionId.ToSysId();
|
||||
if (!SysId.IsValid(articleRegionId))
|
||||
responseData.SetControlError(nameof(OpportunityRegionId), Localiser["msg.validation.mandatory.value"]);
|
||||
}
|
||||
|
||||
// Opportunity status.
|
||||
if (OpportunityStatusCode != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user