v1.0.5.0
Activity Index. User Account country. Internals regions.
This commit is contained in:
@@ -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"]));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user