v1.0.5.0
Activity Index. User Account country. Internals regions.
This commit is contained in:
@@ -159,11 +159,11 @@ namespace Saxonite.Net.Core.Web.Admin.App
|
||||
{
|
||||
if (!generateDatabaseDefinitions || !SaxSystem.DebugMode || SessionContext == null) return;
|
||||
if (!StringUtil.EmptyOnNull(EnvironmentName).EqualsCI("Development")) return;
|
||||
ISacsDatabase database = GetCoreDatabase(sessionContext);
|
||||
if (database == null || StringUtil.IsEmpty(database.ConnectionString)) return;
|
||||
ISacsDatabase coreDatabase = GetCoreDatabase(sessionContext);
|
||||
if (coreDatabase == null || StringUtil.IsEmpty(coreDatabase.ConnectionString)) return;
|
||||
|
||||
// Generate database definitions.
|
||||
SaxDbDfnGenerator.Generate(database.ConnectionString);
|
||||
SaxDbDfnGenerator.Generate(SaxDbDfnGenerator.DatabaseInstance.Core, coreDatabase.ConnectionString);
|
||||
//SaUpdateLogDbDfnGenerator.Generate(database.ConnectionString);
|
||||
}
|
||||
|
||||
|
||||
@@ -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.Admin.Consoles
|
||||
{
|
||||
//=======================================================================
|
||||
public class SaxActivityConsole_Admin : SaxActivityConsole_Web
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public SaxActivityConsole_Admin(SaxSessionContext sessionContext) :
|
||||
base(sessionContext)
|
||||
{
|
||||
String fn = GetType().Name + ".CTR";
|
||||
SaLogger.Info(fn + "");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -31,6 +31,13 @@ namespace Saxonite.Net.Core.Web.Admin.Consoles
|
||||
throw new NotSupportedException(fn + " Data Cache Console not supported in Admin app.");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Activity console.
|
||||
public override SaxActivityConsole CreateActivityConsole(SaxSessionContext sessionContext)
|
||||
{
|
||||
return new SaxActivityConsole_Admin(sessionContext);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Email console.
|
||||
public override SaxEmailConsole CreateEmailConsole(SaxSessionContext sessionContext)
|
||||
|
||||
@@ -30,12 +30,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public String CategoryCode { get; set; }
|
||||
public String CategoryDesc { get; set; }
|
||||
public long MemberCount { get; set; }
|
||||
// Region.
|
||||
public long RegionId { get; set; }
|
||||
public String RegionName { get; set; }
|
||||
// Sport.
|
||||
public long SportId { get; set; }
|
||||
public String SportName { get; set; }
|
||||
// Region.
|
||||
public long RegionId { get; set; }
|
||||
public String RegionName { get; set; }
|
||||
// Common properties.
|
||||
public String StatusCode { get; set; }
|
||||
public String StatusDesc { get; set; }
|
||||
@@ -52,20 +52,14 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
data.CategoryCode = OrganisationCategories.GetCodeForType(organisation.OrganisationCategory);
|
||||
data.CategoryDesc = OrganisationCategories.GetDescForType(organisation.OrganisationCategory);
|
||||
data.MemberCount = AccountMgr.GetOrganisationMemberCount(organisation.Id);
|
||||
// Sport.
|
||||
data.SportId = SysId.ToLong(organisation.SportIdPrimary);
|
||||
using (SaxSport sport = ReferenceMgr.GetSportById(organisation.SportIdPrimary))
|
||||
data.SportName = sport?.Name ?? "";
|
||||
// Region.
|
||||
data.RegionId = SysId.ToLong(organisation.RegionIdPrimary);
|
||||
using (SaxRegion region = ReferenceMgr.GetRegionById(organisation.RegionIdPrimary))
|
||||
{
|
||||
if (region != null)
|
||||
data.RegionName = region.Name;
|
||||
}
|
||||
// Sport.
|
||||
data.SportId = SysId.ToLong(organisation.SportIdPrimary);
|
||||
using (SaxSport region = ReferenceMgr.GetSportById(organisation.SportIdPrimary))
|
||||
{
|
||||
if (region != null)
|
||||
data.SportName = region.Name;
|
||||
}
|
||||
data.RegionName = region?.Name ?? "";
|
||||
// Common properties.
|
||||
data.StatusCode = organisation.StatusCode;
|
||||
data.StatusDesc = organisation.StatusDesc;
|
||||
@@ -119,10 +113,10 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
ColumnDfn colPhoneAlt = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.PhoneAlt);
|
||||
ColumnDfn colUserCount = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.User_Count);
|
||||
ColumnDfn colMemberCount = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Member_Count);
|
||||
ColumnDfn colRegionId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.RegionId);
|
||||
ColumnDfn colRegionName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Region_Name);
|
||||
ColumnDfn colSportId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.SportId);
|
||||
ColumnDfn colSportName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Sport_Name);
|
||||
ColumnDfn colRegionId = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.RegionId);
|
||||
ColumnDfn colRegionName = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Region_Name);
|
||||
ColumnDfn colStatus = AccountMgr.GetOrganisationColumnDfn(SaxOrganisation.Column.Status);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
@@ -133,8 +127,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
colPhoneMain,
|
||||
colPhoneAlt,
|
||||
colUserCount, colMemberCount,
|
||||
colRegionId, colRegionName,
|
||||
colSportId, colSportName,
|
||||
colRegionId, colRegionName,
|
||||
colStatus
|
||||
};
|
||||
|
||||
@@ -155,10 +149,10 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
CategoryCode = values.GetString(colOrganisationCategory.DataName),
|
||||
CategoryDesc = OrganisationCategories.GetDescForCode(values.GetString(colOrganisationCategory.DataName)),
|
||||
MemberCount = StringUtil.ToLong(values.GetString(colMemberCount.DataName)),
|
||||
RegionId = values.GetLong(colRegionId.DataName),
|
||||
RegionName = values.GetString(colRegionName.DataName),
|
||||
SportId = values.GetLong(colSportId.DataName),
|
||||
SportName = values.GetString(colSportName.DataName),
|
||||
RegionId = values.GetLong(colRegionId.DataName),
|
||||
RegionName = values.GetString(colRegionName.DataName),
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||
};
|
||||
@@ -255,10 +249,10 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
organisation.OrganisationType = model.OrganisationType;
|
||||
if (model.OrganisationCategoryValue != null)
|
||||
organisation.OrganisationCategory = model.OrganisationCategory;
|
||||
if (model.OrganisationRegionId != null)
|
||||
organisation.RegionIdPrimary = model.OrganisationRegionId.ToSysId();
|
||||
if (model.OrganisationSportId != null)
|
||||
organisation.SportIdPrimary = model.OrganisationSportId.ToSysId();
|
||||
if (model.OrganisationRegionId != null)
|
||||
organisation.RegionIdPrimary = model.OrganisationRegionId.ToSysId();
|
||||
// Common properties.
|
||||
if (model.OrganisationStatusCode != null)
|
||||
organisation.Status = model.OrganisationStatus;
|
||||
|
||||
@@ -3,6 +3,7 @@ using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Core.Web.Admin.Models;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
@@ -156,14 +157,15 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Identify item.
|
||||
if (!SysId.IsValid(model.RegionId))
|
||||
SysId regionId = model.RegionId.ToSysId();
|
||||
if (!SysId.IsValid(regionId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
// Retrieve item.
|
||||
SaxRegion region = ReferenceMgr.GetRegionById(model.RegionId);
|
||||
SaxRegion region = ReferenceMgr.GetRegionById(regionId);
|
||||
if (region == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve region for Id: '" + model.RegionIdValue + "'");
|
||||
SaLogger.Warn(fn + " Failed to retrieve region for Id: '" + model.RegionId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
@@ -197,10 +199,11 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// Retrieve existing item.
|
||||
SaxRegion region = ReferenceMgr.GetRegionById(model.RegionId);
|
||||
if (region == null && SysId.IsValid(model.RegionId))
|
||||
SysId regionId = model.RegionId.ToSysId();
|
||||
SaxRegion region = ReferenceMgr.GetRegionById(regionId);
|
||||
if (region == null && SysId.IsValid(regionId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve region for Id: '" + model.RegionIdValue + "'");
|
||||
SaLogger.Warn(fn + " Failed to retrieve region for Id: '" + model.RegionId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Saxonite.Net.Core.Web.Admin.Models;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
@@ -136,14 +137,15 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Identify item.
|
||||
if (!SysId.IsValid(model.SportId))
|
||||
SysId sportId = model.SportId.ToSysId();
|
||||
if (!SysId.IsValid(sportId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
// Retrieve item.
|
||||
SaxSport sport = ReferenceMgr.GetSportById(model.SportId);
|
||||
SaxSport sport = ReferenceMgr.GetSportById(sportId);
|
||||
if (sport == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve sport for Id: '" + model.SportIdValue + "'");
|
||||
SaLogger.Warn(fn + " Failed to retrieve sport for Id: '" + model.SportId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
@@ -177,10 +179,11 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// Retrieve existing item.
|
||||
SaxSport sport = ReferenceMgr.GetSportById(model.SportId);
|
||||
if (sport == null && SysId.IsValid(model.SportId))
|
||||
SysId sportId = model.SportId.ToSysId();
|
||||
SaxSport sport = ReferenceMgr.GetSportById(sportId);
|
||||
if (sport == null && SysId.IsValid(sportId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve sport for Id: '" + model.SportIdValue + "'");
|
||||
SaLogger.Warn(fn + " Failed to retrieve sport for Id: '" + model.SportId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
using Saxonite.Net.Core.Web.Admin.Models;
|
||||
using Saxonite.Net.Standard.Base.App;
|
||||
using Saxonite.Net.Standard.Base.Bus;
|
||||
@@ -22,7 +23,12 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// Database data.
|
||||
public class DatabaseTableData
|
||||
{
|
||||
public String Name { get; set; }
|
||||
public String SchemaName { get; set; }
|
||||
public String TableName { get; set; }
|
||||
public String QualifiedName { get; set; }
|
||||
public int RowCount { get; set; }
|
||||
public int ColumnCount { get; set; }
|
||||
public int IndexCount { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -45,9 +51,44 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (!ValidUserSession)
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Core Database connection.
|
||||
ISacsDatabase db = SaxGlobals.App.GetCoreDatabase(SessionContext);
|
||||
|
||||
// Database table row counts.
|
||||
Dictionary<String, int> tableRowCounts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
||||
String query =
|
||||
"SELECT QUOTENAME(SCHEMA_NAME(sOBJ.schema_id)) + '.' + QUOTENAME(sOBJ.name) AS[TableName], SUM(sPTN.Rows) AS[RowCount] " +
|
||||
"FROM sys.objects AS sOBJ " +
|
||||
"INNER JOIN sys.partitions AS sPTN ON sOBJ.object_id = sPTN.object_id " +
|
||||
"WHERE sOBJ.type = 'U' AND sOBJ.is_ms_shipped = 0x0 AND index_id< 2 /*Index Id: 0:Heap,1:Clustered*/ " +
|
||||
"GROUP BY sOBJ.schema_id, sOBJ.name";
|
||||
using (DbResultSet dbResultSet = DbResultSet_DataReader.ExecuteQuery(db, query))
|
||||
{
|
||||
while (dbResultSet != null && dbResultSet.NextRecord())
|
||||
{
|
||||
tableRowCounts.Add(dbResultSet.GetRecordValues().GetValue("TableName").ToString(), (int)dbResultSet.GetRecordValues().GetValue("RowCount").AsLong());
|
||||
}
|
||||
}
|
||||
|
||||
// Core database tables.
|
||||
List<DbDfnTable> tableDfns = db.GetTableDfns();
|
||||
foreach (DbDfnTable tableDfn in tableDfns.OrderBy(item => item.Name))
|
||||
{
|
||||
DatabaseTableData tableData = new DatabaseTableData();
|
||||
tableData.SchemaName = tableDfn.Schema;
|
||||
tableData.TableName = tableDfn.Name;
|
||||
tableData.QualifiedName = tableDfn.QualifiedName;
|
||||
tableData.ColumnCount = tableDfn.ColumnCount;
|
||||
tableData.IndexCount = tableDfn.IndexCount;
|
||||
|
||||
// Row count.
|
||||
tableData.RowCount = tableRowCounts.GetValueOrDefault(tableDfn.QuotedQualifiedName, 0);
|
||||
|
||||
responseData.Tables.Add(tableData);
|
||||
}
|
||||
|
||||
// Complete response.
|
||||
responseData.Success = true;
|
||||
|
||||
return Json(responseData);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (!ValidUserSession)
|
||||
return RedirectToAction("", "");
|
||||
|
||||
model.AdditionalFiles_JS.Add("js/sax-sys-db.js");
|
||||
return View(model);
|
||||
}
|
||||
|
||||
@@ -62,6 +63,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
if (!ValidUserSession)
|
||||
return RedirectToAction("", "");
|
||||
|
||||
model.AdditionalFiles_JS.Add("js/sax-sys-logs.js");
|
||||
return View(model);
|
||||
}
|
||||
|
||||
|
||||
@@ -186,14 +186,15 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Identify item.
|
||||
if (!SysId.IsValid(model.UserAccountId))
|
||||
SysId userAccountId = model.UserAccountId.ToSysId();
|
||||
if (!SysId.IsValid(userAccountId))
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.specified"]));
|
||||
|
||||
// Retrieve item.
|
||||
SaxUserAccount user = AccountMgr.GetUserAccountById(model.UserAccountId);
|
||||
SaxUserAccount user = AccountMgr.GetUserAccountById(userAccountId);
|
||||
if (user == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve user for Id: '" + model.UserAccountIdValue + "'");
|
||||
SaLogger.Warn(fn + " Failed to retrieve user for Id: '" + userAccountId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
@@ -262,10 +263,11 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// Retrieve existing item.
|
||||
SaxUserAccount user = AccountMgr.GetUserAccountById(model.UserAccountId);
|
||||
if (user == null && SysId.IsValid(model.UserAccountId))
|
||||
SysId userAccountId = model.UserAccountId.ToSysId();
|
||||
SaxUserAccount user = AccountMgr.GetUserAccountById(userAccountId);
|
||||
if (user == null && SysId.IsValid(userAccountId))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to retrieve user for Id: '" + model.UserAccountIdValue + "'");
|
||||
SaLogger.Warn(fn + " Failed to retrieve user for Id: '" + model.UserAccountId + "'");
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.item.id.not.found"]));
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
public Sax.OrganisationType OrganisationType { get { return (Sax.OrganisationType)OrganisationTypes.GetTypeForCode(OrganisationTypeValue); } }
|
||||
public String OrganisationCategoryValue { get; set; }
|
||||
public Sax.OrganisationCategory OrganisationCategory { get { return (Sax.OrganisationCategory)OrganisationCategories.GetTypeForCode(OrganisationCategoryValue); } }
|
||||
public String OrganisationRegionId { get; set; }
|
||||
public String OrganisationSportId { get; set; }
|
||||
public String OrganisationRegionId { get; set; }
|
||||
// Common properties.
|
||||
public String OrganisationNotes { get; set; }
|
||||
public String OrganisationStatusCode { get; set; }
|
||||
@@ -71,8 +71,8 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
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.ColumnIdx.Organisation_Name))
|
||||
responseData.SetControlError(nameof(OrganisationName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.Organisation_Name)]);
|
||||
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)]);
|
||||
}
|
||||
|
||||
// Organisation type.
|
||||
|
||||
@@ -41,12 +41,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Region properties.
|
||||
public String RegionIdValue { get; set; }
|
||||
public SysId RegionId
|
||||
{
|
||||
get { return new SysId(StringUtil.ToInt(RegionIdValue)); }
|
||||
set { RegionIdValue = SysId.ToString(value); }
|
||||
}
|
||||
public String RegionId { get; set; }
|
||||
public String RegionTypeCode { get; set; }
|
||||
public Sax.RegionType RegionType
|
||||
{
|
||||
@@ -81,14 +76,15 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
{
|
||||
if (StringUtil.IsEmpty(RegionCountryIso2Code))
|
||||
responseData.SetControlError(nameof(RegionCountryIso2Code), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(RegionCountryIso2Code) != GetControlMaxLength(SaxDbDfn.ColumnIdx.Region_CountryIso2Code))
|
||||
responseData.SetControlError(nameof(RegionCountryIso2Code), Localiser["msg.validation.invalid.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.Region_CountryIso2Code)]);
|
||||
else if (StringUtil.GetLength(RegionCountryIso2Code) != GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Region_CountryIso2Code))
|
||||
responseData.SetControlError(nameof(RegionCountryIso2Code), Localiser["msg.validation.invalid.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Region_CountryIso2Code)]);
|
||||
else
|
||||
{
|
||||
// Check for duplicate code.
|
||||
SaxRegion.Params prmRegion = new SaxRegion.Params();
|
||||
if (SysId.IsValid(RegionId))
|
||||
prmRegion.IdsExcluded.Add(RegionId);
|
||||
SysId regionId = RegionId.ToSysId();
|
||||
if (SysId.IsValid(regionId))
|
||||
prmRegion.IdsExcluded.Add(regionId);
|
||||
prmRegion.CountryIso2CodesIncluded.Add(RegionCountryIso2Code);
|
||||
prmRegion.StatusCat = SaxRegion.StatusCat.Any;
|
||||
if (ReferenceMgr.GetRegionCount(prmRegion) > 0)
|
||||
@@ -108,14 +104,15 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
responseData.SetControlValue(nameof(RegionName), RegionName);
|
||||
if (StringUtil.IsEmpty(RegionName))
|
||||
responseData.SetControlError(nameof(RegionName), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(RegionName) > GetControlMaxLength(SaxDbDfn.ColumnIdx.Region_Name))
|
||||
responseData.SetControlError(nameof(RegionName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.Region_Name)]);
|
||||
else if (StringUtil.GetLength(RegionName) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Region_Name))
|
||||
responseData.SetControlError(nameof(RegionName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Region_Name)]);
|
||||
else
|
||||
{
|
||||
// Check for duplicate name.
|
||||
SaxRegion.Params prmRegion = new SaxRegion.Params();
|
||||
if (SysId.IsValid(RegionId))
|
||||
prmRegion.IdsExcluded.Add(RegionId);
|
||||
SysId regionId = RegionId.ToSysId();
|
||||
if (SysId.IsValid(regionId))
|
||||
prmRegion.IdsExcluded.Add(regionId);
|
||||
prmRegion.NameFull = RegionName;
|
||||
prmRegion.StatusCat = SaxRegion.StatusCat.Any;
|
||||
if (ReferenceMgr.GetRegionCount(prmRegion) > 0)
|
||||
|
||||
@@ -36,12 +36,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Sport properties.
|
||||
public SysId SportId { get; set; }
|
||||
public String SportIdValue
|
||||
{
|
||||
get { return SysId.ToString(SportId); }
|
||||
set { SportId = new SysId(StringUtil.ToInt(value)); }
|
||||
}
|
||||
public String SportId { get; set; }
|
||||
public String SportName { get; set; }
|
||||
public String SportStatusCode { get; set; }
|
||||
public SaStatus SportStatus { get { return SacsSystem.GetStatusForCode(SportStatusCode); } }
|
||||
@@ -58,14 +53,15 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
responseData.SetControlValue(nameof(SportName), SportName);
|
||||
if (StringUtil.IsEmpty(SportName))
|
||||
responseData.SetControlError(nameof(SportName), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(SportName) > GetControlMaxLength(SaxDbDfn.ColumnIdx.Sport_Name))
|
||||
responseData.SetControlError(nameof(SportName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.Sport_Name)]);
|
||||
else if (StringUtil.GetLength(SportName) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Sport_Name))
|
||||
responseData.SetControlError(nameof(SportName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Sport_Name)]);
|
||||
else
|
||||
{
|
||||
// Check for duplicate name.
|
||||
SaxSport.Params prmSport = new SaxSport.Params();
|
||||
if (SysId.IsValid(SportId))
|
||||
prmSport.IdsExcluded.Add(SportId);
|
||||
SysId sportId = SportId.ToSysId();
|
||||
if (SysId.IsValid(sportId))
|
||||
prmSport.IdsExcluded.Add(sportId);
|
||||
prmSport.NamePartial = SportName;
|
||||
prmSport.StatusCat = SaxSport.StatusCat.Any;
|
||||
if (ReferenceMgr.GetSportCount(prmSport) > 0)
|
||||
|
||||
@@ -37,12 +37,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// User properties.
|
||||
public SysId UserAccountId { get; set; }
|
||||
public String UserAccountIdValue
|
||||
{
|
||||
get { return SysId.ToString(UserAccountId); }
|
||||
set { UserAccountId = new SysId(StringUtil.ToInt(value)); }
|
||||
}
|
||||
public String UserAccountId { get; set; }
|
||||
[EmailAddress]
|
||||
public String UserEmailAddress { get; set; }
|
||||
public String UserTitle { get; set; }
|
||||
@@ -76,14 +71,15 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
responseData.SetControlValue(nameof(UserEmailAddress), UserEmailAddress);
|
||||
if (StringUtil.IsEmpty(UserEmailAddress))
|
||||
responseData.SetControlError(nameof(UserEmailAddress), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(UserEmailAddress) > GetControlMaxLength(SaxDbDfn.ColumnIdx.UserAccount_EmailAddress))
|
||||
responseData.SetControlError(nameof(UserEmailAddress), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.UserAccount_EmailAddress)]);
|
||||
else if (StringUtil.GetLength(UserEmailAddress) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_EmailAddress))
|
||||
responseData.SetControlError(nameof(UserEmailAddress), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_EmailAddress)]);
|
||||
else
|
||||
{
|
||||
// Check for duplicate email address.
|
||||
SaxUserAccount.Params prmUserAccount = new SaxUserAccount.Params();
|
||||
if (SysId.IsValid(UserAccountId))
|
||||
prmUserAccount.IdsExcluded.Add(UserAccountId);
|
||||
SysId userAccountId = UserAccountId.ToSysId();
|
||||
if (SysId.IsValid(userAccountId))
|
||||
prmUserAccount.IdsExcluded.Add(userAccountId);
|
||||
prmUserAccount.EmailAddress = UserEmailAddress;
|
||||
prmUserAccount.StatusCat = SaxUserAccount.StatusCat.Any;
|
||||
if (AccountMgr.GetUserAccountCount(prmUserAccount) > 0)
|
||||
@@ -104,8 +100,8 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
responseData.SetControlValue(nameof(UserFirstName), UserFirstName);
|
||||
if (StringUtil.IsEmpty(UserFirstName))
|
||||
responseData.SetControlError(nameof(UserFirstName), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(UserFirstName) > GetControlMaxLength(SaxDbDfn.ColumnIdx.UserAccount_FirstName))
|
||||
responseData.SetControlError(nameof(UserFirstName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.UserAccount_FirstName)]);
|
||||
else if (StringUtil.GetLength(UserFirstName) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_FirstName))
|
||||
responseData.SetControlError(nameof(UserFirstName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_FirstName)]);
|
||||
}
|
||||
|
||||
// User last name.
|
||||
@@ -114,8 +110,8 @@ namespace Saxonite.Net.Core.Web.Admin.Models
|
||||
responseData.SetControlValue(nameof(UserLastName), UserLastName);
|
||||
if (StringUtil.IsEmpty(UserLastName))
|
||||
responseData.SetControlError(nameof(UserLastName), Localiser["msg.validation.mandatory.value"]);
|
||||
else if (StringUtil.GetLength(UserLastName) > GetControlMaxLength(SaxDbDfn.ColumnIdx.UserAccount_LastName))
|
||||
responseData.SetControlError(nameof(UserLastName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn.ColumnIdx.UserAccount_LastName)]);
|
||||
else if (StringUtil.GetLength(UserLastName) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_LastName))
|
||||
responseData.SetControlError(nameof(UserLastName), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.UserAccount_LastName)]);
|
||||
}
|
||||
|
||||
// User status.
|
||||
|
||||
Reference in New Issue
Block a user