diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceController-Ajax-ContactMethods.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceController-Ajax-ContactMethods.cs similarity index 97% rename from SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceController-Ajax-ContactMethods.cs rename to SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceController-Ajax-ContactMethods.cs index 4156494..9475a45 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceController-Ajax-ContactMethods.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceController-Ajax-ContactMethods.cs @@ -7,7 +7,7 @@ using Saxonite.Net.Standard.Base.App; using Saxonite.Net.Standard.Base.Helpers; using System; -namespace Saxonite.Net.Core.Web.Admin.Controllers +namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference { //======================================================================= // Admin Reference Controller - Contact Method Ajax actions only. diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceController-Ajax.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceController-Ajax.cs similarity index 94% rename from SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceController-Ajax.cs rename to SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceController-Ajax.cs index b4d6647..55f91e3 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceController-Ajax.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceController-Ajax.cs @@ -12,7 +12,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace Saxonite.Net.Core.Web.Admin.Controllers +namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference { //======================================================================= // Admin Reference Controller - Ajax actions only. diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceGolfController-Ajax.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceGolfController-Ajax-Stats.cs similarity index 78% rename from SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceGolfController-Ajax.cs rename to SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceGolfController-Ajax-Stats.cs index e889e73..a746a54 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceGolfController-Ajax.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceGolfController-Ajax-Stats.cs @@ -13,7 +13,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace Saxonite.Net.Core.Web.Admin.Controllers +namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference { //======================================================================= // Reference Golf Controller - Ajax requests. @@ -21,33 +21,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers partial class ReferenceGolfController { //------------------------------------------------------------------- - // USGA Country data. - private class UsgaCountryListData : AjaxResponse_Data.ItemData_Base - { - public String Code { get; set; } - public String Name { get; set; } - public bool? PriorityProvincePopulate { get; set; } - public long? ProvinceCount { get; set; } - public long? ProvinceCountActive { get; set; } - } - private class UsgaCountryItemData : UsgaCountryListData - { - } - private void PopulateUsgaCountryResponseListData(SaxGolfUsgaCountry province, UsgaCountryListData data) - { - data.Id = SysId.ToString(province.Id); - data.Code = province.CountryCode; - data.Name = province.CountryName; - data.StatusCode = province.StatusCode; - data.StatusDesc = province.StatusDesc; - } - private void PopulateUsgaCountryResponseItemData(SaxGolfUsgaCountry province, UsgaCountryItemData data) - { - PopulateUsgaCountryResponseListData(province, data); - } - - //------------------------------------------------------------------- - // Get ReferenceGolf List ajax request. + // Get Stats ajax request. //------------------------------------------------------------------- private class AjaxResponse_ReferenceGolfStats : AjaxResponse_Data { @@ -329,82 +303,6 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers return group; } - //------------------------------------------------------------------- - // Get ReferenceGolf List ajax request. - //------------------------------------------------------------------- - private class AjaxResponse_ReferenceGolfList : AjaxResponse_Data - { - // Construction. - public AjaxResponse_ReferenceGolfList(SaxModel_Admin model) : base(model) { } - // Country list. - public List Countries { get; } = new List(); - } - //------------------------------------------------------------------- - [HttpPost] - [Route("Reference/Golf/Ajax/GetUsgaCountryList")] - [Route("Reference/Golf/Ajax/GetUsgaCountryies")] - public IActionResult Ajax_GetUsgaCountryList(Model_ReferenceGolf model) - { - String fn = GetType().Name + ".Ajax_GetUsgaCountryList"; - String messageTitle = Localiser["caption.reference.golf"]; - AjaxResponse_ReferenceGolfList responseData = new AjaxResponse_ReferenceGolfList(model); - - // Validate session. - if (!ValidUserSession) - return GetAjaxResult_InvalidSession(responseData); - - // Item filter. - SaxGolfUsgaCountry.Params prmUsgaCountry = new SaxGolfUsgaCountry.Params(); - prmUsgaCountry.StatusCat = SaxGolfUsgaCountry.StatusCat.Any; - model.Paging.ItemTotal = (ulong)ReferenceGolfMgr.GetUsgaCountryCount(prmUsgaCountry); - model.PopulatePagingTo(prmUsgaCountry.ResultsPaging); - - // Item columns. - ColumnDfn colId = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.Id); - ColumnDfn colCode = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.CountryCode); - ColumnDfn colName = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.CountryName); - ColumnDfn colProvinceCount_All = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.ProvinceCount_All); - ColumnDfn colProvinceCount_Active = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.ProvinceCount_Active); - ColumnDfn colFlags = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.Flags); - ColumnDfn colStatus = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.Status); - List columns = new List() - { - colId, colCode, colName, colProvinceCount_All, colProvinceCount_Active, colFlags, colStatus - }; - - // Sort order. - prmUsgaCountry.SortColumns.Add(colName); - - // Query items. - using (DbResultSet resultSet = ReferenceGolfMgr.ExecuteUsgaCountryQuery(columns, prmUsgaCountry)) - { - while (resultSet != null && resultSet.HasRows && resultSet.NextRecord()) - { - NamedValue.Map values = resultSet.GetRecordValues(); - ushort flags = (ushort)values.GetLong(colFlags.DataName); - UsgaCountryListData provinceData = new UsgaCountryListData() - { - Id = values.GetString(colId.DataName), - Code = values.GetString(colName.DataName), - Name = values.GetString(colName.DataName), - ProvinceCount = values.GetLong(colProvinceCount_All.DataName), - ProvinceCountActive = values.GetLong(colProvinceCount_Active.DataName), - PriorityProvincePopulate = SacsHierarchyItem.GetFlag(flags, SaxGolfUsgaCountry.Flag_Priority), - StatusCode = values.GetString(colStatus.DataName), - StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName)) - }; - responseData.Countries.Add(provinceData); - } - } - if (model.Paging.IsPaged) - model.Paging.ItemCount = (ushort)responseData.Countries.Count; - - // Complete response. - responseData.SetPaging(model); - responseData.Success = true; - return Json(responseData); - } - //------------------------------------------------------------------- } //======================================================================= diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceGolfController-Ajax.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceGolfController-Ajax.cs new file mode 100644 index 0000000..bc8f67e --- /dev/null +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceGolfController-Ajax.cs @@ -0,0 +1,250 @@ +using Microsoft.AspNetCore.Mvc; +using Sarand.Net.Standard.Base.App; +using Sarand.Net.Standard.Base.Bus; +using Sarand.Net.Standard.Base.Core; +using Sarand.Net.Standard.Base.Dbas; +using Sarand.Net.Standard.Base.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.Bus.Reference; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference +{ + //======================================================================= + // Reference Golf Controller - Ajax requests. + //======================================================================= + partial class ReferenceGolfController + { + //------------------------------------------------------------------- + // USGA Country data. + private class UsgaCountryListData : AjaxResponse_Data.ItemData_Base + { + public String Code { get; set; } + public String Name { get; set; } + public bool? PriorityProvincePopulate { get; set; } + public long? ProvinceCount { get; set; } + public long? ProvinceCountActive { get; set; } + public long? FacilityCount { get; set; } + public long? FacilityCountActive { get; set; } + } + private class UsgaCountryItemData : UsgaCountryListData + { + } + private void PopulateUsgaCountryResponseListData(SaxGolfUsgaCountry country, UsgaCountryListData data) + { + data.Id = SysId.ToString(country.Id); + data.Code = country.CountryCode; + data.Name = country.CountryName; + data.StatusCode = country.StatusCode; + data.StatusDesc = country.StatusDesc; + } + private void PopulateUsgaCountryResponseItemData(SaxGolfUsgaCountry country, UsgaCountryItemData data) + { + PopulateUsgaCountryResponseListData(country, data); + } + + //------------------------------------------------------------------- + // USGA Province data. + private class UsgaProvinceListData : AjaxResponse_Data.ItemData_Base + { + public String Code { get; set; } + public String Name { get; set; } + public bool? PriorityProvincePopulate { get; set; } + public long? FacilityCount { get; set; } + public long? FacilityCountActive { get; set; } + public long? CourseCount { get; set; } + public long? CourseCountActive { get; set; } + } + private class UsgaProvinceItemData : UsgaProvinceListData + { + } + private void PopulateUsgaProvinceResponseListData(SaxGolfUsgaProvince province, UsgaProvinceListData data) + { + data.Id = SysId.ToString(province.Id); + data.Code = province.ProvinceCode; + data.Name = province.ProvinceName; + data.StatusCode = province.StatusCode; + data.StatusDesc = province.StatusDesc; + } + private void PopulateUsgaProvinceResponseItemData(SaxGolfUsgaProvince province, UsgaProvinceItemData data) + { + PopulateUsgaProvinceResponseListData(province, data); + } + + //------------------------------------------------------------------- + // Get Country List ajax request. + //------------------------------------------------------------------- + private class AjaxResponse_ReferenceGolf_CountryList : AjaxResponse_Data + { + // Construction. + public AjaxResponse_ReferenceGolf_CountryList(SaxModel_Admin model) : base(model) { } + // Country list. + public List Countries { get; } = new List(); + } + //------------------------------------------------------------------- + [HttpPost] + [Route("Reference/Golf/Ajax/GetUsgaCountryList")] + [Route("Reference/Golf/Ajax/GetUsgaCountries")] + [Route("Reference/Golf/Ajax/GetCountryList")] + [Route("Reference/Golf/Ajax/GetCountries")] + public IActionResult Ajax_GetCountryList(Model_ReferenceGolf model) + { + String fn = GetType().Name + ".Ajax_GetCountryList"; + String messageTitle = Localiser["caption.reference.golf"]; + AjaxResponse_ReferenceGolf_CountryList responseData = new AjaxResponse_ReferenceGolf_CountryList(model); + + // Validate session. + if (!ValidUserSession) + return GetAjaxResult_InvalidSession(responseData); + + // Item columns. + ColumnDfn colId = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.Id); + ColumnDfn colCode = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.CountryCode); + ColumnDfn colName = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.CountryName); + ColumnDfn colProvinceCount_All = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.ProvinceCount_All); + ColumnDfn colProvinceCount_Active = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.ProvinceCount_Active); + ColumnDfn colFacilityCount_All = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.FacilityCount_All); + ColumnDfn colFacilityCount_Active = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.FacilityCount_Active); + ColumnDfn colFlags = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.Flags); + ColumnDfn colStatus = ReferenceGolfMgr.GetUsgaCountryColumnDfn(SaxGolfUsgaCountry.Column.Status); + List columns = new List() + { + colId, colCode, colName, colProvinceCount_All, colProvinceCount_Active, colFacilityCount_All, colFacilityCount_Active, colFlags, colStatus + }; + + // Item filter. + SaxGolfUsgaCountry.Params prmUsgaCountry = new SaxGolfUsgaCountry.Params(); + prmUsgaCountry.CountryFilter = model.Filter.CountrySearch; + prmUsgaCountry.StatusCat = SaxGolfUsgaCountry.StatusCat.Any; + model.Paging.ItemTotal = (ulong)ReferenceGolfMgr.GetUsgaCountryCount(prmUsgaCountry); + model.PopulatePagingTo(prmUsgaCountry.ResultsPaging); + + // Sort order. + prmUsgaCountry.SortColumns.Add(colName); + + // Query items. + using (DbResultSet resultSet = ReferenceGolfMgr.ExecuteUsgaCountryQuery(columns, prmUsgaCountry)) + { + while (resultSet != null && resultSet.HasRows && resultSet.NextRecord()) + { + NamedValue.Map values = resultSet.GetRecordValues(); + ushort flags = (ushort)values.GetLong(colFlags.DataName); + UsgaCountryListData provinceData = new UsgaCountryListData() + { + Id = values.GetString(colId.DataName), + Code = values.GetString(colCode.DataName), + Name = values.GetString(colName.DataName), + PriorityProvincePopulate = SacsHierarchyItem.GetFlag(flags, SaxGolfUsgaCountry.Flag_Priority), + ProvinceCount = values.GetLong(colProvinceCount_All.DataName), + ProvinceCountActive = values.GetLong(colProvinceCount_Active.DataName), + FacilityCount = values.GetLong(colFacilityCount_All.DataName), + FacilityCountActive = values.GetLong(colFacilityCount_Active.DataName), + StatusCode = values.GetString(colStatus.DataName), + StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName)) + }; + responseData.Countries.Add(provinceData); + } + } + if (model.Paging.IsPaged) + model.Paging.ItemCount = (ushort)responseData.Countries.Count; + + // Complete response. + responseData.SetPaging(model); + responseData.Success = true; + return Json(responseData); + } + + //------------------------------------------------------------------- + // Get Province List ajax request. + //------------------------------------------------------------------- + private class AjaxResponse_ReferenceGolf_ProvinceList : AjaxResponse_Data + { + // Construction. + public AjaxResponse_ReferenceGolf_ProvinceList(SaxModel_Admin model) : base(model) { } + // Province list. + public List Provinces { get; } = new List(); + } + //------------------------------------------------------------------- + [HttpPost] + [Route("Reference/Golf/Ajax/GetUsgaProvinceList")] + [Route("Reference/Golf/Ajax/GetUsgaProvinces")] + [Route("Reference/Golf/Ajax/GetProvinceList")] + [Route("Reference/Golf/Ajax/GetProvinces")] + public IActionResult Ajax_GetProvinceList(Model_ReferenceGolf model) + { + String fn = GetType().Name + ".Ajax_GetProvinceList"; + String messageTitle = Localiser["caption.reference.golf"]; + AjaxResponse_ReferenceGolf_ProvinceList responseData = new AjaxResponse_ReferenceGolf_ProvinceList(model); + + // Validate session. + if (!ValidUserSession) + return GetAjaxResult_InvalidSession(responseData); + + // Item columns. + ColumnDfn colId = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.Id); + ColumnDfn colCode = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.ProvinceCode); + ColumnDfn colName = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.ProvinceName); + ColumnDfn colFacilityCount_All = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.FacilityCount_All); + ColumnDfn colFacilityCount_Active = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.FacilityCount_Active); + ColumnDfn colCourseCount_All = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.CourseCount_All); + ColumnDfn colCourseCount_Active = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.CourseCount_Active); + ColumnDfn colFlags = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.Flags); + ColumnDfn colStatus = ReferenceGolfMgr.GetUsgaProvinceColumnDfn(SaxGolfUsgaProvince.Column.Status); + List columns = new List() + { + colId, colCode, colName, colFacilityCount_All, colFacilityCount_Active, colCourseCount_All, colCourseCount_Active, colFlags, colStatus + }; + + // Item filter. + SaxGolfUsgaProvince.Params prmUsgaProvince = new SaxGolfUsgaProvince.Params(); + if (StringUtil.ToLong(model.Filter.CountryId) > 0) + prmUsgaProvince.CountryIdsIncluded.Add(StringUtil.ToSysId(model.Filter.CountryId)); + prmUsgaProvince.ProvinceFilter = model.Filter.ProvinceSearch; + prmUsgaProvince.StatusCat = SaxGolfUsgaProvince.StatusCat.Any; + model.Paging.ItemTotal = (ulong)ReferenceGolfMgr.GetUsgaProvinceCount(prmUsgaProvince); + model.PopulatePagingTo(prmUsgaProvince.ResultsPaging); + + // Sort order. + prmUsgaProvince.SortColumns.Add(colCode); + + // Query items. + using (DbResultSet resultSet = ReferenceGolfMgr.ExecuteUsgaProvinceQuery(columns, prmUsgaProvince)) + { + while (resultSet != null && resultSet.HasRows && resultSet.NextRecord()) + { + NamedValue.Map values = resultSet.GetRecordValues(); + ushort flags = (ushort)values.GetLong(colFlags.DataName); + UsgaProvinceListData provinceData = new UsgaProvinceListData() + { + Id = values.GetString(colId.DataName), + Code = values.GetString(colCode.DataName), + Name = values.GetString(colName.DataName), + PriorityProvincePopulate = SacsHierarchyItem.GetFlag(flags, SaxGolfUsgaProvince.Flag_Priority), + FacilityCount = values.GetLong(colFacilityCount_All.DataName), + FacilityCountActive = values.GetLong(colFacilityCount_Active.DataName), + CourseCount = values.GetLong(colCourseCount_All.DataName), + CourseCountActive = values.GetLong(colCourseCount_Active.DataName), + StatusCode = values.GetString(colStatus.DataName), + StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName)) + }; + responseData.Provinces.Add(provinceData); + } + } + if (model.Paging.IsPaged) + model.Paging.ItemCount = (ushort)responseData.Provinces.Count; + + // Complete response. + responseData.SetPaging(model); + responseData.Success = true; + return Json(responseData); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceGolfController.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceGolfController.cs similarity index 95% rename from SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceGolfController.cs rename to SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceGolfController.cs index db211eb..87c9f8f 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/ReferenceGolfController.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/Reference/ReferenceGolfController.cs @@ -9,7 +9,7 @@ using System.Diagnostics; using System.Linq; using System.Threading.Tasks; -namespace Saxonite.Net.Core.Web.Admin.Controllers +namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference { //======================================================================= public partial class ReferenceGolfController : SaxController_Admin diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/SystemController-Ajax-Database.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/System/SystemController-Ajax-Database.cs similarity index 99% rename from SaxoniteCoreWebAdmin/Admin/Controllers/SystemController-Ajax-Database.cs rename to SaxoniteCoreWebAdmin/Admin/Controllers/System/SystemController-Ajax-Database.cs index a18ea6e..2c596d6 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/SystemController-Ajax-Database.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/System/SystemController-Ajax-Database.cs @@ -18,7 +18,7 @@ using System.Linq; using System.Reflection; using System.Threading.Tasks; -namespace Saxonite.Net.Core.Web.Admin.Controllers +namespace Saxonite.Net.Core.Web.Admin.Controllers.System { //======================================================================= // System - Ajax - Database controller diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/SystemController-Ajax-Logs.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/System/SystemController-Ajax-Logs.cs similarity index 98% rename from SaxoniteCoreWebAdmin/Admin/Controllers/SystemController-Ajax-Logs.cs rename to SaxoniteCoreWebAdmin/Admin/Controllers/System/SystemController-Ajax-Logs.cs index 4c12057..5f45b20 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/SystemController-Ajax-Logs.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/System/SystemController-Ajax-Logs.cs @@ -4,6 +4,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.IO; using Sarand.Net.Standard.Base.Utils; using Saxonite.Net.Core.Web.Admin.Models; using Saxonite.Net.Standard.Base.App; @@ -15,7 +16,7 @@ using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; -namespace Saxonite.Net.Core.Web.Admin.Controllers +namespace Saxonite.Net.Core.Web.Admin.Controllers.System { //======================================================================= // System - Ajax - Database controller @@ -256,7 +257,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers responseData.File.Name = Path.GetFileName(responseData.File.Path); try { - String[] fileLines = System.IO.File.ReadAllLines(responseData.File.Path); + String[] fileLines = FileUtil.ReadAllFileLines(responseData.File.Path); responseData.File.Data = String.Join("\n", fileLines); // Construct html data. foreach (var fileLine in fileLines) diff --git a/SaxoniteCoreWebAdmin/Admin/Controllers/SystemController.cs b/SaxoniteCoreWebAdmin/Admin/Controllers/System/SystemController.cs similarity index 97% rename from SaxoniteCoreWebAdmin/Admin/Controllers/SystemController.cs rename to SaxoniteCoreWebAdmin/Admin/Controllers/System/SystemController.cs index a67715a..60cb975 100644 --- a/SaxoniteCoreWebAdmin/Admin/Controllers/SystemController.cs +++ b/SaxoniteCoreWebAdmin/Admin/Controllers/System/SystemController.cs @@ -14,7 +14,7 @@ using System.Diagnostics; using System.Linq; using System.Threading.Tasks; -namespace Saxonite.Net.Core.Web.Admin.Controllers +namespace Saxonite.Net.Core.Web.Admin.Controllers.System { //======================================================================= public partial class SystemController : SaxController_Admin diff --git a/SaxoniteCoreWebAdmin/Admin/Models/Model_ReferenceGolf.cs b/SaxoniteCoreWebAdmin/Admin/Models/Model_ReferenceGolf.cs index e33e19e..ee9aa57 100644 --- a/SaxoniteCoreWebAdmin/Admin/Models/Model_ReferenceGolf.cs +++ b/SaxoniteCoreWebAdmin/Admin/Models/Model_ReferenceGolf.cs @@ -30,6 +30,12 @@ namespace Saxonite.Net.Core.Web.Admin.Models // Reference Golf list parameters. public class FilterData { + public String CountrySearch { get; set; } + public String CountryId { get; set; } + public String ProvinceSearch { get; set; } + public String ProvinceId { get; set; } + public String CourseSearch{ get; set; } + public String CourseId { get; set; } } public FilterData Filter { get; } = new FilterData(); diff --git a/SaxoniteCoreWebAdmin/Localisation/SaxAdminProperties.resx b/SaxoniteCoreWebAdmin/Localisation/SaxAdminProperties.resx index 7bfb1b9..3019d65 100644 --- a/SaxoniteCoreWebAdmin/Localisation/SaxAdminProperties.resx +++ b/SaxoniteCoreWebAdmin/Localisation/SaxAdminProperties.resx @@ -270,6 +270,12 @@ Close + + Clubs + + + Code + Column @@ -282,12 +288,18 @@ Core + + Countries + Country County + + Courses + Create @@ -393,6 +405,9 @@ Logs + + Markers + Members @@ -471,9 +486,15 @@ Previous + + Priority + Province + + Provinces + Reference diff --git a/SaxoniteCoreWebAdmin/Views/Reference/Golf/Index.cshtml b/SaxoniteCoreWebAdmin/Views/Reference/Golf/Index.cshtml index 55fb6c6..e801bc3 100644 --- a/SaxoniteCoreWebAdmin/Views/Reference/Golf/Index.cshtml +++ b/SaxoniteCoreWebAdmin/Views/Reference/Golf/Index.cshtml @@ -33,6 +33,12 @@
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmRefGolfFilter", @class = "sax-form", @onSubmit = "return false;" })) { + @Html.HiddenFor(model => model.Filter.CountrySearch, new { @class = "FilterCountrySearch" }) + @Html.HiddenFor(model => model.Filter.CountryId, new { @class = "FilterCountryId" }) + @Html.HiddenFor(model => model.Filter.ProvinceSearch, new { @class = "FilterProvinceSearch" }) + @Html.HiddenFor(model => model.Filter.ProvinceId, new { @class = "FilterProvinceId" }) + @Html.HiddenFor(model => model.Filter.CourseSearch, new { @class = "FilterCourseSearch" }) + @Html.HiddenFor(model => model.Filter.CourseId, new { @class = "FilterCourseId" })
@Localiser["label.options"]
@@ -68,28 +74,112 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ @* Reference - Golf - Countries *@ + @using (@Html.BeginForm(FormMethod.Post, new { @id = "frmCountries", @class = "sax-form", @onSubmit = "return false;" })) + { +
+
+
+
+ @Localiser["label.search"] +
+
@Localiser["label.countries"]
+
+
+
+ + + + + + + + + + + + +
@Localiser["label.code"]@Localiser["label.name"]@Localiser["label.priority"]@Localiser["label.provinces"]@Localiser["label.clubs"]@Localiser["label.status"]
+
+ + + + + + + + + +
+
+ } + + @* Reference - Golf - Provinces *@ + @using (@Html.BeginForm(FormMethod.Post, new { @id = "frmProvinces", @class = "sax-form", @onSubmit = "return false;" })) + { + @Html.HiddenFor(Model => Model.Filter.CountryId, new { @class = "FilterCountryId" }) +
+
+
+
+ @Localiser["label.search"] + +
+
@Localiser["label.provinces"]
+
+
+
+
+
+ + + + + + + + + + + + +
@Localiser["label.code"]@Localiser["label.name"]@Localiser["label.priority"]@Localiser["label.clubs"]@Localiser["label.courses"]@Localiser["label.status"]
+
+ + + + + + + + + +
+
+ } + + @* Reference - Golf - Courses *@ +
+
+
@Localiser["label.courses"]
+ @* Icons. *@ +
+ +
+
+ Active +
+
+ Inactive +
+
+ Deleted +
+
diff --git a/SaxoniteCoreWebAdmin/wwwroot/css/sax-base.css b/SaxoniteCoreWebAdmin/wwwroot/css/sax-base.css index 437b161..06a84ae 100644 --- a/SaxoniteCoreWebAdmin/wwwroot/css/sax-base.css +++ b/SaxoniteCoreWebAdmin/wwwroot/css/sax-base.css @@ -170,6 +170,11 @@ select text-transform: lowercase !important; } +.left +{ + text-align: left !important; +} + .center { text-align: center !important; diff --git a/SaxoniteCoreWebAdmin/wwwroot/css/sax-data.css b/SaxoniteCoreWebAdmin/wwwroot/css/sax-data.css index 3db2aef..448d63e 100644 --- a/SaxoniteCoreWebAdmin/wwwroot/css/sax-data.css +++ b/SaxoniteCoreWebAdmin/wwwroot/css/sax-data.css @@ -77,7 +77,7 @@ { min-width: 75%; max-width: 90%; - width:90%; + width: 90%; } .sax-panel-filter .sax-content .sax-button @@ -121,7 +121,7 @@ .sax-header ul.nav.sax-burger ul.sax-dropdown-menu { padding: 4px 8px 4px 4px; - border-radius:2px 2px 8px 4px; + border-radius: 2px 2px 8px 4px; box-shadow: 0 0 8px 2px #80808080; } @@ -243,6 +243,13 @@ /* Data Items panel */ +@media (min-width: 576px) +{ + .sax-panel-results + { + } +} + .sax-panel-results { } @@ -264,6 +271,48 @@ background-image: url("../img/icon/error-18.png"); } +/* Item List table */ + +.sax-item-list-table-prefix, .sax-item-list-table-suffix +{ + width: 100%; + height: 12px; +} + +table.sax-item-list +{ + width: 100%; + border-spacing: 0; + border-collapse: collapse; + overflow: auto; +} + +table.sax-item-list thead th +{ + position: sticky; + top: 0; + padding:4px 2px 2px 2px; + z-index: 1; + background-color: #f8f8f8; +} + +table.sax-item-list tbody th +{ + position: sticky; + left: 0; + background-color: #f8f8f8; +} + +table.sax-item-list tbody tr:hover +{ + background-color: lightyellow; +} + +table.sax-item-list tbody tr.sax-sel +{ + background-color: palegreen; +} + /* Item */ .sax-panel-item-template @@ -331,13 +380,6 @@ font-size: 0.8rem; } -@media (min-width: 576px) -{ - .sax-panel-filter - { - } -} - /* Item statuses */ .sax-status-awa diff --git a/SaxoniteCoreWebAdmin/wwwroot/css/sax-form.css b/SaxoniteCoreWebAdmin/wwwroot/css/sax-form.css index 52fa0e2..581bc96 100644 --- a/SaxoniteCoreWebAdmin/wwwroot/css/sax-form.css +++ b/SaxoniteCoreWebAdmin/wwwroot/css/sax-form.css @@ -42,7 +42,7 @@ .sax-panel-info > .sax-header, .sax-panel-form > .sax-header { - padding: 12px 12px; + padding: 8px 12px; text-align: center; background-color: #e8e8e8; border-bottom: solid 1px #606060; @@ -122,7 +122,7 @@ .sax-panel-info .sax-label { - padding-right: 16px; + padding-right: 12px; font-weight: bold; color: #808080; } diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/cross-24.png b/SaxoniteCoreWebAdmin/wwwroot/img/icon/cross-24.png new file mode 100644 index 0000000..575cabd Binary files /dev/null and b/SaxoniteCoreWebAdmin/wwwroot/img/icon/cross-24.png differ diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/cross-32.png b/SaxoniteCoreWebAdmin/wwwroot/img/icon/cross-32.png new file mode 100644 index 0000000..a73481f Binary files /dev/null and b/SaxoniteCoreWebAdmin/wwwroot/img/icon/cross-32.png differ diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/cross-64.png b/SaxoniteCoreWebAdmin/wwwroot/img/icon/cross-64.png new file mode 100644 index 0000000..c4cd128 Binary files /dev/null and b/SaxoniteCoreWebAdmin/wwwroot/img/icon/cross-64.png differ diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-blue.svg b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-blue.svg new file mode 100644 index 0000000..6bc4e20 --- /dev/null +++ b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-blue.svg @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-green.svg b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-green.svg new file mode 100644 index 0000000..3e986d5 --- /dev/null +++ b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-green.svg @@ -0,0 +1,254 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-lightblue.svg b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-lightblue.svg new file mode 100644 index 0000000..c6d4d9e --- /dev/null +++ b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-lightblue.svg @@ -0,0 +1,254 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-lightgreen.svg b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-lightgreen.svg new file mode 100644 index 0000000..3ff7daa --- /dev/null +++ b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-lightgreen.svg @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-orange.svg b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-orange.svg new file mode 100644 index 0000000..cb915c2 --- /dev/null +++ b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-orange.svg @@ -0,0 +1,254 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-pink.svg b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-pink.svg new file mode 100644 index 0000000..b562274 --- /dev/null +++ b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-pink.svg @@ -0,0 +1,216 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-purple.svg b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-purple.svg new file mode 100644 index 0000000..3875515 --- /dev/null +++ b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-purple.svg @@ -0,0 +1,254 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-red.svg b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-red.svg new file mode 100644 index 0000000..91b3935 --- /dev/null +++ b/SaxoniteCoreWebAdmin/wwwroot/img/icon/sphere-red.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/tick-24.png b/SaxoniteCoreWebAdmin/wwwroot/img/icon/tick-24.png new file mode 100644 index 0000000..a34147c Binary files /dev/null and b/SaxoniteCoreWebAdmin/wwwroot/img/icon/tick-24.png differ diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/tick-32.png b/SaxoniteCoreWebAdmin/wwwroot/img/icon/tick-32.png new file mode 100644 index 0000000..70affe7 Binary files /dev/null and b/SaxoniteCoreWebAdmin/wwwroot/img/icon/tick-32.png differ diff --git a/SaxoniteCoreWebAdmin/wwwroot/img/icon/tick-64.png b/SaxoniteCoreWebAdmin/wwwroot/img/icon/tick-64.png new file mode 100644 index 0000000..f886b96 Binary files /dev/null and b/SaxoniteCoreWebAdmin/wwwroot/img/icon/tick-64.png differ diff --git a/SaxoniteCoreWebAdmin/wwwroot/js/sax-ref-golf.js b/SaxoniteCoreWebAdmin/wwwroot/js/sax-ref-golf.js index 3772b4a..e97a645 100644 --- a/SaxoniteCoreWebAdmin/wwwroot/js/sax-ref-golf.js +++ b/SaxoniteCoreWebAdmin/wwwroot/js/sax-ref-golf.js @@ -6,20 +6,19 @@ { "use strict"; let rg = sax.refGolf = sax.refGolf || { data: {}, fn: {}, $pnl: {}, $frm: {}, $dlg: {} }; + rg.attr_id = 'sax-id'; + rg.class_sel = 'sax-sel'; //-------------------------------------------------------------- /* Reference - Golf - Stats. */ rg.fn.refreshStats = function (delay) { - //sax.debug('refreshOrganisations'); rg.ajaxGolfStats = rg.ajaxGolfStats || { url: sax.url.base + 'Reference/Golf/Ajax/GetStats', formId: rg.$frm.filter.prop('id'), callbackFn: rg.fn.doRefreshStats }; sax.doAjaxRequest(rg.ajaxGolfStats, delay || 50); } rg.fn.doRefreshStats = function (response) { - sax.debug('doRefreshStats', response); if (!response.success) return; - let $msgs = $('.sax-panel-messages', rg.$pnl.stats).empty(); let $list = $('.sax-panel-item-list', rg.$pnl.stats).empty(); for (let groupIdx = 0; groupIdx < (response.groups || []).length; groupIdx++) @@ -29,11 +28,11 @@ for (let statIdx = 0; statIdx < (group.stats || []).length; statIdx++) { let stat = group.stats[statIdx]; - if (stat.value>0) $list.append(rg.fn.populateStat(rg.fn.getStatTemplate(), stat.caption, stat.value)); + if (stat.value > 0) $list.append(rg.fn.populateStat(rg.fn.getStatTemplate(), stat.caption, stat.value)); } } } - rg.fn.populateStatGroup=function($item, caption) + rg.fn.populateStatGroup = function ($item, caption) { $('.GroupCaption', $item).text(caption); return $item; @@ -53,6 +52,134 @@ return $('.sax-panel-item-template .GolfStat', rg.$pnl.stats).clone(); } + //-------------------------------------------------------------- + /* Reference - Golf - Countries. */ + rg.fn.clearCountries = function () + { + rg.fn.clearProvinces(); + rg.$pnl.countriesMsgs.empty(); + rg.$pnl.countriesList.find('tbody tr').remove(); + $('.FilterProvinceSearch', rg.$frm.provinces).val(''); + } + rg.fn.refreshCountries = function (delay) + { + rg.fn.clearCountries(); + rg.ajaxGolfCountries = rg.ajaxGolfCountries || { url: sax.url.base + 'Reference/Golf/Ajax/GetCountries', formId: rg.$frm.countries.prop('id'), callbackFn: rg.fn.doRefreshCountries }; + sax.doAjaxRequest(rg.ajaxGolfCountries, delay || 50); + } + rg.fn.doRefreshCountries = function (response) + { + //sax.debug('doRefreshCountries', response); + rg.fn.clearCountries(); + if (!response.success) return; + let $list = rg.$pnl.countriesList; + $('tbody tr', $list).remove() + for (let countryIdx = 0; countryIdx < (response.countries || []).length; countryIdx++) + { + let $item = rg.fn.getCountryTemplate(); + let item = response.countries[countryIdx]; + $list.append(rg.fn.populateCountry($item, item)); + if (countryIdx == 0 && response.countries.length == 1) + rg.fn.selectCountry($item, item); + } + } + rg.fn.populateCountry = function ($item, item) + { + $item.attr(rg.attr_id, item.id).on('click', function () { rg.fn.selectCountry($item, item); }) + $('.CountryCode', $item).text(item.code); + $('.CountryName', $item).text(item.name); + if (item.provinceCountActive) $('.CountryProvinces', $item).text(item.provinceCountActive); + if (item.facilityCountActive) $('.CountryClubs', $item).text(item.facilityCountActive); + if (item.priorityProvincePopulate) $('.CountryPriority', $item).append(rg.fn.getTickIcon()); + $('.CountryStatus', $item).append(rg.fn.getStatusIcon(item.statusCode.toLowerCase())); + return $item; + } + rg.fn.getCountryTemplate = function () + { + return $('table.sax-panel-item-template tr.GolfCountry', rg.$pnl.countries).clone(); + } + rg.fn.selectCountry = function ($item, item) + { + //sax.debug('selectCountry', $item, item) + $('table.sax-item-list tbody tr', rg.$pnl.countries).removeClass(rg.class_sel); + $item.addClass(rg.class_sel); + setTimeout(rg.fn.refreshProvinces(500), 100); + } + + //-------------------------------------------------------------- + /* Reference - Golf - Provinces. */ + rg.fn.clearProvinces = function () + { + rg.$pnl.provincesMsgs.empty(); + rg.$pnl.provincesList.find('tbody tr').remove(); + } + rg.fn.refreshProvinces = function (delay) + { + rg.fn.clearProvinces(); + let countryId = rg.$pnl.countriesList.find('tbody tr.' + rg.class_sel).attr(rg.attr_id); + if (!countryId) + { + rg.$pnl.provincesMsgs.empty().text('Country must be selected.'); + return; + } + $('.FilterCountryId', rg.$frm.provinces).val(countryId); + rg.ajaxGolfProvinces = rg.ajaxGolfProvinces || { url: sax.url.base + 'Reference/Golf/Ajax/GetProvinces', formId: rg.$frm.provinces.prop('id'), callbackFn: rg.fn.doRefreshProvinces }; + sax.doAjaxRequest(rg.ajaxGolfProvinces, delay || 50); + } + rg.fn.doRefreshProvinces = function (response) + { + //sax.debug('doRefreshProvinces', response); + rg.fn.clearProvinces(); + if (!response.success) return; + let $list = rg.$pnl.provincesList; + $('tbody tr', $list).remove() + for (let provinceIdx = 0; provinceIdx < (response.provinces || []).length; provinceIdx++) + $list.append(rg.fn.populateProvince(rg.fn.getProvinceTemplate(), response.provinces[provinceIdx])); + } + rg.fn.populateProvince = function ($item, item) + { + $item.attr(rg.attr_id, item.id).on('click', function () { rg.fn.selectProvince($item, item); }) + $('.ProvinceCode', $item).text(item.code); + $('.ProvinceName', $item).text(item.name); + if (item.facilityCountActive) $('.ProvinceClubs', $item).text(item.facilityCountActive); + if (item.courseCountActive) $('.ProvinceCourses', $item).text(item.courseCountActive); + if (item.priorityClubPopulate) $('.ProvincePriority', $item).append(rg.fn.getTickIcon()); + $('.ProvinceStatus', $item).append(rg.fn.getStatusIcon(item.statusCode.toLowerCase())); + return $item; + } + rg.fn.getProvinceTemplate = function () + { + return $('table.sax-panel-item-template tr.GolfProvince', rg.$pnl.provinces).clone(); + } + rg.fn.selectProvince = function ($item, item) + { + //sax.debug('selectProvince', $item, item) + $('table.sax-item-list tbody tr', rg.$pnl.provinces).removeClass(rg.class_sel); + $item.addClass(rg.class_sel); + setTimeout(rg.fn.refreshClubs(500), 100); + } + + //-------------------------------------------------------------- + /* Reference - Golf - Clubs. */ + rg.fn.refreshClubs = function (delay) + { + } + + //-------------------------------------------------------------- + // Utilities. + rg.fn.getTickIcon = function () + { + return $('.sax-panel-item-template img.sax-tick', rg.$pnl.golf).clone(); + } + rg.fn.getCrossIcon = function () + { + return $('.sax-panel-item-template img.sax-cross', rg.$pnl.golf).clone(); + } + rg.fn.getStatusIcon = function (stat) + { + return $('.sax-panel-item-template img.sax-status-' + stat, rg.$pnl.golf).clone(); + } + //-------------------------------------------------------------- $(function () { @@ -65,6 +192,21 @@ rg.$pnl.stats = $('.sax-panel-info.GolfStats', rg.$pnl.golf); setTimeout(rg.fn.refreshStats, 250); + // Countries. + rg.$pnl.countries = $('.sax-panel-info.Countries', rg.$pnl.golf); + rg.$pnl.countriesMsgs = $('.sax-panel-messages', rg.$pnl.countries); + rg.$pnl.countriesList = $('table.sax-item-list', rg.$pnl.countries); + rg.$frm.countries = $('#frmCountries', rg.$pnl.golf); + $('.FilterCountrySearch', rg.$frm.countries).on('input', function () { setTimeout(rg.fn.refreshCountries(500), 100); }); + setTimeout(rg.fn.refreshCountries, 1000); + + // Provinces. + rg.$pnl.provinces = $('.sax-panel-info.Provinces', rg.$pnl.golf); + rg.$pnl.provincesMsgs = $('.sax-panel-messages', rg.$pnl.provinces); + rg.$pnl.provincesList = $('table.sax-item-list', rg.$pnl.provinces); + rg.$frm.provinces = $('#frmProvinces', rg.$pnl.golf); + $('.FilterProvinceSearch', rg.$frm.provinces).on('input', function () { setTimeout(rg.fn.refreshProvinces(500), 100); }); + // Courses. //$('.PagingPageNo', rg.$dlg).val(1); //$('.PagingPageLength', rg.$dlg).val(16); diff --git a/SaxoniteCoreWebOnline/wwwroot/css/sax-base.css b/SaxoniteCoreWebOnline/wwwroot/css/sax-base.css index 189264d..0ab15c0 100644 --- a/SaxoniteCoreWebOnline/wwwroot/css/sax-base.css +++ b/SaxoniteCoreWebOnline/wwwroot/css/sax-base.css @@ -153,6 +153,11 @@ textarea text-transform: lowercase !important; } +.left +{ + text-align: left !important; +} + .center { text-align: center !important; diff --git a/SaxoniteCoreWebOnline/wwwroot/css/sax-form.css b/SaxoniteCoreWebOnline/wwwroot/css/sax-form.css index 39a80ae..507b7be 100644 --- a/SaxoniteCoreWebOnline/wwwroot/css/sax-form.css +++ b/SaxoniteCoreWebOnline/wwwroot/css/sax-form.css @@ -117,7 +117,7 @@ .sax-panel-info .sax-label { - padding-right: 16px; + padding-right: 12px; font-weight: bold; color: #808080; } diff --git a/SaxoniteStandardBase/Base/App/Sax-Config.cs b/SaxoniteStandardBase/Base/App/Sax-Config.cs index 1febe1e..d6b0f9e 100644 --- a/SaxoniteStandardBase/Base/App/Sax-Config.cs +++ b/SaxoniteStandardBase/Base/App/Sax-Config.cs @@ -176,7 +176,7 @@ namespace Saxonite.Net.Standard.Base.App public static class UsgaGolfDataLookup { public static bool Enabled { get; set; } = SacsSystem.DebugMode ? true : true; - public static int MinsBetweenExecution { get; set; } = SacsSystem.DebugMode ? 8 : 30; + public static int MinsBetweenExecution { get; set; } = SacsSystem.DebugMode ? 8 : 15; public static int HoursBetweenCountryLookup { get; set; } = SacsSystem.DebugMode ? 24 : 24 * 5; } } diff --git a/SaxoniteStandardBase/Base/App/Sax-Version.cs b/SaxoniteStandardBase/Base/App/Sax-Version.cs index 3e25836..c10a68e 100644 --- a/SaxoniteStandardBase/Base/App/Sax-Version.cs +++ b/SaxoniteStandardBase/Base/App/Sax-Version.cs @@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App //------------------------------------------------------------------- public static class Version { - private static String version { get; } = "1.2.11.8"; + private static String version { get; } = "1.2.11.9"; // Retrieve version. public static String GetFullVersion () { return version; } public static String GetAppVersion () diff --git a/SaxoniteStandardBase/Base/App/SaxSystem.cs b/SaxoniteStandardBase/Base/App/SaxSystem.cs index 812f1ba..955e659 100644 --- a/SaxoniteStandardBase/Base/App/SaxSystem.cs +++ b/SaxoniteStandardBase/Base/App/SaxSystem.cs @@ -28,7 +28,7 @@ namespace Saxonite.Net.Standard.Base.App //------------------------------------------------------------------- public static Sax.Environment GetEnvironment() { - if (ComputerName.EqualsCI("Sarand602")) + if (ComputerName.ContainsCI("Sarand602")) return Sax.Environment.Production; if (ComputerName.ContainsCI("Sarand")) return Sax.Environment.Development; diff --git a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaCountry.cs b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaCountry.cs index cb31019..20d3158 100644 --- a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaCountry.cs +++ b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaCountry.cs @@ -29,6 +29,8 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference // Associated data. ProvinceCount_All, ProvinceCount_Active, + FacilityCount_All, + FacilityCount_Active, // Common. Notes, Flags, diff --git a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaProvince.cs b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaProvince.cs index 47c1ccc..5e47759 100644 --- a/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaProvince.cs +++ b/SaxoniteStandardBase/Base/Bus/Reference/SaxGolfUsgaProvince.cs @@ -27,6 +27,10 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference EntProvinceCode, ProvinceName, // Associated data. + FacilityCount_All, + FacilityCount_Active, + CourseCount_All, + CourseCount_Active, // Common. Notes, Flags, diff --git a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCountry.cs b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCountry.cs index f678cf8..f3bf142 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCountry.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCountry.cs @@ -317,6 +317,10 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference private static readonly String aliasUsgaCountry = "UsgPrv"; private static readonly String aliasUsgaCountry_Dummy = "UsgPrv_Cty"; private static readonly String prefixUsgaCountry_Dummy = aliasUsgaCountry_Dummy + "_"; + private static readonly String colCountry_Province_Count = "Cty_Prv_Count"; + private static readonly String colCountry_Province_Active_Count = "Cty_Prv_Act_Count"; + private static readonly String colCountry_Facility_Count = "Cty_Fty_Count"; + private static readonly String colCountry_Facility_Active_Count = "Cty_Fty_Act_Count"; private void SetUsgaCountryColDfn (ColumnDfn col, String caption, int width, SaxDbDfn_Reference.ColumnIdx dbCol, ColumnAlignment align = ColumnAlignment.Default, DataValue.DataType dataType = DataValue.DataType.String, @@ -357,6 +361,22 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference //----------------------------------------------------------- // Derived properties. + case SaxGolfUsgaCountry.Column.ProvinceCount_All: + SetUsgaCountryColDfn(columnDfn, "Provinces", 60, SaxDbDfn_Reference.ColumnIdx.Unknown, ColumnAlignment.Center, DataValue.DataType.Long); + columnDfn.DataName = colCountry_Province_Count; + break; + case SaxGolfUsgaCountry.Column.ProvinceCount_Active: + SetUsgaCountryColDfn(columnDfn, "Provinces (act)", 60, SaxDbDfn_Reference.ColumnIdx.Unknown, ColumnAlignment.Center, DataValue.DataType.Long); + columnDfn.DataName = colCountry_Province_Active_Count; + break; + case SaxGolfUsgaCountry.Column.FacilityCount_All: + SetUsgaCountryColDfn(columnDfn, "Facilities", 60, SaxDbDfn_Reference.ColumnIdx.Unknown, ColumnAlignment.Center, DataValue.DataType.Long); + columnDfn.DataName = colCountry_Facility_Count; + break; + case SaxGolfUsgaCountry.Column.FacilityCount_Active: + SetUsgaCountryColDfn(columnDfn, "Facilities (act)", 60, SaxDbDfn_Reference.ColumnIdx.Unknown, ColumnAlignment.Center, DataValue.DataType.Long); + columnDfn.DataName = colCountry_Facility_Active_Count; + break; //----------------------------------------------------------- // Common properties. @@ -418,10 +438,10 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference filterWords.RemoveBlanks(); foreach (String filterWord in filterWords) { - List articleFilter = new List(); - articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryCode, aliasUsgaCountry)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryName, aliasUsgaCountry)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - filter.Add(articleFilter.Concat(" OR ", "(", ")")); + List countryFilter = new List(); + countryFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryCode, aliasUsgaCountry)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + countryFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_CountryName, aliasUsgaCountry)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + filter.Add(countryFilter.Concat(" OR ", "(", ")")); } } @@ -469,7 +489,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference public List GetUsgaCountrySortColumns(SaxGolfUsgaCountry.Params prm) { // Sort sequence: - List sortColumnNames = new List(); + HashSet sortColumnNames = new HashSet(); foreach (var columnDfn in prm.SortColumns) { // Need to ensure correct alias used for UsgaCountry columns in case of conflict. @@ -496,7 +516,7 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference // Default sort columns. sortColumnNames.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_Id, aliasUsgaCountry) + " ASC"); } - return sortColumnNames; + return sortColumnNames.ToList(); } //------------------------------------------------------------------- @@ -581,6 +601,68 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference if (columns.HasId(SaxGolfUsgaCountry.Column.UpdateOn_Date)) query.Columns.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_UpdateOn, aliasUsgaCountry)); + //--------------------------------------------------------------------- + // Province count. + if (columns.HasId(SaxGolfUsgaCountry.Column.ProvinceCount_All)) + { + String aliasProvince = "aCtyPrv_Count"; + DbQuery queryProvince = new DbQuery(CoreDatabase.DbmsType); + queryProvince.Tables.Add(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaProvince), aliasProvince); + queryProvince.Columns.Add("Count(*)"); + queryProvince.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_CountryId, aliasProvince) + "=" + SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_Id, aliasUsgaCountry)); + query.Columns.Add("(" + queryProvince.BuildQuery() + ")", colCountry_Province_Count); + } + + // Active Province count. + if (columns.HasId(SaxGolfUsgaCountry.Column.ProvinceCount_Active)) + { + String aliasProvince = "aCtyPrvAct_Count"; + DbQuery queryProvince = new DbQuery(CoreDatabase.DbmsType); + queryProvince.Tables.Add(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaProvince), aliasProvince); + queryProvince.Columns.Add("Count(*)"); + queryProvince.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_CountryId, aliasProvince) + "=" + SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_Id, aliasUsgaCountry)); + queryProvince.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Status, aliasProvince) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'"); + query.Columns.Add("(" + queryProvince.BuildQuery() + ")", colCountry_Province_Active_Count); + } + + //--------------------------------------------------------------------- + // Facility count. + if (columns.HasId(SaxGolfUsgaCountry.Column.ProvinceCount_All)) + { + String aliasProvince = "aCtyFty_Count_Prv"; + DbQuery queryProvince = new DbQuery(CoreDatabase.DbmsType); + queryProvince.Tables.Add(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaProvince), aliasProvince); + queryProvince.Columns.Add("Count(*)"); + queryProvince.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_CountryId, aliasProvince) + "=" + SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_Id, aliasUsgaCountry)); + // Join to Facility. + String aliasFacility = "aCtyFty_Count_Fty"; + DbQueryJoin joinFacility = new DbQueryJoin(DbJoinType.Inner); + joinFacility.Table = new StringPair(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaFacility), aliasFacility); + joinFacility.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_ProvinceId, aliasFacility) + "=" + SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Id, aliasProvince)); + queryProvince.Joins.Add(joinFacility); + // Construct sub-query. + query.Columns.Add("(" + queryProvince.BuildQuery() + ")", colCountry_Facility_Count); + } + + // Active Facility count. + if (columns.HasId(SaxGolfUsgaCountry.Column.ProvinceCount_Active)) + { + String aliasProvince = "aCtyFty_Count_Prv"; + DbQuery queryProvince = new DbQuery(CoreDatabase.DbmsType); + queryProvince.Tables.Add(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaProvince), aliasProvince); + queryProvince.Columns.Add("Count(*)"); + queryProvince.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_CountryId, aliasProvince) + "=" + SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCountry_Id, aliasUsgaCountry)); + // Join to Facility. + String aliasFacility = "aCtyFty_Count_Fty"; + DbQueryJoin joinFacility = new DbQueryJoin(DbJoinType.Inner); + joinFacility.Table = new StringPair(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaFacility), aliasFacility); + joinFacility.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_ProvinceId, aliasFacility) + "=" + SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Id, aliasProvince)); + joinFacility.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_Status, aliasFacility) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'"); + queryProvince.Joins.Add(joinFacility); + // Construct sub-query. + query.Columns.Add("(" + queryProvince.BuildQuery() + ")", colCountry_Facility_Active_Count); + } + //--------------------------------------------------------------------- // Populate filter. query.Filters.AddRange(GetUsgaCountryQueryFilter(prm)); diff --git a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCourse.cs b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCourse.cs index 6d50011..2e64679 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCourse.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaCourse.cs @@ -529,13 +529,13 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference filterWords.RemoveBlanks(); foreach (String filterWord in filterWords) { - List articleFilter = new List(); - articleFilter.Add($"{col_CourseName} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_FullName, aliasUsgaCourse)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Address1, aliasUsgaCourse)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Address2, aliasUsgaCourse)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_City, aliasUsgaCourse)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - filter.Add(articleFilter.Concat(" OR ", "(", ")")); + List courseFilter = new List(); + courseFilter.Add($"{col_CourseName} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + courseFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_FullName, aliasUsgaCourse)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + courseFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Address1, aliasUsgaCourse)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + courseFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Address2, aliasUsgaCourse)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + courseFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_City, aliasUsgaCourse)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + filter.Add(courseFilter.Concat(" OR ", "(", ")")); } } diff --git a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaFacility.cs b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaFacility.cs index 970ef9b..3c4e0aa 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaFacility.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaFacility.cs @@ -468,9 +468,9 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference filterWords.RemoveBlanks(); foreach (String filterWord in filterWords) { - List articleFilter = new List(); - articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_FacilityName, aliasUsgaFacility)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - filter.Add(articleFilter.Concat(" OR ", "(", ")")); + List facilityFilter = new List(); + facilityFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_FacilityName, aliasUsgaFacility)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + filter.Add(facilityFilter.Concat(" OR ", "(", ")")); } } diff --git a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaMarker.cs b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaMarker.cs index abb0b72..076eb82 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaMarker.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaMarker.cs @@ -514,12 +514,12 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference filterWords.RemoveBlanks(); foreach (String filterWord in filterWords) { - List articleFilter = new List(); - articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_Caption, aliasUsgaMarker)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_HolesCaption, aliasUsgaMarker)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_Tee, aliasUsgaMarker)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_Gender, aliasUsgaMarker)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - filter.Add(articleFilter.Concat(" OR ", "(", ")")); + List markerFilter = new List(); + markerFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_Caption, aliasUsgaMarker)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + markerFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_HolesCaption, aliasUsgaMarker)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + markerFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_Tee, aliasUsgaMarker)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + markerFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaMarker_Gender, aliasUsgaMarker)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + filter.Add(markerFilter.Concat(" OR ", "(", ")")); } } diff --git a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaProvince.cs b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaProvince.cs index 4fae730..0d42fd0 100644 --- a/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaProvince.cs +++ b/SaxoniteStandardDbas/Dbas/Mgr/Reference/SaxReferenceGolfMgr_Dbas-UsgaProvince.cs @@ -327,6 +327,10 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference private static readonly String aliasUsgaProvince = "UsgPrv"; private static readonly String aliasUsgaProvince_Country = "UsgPrv_Cty"; private static readonly String prefixUsgaProvince_Country = aliasUsgaProvince_Country + "_"; + private static readonly String colProvince_Facility_Count = "Prv_Fty_Count"; + private static readonly String colProvince_Facility_Active_Count = "Prv_Fty_Act_Count"; + private static readonly String colProvince_Course_Count = "Prv_Crs_Count"; + private static readonly String colProvince_Course_Active_Count = "Prv_Crs_Act_Count"; private void SetUsgaProvinceColDfn (ColumnDfn col, String caption, int width, SaxDbDfn_Reference.ColumnIdx dbCol, ColumnAlignment align = ColumnAlignment.Default, DataValue.DataType dataType = DataValue.DataType.String, @@ -377,6 +381,22 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference //----------------------------------------------------------- // Derived properties. + case SaxGolfUsgaProvince.Column.FacilityCount_All: + SetUsgaProvinceColDfn(columnDfn, "Facilities", 60, SaxDbDfn_Reference.ColumnIdx.Unknown, ColumnAlignment.Center, DataValue.DataType.Long); + columnDfn.DataName = colProvince_Facility_Count; + break; + case SaxGolfUsgaProvince.Column.FacilityCount_Active: + SetUsgaProvinceColDfn(columnDfn, "Facilities (act)", 60, SaxDbDfn_Reference.ColumnIdx.Unknown, ColumnAlignment.Center, DataValue.DataType.Long); + columnDfn.DataName = colProvince_Facility_Active_Count; + break; + case SaxGolfUsgaProvince.Column.CourseCount_All: + SetUsgaProvinceColDfn(columnDfn, "Courses", 60, SaxDbDfn_Reference.ColumnIdx.Unknown, ColumnAlignment.Center, DataValue.DataType.Long); + columnDfn.DataName = colProvince_Course_Count; + break; + case SaxGolfUsgaProvince.Column.CourseCount_Active: + SetUsgaProvinceColDfn(columnDfn, "Courses (act)", 60, SaxDbDfn_Reference.ColumnIdx.Unknown, ColumnAlignment.Center, DataValue.DataType.Long); + columnDfn.DataName = colProvince_Course_Active_Count; + break; //----------------------------------------------------------- // Common properties. @@ -442,10 +462,10 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference filterWords.RemoveBlanks(); foreach (String filterWord in filterWords) { - List articleFilter = new List(); - articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceCode, aliasUsgaProvince)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - articleFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceName, aliasUsgaProvince)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); - filter.Add(articleFilter.Concat(" OR ", "(", ")")); + List provinceFilter = new List(); + provinceFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceCode, aliasUsgaProvince)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + provinceFilter.Add($"{SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_ProvinceName, aliasUsgaProvince)} Like '%{DbQuery.FormatForLike(filterWord, true)}%'"); + filter.Add(provinceFilter.Concat(" OR ", "(", ")")); } } @@ -623,6 +643,68 @@ namespace Saxonite.Net.Standard.Dbas.Mgr.Reference prm.Alias_Country = aliasUsgaProvince_Country; } + //--------------------------------------------------------------------- + // Facility count. + if (columns.HasId(SaxGolfUsgaProvince.Column.FacilityCount_All)) + { + String aliasFacility = "aPrvFty_Count"; + DbQuery queryFacility = new DbQuery(CoreDatabase.DbmsType); + queryFacility.Tables.Add(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaFacility), aliasFacility); + queryFacility.Columns.Add("Count(*)"); + queryFacility.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_ProvinceId, aliasFacility) + "=" + SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Id, aliasUsgaProvince)); + query.Columns.Add("(" + queryFacility.BuildQuery() + ")", colProvince_Facility_Count); + } + + // Active Facility count. + if (columns.HasId(SaxGolfUsgaProvince.Column.FacilityCount_Active)) + { + String aliasFacility = "aPrvFtyAct_Count"; + DbQuery queryFacility = new DbQuery(CoreDatabase.DbmsType); + queryFacility.Tables.Add(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaFacility), aliasFacility); + queryFacility.Columns.Add("Count(*)"); + queryFacility.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_ProvinceId, aliasFacility) + "=" + SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Id, aliasUsgaProvince)); + queryFacility.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_Status, aliasFacility) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'"); + query.Columns.Add("(" + queryFacility.BuildQuery() + ")", colProvince_Facility_Active_Count); + } + + //--------------------------------------------------------------------- + // Course count. + if (columns.HasId(SaxGolfUsgaProvince.Column.FacilityCount_All)) + { + String aliasFacility = "aPrvFty_Count_Fty"; + DbQuery queryFacility = new DbQuery(CoreDatabase.DbmsType); + queryFacility.Tables.Add(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaFacility), aliasFacility); + queryFacility.Columns.Add("Count(*)"); + queryFacility.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_ProvinceId, aliasFacility) + "=" + SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Id, aliasUsgaProvince)); + // Join to Course. + String aliasCourse = "aPrvFty_Count_Crs"; + DbQueryJoin joinCourse = new DbQueryJoin(DbJoinType.Inner); + joinCourse.Table = new StringPair(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaCourse), aliasCourse); + joinCourse.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_FacilityId, aliasCourse) + "=" + SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_Id, aliasFacility)); + queryFacility.Joins.Add(joinCourse); + // Construct sub-query. + query.Columns.Add("(" + queryFacility.BuildQuery() + ")", colProvince_Course_Count); + } + + // Active Course count. + if (columns.HasId(SaxGolfUsgaProvince.Column.FacilityCount_Active)) + { + String aliasFacility = "aPrvFty_Count_Fty"; + DbQuery queryFacility = new DbQuery(CoreDatabase.DbmsType); + queryFacility.Tables.Add(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaFacility), aliasFacility); + queryFacility.Columns.Add("Count(*)"); + queryFacility.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_ProvinceId, aliasFacility) + "=" + SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaProvince_Id, aliasUsgaProvince)); + // Join to Course. + String aliasCourse = "aPrvFty_Count_Crs"; + DbQueryJoin joinCourse = new DbQueryJoin(DbJoinType.Inner); + joinCourse.Table = new StringPair(SaxDbDfn_Reference.GetTableNameQual(SaxDbDfn_Reference.TableIdx.UsgaCourse), aliasCourse); + joinCourse.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_FacilityId, aliasCourse) + "=" + SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaFacility_Id, aliasFacility)); + joinCourse.Filters.Add(SaxDbDfn_Reference.GetColumnNameQual(SaxDbDfn_Reference.ColumnIdx.UsgaCourse_Status, aliasCourse) + "='" + SacsSystem.GetStatusCode(SaStatus.Active) + "'"); + queryFacility.Joins.Add(joinCourse); + // Construct sub-query. + query.Columns.Add("(" + queryFacility.BuildQuery() + ")", colProvince_Course_Active_Count); + } + //--------------------------------------------------------------------- // Populate filter. query.Filters.AddRange(GetUsgaProvinceQueryFilter(prm)); diff --git a/SaxoniteWebApi/Api/App/SaxApplication_Api.cs b/SaxoniteWebApi/Api/App/SaxApplication_Api.cs index 6f0f543..78f83f4 100644 --- a/SaxoniteWebApi/Api/App/SaxApplication_Api.cs +++ b/SaxoniteWebApi/Api/App/SaxApplication_Api.cs @@ -92,11 +92,6 @@ namespace Saxonite.Web.Api.App { try { - // Environment. - environmentName = Environments.Development; - if (SaxSystem.ComputerName.EqualsCI("Sarand601")) - environmentName = Environments.Production; - // Application configuration. appConfigs = SaxAppConfigHelper.ExtractAppConfigs(SaxConfiguration.GetSection("AppConfigs")); emailConfigs = SaxEmailConfigHelper.ExtractEmailConfigs(SaxConfiguration.GetSection("EmailConfigs")); diff --git a/SaxoniteWebApi/Api/Controllers/SystemController.cs b/SaxoniteWebApi/Api/Controllers/SystemController.cs index 61581aa..1f1a5fb 100644 --- a/SaxoniteWebApi/Api/Controllers/SystemController.cs +++ b/SaxoniteWebApi/Api/Controllers/SystemController.cs @@ -51,9 +51,10 @@ namespace Saxonite.Web.Api.Controllers { public class ConfigData { - public String? Version { get; set; } public String? Environment { get; set; } public String? Instance { get; set; } + public String? Version { get; set; } + public String? Host{ get; set; } public String? ConfigLogFolder { get; set; } public String? LogFolder { get; set; } public String? EmailContext { get; set; } @@ -71,9 +72,10 @@ namespace Saxonite.Web.Api.Controllers public ResponseData_Config GetConfig_Post(RequestData_Config requestData) { ResponseData_Config responseData = new ResponseData_Config(); - responseData.Config.Version = Sax.Version.GetFullVersion(); responseData.Config.Environment = SaxApplication_Api.AppInstance?.EnvironmentName; responseData.Config.Instance = SaxApplication_Api.AppInstance?.InstanceType.ToString(); + responseData.Config.Version = Sax.Version.GetFullVersion(); + responseData.Config.Host = SaxSystem.ComputerName; responseData.Config.ConfigLogFolder = SaxApplication_Api.AppInstance?.AppConfig.Logging.RootFolder; responseData.Config.LogFolder = SaLogger.LogFolder; responseData.Config.EmailContext = SaxApplication_Api.AppInstance?.EmailConfig.Context;