1.2.11.12 Online Events

This commit is contained in:
2024-08-20 17:51:32 +01:00
parent 780e6778e5
commit 41db4e63d4
158 changed files with 6945 additions and 666 deletions
Binary file not shown.
+32 -15
View File
@@ -28,37 +28,53 @@ The type of activity determines the sequence and period for which they are prese
- Events: members of orgsniations allowed to manage events.
- Opportunities: members of orgsniations allowed to manage opportunities.
### Data Components
- Regions
- Hierarchy: World, Continents, Countries, Provinces
- Sports
- Specific sports (positions, disciplines etc)
- Banner (related) sports (Athletics - Track and Field, Swimmming - pool and wild).
- Grouped sports (Organisation supporting Baseball and Softball).
- Individual has interest and experience in specific and banner sports.
- Organisation identifies any level of sport as their remit.
- Relationships: parent holds list of child sports.
### Application Components
#### Styling
* Web resources:
* Colour analysis, including complementary etc. https://www.crispedge.com/color/556B2F
- Web resources:
- Colour analysis, including complementary etc. https://www.crispedge.com/color/556B2F
##### Online
* Colours:
* Base: #556B2F Dark Olive Green
* Darker: #445525, #33401c. Lighter: #768858, #99a682, #a6c275, #b7ce90.
- Colours:
- Base: #556B2F Dark Olive Green
- Darker: #445525, #33401c. Lighter: #768858, #99a682, #a6c275, #b7ce90.
#### Graphics
##### Icons
- Icons
- **Bootstrap**: https://icons.getbootstrap.com/
- Where to find icons: https://www.canva.com/learn/free-icons-download/
- https://icons8.com
- https://www.smashingmagazine.com/category/freebies
- https://goodstuffnononsense.com/icons-category/free/
- https://www.iconfinder.com/
##### Animated gifs
* https://icons8.com/preloaders/
- Animated gifs
- https://icons8.com/preloaders/
#### Page Functionality
##### Timepicker
* JQuery TimePicker
* https://github.com/jonthornton/jquery-timepicker
* https://github.com/technovistalimited/bootstrap4-datetimepicker
* Requires moment.js:
* NuGet package contents can be found under **C:\\Users\\[user]\\.nuget\\packages\\moment.js**
##### HTML Editor Controls
- RoosterJS
@@ -69,12 +85,13 @@ The type of activity determines the sequence and period for which they are prese
- https://www.npmjs.com/package/roosterjs - distribution files.
- https://registry.npmjs.org/roosterjs/latest - dist - tarball for download URL.
- Download specific version: https://registry.npmjs.org/roosterjs/-/roosterjs-8.41.0.tgz
- TinyMCE
- NuGet package available but effectively doesn nothing - no longer able to copy script filles to aapplication folders.
- Manually copy files from: https://www.tiny.cloud/get-tiny/self-hosted/
###### TinyMCE
- - TinyMCE
- NuGet package available but effectively does nothing - no longer able to copy script filles to aapplication folders.
- Manually copy files from: https://www.tiny.cloud/get-tiny/self-hosted/
* HTML editor
* Journallist Articles etc
* Initialisation:
@@ -61,7 +61,7 @@ namespace Saxonite.Net.Core.UnitTests.Web.Admin.App
idx = sessionData.NextItemIdx;
// Serialise session data using same method as base controller.
String sessionDataJson = JsonConvert.SerializeObject(sessionData);
String sessionDataJson = NewtonsoftJsonUtil.SerializeObject(sessionData);
Assert.AreNotEqual("", sessionDataJson);
// Deserialise session data using same method as base controller.
+6
View File
@@ -213,6 +213,12 @@ namespace Saxonite.Net.Core.Web.Base.App
return GetCodeTypeCaption(Sax.CodeType.Gender, gender);
}
// Sport Grouping.
public String GetSportGroupingCaption(Sax.SportGrouping sportGrouping)
{
return GetCodeTypeCaption(Sax.CodeType.SportGrouping, sportGrouping);
}
// Sport Speciality label.
public String GetSportSpecialityLabelCaption(Sax.SportSpecialityLabel sportSpecialityLabel)
{
@@ -1,14 +1,20 @@
using Sacs.Web.Components;
using Microsoft.AspNetCore.Mvc;
using Sacs.Web.Components;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Email;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Core.Web.Base.App;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Standard.Base.Bus;
using Saxonite.Net.Standard.Base.Consoles;
using Saxonite.Net.Standard.Base.Mgr;
using Saxonite.Net.Standard.Base.Mgr.Reference;
using Saxonite.Net.Standard.Base.Mgr.Support;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Saxonite.Net.Core.Web.Base.Controllers
{
@@ -65,6 +71,7 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
public SaxSupportMgr SupportMgr { get { return Internals.SupportMgr; } }
// System codes.
public List<TypeCodeDesc> DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } }
public List<TypeCodeDesc> SportGroupingCodes { get { return Internals.SportGroupingCodes; } }
public List<TypeCodeDesc> SportSpecialityLabelCodes { get { return Internals.SportSpecialityLabelCodes; } }
public List<TypeCodeDesc> SportContactTypeCodes { get { return Internals.SportContactTypeCodes; } }
public List<TypeCodeDesc> SportParticipatingCodes { get { return Internals.SportParticipatingCodes; } }
@@ -88,6 +95,52 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
public SaEmailConfig EmailConfig { get { return App.EmailConfig; } }
public SaxEmailConsole EmailConsole { get { return Internals.EmailConsole; } }
//-------------------------------------------------------------------
[NonAction]
/// <summary>
/// Retrieve sport by matching the name and include groups as required.
/// </summary>
/// <param name="sportName"></param>
/// <param name="includeGroups"></param>
/// <returns>List of matching sports.</returns>
public List<SaxSport.Data> GetSportsByName(String sportName, bool includeGroups = false)
{
List<SaxSport.Data> sportsData = new List<SaxSport.Data>();
if (DataCacheConsole != null)
{
List<SaxSport.Data> allSports = DataCacheConsole.GetActiveSports();
foreach (SaxSport.Data sport in allSports.Where(item => item.Name.EqualsCI(sportName)))
{
sportsData.Add(sport);
if (!includeGroups) continue;
foreach (SaxSport.Data sportParent in allSports.Where(item => item.Id.Equals(sport.SportIdParent)))
sportsData.Add(sportParent);
}
}
else
{
// Data cache is not available.
// Query direct from the database (Admin).
Dictionary<SysId, SaxSport> sports = new Dictionary<SysId, SaxSport>();
// Sport by name.
SaxSport.Params prmSport = new SaxSport.Params();
prmSport.NameFull = sportName;
sports.AddRange(ReferenceMgr.GetSportList(prmSport).ToDictionary(item => item.Id));
if (includeGroups)
{
// Parent sports.
prmSport = new SaxSport.Params();
prmSport.IdsIncluded.AddIds(sports.Values.Where(item => SysId.IsValid(item.SportIdParent)).Select(item => item.SportIdParent));
if (prmSport.IdsIncluded.Any())
sports.AddRange(ReferenceMgr.GetSportList(prmSport).ToDictionary(item => item.Id));
}
sportsData = sports.Values.Select(item => item.GetData()).ToList();
}
return sportsData;
}
//-------------------------------------------------------------------
}
//=======================================================================
@@ -69,7 +69,7 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
// Some actions (eg. score password) don't need to.
if (StoreSessionData)
{
String sessionDataJson = JsonConvert.SerializeObject(SessionData);
String sessionDataJson = NewtonsoftJsonUtil.SerializeObject(SessionData);
HttpContext.Session.Set(SessionStorage.SessionKey_SessionData, SessionStorage.sessionDataEncoding.GetBytes(sessionDataJson));
}
}
@@ -73,6 +73,7 @@ namespace Saxonite.Net.Core.Web.Base.Models
// System codes.
public List<TypeCodeDesc> DataItemTypeCodes { get { return Internals.DataItemTypeCodes; } }
public List<TypeCodeDesc> YesNoCodes { get { return Internals.YesNoCodes; } }
public List<TypeCodeDesc> SportGroupingCodes { get { return Internals.SportGroupingCodes; } }
public List<TypeCodeDesc> SportSpecialityLabelCodes { get { return Internals.SportSpecialityLabelCodes; } }
public List<TypeCodeDesc> SportContactTypeCodes { get { return Internals.SportContactTypeCodes; } }
public List<TypeCodeDesc> SportParticipatingCodes { get { return Internals.SportParticipatingCodes; } }
@@ -292,6 +293,18 @@ namespace Saxonite.Net.Core.Web.Base.Models
}
}
/// <summary>List of Sport Grouping for dropdown.</summary>
public IEnumerable<SelectListItem> SportGroupingCodesForSelect
{
get
{
List<SelectListItem> values = new List<SelectListItem>();
foreach (TypeCodeDesc sportGrouping in SportGroupingCodes)
values.Add(new SelectListItem(Localiser.GetSportGroupingCaption((Sax.SportGrouping)sportGrouping.Type), sportGrouping.Code));
return values;
}
}
/// <summary>List of Sport Speciality Labels for dropdown.</summary>
public IEnumerable<SelectListItem> SportSpecialityLabelCodesForSelect
{
@@ -207,7 +207,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs
// 5a. Active Country with no Provinces.
{
bool populateCountryNoProvinces = SacsRandomHelper.GetInt32(1, 3) == 1;
bool populateCountryNoProvinces = SacsRandomHelper.GetInt32(1, 17) == 1;
if (populateCountryNoProvinces)
{
SaxGolfUsgaCountry.Params prmCountry = new SaxGolfUsgaCountry.Params();
@@ -227,7 +227,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs
// 5b. Active Province with no Facilities (courses).
{
bool populateProvinceNoFacilities = SacsRandomHelper.GetInt32(1, 4) == 1;
bool populateProvinceNoFacilities = SacsRandomHelper.GetInt32(1, 3) == 1;
if (populateProvinceNoFacilities)
{
// Active Provinces with no Facilities.
@@ -11,6 +11,7 @@ using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Helpers;
using Sarand.Net.Standard.Base.Net;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Core.Web.Base.Controllers;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Standard.Base.Bus.Reference;
using Saxonite.Net.Standard.Base.Mgr.Reference;
@@ -33,13 +34,18 @@ namespace Saxonite.Net.Core.Web.Base.Procs
// Definitions.
public enum Task
{
CleanseCourseCaptions,
CleanseCourses,
CleanseMarkers
}
public new class Config : SaxProcess_Web.Config
{
public Config(SaxSessionContext sessionContext, DbUpdateInfo dbUpdateInfo) : base(sessionContext, dbUpdateInfo)
{ }
/// <summary>Restrict countries by Id.</summary>
public HashSet<SysId> UsgaCountryIdsIncluded { get; } = new HashSet<SysId>();
/// <summary>Restrict countries by Code.</summary>
public HashSet<String> UsgaCountryCodesIncluded { get; } = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
/// <summary>Tasks to be run under this instance of the USGA Data Lookup process.</summary>
public HashSet<Task> Tasks { get; } = new HashSet<Task>();
}
@@ -108,12 +114,31 @@ namespace Saxonite.Net.Core.Web.Base.Procs
public class MarkerData
{
[JsonConstructor]
private MarkerData() { }
public MarkerData(SysId courseId, short holes, string holesCaption)
{
this.CourseId = courseId;
this.Holes = holes;
this.HolesCaption = holesCaption;
}
public MarkerData(SaxGolfUsgaCourse course, SaxGolfUsgaMarker marker) : this(course.UsgaCourseId, marker)
{
}
public MarkerData(SysId usgaCourseId, SaxGolfUsgaMarker marker)
{
this.CourseId = usgaCourseId;
this.CourseId = marker.UsgaMarkerId;
this.Holes = marker.Holes;
this.HolesCaption = marker.HolesCaption;
this.Tee = marker.Tee;
this.Gender = marker.Gender;
this.SlopeRating = marker.SlopeRating;
this.Par = marker.Par;
this.CourseRating = marker.CourseRating;
this.BogeyRating = marker.BogeyRating;
this.Length = marker.Length;
}
public SysId CourseId { get; }
public SysId MarkerId { get; set; }
public string Caption { get { return StringUtil.TrimWhitespace(StringUtil.OnBlank(Tee) + " " + StringUtil.OnBlank(HolesCaption) + " " + StringUtil.OnBlank(Gender)); } }
@@ -166,8 +191,11 @@ namespace Saxonite.Net.Core.Web.Base.Procs
{
switch (task)
{
case Task.CleanseCourseCaptions:
CleanseCourseCaptions();
case Task.CleanseCourses:
CleanseCourses();
break;
case Task.CleanseMarkers:
CleanseMarkers();
break;
}
if (!OK) break;
@@ -307,8 +335,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs
countryData.CountryName = usgaCountry.Name;
countriesData.Add(countryData);
}
ReferenceGolfMgr.BulkUpdateUsgaCountries(countriesData, DbUpdateInfo);
if (ReferenceGolfMgr.HasErrorState())
if (!ReferenceGolfMgr.BulkUpdateUsgaCountries(countriesData, DbUpdateInfo))
SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA countries: {ReferenceGolfMgr.ErrorStateMessage}.");
}
@@ -333,7 +360,9 @@ namespace Saxonite.Net.Core.Web.Base.Procs
using (DisposableCollection<SacsDisposable> disposableItems = new DisposableCollection<SacsDisposable>())
{
// Retrieve and validate country.
SaxGolfUsgaCountry usgaCountry = ReferenceGolfMgr.GetUsgaCountry(new SaxGolfUsgaCountry.Params() { CountryCodeFull = countryCode });
SaxGolfUsgaCountry.Params prmCountry = new SaxGolfUsgaCountry.Params();
prmCountry.CountryCodesIncluded.Add(countryCode);
SaxGolfUsgaCountry usgaCountry = ReferenceGolfMgr.GetUsgaCountry(prmCountry);
disposableItems.Add(usgaCountry);
if (usgaCountry == null)
{
@@ -344,7 +373,8 @@ namespace Saxonite.Net.Core.Web.Base.Procs
{
// Clear country 'priority' flag.
usgaCountry.Priority = false;
ReferenceGolfMgr.UpdateUsgaCountry(usgaCountry, DbUpdateInfo);
if (!ReferenceGolfMgr.UpdateUsgaCountry(usgaCountry, DbUpdateInfo))
SaLogger.Warn($"{SysUtil.Fn} Error updating Country '{usgaCountry.CountryCode}' - {ReferenceGolfMgr.ErrorStateMessage}");
}
try
@@ -417,7 +447,8 @@ namespace Saxonite.Net.Core.Web.Base.Procs
// Provinces stored OK = update Country.
usgaCountry.ProvincesUpdateAt = DateTime.Now;
usgaCountry.Priority = false;
ReferenceGolfMgr.UpdateUsgaCountry(usgaCountry, DbUpdateInfo);
if (!ReferenceGolfMgr.UpdateUsgaCountry(usgaCountry, DbUpdateInfo))
SaLogger.Warn($"{SysUtil.Fn} Error updating Country '{usgaCountry.CountryCode}' - {ReferenceGolfMgr.ErrorStateMessage}");
}
else SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA provinces: {ReferenceGolfMgr.ErrorStateMessage}.");
}
@@ -443,7 +474,9 @@ namespace Saxonite.Net.Core.Web.Base.Procs
using (DisposableCollection<SacsDisposable> disposableItems = new DisposableCollection<SacsDisposable>())
{
// Retrieve and validate country.
SaxGolfUsgaCountry usgaCountry = ReferenceGolfMgr.GetUsgaCountry(new SaxGolfUsgaCountry.Params() { CountryCodeFull = countryCode });
SaxGolfUsgaCountry.Params prmCountry = new SaxGolfUsgaCountry.Params();
prmCountry.CountryCodesIncluded.Add(countryCode);
SaxGolfUsgaCountry usgaCountry = ReferenceGolfMgr.GetUsgaCountry(prmCountry);
disposableItems.Add(usgaCountry);
if (usgaCountry == null)
{
@@ -462,7 +495,8 @@ namespace Saxonite.Net.Core.Web.Base.Procs
{
// Clear province 'priority' flag.
usgaProvince.Priority = false;
ReferenceGolfMgr.UpdateUsgaProvince(usgaProvince, DbUpdateInfo);
if (!ReferenceGolfMgr.UpdateUsgaProvince(usgaProvince, DbUpdateInfo))
SaLogger.Warn($"{SysUtil.Fn} Error updating Province '{usgaProvince.ProvinceCode}' - {ReferenceGolfMgr.ErrorStateMessage}");
}
try
@@ -492,7 +526,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs
if (!StringUtil.IsBlank(response.Data))
{
HashSet<String> UnrecognisedCourseProperties = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
HashSet<String> UnrecognisedCourseProperties = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
dynamic coursesJson = SacsJsonHelper.DeserializeJsonObject(response.Data);
if (coursesJson is JArray)
{
@@ -569,8 +603,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs
countryData.EntCountryCode = usgaCourse.EntCountryCode;
countriesData[countryData.CountryCode] = countryData;
}
ReferenceGolfMgr.BulkUpdateUsgaCountries(countriesData.Values.ToList(), DbUpdateInfo);
if (ReferenceGolfMgr.HasErrorState())
if (!ReferenceGolfMgr.BulkUpdateUsgaCountries(countriesData.Values.ToList(), DbUpdateInfo))
SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA countries: {ReferenceGolfMgr.ErrorStateMessage}.");
// Store provinces.
@@ -583,8 +616,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs
provinceData.EntProvinceCode = usgaCourse.EntProvinceCode;
provincesData[provinceData.ProvinceCode] = provinceData;
}
ReferenceGolfMgr.BulkUpdateUsgaProvinces(provincesData.Values.ToList(), DbUpdateInfo);
if (ReferenceGolfMgr.HasErrorState())
if (!ReferenceGolfMgr.BulkUpdateUsgaProvinces(provincesData.Values.ToList(), DbUpdateInfo))
SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA provinces: {ReferenceGolfMgr.ErrorStateMessage}.");
// Store facilities.
@@ -603,8 +635,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs
}
facilitiesData[facilityData.UsgaFacilityId] = facilityData;
}
ReferenceGolfMgr.BulkUpdateUsgaFacilities(facilitiesData.Values.ToList(), DbUpdateInfo);
if (ReferenceGolfMgr.HasErrorState())
if (!ReferenceGolfMgr.BulkUpdateUsgaFacilities(facilitiesData.Values.ToList(), DbUpdateInfo))
SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA facilities: {ReferenceGolfMgr.ErrorStateMessage}.");
// Store courses.
@@ -637,7 +668,8 @@ namespace Saxonite.Net.Core.Web.Base.Procs
// Courses stored OK - update Province.
usgaProvince.CoursesUpdateAt = DateTime.Now;
usgaProvince.Priority = false;
ReferenceGolfMgr.UpdateUsgaProvince(usgaProvince, DbUpdateInfo);
if (!ReferenceGolfMgr.UpdateUsgaProvince(usgaProvince, DbUpdateInfo))
SaLogger.Warn($"{SysUtil.Fn} Error updating Province '{usgaProvince.ProvinceCode}' - {ReferenceGolfMgr.ErrorStateMessage}");
}
else SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA courses: {ReferenceGolfMgr.ErrorStateMessage}.");
}
@@ -715,7 +747,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs
}
//------------------------------------------------------------------
public bool CleanseCourseCaptions()
public bool CleanseCourses()
{
SaLogger.Info($"{SysUtil.Fn} START", true);
DateTime startedAt = DateTime.Now;
@@ -729,10 +761,13 @@ namespace Saxonite.Net.Core.Web.Base.Procs
using (DisposableCollection<SacsDisposable> disposables = new DisposableCollection<SacsDisposable>())
{
// Local function to allow break/return from within nested loop.
void CompareCourseCaptions()
void CompareCourse()
{
// Countries.
foreach (SaxGolfUsgaCountry country in ReferenceGolfMgr.GetUsgaCountryList(new SaxGolfUsgaCountry.Params()))
SaxGolfUsgaCountry.Params prmCountry = new SaxGolfUsgaCountry.Params();
prmCountry.IdsIncluded.AddIds(config.UsgaCountryIdsIncluded);
prmCountry.CountryCodesIncluded.UnionWith(config.UsgaCountryCodesIncluded);
foreach (SaxGolfUsgaCountry country in ReferenceGolfMgr.GetUsgaCountryList(prmCountry))
{
disposables.Add(country);
@@ -750,6 +785,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs
// Facilities.
SaxGolfUsgaFacility.Params prmFacility = new SaxGolfUsgaFacility.Params();
prmFacility.ProvinceIdsIncluded.Add(province.Id);
prmFacility.HasCourses = SacsHierarchyItem.Params.BoolState.True;
foreach (SaxGolfUsgaFacility facility in ReferenceGolfMgr.GetUsgaFacilityList(prmFacility))
{
disposablesProvince.Add(facility);
@@ -791,7 +827,7 @@ namespace Saxonite.Net.Core.Web.Base.Procs
}
}
// Invoke local function.
CompareCourseCaptions();
CompareCourse();
}
// Log statistics.
@@ -855,7 +891,8 @@ namespace Saxonite.Net.Core.Web.Base.Procs
if (usgaCourse.Priority)
{
usgaCourse.Priority = false;
ReferenceGolfMgr.UpdateUsgaCourse(usgaCourse, DbUpdateInfo);
if (!ReferenceGolfMgr.UpdateUsgaCourse(usgaCourse, DbUpdateInfo))
SaLogger.Warn($"{SysUtil.Fn} Error updating Course '{usgaCourse.FullName}' - {ReferenceGolfMgr.ErrorStateMessage}");
}
try
@@ -1049,10 +1086,11 @@ namespace Saxonite.Net.Core.Web.Base.Procs
{
// Markers stored OK - update Course.
if (markersData.Markers.Any())
usgaCourse.MarkersData = JsonConvert.SerializeObject(markersData);
usgaCourse.MarkersData = NewtonsoftJsonUtil.SerializeObject(markersData, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore });
usgaCourse.MarkersUpdateAt = DateTime.Now;
usgaCourse.Priority = false;
ReferenceGolfMgr.UpdateUsgaCourse(usgaCourse, DbUpdateInfo);
if (!ReferenceGolfMgr.UpdateUsgaCourse(usgaCourse, DbUpdateInfo))
SaLogger.Warn($"{SysUtil.Fn} Error updating Course '{usgaCourse.FullName}' - {ReferenceGolfMgr.ErrorStateMessage}");
}
else SaLogger.Warn($"{SysUtil.Fn} Error bulk updating USGA markers: {ReferenceGolfMgr.ErrorStateMessage}.");
}
@@ -1065,6 +1103,182 @@ namespace Saxonite.Net.Core.Web.Base.Procs
}
//------------------------------------------------------------------
/// <summary>
/// Front and Back 9 likely missing par values - derive from other properties.
/// </summary>
/// <param name="marker">Marker to have its par calulated.</param>
/// <param name="markers">Full list of markers for the course.</param>
/// <returns></returns>
private short CalculateMarkerParByCourseRating(MarkerData marker, List<MarkerData> markers)
{
if (marker.Holes > 9) return marker.Par;
// Locate the corresponding marker for the other half of the course (F9/B9).
String holesCaptionOpp = marker.HolesCaption.EqualsCI("F9") ? "B9" : marker.HolesCaption.EqualsCI("B9") ? "F9" : "";
MarkerData marker18 = markers.Find(item => item.Holes == 18 && item.Tee == marker.Tee && item.Gender == marker.Gender);
MarkerData markerOpp = markers.Find(item => item.HolesCaption.EqualsCI(holesCaptionOpp) && item.Tee == marker.Tee && item.Gender == marker.Gender);
if (marker18 != null && markerOpp != null)
{
decimal combined9sCourseRating = marker.CourseRating + markerOpp.CourseRating;
return (short)Math.Round(marker18.Par * marker.CourseRating / combined9sCourseRating);
}
return marker.Par;
}
/// <summary>
/// Front and Back 9 likely missing par values - derive from other properties.
/// </summary>
/// <param name="marker">Marker to have its par calulated.</param>
/// <param name="markers">Full list of markers for the course.</param>
/// <returns></returns>
private short CalculateMarkerParBySlopeRating(MarkerData marker, List<MarkerData> markers)
{
if (marker.Holes > 9) return marker.Par;
// Locate the corresponding marker for the other half of the course (F9/B9).
String holesCaptionOpp = marker.HolesCaption.EqualsCI("F9") ? "B9" : marker.HolesCaption.EqualsCI("B9") ? "F9" : "";
MarkerData marker18 = markers.Find(item => item.Holes == 18 && item.Tee == marker.Tee && item.Gender == marker.Gender);
MarkerData markerOpp = markers.Find(item => item.HolesCaption.EqualsCI(holesCaptionOpp) && item.Tee == marker.Tee && item.Gender == marker.Gender);
if (marker18 != null && markerOpp != null)
{
decimal combined9sSlopeRating = marker.SlopeRating + markerOpp.SlopeRating;
return (short)Math.Round(marker18.Par * marker.SlopeRating / combined9sSlopeRating);
}
return marker.Par;
}
//------------------------------------------------------------------
public bool CleanseMarkers()
{
SaLogger.Info($"{SysUtil.Fn} START", true);
DateTime startedAt = DateTime.Now;
ClearProcessMessages();
int markerCount = 0;
int courseCount = 0;
int maxMarkers = 0;
int markersCorrected = 0;
using (DisposableCollection<SacsDisposable> disposables = new DisposableCollection<SacsDisposable>())
{
// Local function to allow break/return from within nested loop.
void CleanseMarkers()
{
// Countries.
SaxGolfUsgaCountry.Params prmCountry = new SaxGolfUsgaCountry.Params();
prmCountry.IdsIncluded.AddIds(config.UsgaCountryIdsIncluded);
prmCountry.CountryCodesIncluded.UnionWith(config.UsgaCountryCodesIncluded);
foreach (SaxGolfUsgaCountry country in ReferenceGolfMgr.GetUsgaCountryList(prmCountry))
{
disposables.Add(country);
// Provinces.
SaxGolfUsgaProvince.Params prmProvince = new SaxGolfUsgaProvince.Params();
prmProvince.CountryIdsIncluded.Add(country.Id);
foreach (SaxGolfUsgaProvince province in ReferenceGolfMgr.GetUsgaProvinceList(prmProvince))
{
disposables.Add(province);
// Separate disposables for each province to restrict volume handled on each disposal.
using (DisposableCollection<SacsDisposable> disposablesProvince = new DisposableCollection<SacsDisposable>())
{
// Facilities.
SaxGolfUsgaFacility.Params prmFacility = new SaxGolfUsgaFacility.Params();
prmFacility.ProvinceIdsIncluded.Add(province.Id);
foreach (SaxGolfUsgaFacility facility in ReferenceGolfMgr.GetUsgaFacilityList(prmFacility))
{
disposablesProvince.Add(facility);
// Courses.
SaxGolfUsgaCourse.Params prmCourse = new SaxGolfUsgaCourse.Params();
prmCourse.FacilityIdsIncluded.Add(facility.Id);
prmCourse.HasMarkers = SacsHierarchyItem.Params.BoolState.True;
foreach (SaxGolfUsgaCourse course in ReferenceGolfMgr.GetUsgaCourseList(prmCourse))
{
disposablesProvince.Add(course);
courseCount++;
int markersModified = 0;
// Extract markers from data.
MarkersData markersData = null;
try
{
markersData = JsonConvert.DeserializeObject<MarkersData>(course.MarkersData, new JsonSerializerSettings() { });
}
catch (Exception exc)
{
SaLogger.Warn($"{SysUtil.Fn} {ExceptionUtil.GetLogMessage(exc, 4)}");
}
markersData = markersData ?? new MarkersData();
// Markers.
SaxGolfUsgaMarker.Params prmMarker = new SaxGolfUsgaMarker.Params();
prmMarker.CourseIdsIncluded.Add(course.Id);
List<SaxGolfUsgaMarker> markers = ReferenceGolfMgr.GetUsgaMarkerList(prmMarker);
if (!markersData.Markers.Any() && markers.Any())
{
// Generate Markers data from stored markers.
SaLogger.Warn($"{SysUtil.Fn} Regenerating missing markers data. Course: {country.CountryCode} {province.ProvinceCode} {course.Caption}.");
markersData = new MarkersData();
foreach (SaxGolfUsgaMarker marker in markers)
markersData.Markers.Add(new MarkerData(course.UsgaCourseId, marker));
}
markerCount += markersData.Markers.Count;
// Validate number of markers against data.
if (markers.Count != markersData.Markers.Count)
{
SaLogger.Warn($"{SysUtil.Fn} Inconsistent marker count. Course: {country.CountryCode} {province.ProvinceCode} {course.Caption}. Markers data: {markersData.Markers.Count}. Markers: {markers.Count}.");
continue;
}
markerCount += markersData.Markers.Count;
foreach (MarkerData markerData in markersData.Markers)
{
// Calulate Par by Course Rating.
short parCalulatedByCourseRating = CalculateMarkerParByCourseRating(markerData, markersData.Markers);
if (markerData.Par != parCalulatedByCourseRating)
{
SaLogger.Warn($"{SysUtil.Fn} Marker par recalculated by Course Rating. Course: {country.CountryCode} {province.ProvinceCode} {course.Caption}. Marker: {markerData.Tee} {markerData.HolesCaption} {markerData.Gender}. Par found: {markerData.Par}. Recalculated: {parCalulatedByCourseRating}.");
//markerData.Par = parCalulated;
// markersModified ++;
}
// Calulate Par by Slope Rating.
short parCalulatedBySlopeRating = CalculateMarkerParBySlopeRating(markerData, markersData.Markers);
if (markerData.Par != parCalulatedBySlopeRating)
{
SaLogger.Warn($"{SysUtil.Fn} Marker par recalculated by Slope Rating. Course: {country.CountryCode} {province.ProvinceCode} {course.Caption}. Marker: {markerData.Tee} {markerData.HolesCaption} {markerData.Gender}. Par found: {markerData.Par}. Recalculated: {parCalulatedBySlopeRating}.");
//markerData.Par = parCalulated;
// markersModified ++;
}
}
if (markersModified > 0)
{
// ToDo Bulk update the markers to apply changes.
}
}
}
}
}
}
}
// Invoke local function.
CleanseMarkers();
}
// Log statistics.
SaLogger.Info($"{SysUtil.Fn} Markers corrected: {markersCorrected}. Markers checked: {markerCount}.", true);
SaLogger.Info($"{SysUtil.Fn} END Elapsed: {DateUtil.FormatNumberOfSeconds((DateTime.Now - startedAt).TotalSeconds)}", true);
return OK;
}
//------------------------------------------------------------------
}
//======================================================================
}
+1 -1
View File
@@ -24,7 +24,7 @@
<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.61" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.30" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.31" />
</ItemGroup>
<ItemGroup>
@@ -31,7 +31,7 @@ namespace Saxonite.Net.Core.Web.Admin.App
{
//-------------------------------------------------------------------
// Data members.
private bool generateDatabaseDefinitions = false;
private bool generateDatabaseDefinitions = true;
private bool populateRegions = false;
private Dictionary<String, SaxAppConfig> appConfigs = new Dictionary<string, SaxAppConfig>();
private Dictionary<String, SaxEmailConfig> emailConfigs = new Dictionary<string, SaxEmailConfig>();
@@ -19,7 +19,7 @@ using System.Threading.Tasks;
namespace Saxonite.Net.Core.Web.Admin.Controllers
{
//=======================================================================
// Controller: Organisation Images - Ajax
// Controller: Organisation - Ajax - Images
//=======================================================================
partial class OrganisationController
{
@@ -156,18 +156,28 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
imageData = fileStream.ToArray();
}
// Validate content type.
if (StringUtil.IsEmpty(file.ContentType) || !SaxItemImage.GetValidContentTypes(Sax.DataItemType.Organisation).ContainsCI(file.ContentType))
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.upload.image.invalid.content.type"]));
Sarand.Net.Standard.Base.Core.Sacs.MimeType mimeTypeExpected = SacsContentTypeHelper.GetMimeTypeFromContentType(file.ContentType);
// Validate the image.
ImageUtils.ImageConfig imageConfig = ImageUtils.VerifyImageData(imageData);
ImageUtils.ImageConfig imageConfig = null;
if (mimeTypeExpected == Sarand.Net.Standard.Base.Core.Sacs.MimeType.Svg)
imageConfig = ImageUtils.VerifySvgImageData(imageData);
else
imageConfig = ImageUtils.VerifyImageData(imageData);
if (!imageConfig.ValidImage)
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.upload.image.invalid"]));
// Validate mime type.
if (!SaxItemImage.GetValidMimeTypes(Sax.DataItemType.UserAccount).Contains(imageConfig.MimeType))
if (!SaxItemImage.GetValidMimeTypes(Sax.DataItemType.Organisation).Contains(imageConfig.MimeType))
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.upload.image.invalid.mime"]));
// Validate content type.
if (StringUtil.IsEmpty(file.ContentType) || !SaxItemImage.GetValidContentTypes(Sax.DataItemType.UserAccount).ContainsCI(file.ContentType))
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.upload.image.invalid.content.type"]));
if (imageConfig.MimeType != mimeTypeExpected)
{
SaLogger.Warn($"{SysUtil.Fn} Image upload - inconsistent Mime. Filename: {file.FileName}. Mime: {imageConfig.MimeType}. Expected Mime: {mimeTypeExpected}.");
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.upload.image.invalid"]));
}
// Resize the image if required.
if (!ImageUtils.ConstrainImage(imageConfig, Sax.Config.Organisation.Logo.WidthMax, Sax.Config.Organisation.Logo.HeightMax))
@@ -0,0 +1,46 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Saxonite.Net.Core.Web.Admin.Models.Reference;
using Saxonite.Net.Core.Web.Base.App;
using Saxonite.Net.Core.Web.Base.Controllers;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference
{
//=======================================================================
public partial class ReferenceBaseballController : SaxController_Admin
{
//-------------------------------------------------------------------
// Construction.
public ReferenceBaseballController(SaxLocaliser localiser, ILogger<HomeController> logger) :
base(localiser, logger)
{
}
//-------------------------------------------------------------------
[HttpGet]
[Route("Reference/Baseball")]
public IActionResult Index()
{
// Validate session.
if (!ValidUserSession)
AutoLoginUser();
if (!ValidUserSession)
return RedirectToAction("", "");
// Paging.
Model_ReferenceBaseball model = new Model_ReferenceBaseball(Localiser);
//model.Paging.PageNo = 1;
//model.Paging.PageLength = 12;
return View("/Views/Reference/Baseball/Index.cshtml",model);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,76 @@
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.Core.Web.Admin.Models.Reference;
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 Baseball Controller - Ajax requests - Stats.
//=======================================================================
partial class ReferenceBaseballController
{
//-------------------------------------------------------------------
// Get Stats ajax request.
//-------------------------------------------------------------------
private class AjaxResponse_ReferenceBaseballStats : AjaxResponse_Data
{
// Construction.
public AjaxResponse_ReferenceBaseballStats(SaxModel_Admin model) : base(model) { }
// Statistics.
public List<StatsGroupData> Groups { get; } = new List<StatsGroupData>();
}
//-------------------------------------------------------------------
[HttpPost]
[Route("Reference/Baseball/Ajax/GetStats")]
[Route("Reference/Baseball/Ajax/Stats")]
public IActionResult Ajax_GetUsgaStats(Model_ReferenceBaseball model)
{
String fn = GetType().Name + ".Ajax_GetUsgaStats";
String messageTitle = Localiser["caption.reference.baseball"];
AjaxResponse_ReferenceBaseballStats responseData = new AjaxResponse_ReferenceBaseballStats(model);
// Validate session.
if (!ValidUserSession)
return GetAjaxResult_InvalidSession(responseData);
// Statistics.
responseData.Groups.Add(PopulateCoreStatsData(model));
// Complete response.
responseData.Success = true;
return Json(responseData);
}
//-------------------------------------------------------------------
private AjaxResponse_Data.StatsGroupData PopulateCoreStatsData(Model_ReferenceBaseball model)
{
AjaxResponse_Data.StatsGroupData group = new AjaxResponse_Data.StatsGroupData() { Caption = "Core" };
// Sports.
List<SaxSport.Data> sports = GetSportsByName("Baseball", true);
// Organisations.
SaxOrganisation.Params prmOrganisation = new SaxOrganisation.Params();
prmOrganisation.SportIdsIncluded.AddIds(sports.Select(item => item.Id));
prmOrganisation.StatusCat = SaxOrganisation.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Active Organisations", Value = AccountMgr.GetOrganisationCount(prmOrganisation).ToString() });
return group;
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Mvc;
using NPOI.SS.Formula.Functions;
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.Consoles;
using Saxonite.Net.Core.Web.Admin.Models;
using Saxonite.Net.Core.Web.Admin.Models.Reference;
using Saxonite.Net.Core.Web.Admin.Procs;
using Saxonite.Net.Core.Web.Base.Procs;
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 Baseball Controller - Ajax requests.
//=======================================================================
partial class ReferenceBaseballController
{
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -17,7 +17,7 @@ using System.Threading.Tasks;
namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference
{
//=======================================================================
// Reference Golf Controller - Ajax requests.
// Reference Golf Controller - Ajax requests - Stats.
//=======================================================================
partial class ReferenceGolfController
{
@@ -29,17 +29,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference
// Construction.
public AjaxResponse_ReferenceGolfStats(SaxModel_Admin model) : base(model) { }
// Statistics.
public class StatData : AjaxResponse_Base
{
public String Caption { get; set; }
public String Value { get; set; }
}
public class StatGroupData : AjaxResponse_Base
{
public String Caption { get; set; }
public List<StatData> Stats { get; } = new List<StatData>();
}
public List<StatGroupData> Groups { get; } = new List<StatGroupData>();
public List<StatsGroupData> Groups { get; } = new List<StatsGroupData>();
}
//-------------------------------------------------------------------
[HttpPost]
@@ -69,237 +59,237 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference
}
//-------------------------------------------------------------------
private AjaxResponse_ReferenceGolfStats.StatGroupData PopulateCountryStatsData()
private AjaxResponse_Data.StatsGroupData PopulateCountryStatsData()
{
AjaxResponse_ReferenceGolfStats.StatGroupData group = new AjaxResponse_ReferenceGolfStats.StatGroupData() { Caption = "Countries" };
AjaxResponse_Data.StatsGroupData group = new AjaxResponse_Data.StatsGroupData() { Caption = "Countries" };
// All countries.
SaxGolfUsgaCountry.Params prmCountry = new SaxGolfUsgaCountry.Params();
prmCountry.StatusCat = SaxGolfUsgaCountry.StatusCat.Any;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Total", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Total", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
// Active countries.
prmCountry = new SaxGolfUsgaCountry.Params();
prmCountry.StatusCat = SaxGolfUsgaCountry.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Active", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Active", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
// Inctive countries.
prmCountry = new SaxGolfUsgaCountry.Params();
prmCountry.StatusCat = SaxGolfUsgaCountry.StatusCat.InactiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Inactive", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Inactive", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
// Deleted countries.
prmCountry = new SaxGolfUsgaCountry.Params();
prmCountry.StatusCat = SaxGolfUsgaCountry.StatusCat.DeletedOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Deleted", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Deleted", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
// Priority countries without provinces.
prmCountry = new SaxGolfUsgaCountry.Params();
prmCountry.PriorityFlagState = SacsHierarchyItem.Params.FlagState.True;
prmCountry.HasProvinces = SacsHierarchyItem.Params.BoolState.False;
prmCountry.StatusCat = SaxGolfUsgaCountry.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Priority no provinces", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Priority no provinces", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
// Non-Priority countries without provinces.
prmCountry = new SaxGolfUsgaCountry.Params();
prmCountry.PriorityFlagState = SacsHierarchyItem.Params.FlagState.False;
prmCountry.HasProvinces = SacsHierarchyItem.Params.BoolState.False;
prmCountry.StatusCat = SaxGolfUsgaCountry.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Non-priority no provinces", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Non-priority no provinces", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
// Priority countries with provinces.
prmCountry = new SaxGolfUsgaCountry.Params();
prmCountry.PriorityFlagState = SacsHierarchyItem.Params.FlagState.True;
prmCountry.HasProvinces = SacsHierarchyItem.Params.BoolState.True;
prmCountry.StatusCat = SaxGolfUsgaCountry.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Priority with provinces", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Priority with provinces", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
// Non-Priority countries with provinces.
prmCountry = new SaxGolfUsgaCountry.Params();
prmCountry.PriorityFlagState = SacsHierarchyItem.Params.FlagState.False;
prmCountry.HasProvinces = SacsHierarchyItem.Params.BoolState.True;
prmCountry.StatusCat = SaxGolfUsgaCountry.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Non-priority with provinces", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Non-priority with provinces", Value = ReferenceGolfMgr.GetUsgaCountryCount(prmCountry).ToString() });
return group;
}
//-------------------------------------------------------------------
private AjaxResponse_ReferenceGolfStats.StatGroupData PopulateProvinceStatsData()
private AjaxResponse_Data.StatsGroupData PopulateProvinceStatsData()
{
AjaxResponse_ReferenceGolfStats.StatGroupData group = new AjaxResponse_ReferenceGolfStats.StatGroupData() { Caption = "Provinces" };
AjaxResponse_Data.StatsGroupData group = new AjaxResponse_Data.StatsGroupData() { Caption = "Provinces" };
// All provinces.
SaxGolfUsgaProvince.Params prmProvince = new SaxGolfUsgaProvince.Params();
prmProvince.StatusCat = SaxGolfUsgaProvince.StatusCat.Any;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Total", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Total", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
// Active provinces.
prmProvince = new SaxGolfUsgaProvince.Params();
prmProvince.StatusCat = SaxGolfUsgaProvince.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Active", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Active", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
// Inctive provinces.
prmProvince = new SaxGolfUsgaProvince.Params();
prmProvince.StatusCat = SaxGolfUsgaProvince.StatusCat.InactiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Inactive", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Inactive", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
// Deleted provinces.
prmProvince = new SaxGolfUsgaProvince.Params();
prmProvince.StatusCat = SaxGolfUsgaProvince.StatusCat.DeletedOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Deleted", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Deleted", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
// Priority provinces without facilities.
prmProvince = new SaxGolfUsgaProvince.Params();
prmProvince.PriorityFlagState = SacsHierarchyItem.Params.FlagState.True;
prmProvince.HasFacilities = SacsHierarchyItem.Params.BoolState.False;
prmProvince.StatusCat = SaxGolfUsgaProvince.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Priority no facilities", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Priority no facilities", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
// Non-Priority provinces without facilities.
prmProvince = new SaxGolfUsgaProvince.Params();
prmProvince.PriorityFlagState = SacsHierarchyItem.Params.FlagState.False;
prmProvince.HasFacilities = SacsHierarchyItem.Params.BoolState.False;
prmProvince.StatusCat = SaxGolfUsgaProvince.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Non-priority no facilities", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Non-priority no facilities", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
// Priority provinces with facilities.
prmProvince = new SaxGolfUsgaProvince.Params();
prmProvince.PriorityFlagState = SacsHierarchyItem.Params.FlagState.True;
prmProvince.HasFacilities = SacsHierarchyItem.Params.BoolState.True;
prmProvince.StatusCat = SaxGolfUsgaProvince.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Priority with facilities", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Priority with facilities", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
// Non-Priority provinces with facilities.
prmProvince = new SaxGolfUsgaProvince.Params();
prmProvince.PriorityFlagState = SacsHierarchyItem.Params.FlagState.False;
prmProvince.HasFacilities = SacsHierarchyItem.Params.BoolState.True;
prmProvince.StatusCat = SaxGolfUsgaProvince.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Non-priority with facilities", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Non-priority with facilities", Value = ReferenceGolfMgr.GetUsgaProvinceCount(prmProvince).ToString() });
return group;
}
//-------------------------------------------------------------------
private AjaxResponse_ReferenceGolfStats.StatGroupData PopulateFacilityStatsData()
private AjaxResponse_Data.StatsGroupData PopulateFacilityStatsData()
{
AjaxResponse_ReferenceGolfStats.StatGroupData group = new AjaxResponse_ReferenceGolfStats.StatGroupData() { Caption = "Facilities" };
AjaxResponse_Data.StatsGroupData group = new AjaxResponse_Data.StatsGroupData() { Caption = "Facilities" };
// All facilities.
SaxGolfUsgaFacility.Params prmFacility = new SaxGolfUsgaFacility.Params();
prmFacility.StatusCat = SaxGolfUsgaFacility.StatusCat.Any;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Total", Value = ReferenceGolfMgr.GetUsgaFacilityCount(prmFacility).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Total", Value = ReferenceGolfMgr.GetUsgaFacilityCount(prmFacility).ToString() });
// Active facilities.
prmFacility = new SaxGolfUsgaFacility.Params();
prmFacility.StatusCat = SaxGolfUsgaFacility.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Active", Value = ReferenceGolfMgr.GetUsgaFacilityCount(prmFacility).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Active", Value = ReferenceGolfMgr.GetUsgaFacilityCount(prmFacility).ToString() });
// Inctive facilities.
prmFacility = new SaxGolfUsgaFacility.Params();
prmFacility.StatusCat = SaxGolfUsgaFacility.StatusCat.InactiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Inactive", Value = ReferenceGolfMgr.GetUsgaFacilityCount(prmFacility).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Inactive", Value = ReferenceGolfMgr.GetUsgaFacilityCount(prmFacility).ToString() });
// Deleted facilities.
prmFacility = new SaxGolfUsgaFacility.Params();
prmFacility.StatusCat = SaxGolfUsgaFacility.StatusCat.DeletedOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Deleted", Value = ReferenceGolfMgr.GetUsgaFacilityCount(prmFacility).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Deleted", Value = ReferenceGolfMgr.GetUsgaFacilityCount(prmFacility).ToString() });
// Facilities without courses.
prmFacility = new SaxGolfUsgaFacility.Params();
prmFacility.HasCourses = SacsHierarchyItem.Params.BoolState.False;
prmFacility.StatusCat = SaxGolfUsgaFacility.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "No courses", Value = ReferenceGolfMgr.GetUsgaFacilityCount(prmFacility).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "No courses", Value = ReferenceGolfMgr.GetUsgaFacilityCount(prmFacility).ToString() });
// Priority facilities with courses.
prmFacility = new SaxGolfUsgaFacility.Params();
prmFacility.HasCourses = SacsHierarchyItem.Params.BoolState.True;
prmFacility.StatusCat = SaxGolfUsgaFacility.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "With courses", Value = ReferenceGolfMgr.GetUsgaFacilityCount(prmFacility).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "With courses", Value = ReferenceGolfMgr.GetUsgaFacilityCount(prmFacility).ToString() });
return group;
}
//-------------------------------------------------------------------
private AjaxResponse_ReferenceGolfStats.StatGroupData PopulateCourseStatsData()
private AjaxResponse_Data.StatsGroupData PopulateCourseStatsData()
{
AjaxResponse_ReferenceGolfStats.StatGroupData group = new AjaxResponse_ReferenceGolfStats.StatGroupData() { Caption = "Courses" };
AjaxResponse_Data.StatsGroupData group = new AjaxResponse_Data.StatsGroupData() { Caption = "Courses" };
// All courses.
SaxGolfUsgaCourse.Params prmCourse = new SaxGolfUsgaCourse.Params();
prmCourse.StatusCat = SaxGolfUsgaCourse.StatusCat.Any;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Total", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Total", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
// Active courses.
prmCourse = new SaxGolfUsgaCourse.Params();
prmCourse.StatusCat = SaxGolfUsgaCourse.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Active", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Active", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
// Inctive courses.
prmCourse = new SaxGolfUsgaCourse.Params();
prmCourse.StatusCat = SaxGolfUsgaCourse.StatusCat.InactiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Inactive", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Inactive", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
// Deleted courses.
prmCourse = new SaxGolfUsgaCourse.Params();
prmCourse.StatusCat = SaxGolfUsgaCourse.StatusCat.DeletedOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Deleted", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Deleted", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
// Priority courses without markers.
prmCourse = new SaxGolfUsgaCourse.Params();
prmCourse.PriorityFlagState = SacsHierarchyItem.Params.FlagState.True;
prmCourse.HasMarkers = SacsHierarchyItem.Params.BoolState.False;
prmCourse.StatusCat = SaxGolfUsgaCourse.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Priority no markers", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Priority no markers", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
// Non-Priority courses without markers.
prmCourse = new SaxGolfUsgaCourse.Params();
prmCourse.PriorityFlagState = SacsHierarchyItem.Params.FlagState.False;
prmCourse.HasMarkers = SacsHierarchyItem.Params.BoolState.False;
prmCourse.StatusCat = SaxGolfUsgaCourse.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Non-priority no markers", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Non-priority no markers", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
// Priority courses with markers.
prmCourse = new SaxGolfUsgaCourse.Params();
prmCourse.PriorityFlagState = SacsHierarchyItem.Params.FlagState.True;
prmCourse.HasMarkers = SacsHierarchyItem.Params.BoolState.True;
prmCourse.StatusCat = SaxGolfUsgaCourse.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Priority with markers", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Priority with markers", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
// Non-Priority courses with markers.
prmCourse = new SaxGolfUsgaCourse.Params();
prmCourse.PriorityFlagState = SacsHierarchyItem.Params.FlagState.False;
prmCourse.HasMarkers = SacsHierarchyItem.Params.BoolState.True;
prmCourse.StatusCat = SaxGolfUsgaCourse.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Non-priority with markers", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Non-priority with markers", Value = ReferenceGolfMgr.GetUsgaCourseCount(prmCourse).ToString() });
return group;
}
//-------------------------------------------------------------------
private AjaxResponse_ReferenceGolfStats.StatGroupData PopulateMarkerStatsData()
private AjaxResponse_Data.StatsGroupData PopulateMarkerStatsData()
{
AjaxResponse_ReferenceGolfStats.StatGroupData group = new AjaxResponse_ReferenceGolfStats.StatGroupData() { Caption = "Markers" };
AjaxResponse_Data.StatsGroupData group = new AjaxResponse_Data.StatsGroupData() { Caption = "Markers" };
// All markers.
SaxGolfUsgaMarker.Params prmMarker = new SaxGolfUsgaMarker.Params();
prmMarker.StatusCat = SaxGolfUsgaMarker.StatusCat.Any;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Total", Value = ReferenceGolfMgr.GetUsgaMarkerCount(prmMarker).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Total", Value = ReferenceGolfMgr.GetUsgaMarkerCount(prmMarker).ToString() });
// Active markers.
prmMarker = new SaxGolfUsgaMarker.Params();
prmMarker.StatusCat = SaxGolfUsgaMarker.StatusCat.ActiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Active", Value = ReferenceGolfMgr.GetUsgaMarkerCount(prmMarker).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Active", Value = ReferenceGolfMgr.GetUsgaMarkerCount(prmMarker).ToString() });
// Inctive markers.
prmMarker = new SaxGolfUsgaMarker.Params();
prmMarker.StatusCat = SaxGolfUsgaMarker.StatusCat.InactiveOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Inactive", Value = ReferenceGolfMgr.GetUsgaMarkerCount(prmMarker).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Inactive", Value = ReferenceGolfMgr.GetUsgaMarkerCount(prmMarker).ToString() });
// Deleted markers.
prmMarker = new SaxGolfUsgaMarker.Params();
prmMarker.StatusCat = SaxGolfUsgaMarker.StatusCat.DeletedOnly;
group.Stats.Add(new AjaxResponse_ReferenceGolfStats.StatData() { Caption = "Deleted", Value = ReferenceGolfMgr.GetUsgaMarkerCount(prmMarker).ToString() });
group.Stats.Add(new AjaxResponse_Data.StatData() { Caption = "Deleted", Value = ReferenceGolfMgr.GetUsgaMarkerCount(prmMarker).ToString() });
return group;
}
@@ -464,7 +464,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers.Reference
// Configure the process.
SaxGolfUsgaDataLookup.Config processConfig = new SaxGolfUsgaDataLookup.Config(SessionContext, DbUpdateInfo);
processConfig.Tasks.Add(SaxGolfUsgaDataLookup.Task.CleanseCourseCaptions);
processConfig.Tasks.Add(SaxGolfUsgaDataLookup.Task.CleanseCourses);
SaxGolfUsgaDataLookup process = new SaxGolfUsgaDataLookup(processConfig);
// Store the process and run.
@@ -24,6 +24,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
private class SportListData : AjaxResponse_Data.ItemData_Base
{
public String Name { get; set; }
public String GroupingCode { get; set; }
public String GroupingDesc { get; set; }
public String SportIdParent { get; set; }
public String SportNameParent { get; set; }
public String SpecialityLabelCode { get; set; }
@@ -35,6 +37,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
private void PopulateSportResponseListData(SaxSport sport, SaxSport parentSport, SportListData data)
{
data.Id = SysId.ToString(sport.Id);
data.GroupingCode = SportGroupingCodes.GetCodeForType(sport.Grouping);
data.GroupingDesc = SportGroupingCodes.GetDescForType(sport.Grouping);
data.SportNameParent = parentSport?.Name ?? null;
data.SportIdParent = parentSport?.Id.ToString() ?? null;
data.Name = sport.Name;
@@ -88,6 +92,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
// Item columns.
ColumnDfn colId = ReferenceMgr.GetSportColumnDfn(SaxSport.Column.Id);
ColumnDfn colGrouping = ReferenceMgr.GetSportColumnDfn(SaxSport.Column.Grouping);
ColumnDfn colParentId = ReferenceMgr.GetSportColumnDfn(SaxSport.Column.SportIdParent);
ColumnDfn colParentName = ReferenceMgr.GetSportColumnDfn(SaxSport.Column.ParentSport_Name);
ColumnDfn colName = ReferenceMgr.GetSportColumnDfn(SaxSport.Column.Name);
@@ -95,7 +100,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
ColumnDfn colStatus = ReferenceMgr.GetSportColumnDfn(SaxSport.Column.Status);
List<ColumnDfn> columns = new List<ColumnDfn>()
{
colId, colParentId, colParentName,
colId, colGrouping, colParentId, colParentName,
colName, colSpecialityLabel, colStatus
};
@@ -108,10 +113,13 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
{
NamedValue.Map values = resultSet.GetRecordValues();
Sax.SportGrouping grouping = (Sax.SportGrouping)values.GetLong(colGrouping.DataName);
Sax.SportSpecialityLabel specialityLabel = (Sax.SportSpecialityLabel)values.GetLong(colSpecialityLabel.DataName);
SportListData sportData = new SportListData()
{
Id = values.GetString(colId.DataName),
GroupingCode = SportGroupingCodes.GetCodeForType(grouping),
GroupingDesc = SportGroupingCodes.GetDescForType(grouping),
SportIdParent = values.GetString(colParentId.DataName),
SportNameParent = values.GetString(colParentName.DataName),
Name = values.GetString(colName.DataName),
@@ -229,6 +237,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
}
// Populate item properties.
if (model.SportGroupingCode != null)
sport.Grouping = model.SportGrouping;
if (model.SportIdParent != null)
sport.SportIdParent = model.SportIdParent.ToSysId();
if (model.SportName != null)
@@ -37,8 +37,12 @@ namespace Saxonite.Net.Core.Web.Admin.Models
//-------------------------------------------------------------------
// Sport properties.
public String SportId { get; set; }
public String SportIdParent { get; set; }
public String SportName { get; set; }
public String SportGroupingCode { get; set; }
public Sax.SportGrouping SportGrouping { get { return (Sax.SportGrouping)SportGroupingCodes.GetTypeForCode(SportGroupingCode); } }
public String SportIdParent { get; set; }
public String SportIdsParents { get; set; }
public String SportIdsChildren { get; set; }
public String SportSpecialityLabelCode { get; set; }
public Sax.SportSpecialityLabel SportSpecialityLabel { get { return (Sax.SportSpecialityLabel)SportSpecialityLabelCodes.GetTypeForCode(SportSpecialityLabelCode); } }
public String SportStatusCode { get; set; }
@@ -54,6 +58,16 @@ namespace Saxonite.Net.Core.Web.Admin.Models
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
{
// Sport Grouping.
if (SportGroupingCode != null)
{
String controlName = nameof(SportGrouping);
if (StringUtil.IsEmpty(SportGroupingCode))
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
else if (SportGrouping <= 0)
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
}
// Parent sport.
SysId sportIdParent = SportIdParent.ToSysId();
if (SportIdParent != null && SysId.IsValid(sportIdParent))
@@ -70,11 +84,12 @@ namespace Saxonite.Net.Core.Web.Admin.Models
// Sport name.
if (SportName != null)
{
responseData.SetControlValue(nameof(SportName), SportName);
String controlName = nameof(SportName);
responseData.SetControlValue(controlName, SportName);
if (StringUtil.IsEmpty(SportName))
responseData.SetControlError(nameof(SportName), Localiser["msg.validation.mandatory.value"]);
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
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)]);
responseData.SetControlError(controlName, Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.Sport_Name)]);
else
{
// Check for duplicate name.
@@ -85,27 +100,29 @@ namespace Saxonite.Net.Core.Web.Admin.Models
prmSport.NameFull = SportName;
prmSport.StatusCat = SaxSport.StatusCat.Any;
if (ReferenceMgr.GetSportCount(prmSport) > 0)
responseData.SetControlError(nameof(SportName), Localiser["msg.validation.duplicate.value"]);
responseData.SetControlError(controlName, Localiser["msg.validation.duplicate.value"]);
}
}
// Sport Speciality Label.
if (SportSpecialityLabelCode != null)
{
String controlName = nameof(SportSpecialityLabel);
if (!StringUtil.IsEmpty(SportSpecialityLabelCode))
{
if (SportSpecialityLabel <= 0)
responseData.SetControlError(nameof(SportSpecialityLabel), Localiser["msg.validation.invalid.value"]);
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
}
}
// Sport status.
if (SportStatusCode != null)
{
String controlName = nameof(SportStatus);
if (StringUtil.IsEmpty(SportStatusCode))
responseData.SetControlError(nameof(SportStatus), Localiser["msg.validation.mandatory.value"]);
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
else if (!SaxSport.ValidStatuses.Contains(SportStatus))
responseData.SetControlError(nameof(SportStatus), Localiser["msg.validation.invalid.value"]);
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
}
}
@@ -0,0 +1,56 @@
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Base.App;
using Saxonite.Net.Core.Web.Base.App;
using Saxonite.Net.Core.Web.Base.Controllers;
using Saxonite.Net.Core.Web.Base.Models;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Standard.Base.Bus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Saxonite.Net.Core.Web.Admin.Models.Reference
{
//=======================================================================
public class Model_ReferenceBaseball : SaxModel_Admin
{
//-------------------------------------------------------------------
// Construction.
public Model_ReferenceBaseball(SaxLocaliser localiser) :
base(localiser)
{
AdditionalFiles_JS.Add("js/ref/sax-ref-baseball.js");
}
//-------------------------------------------------------------------
// Reference Baseball list parameters.
public class FilterData
{
}
public FilterData Filter { get; } = new FilterData();
//-------------------------------------------------------------------
// Reference Baseball properties.
//-------------------------------------------------------------------
// Validation.
//-------------------------------------------------------------------
// Reference Baseball.
public bool ValidateReferenceBaseballData(Sacs.Web.Components.SaController.AjaxResponse_Data responseData)
{
// Record disposable items as they are created so all can be disposed when needed.
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
{
}
return !responseData.HasControlErrors();
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -23,7 +23,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models.Reference
public Model_ReferenceGolf(SaxLocaliser localiser) :
base(localiser)
{
AdditionalFiles_JS.Add("js/sax-ref-golf.js");
AdditionalFiles_JS.Add("js/ref/sax-ref-golf.js");
}
//-------------------------------------------------------------------
@@ -52,7 +52,7 @@ namespace Saxonite.Net.Core.Web.Admin.Models.Reference
public bool ValidateReferenceGolfData(Sacs.Web.Components.SaController.AjaxResponse_Data responseData)
{
// Record disposable items as they are created so all can be disposed when needed.
using (DisposableCollection<SacsHierarchyItem> disposableItems = new DisposableCollection<SacsHierarchyItem>())
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
{
}
return !responseData.HasControlErrors();
@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="caption.baseball" xml:space="preserve">
<value>Baseball</value>
</data>
<data name="caption.contact.method" xml:space="preserve">
<value>Contact Method</value>
</data>
@@ -162,6 +165,9 @@
<data name="caption.organisations" xml:space="preserve">
<value>Organisations</value>
</data>
<data name="caption.reference.baseball" xml:space="preserve">
<value>Reference - Baseball</value>
</data>
<data name="caption.reference.golf" xml:space="preserve">
<value>Reference - Golf</value>
</data>
@@ -375,6 +381,15 @@
<data name="label.gender" xml:space="preserve">
<value>Gender</value>
</data>
<data name="label.grouped.sports" xml:space="preserve">
<value>Grouped sports</value>
</data>
<data name="label.grouping" xml:space="preserve">
<value>Grouping</value>
</data>
<data name="label.groups" xml:space="preserve">
<value>Groups</value>
</data>
<data name="label.header.row" xml:space="preserve">
<value>Header row</value>
</data>
@@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="jQuery.UI.Combined" Version="1.13.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.30" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.31" />
<PackageReference Include="System.Collections.Specialized" Version="4.3.0" />
</ItemGroup>
@@ -36,7 +36,7 @@
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Update="wwwroot\js\sax-ref-golf.js">
<Content Update="wwwroot\js\ref\sax-ref-golf.js">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
@@ -0,0 +1,10 @@
@model SaxModel_Admin
@inject SaxLocaliser Localiser
@* Icons. *@
<div class="sax-panel-item-template">
<img src="~/img/icon/tick-64.png" alt="" title="" class="sax-tick" style="max-width:16px;" />
<img src="~/img/icon/sphere-green.svg" alt="Active" title="Active" class="sax-status-atv" style="max-width:16px;" />
<img src="~/img/icon/sphere-orange.svg" alt="Inactive" title="Inactive" class="sax-status-ina" style="max-width:16px;" />
<img src="~/img/icon/sphere-purple.svg" alt="Deleted" title="Deleted" class="sax-status-del" style="max-width:16px;" />
</div>
@@ -0,0 +1,73 @@
@model Model_ReferenceBaseball
@inject SaxLocaliser Localiser
@{
/* Reference - Baseball - Index */
ViewData["Title"] = "Reference - Baseball";
}
<div class="sax-panel Baseball">
<style type="text/css">
.BaseballStats .GroupCaption
{
margin-top: 4px;
margin-bottom: 4px;
font-weight: 600;
text-align: center;
border-bottom: 1px solid slategray;
}
.BaseballStats .StatCaption
{
color: slategray;
}
</style>
<div class="sax-panel-filter">
<div class="sax-header row">
<div class="col"><div class="sax-caption">@Localiser["caption.reference.baseball"]</div></div>
<div class="fixed row">
<div class="sax-action sax-results-refresh"><img src="~/img/action/refresh24.png" alt="@(Localiser["label.refresh"])" title="@(Localiser["label.refresh"])" /></div>
</div>
</div>
@using (@Html.BeginForm(FormMethod.Post, new { @id = "frmRefBaseballFilter", @class = "sax-form", @onSubmit = "return false;" }))
{
@*
<div class="sax-content">
<div class="row">
<div class="col-sm-5 col-md-3 sax-label text-left text-sm-right">@Localiser["label.options"]</div>
<div class="col-sm-7 col-md-3 mb-sm-1 mb-md-0">
</div>
</div>
</div>
*@
}
</div>
@* Reference - Baseball - Stats *@
<div class="sax-panel-info sax-panel-results BaseballStats">
<div class="sax-header">
<div class="sax-caption">@Localiser["label.statictics"]</div>
</div>
<div class="sax-content">
<div class="sax-panel-messages"></div>
<div class="sax-panel-item-list row"></div>
</div>
<div class="sax-panel-item-template">
<div class="BaseballStatGroup col-sm-12">
<div class="GroupCaption"></div>
</div>
<div class="BaseballStat col-sm-6">
<div class="row">
<div class="col-8 text-right pr-2"><div class="StatCaption"></div></div>
<div class="col-4"><div class="StatValue"></div></div>
</div>
</div>
</div>
</div>
@* Templates. *@
<partial name="~/Views/Common/Template-Icons.cshtml" />
</div>
@@ -285,12 +285,7 @@
</div>
}
@* Icons. *@
<div class="sax-panel-item-template">
<img src="~/img/icon/tick-64.png" alt="" title="" class="sax-tick" style="max-width:16px;" />
<img src="~/img/icon/sphere-green.svg" alt="Active" title="Active" class="sax-status-atv" style="max-width:16px;" />
<img src="~/img/icon/sphere-orange.svg" alt="Inactive" title="Inactive" class="sax-status-ina" style="max-width:16px;" />
<img src="~/img/icon/sphere-purple.svg" alt="Deleted" title="Deleted" class="sax-status-del" style="max-width:16px;" />
</div>
@* Templates. *@
<partial name="~/Views/Common/Template-Icons.cshtml" />
</div>
@@ -136,6 +136,8 @@
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Sport');">@Localiser["sport.caption.sports"]</div>
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Region');">@Localiser["region.caption.regions"]</div>
<hr />
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Reference/Baseball');">@Localiser["caption.baseball"]</div>
<div class="dropdown-item text-dark sax-action" onclick="sax.goToPage('Reference/Golf');">@Localiser["caption.golf"]</div>
</div>
</li>
@@ -42,7 +42,24 @@
</div>
</div>
@* Sport Parent *@
@* Sport Grouping *@
<div class="sax-form-control SportGrouping">
<div class="row">
<div class="col-sm-3">
<div class="sax-label">
<label for="cbSportGrouping"><span>@Localiser["label.grouping"]</span></label>
</div>
</div>
<div class="col-sm-9">
<div class="sax-control">
@Html.DropDownListFor(model => model.SportGroupingCode, Model.SportGroupingCodesForSelect, new { @id = "cbSportGrouping", @class = "SportGrouping sax-select" })
</div>
<div class="sax-message"></div>
</div>
</div>
</div>
@* Banner Sport *@
<div class="sax-form-control SportParent">
<div class="row">
<div class="col-sm-3">
@@ -62,6 +79,26 @@
</div>
</div>
@* Child Sports *@
<div class="sax-form-control SportsChildren">
<div class="row">
<div class="col-sm-3">
<div class="sax-label">
<label><span>@Localiser["label.grouped.sports"]</span></label>
</div>
</div>
<div class="col-sm-9">
<div class="sax-control row">
@Html.HiddenFor(model => model.SportIdsChildren, new { @id = "ifSportIdsChildren", @class = "SportIdsChildren" })
<div class="col"><div class="SportsChildren" style="min-height:48px;max-height:120px;width:100%;border:1px solid #808080;border-radius:4px 0 0 4px;overflow-y:scroll;"></div></div>
<div class="fixed"><div class="sax-action ChildSportsClear"><img src="~/img/action/delete24.png" alt="@(Localiser["label.clear"])" title="@(Localiser["label.clear"])" /></div></div>
<div class="fixed"><button type="button" id="pbSelectChildSports" class="sax-button" style="min-width:auto;margin-left:4px;padding:4px 6px">@Localiser["label.select"]</button></div>
</div>
<div class="sax-message"></div>
</div>
</div>
</div>
@* Sport Speciality Label *@
<div class="sax-form-control SportSpecialityLabel">
<div class="row">
+27 -27
View File
@@ -36,7 +36,7 @@
font-weight: bold;
}
.sax-panel-filter .sax-header ul.nav.sax-burger
.sax-panel-filter ul.nav.sax-burger
{
margin-top: 2px;
}
@@ -62,7 +62,7 @@
.sax-panel-filter .sax-content .sax-label
{
padding-top: 2px;
padding-top: 6px;
padding-right: 12px;
text-align: right;
}
@@ -113,19 +113,19 @@
/* Panel header - Burger */
.sax-header ul.nav.sax-burger
ul.nav.sax-burger
{
margin: 0;
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu
ul.nav.sax-burger ul.sax-dropdown-menu
{
padding: 4px 8px 4px 4px;
border-radius: 2px 2px 8px 4px;
box-shadow: 0 0 8px 2px #80808080;
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item
{
margin: 2px 4px 2px 0;
padding: 2px 4px 2px 30px;
@@ -133,109 +133,109 @@
background-position: left center;
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-refresh
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-refresh
{
background-image: url('../img/action/refresh24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-info
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-info
{
background-image: url('../img/action/info24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-add
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-add
{
background-image: url('../img/action/add24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-edit
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-edit
{
background-image: url('../img/action/edit24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-remove
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-remove
{
background-image: url('../img/action/delete24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-experience
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-experience
{
background-image: url('../img/action/trophy24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-user
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-user
{
background-image: url('../img/action/user24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-users
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-users
{
background-image: url('../img/action/users24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-mail
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-mail
{
background-image: url('../img/action/mail24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-location
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-location
{
background-image: url('../img/action/location-24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-image
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-image
{
background-image: url('../img/action/image-24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-process
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-process
{
background-image: url('../img/action/process24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-upload
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-upload
{
background-image: url('../img/action/upload24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-download
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-download
{
background-image: url('../img/action/download24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-network
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-network
{
background-image: url('../img/action/network-24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-close
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-close
{
background-image: url('../img/action/prev24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-itemlock
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-itemlock
{
background-image: url('../img/action/lock24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-unlock
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-unlock
{
background-image: url('../img/action/unlock24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item:hover
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item:hover
{
background-color: #f8f8f8;
box-shadow: none;
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item .sax-label
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item .sax-label
{
margin: 0;
padding: 0 0 0 4px;
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item:hover .sax-label
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item:hover .sax-label
{
background-color: #f8f8f8;
box-shadow: 0 0 2px 1px #80808080;
@@ -353,7 +353,7 @@ table.sax-item-list tbody td
font-weight: bold;
}
.sax-panel-item > .sax-header ul.nav.sax-burger
.sax-panel-item > ul.nav.sax-burger
{
margin: 0;
}
@@ -140,7 +140,7 @@
.sax-form .sax-form-control .sax-label
{
margin: 0 0 8px 0;
margin: 4px 0 4px 0;
font-size: 1rem;
line-height: 1.25;
}
@@ -183,9 +183,9 @@
.sax-form .sax-input:read-only, .sax-form .sax-textarea:read-only, .sax-form .sax-select:disabled
{
color: #202020;
color: #404040;
opacity: 1;
background-color: #f8f8f8;
background-color: #f0f0f0;
}
.sax-form .sax-form-control.sax-error .sax-input, .sax-form .sax-form-control.sax-error .sax-textarea, .sax-form .sax-form-control.sax-error .sax-select
@@ -0,0 +1,91 @@
/*
* Admin - Reference - Baseball page scripts.
*/
(function (win, doc, undef)
{
"use strict";
let rb = sax.refBaseball = sax.refBaseball || { ajax: {}, data: {}, fn: {}, $pnl: {}, $frm: {}, $dlg: {} };
rb.attr_id = 'sax-id';
rb.class_sel = 'sax-sel';
//--------------------------------------------------------------
/* Reference - Baseball - Stats. */
rb.fn.refreshStats = function (delay)
{
rb.ajax.baseballStats = rb.ajax.baseballStats || { url: sax.url.base + 'Reference/Baseball/Ajax/GetStats', formId: rb.$frm.filter.prop('id'), callbackFn: rb.fn.doRefreshStats };
sax.doAjaxRequest(rb.ajax.baseballStats, delay || 50);
}
rb.fn.doRefreshStats = function (response)
{
if (!response.success) return;
let $msgs = $('.sax-panel-messages', rb.$pnl.stats).empty();
let $list = $('.sax-panel-item-list', rb.$pnl.stats).empty();
for (let groupIdx = 0; groupIdx < (response.groups || []).length; groupIdx++)
{
let group = response.groups[groupIdx];
$list.append(rb.fn.populateStatGroup(rb.fn.getStatGroupTemplate(), group.caption));
for (let statIdx = 0; statIdx < (group.stats || []).length; statIdx++)
{
let stat = group.stats[statIdx];
if (stat.value > 0) $list.append(rb.fn.populateStat(rb.fn.getStatTemplate(), stat.caption, stat.value));
}
}
}
rb.fn.populateStatGroup = function ($item, caption)
{
$('.GroupCaption', $item).text(caption);
return $item;
}
rb.fn.getStatGroupTemplate = function ()
{
return $('.sax-panel-item-template .BaseballStatGroup', rb.$pnl.stats).clone();
}
rb.fn.populateStat = function ($item, caption, value)
{
$('.StatCaption', $item).text(caption);
$('.StatValue', $item).text(value);
return $item;
}
rb.fn.getStatTemplate = function ()
{
return $('.sax-panel-item-template .BaseballStat', rb.$pnl.stats).clone();
}
//--------------------------------------------------------------
// Utilities.
rb.fn.getMenuOption = function ($opt, lbl, fn, cls)
{
return $opt.find('div.sax-label').text(lbl).end().on('click', fn).addClass(cls);
}
rb.fn.getTickIcon = function ()
{
return $('.sax-panel-item-template img.sax-tick', rb.$pnl.baseball).clone();
}
rb.fn.getCrossIcon = function ()
{
return $('.sax-panel-item-template img.sax-cross', rb.$pnl.baseball).clone();
}
rb.fn.getStatusIcon = function (stat)
{
return $('.sax-panel-item-template img.sax-status-' + stat, rb.$pnl.baseball).clone();
}
//--------------------------------------------------------------
$(function ()
{
rb.$pnl.baseball = $('.sax-panel.Baseball');
rb.$pnl.filter = $('.sax-panel-filter', rb.$pnl.baseball);
$('.sax-results-refresh', rb.$pnl.filter).on('click', rb.fn.refreshStats);
rb.$frm.filter = $('#frmRefBaseballFilter', rb.$pnl.filter);
// Stats.
rb.$pnl.stats = $('.sax-panel-info.BaseballStats', rb.$pnl.baseball);
setTimeout(function () { rb.fn.refreshStats(); }, 250);
});
//--------------------------------------------------------------
}(window, window.document));
/* The End */
@@ -1,5 +1,5 @@
/*
* Admin - User page scripts.
* Admin - Reference - Golf page scripts.
*/
(function (win, doc, undef)
@@ -56,11 +56,11 @@
if (!item) return;
$item.prop('id', om.itemIdPrefix + item.id);
$('.UserEmailAddress', $item).text(item.emailAddress);
$('.UserStatusDesc', $item).text(item.userStatusDesc).addClass('sax-status-' + (item.userStatusCode || '').toLowerCase());
$('.UserStatusDesc', $item).text(item.userStatusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sax-status-\S+/g) || []).join(' '); }).addClass('sax-status-' + (item.userStatusCode || '').toLowerCase());
$('.UserStatus', $item).toggle(!item.userActive);
$('.UserDisplayName', $item).text(item.displayName);
$('.MemberRoleCount .RoleCount', $item).text(item.roleCount);
$('.StatusDesc', $item).text(item.statusDesc).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.StatusDesc', $item).text(item.statusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sax-status-\S+/g) || []).join(' '); }).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.sax-caption .sax-action').toggleClass('sax-action', !item.deleted);
let $mnu = $('ul.sax-dropdown-menu', $item).empty();
if (!item.deleted)
+1 -1
View File
@@ -65,7 +65,7 @@
$('.OrganisationSport', $item).text(item.sportName);
$('.OrganisationRegion', $item).text(item.regionPrimary.name);
$('.OrganisationMemberCount', $item).on('click', function () { op.onClickMemberCount(item.id); }).find('.MemberCount').text(item.memberCount);
$('.StatusDesc', $item).text(item.statusDesc).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.StatusDesc', $item).text(item.statusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sax-status-\S+/g) || []).join(' '); }).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.sax-caption .sax-action').toggleClass('sax-action', !item.deleted);
let $mnu = $('ul.sax-dropdown-menu', $item).empty();
if (!item.deleted)
+1 -1
View File
@@ -55,7 +55,7 @@
$('.RegionCountryIso2Code', $item).text(item.countryIso2Code);
$('.RegionTypeDesc', $item).text(item.regionTypeDesc);
$('.RegionParentName', $item).text(item.parentName);
$('.RegionStatusDesc', $item).text(item.statusDesc).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.RegionStatusDesc', $item).text(item.statusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sax-status-\S+/g) || []).join(' '); }).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.sax-caption .sax-action, .sax-actions .sax-action.sax-item-update', $item).off('click').on('click', function () { sax.updateItem(item.id) })
$item.off('dblclick').on('dblclick', function () { sax.updateItem(item.id) })
$('.sax-panel-results .sax-panel-messages').hide().empty();
+3 -1
View File
@@ -56,11 +56,12 @@
if (!item) return;
$item.prop('id', sax.itemIdPrefix + item.id);
$('.SportName', $item).text(item.name);
$('.SportGrouping', $item).text(item.groupingDesc);
$('.SportNameParent', $item).text(item.sportNameParent);
$('.SportParent', $item).toggle(!!item.sportNameParent);
$('.SportSpecialityLabel', $item).text(item.specialityLabelDesc);
$('.SportSpeciality', $item).toggle(!!item.specialityLabelCode);
$('.StatusDesc', $item).text(item.statusDesc).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.StatusDesc', $item).text(item.statusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sax-status-\S+/g) || []).join(' '); }).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.sax-caption .sax-action').toggleClass('sax-action', !item.deleted);
let $mnu = $('ul.sax-dropdown-menu', $item).empty();
if (!item.deleted)
@@ -131,6 +132,7 @@
if (!response.success) return;
let item = response.sport;
$('.SportId', frm).val(item.id);
$('.SportGrouping', frm).val(item.groupingCode);
$('.SportIdParent', frm).val(item.sportIdParent);
$('.SportNameParent', frm).val(item.sportNameParent);
$('.SportName', frm).val(item.name);
@@ -55,7 +55,7 @@
$('.UserReportTitle', $item).text(item.title);
$('.UserDisplayName', $item).text(item.userDisplayName);
$('.UserReportRaisedOnDisp', $item).text(item.recordedOnDisp);
$('.StatusDesc', $item).text(item.statusDesc).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.StatusDesc', $item).text(item.statusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sax-status-\S+/g) || []).join(' '); }).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.sax-caption .sax-action',$item).toggleClass('sax-action', !item.deleted);
let $mnu = $('ul.sax-dropdown-menu', $item).empty();
if (!item.deleted)
+1 -1
View File
@@ -71,7 +71,7 @@
$('.UserLastOnlineLogin', $item).toggle(!!item.lastOnlineLoginAt);
$('.UserLastAdminLoginAt', $item).text(item.lastAdminLoginAt);
$('.UserLastAdminLogin', $item).toggle(!!item.lastAdminLoginAt);
$('.StatusDesc', $item).text(item.statusDesc).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.StatusDesc', $item).text(item.statusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sax-status-\S+/g) || []).join(' '); }).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.sax-caption .sax-action').toggleClass('sax-action', !item.deleted);
let $mnu = $('ul.sax-dropdown-menu', $item);
if (!item.deleted)
@@ -273,6 +273,9 @@
<data name="label.account" xml:space="preserve">
<value>My Account</value>
</data>
<data name="label.actions" xml:space="preserve">
<value>Actions</value>
</data>
<data name="label.activate" xml:space="preserve">
<value>Activate</value>
</data>
@@ -345,6 +348,9 @@
<data name="label.contacts" xml:space="preserve">
<value>Contacts</value>
</data>
<data name="label.copy" xml:space="preserve">
<value>Copy</value>
</data>
<data name="label.country" xml:space="preserve">
<value>Country</value>
</data>
@@ -396,6 +402,9 @@
<data name="label.email.address" xml:space="preserve">
<value>Email address</value>
</data>
<data name="label.ends" xml:space="preserve">
<value>Ends</value>
</data>
<data name="label.events" xml:space="preserve">
<value>Events</value>
</data>
@@ -423,6 +432,9 @@
<data name="label.feedback" xml:space="preserve">
<value>Feedback</value>
</data>
<data name="label.finishes" xml:space="preserve">
<value>Finishes</value>
</data>
<data name="label.first" xml:space="preserve">
<value>First</value>
</data>
@@ -645,6 +657,9 @@
<data name="label.sports.available" xml:space="preserve">
<value>Available sports</value>
</data>
<data name="label.starts" xml:space="preserve">
<value>Starts</value>
</data>
<data name="label.strength" xml:space="preserve">
<value>Strength</value>
</data>
@@ -675,6 +690,9 @@
<data name="label.type" xml:space="preserve">
<value>Type</value>
</data>
<data name="label.until" xml:space="preserve">
<value>Until</value>
</data>
<data name="label.update" xml:space="preserve">
<value>Update</value>
</data>
@@ -61,9 +61,9 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
data.About = userAccount.About;
data.Gender = (byte)userAccount.Gender;
data.GenderCaption = Localiser.GetGenderCaption(userAccount.Gender);
data.DobDay = (byte)userAccount.DateOfBirthDay;
data.DobMonth = (byte)userAccount.DateOfBirthMonth;
data.DobYear = (short)userAccount.DateOfBirthYear;
data.DobDay = (byte)(userAccount.DateOfBirthDay ?? 0);
data.DobMonth = (byte)(userAccount.DateOfBirthMonth ?? 0);
data.DobYear = (short)(userAccount.DateOfBirthYear ?? 0);
if (ItemDataMgr.ItemHasActiveImage(userAccount.GetItemId(), Sax.ImageType.Avatar))
data.HasImage = true;
// Regions.
@@ -205,18 +205,28 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
imageData = fileStream.ToArray();
}
// Validate content type.
if (StringUtil.IsEmpty(file.ContentType) || !SaxItemImage.GetValidContentTypes(Sax.DataItemType.UserAccount).ContainsCI(file.ContentType))
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.invalid.content.type"]));
Sarand.Net.Standard.Base.Core.Sacs.MimeType mimeTypeExpected = SacsContentTypeHelper.GetMimeTypeFromContentType(file.ContentType);
// Validate the image.
ImageUtils.ImageConfig imageConfig = ImageUtils.VerifyImageData(imageData);
ImageUtils.ImageConfig imageConfig = null;
if (mimeTypeExpected == Sarand.Net.Standard.Base.Core.Sacs.MimeType.Svg)
imageConfig = ImageUtils.VerifySvgImageData(imageData);
else
imageConfig = ImageUtils.VerifyImageData(imageData);
if (!imageConfig.ValidImage)
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.invalid"]));
// Validate mime type.
if (!SaxItemImage.GetValidMimeTypes(Sax.DataItemType.UserAccount).Contains(imageConfig.MimeType))
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.invalid.mime"]));
// Validate content type.
if (StringUtil.IsEmpty(file.ContentType) || !SaxItemImage.GetValidContentTypes(Sax.DataItemType.UserAccount).ContainsCI(file.ContentType))
return Json(responseData.SetControlError("AccountContactImage", Localiser["msg.upload.image.invalid.content.type"]));
if (imageConfig.MimeType != mimeTypeExpected)
{
SaLogger.Warn($"{SysUtil.Fn} Image upload - inconsistent Mime. Filename: {file.FileName}. Mime: {imageConfig.MimeType}. Expected Mime: {mimeTypeExpected}.");
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.upload.image.invalid"]));
}
// Resize the image if required.
if (!ImageUtils.ConstrainImage(imageConfig, Sax.Config.User.Image.WidthMax, Sax.Config.User.Image.HeightMax))
@@ -444,18 +444,28 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
imageData = fileStream.ToArray();
}
// Validate content type.
if (StringUtil.IsEmpty(file.ContentType) || !SaxItemImage.GetValidContentTypes(Sax.DataItemType.Article).ContainsCI(file.ContentType))
return Json(responseData.SetControlError("ArticleImage", Localiser["msg.upload.image.invalid.content.type"]));
Sarand.Net.Standard.Base.Core.Sacs.MimeType mimeTypeExpected = SacsContentTypeHelper.GetMimeTypeFromContentType(file.ContentType);
// Validate the image.
ImageUtils.ImageConfig imageConfig = ImageUtils.VerifyImageData(imageData);
ImageUtils.ImageConfig imageConfig = null;
if (mimeTypeExpected == Sarand.Net.Standard.Base.Core.Sacs.MimeType.Svg)
imageConfig = ImageUtils.VerifySvgImageData(imageData);
else
imageConfig = ImageUtils.VerifyImageData(imageData);
if (!imageConfig.ValidImage)
return Json(responseData.SetControlError("ArticleImage", Localiser["msg.upload.image.invalid"]));
// Validate mime type.
if (!SaxItemImage.GetValidMimeTypes(Sax.DataItemType.Article).Contains(imageConfig.MimeType))
return Json(responseData.SetControlError("ArticleImage", Localiser["msg.upload.image.invalid.mime"]));
// Validate content type.
if (StringUtil.IsEmpty(file.ContentType) || !SaxItemImage.GetValidContentTypes(Sax.DataItemType.Article).ContainsCI(file.ContentType))
return Json(responseData.SetControlError("ArticleImage", Localiser["msg.upload.image.invalid.content.type"]));
if (imageConfig.MimeType != mimeTypeExpected)
{
SaLogger.Warn($"{SysUtil.Fn} Image upload - inconsistent Mime. Filename: {file.FileName}. Mime: {imageConfig.MimeType}. Expected Mime: {mimeTypeExpected}.");
return Json(responseData.SetControlError("OrganisationLogoImage", Localiser["msg.upload.image.invalid"]));
}
// Resize the image if required.
if (!ImageUtils.ConstrainImage(imageConfig, Sax.Config.Articles.Images.WidthMax, Sax.Config.Articles.Images.HeightMax))
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Diagnostics;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
@@ -23,12 +24,14 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
// Organisation Event data.
private class EventListData : AjaxResponse_Data.ItemData_Base
{
public String EventDateFmt { get; set; }
public String EventTimeFmt { get; set; }
public String EventAtDateFmt { get; set; }
public String EventAtTimeFmt { get; set; }
public String EventToDateFmt { get; set; }
public String EventToTimeFmt { get; set; }
public String Duration { get; set; }
public String TypeCode { get; set; }
public String TypeDesc { get; set; }
public String Summary { get; set; }
public String Details { get; set; }
public String SportCaptionPrimary { get; set; }
public String RegionCaptionCountry { get; set; }
public String PublishedOnFmt { get; set; }
@@ -36,9 +39,13 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
}
private class EventItemData : EventListData
{
public String EventOn_Calendar { get; set; }
public String EventOn_YYYYMMDD { get; set; }
public String EventAt_Calendar { get; set; }
public String EventAt_YYYYMMDD { get; set; }
public String EventAt_HHMM { get; set; }
public String EventTo_Calendar { get; set; }
public String EventTo_YYYYMMDD { get; set; }
public String EventTo_HHMM { get; set; }
public String Details { get; set; }
public String SportIdPrimary { get; set; }
public String RegionIdCountry { get; set; }
public String PublishedOn_YYYYMMDD { get; set; }
@@ -47,16 +54,26 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
private void PopulateEventResponseListData(Model_Organisation_Events model, SaxOrganisationEvent organisationEvent, EventListData data)
{
data.Id = model.EncryptId(organisationEvent.Id);
data.EventDateFmt = Localiser.FormatDate(organisationEvent.EventAt);
data.EventTimeFmt = DateUtil.Format(organisationEvent.EventAt, "HH:mm");
// 'At' date/time.
data.EventAtDateFmt = Localiser.FormatDate(organisationEvent.EventAt);
if (organisationEvent.HasValidEventAtTime())
data.EventAtTimeFmt = DateUtil.Format(organisationEvent.EventAt, "HH:mm");
// 'To' date/time.
data.EventToDateFmt = Localiser.FormatDate(organisationEvent.EventTo);
if (organisationEvent.HasValidEventToTime())
data.EventToTimeFmt = DateUtil.Format(organisationEvent.EventTo, "HH:mm");
// Event properties.
if (DateUtil.IsValid(organisationEvent.EventTo) && organisationEvent.EventTo > organisationEvent.EventAt)
data.Duration = DateUtil.FormatNumberOfSeconds(((DateTime)organisationEvent.EventTo - organisationEvent.EventAt).TotalSeconds);
data.TypeCode = EventTypeCodes.GetCodeForType(organisationEvent.EventType);
data.TypeDesc = Localiser.GetEventTypeCaption(organisationEvent.EventType);
data.Summary = organisationEvent.Summary;
data.Details = organisationEvent.Details;
data.SportCaptionPrimary = model.GetSportCaption(organisationEvent.SportIdPrimary);
data.RegionCaptionCountry = model.GetRegionCaption(organisationEvent.RegionIdCountry);
data.CreatedOnFmt = Localiser.FormatDate(organisationEvent.CreateStamp.On);
if (DateUtil.IsValid(organisationEvent.PublishedAt))
data.PublishedOnFmt = Localiser.FormatDate(organisationEvent.PublishedAt);
if (DateUtil.IsValid(organisationEvent.ExpiresAt))
data.ExpiresOnFmt = Localiser.FormatDate(organisationEvent.ExpiresAt);
data.StatusCode = organisationEvent.StatusCode;
data.StatusDesc = organisationEvent.StatusDesc;
@@ -64,12 +81,23 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
private void PopulateEventResponseItemData(Model_Organisation_Events model, SaxOrganisationEvent organisationEvent, EventItemData data)
{
PopulateEventResponseListData(model, organisationEvent, data as EventListData);
data.EventOn_Calendar = model.FormatDateForForm(organisationEvent.EventAt);
data.EventOn_YYYYMMDD = DateUtil.Format(organisationEvent.EventAt, "yyyyMMdd");
// 'At' date/time.
data.EventAt_Calendar = model.FormatDateForForm(organisationEvent.EventAt);
data.EventAt_YYYYMMDD = DateUtil.Format(organisationEvent.EventAt, "yyyyMMdd");
if (organisationEvent.HasValidEventAtTime())
data.EventAt_HHMM = DateUtil.Format(organisationEvent.EventAt, "HH:mm");
// 'To' date/time.
data.EventTo_Calendar = model.FormatDateForForm(organisationEvent.EventTo);
data.EventTo_YYYYMMDD = DateUtil.Format(organisationEvent.EventTo, "yyyyMMdd");
if (organisationEvent.HasValidEventToTime())
data.EventTo_HHMM = DateUtil.Format(organisationEvent.EventTo, "HH:mm");
// Event properties.
data.Details = organisationEvent.Details;
data.RegionIdCountry = model.GetEncryptedRegionId(organisationEvent.RegionIdCountry);
data.SportIdPrimary = model.GetEncryptedSportId(organisationEvent.SportIdPrimary);
if (DateUtil.IsValid(organisationEvent.PublishedAt))
data.PublishedOn_YYYYMMDD = DateUtil.Format(organisationEvent.PublishedAt, "yyyyMMdd");
if (DateUtil.IsValid(organisationEvent.ExpiresAt))
data.ExpiresOn_YYYYMMDD = DateUtil.Format(organisationEvent.ExpiresAt, "yyyyMMdd");
}
@@ -101,6 +129,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
public OrganisationData Organisation { get; } = new OrganisationData();
// Reference data.
public List<CodeDesc> EventTypes { get; } = new List<CodeDesc>();
public String EventTypeDefault { get; set; }
}
//-------------------------------------------------------------------
[HttpPost]
@@ -140,6 +169,8 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
// Reference data - organisationEvent types.
foreach (TypeCodeDesc eventType in EventTypeCodes)
responseData.EventTypes.Add(eventType.Code, Localiser.GetEventTypeCaption((Sax.EventType)eventType.Type));
// ToDo: Organisation default Event Type.
responseData.EventTypeDefault = EventTypeCodes.GetCodeForType(Sax.EventType.Playing);
// User organisation.
SaxUserOrganisation.Params prmUserOrganisation = new SaxUserOrganisation.Params();
@@ -170,17 +201,34 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
SaxOrganisationEvent.Params prmEvent = new SaxOrganisationEvent.Params();
prmEvent.UserAccountIdsIncluded.Add(userAccountId);
prmEvent.OrganisationIdsIncluded.Add(organisationId);
switch (model.Filter.Period.PeriodType)
{
case Model_Organisation_Events.PeriodType.FromThisMonth:
prmEvent.EventFrom = DateUtil.StartOfMonth(DateTime.Today);
break;
case Model_Organisation_Events.PeriodType.FromLastMonth:
prmEvent.EventFrom = DateUtil.StartOfMonth(DateUtil.IncrementMonth(DateTime.Today, -1));
break;
case Model_Organisation_Events.PeriodType.FromNextMonth:
prmEvent.EventFrom = DateUtil.StartOfMonth(DateUtil.IncrementMonth(DateTime.Today, 1));
break;
case Model_Organisation_Events.PeriodType.FromThisWeek:
default:
prmEvent.EventFrom = DateUtil.StartOfWorkingWeek(DateTime.Today);
break;
}
prmEvent.EventFilter = model.Filter.Event;
prmEvent.StatusCat = SaxOrganisationEvent.StatusCat.NotDeleted;
prmEvent.SortColumns.Add(ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.EventAt_DateTime));
model.Paging.ItemTotal = (ulong)ActivityMgr.GetOrganisationEventCount(prmEvent);
model.PopulatePagingTo(prmEvent.ResultsPaging);
// Item columns.
ColumnDfn colId = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Id);
ColumnDfn colEventAt = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.EventAt_DateTime);
ColumnDfn colEventTo = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.EventTo_DateTime);
ColumnDfn colEventTypeCode = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.EventTypeCode);
ColumnDfn colSummary = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Summary);
ColumnDfn colDetails = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Details);
ColumnDfn colRegionId = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.RegionIdCountry);
ColumnDfn colRegionName = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.Region_Name);
ColumnDfn colSportId = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.SportIdPrimary);
@@ -191,7 +239,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
ColumnDfn colCreatedOn = ActivityMgr.GetOrganisationEventColumnDfn(SaxOrganisationEvent.Column.CreateOn_Date);
List<ColumnDfn> columns = new List<ColumnDfn>()
{
colId, colEventAt, colEventTypeCode, colSummary, colDetails,
colId, colEventAt, colEventTo, colEventTypeCode, colSummary,
colRegionId, colRegionName, colSportId, colSportName,
colPublishedOn, colExpiresOn,
colStatus, colCreatedOn
@@ -207,15 +255,15 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
while (resultSet != null && resultSet.HasRows && resultSet.NextRecord())
{
NamedValue.Map values = resultSet.GetRecordValues();
DateTime eventAt = values.GetDateTime(colEventAt.DataName);
DateTime? eventTo = values.GetDateTime(colEventTo.DataName);
EventListData eventData = new EventListData()
{
Id = model.EncryptId(new SysId(values.GetLong(colId.DataName))),
EventDateFmt = Localiser.FormatDate(values.GetDateTime(colEventAt.DataName)),
EventTimeFmt = DateUtil.Format(values.GetDateTime(colEventAt.DataName), "HH:mm"),
EventAtDateFmt = Localiser.FormatDate(values.GetDateTime(colEventAt.DataName)),
TypeCode = values.GetString(colEventTypeCode.DataName),
TypeDesc = Localiser.GetEventTypeCaption((Sax.EventType)EventTypeCodes.GetTypeForCode(values.GetString(colEventTypeCode.DataName))),
Summary = ActivityMgr.GetOrganisationEventDataValue(colSummary, values).AsString(),
Details = ActivityMgr.GetOrganisationEventDataValue(colDetails, values).AsString(),
RegionCaptionCountry = model.GetRegionCaption(values.GetString(colRegionId.DataName).ToSysId()),
SportCaptionPrimary = model.GetSportCaption(values.GetString(colSportId.DataName).ToSysId()),
CreatedOnFmt = Localiser.FormatDate(values.GetDateTime(colCreatedOn.DataName)),
@@ -224,6 +272,14 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
StatusCode = values.GetString(colStatus.DataName),
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
};
if (SaxOrganisationEvent.HasValidEventTime(eventAt))
eventData.EventAtTimeFmt = DateUtil.Format(eventAt, "HH:mm");
if (DateUtil.IsValid(eventTo) && eventAt.Date != ((DateTime)eventTo).Date)
eventData.EventToDateFmt = Localiser.FormatDate(eventTo);
if (SaxOrganisationEvent.HasValidEventTime(eventTo))
eventData.EventToTimeFmt = DateUtil.Format(eventTo, "HH:mm");
if (DateUtil.IsValid(eventTo) && eventTo > eventAt)
eventData.EventAtTimeFmt = DateUtil.FormatNumberOfSeconds(((DateTime)eventTo - eventAt).TotalSeconds);
responseData.Events.Add(eventData);
}
}
@@ -254,7 +310,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
public IActionResult Ajax_GetEvent(Model_Organisation_Events model)
{
String fn = GetType().Name + ".Ajax_GetEvent";
String messageTitle = Localiser["organisation.caption.organisationEvent"];
String messageTitle = Localiser["organisation.caption.event"];
AjaxResponse_Event responseData = new AjaxResponse_Event(model);
// Validate session and referrer.
@@ -309,7 +365,7 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
public IActionResult Ajax_StoreEvent(Model_Organisation_Events model)
{
String fn = GetType().Name + ".Ajax_StoreEvent";
String messageTitle = Localiser["organisation.caption.organisationEvent"];
String messageTitle = Localiser["organisation.caption.event"];
AjaxResponse_Event responseData = new AjaxResponse_Event(model);
// Validate session and referrer.
@@ -388,11 +444,33 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
organisationEvent.SportIdPrimary = model.ExtractSysId(model.EventSportIdPrimary);
if (model.EventRegionIdCountry != null)
organisationEvent.RegionIdCountry = model.ExtractSysId(model.EventRegionIdCountry);
if (model.EventDate != null)
if (model.EventAtDate != null)
{
organisationEvent.EventAt = model.ParseDateFromForm(model.EventDate);
if (!StringUtil.IsEmpty(model.EventTime))
organisationEvent.EventAt = DateUtil.SetTime(organisationEvent.EventAt, DateUtil.ParseExact(model.EventTime, "HH:mm"));
// 'At' date.
organisationEvent.EventAt = model.ParseDateFromForm(model.EventAtDate);
if (model.EventAtTimeSet && !StringUtil.IsBlank(model.EventAtTime))
{
// For midnight (00:00) set +1 minute so that the value is treated as a valid start time.
if (model.EventAtTime.Equals("00:00"))
model.EventAtTime = "00:01";
organisationEvent.EventAt = DateUtil.SetTime(organisationEvent.EventAt, DateUtil.ParseExact(model.EventAtTime, "HH:mm"));
}
if (model.EventToDateSet || model.EventToTimeSet)
{
// 'To' date.
organisationEvent.EventTo = organisationEvent.EventAt;
if (model.EventToDate != null && model.EventToDateSet)
organisationEvent.EventTo = model.ParseDateFromForm(model.EventToDate);
// 'To' time.
if (model.EventAtTimeSet && model.EventToTimeSet && !StringUtil.IsBlank(model.EventToTime))
{
// For midnight (00:00) set +1 minute so that the value is treated as a valid finish time.
if (model.EventToTime.Equals("00:00"))
model.EventToTime = "00:01";
organisationEvent.EventTo = DateUtil.SetTime(organisationEvent.EventTo ?? organisationEvent.EventAt, DateUtil.ParseExact(model.EventToTime, "HH:mm"));
}
}
else organisationEvent.EventTo = null;
}
if (model.EventTypeCode != null)
organisationEvent.EventType = (Sax.EventType)EventTypeCodes.GetTypeForCode(model.EventTypeCode);
@@ -141,9 +141,14 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
prmUserOrganisation.UserAccountIdsIncluded.Add(SessionUserAccountId);
prmUserOrganisation.OrganisationStatusCat = SaxOrganisation.StatusCat.ActiveOnly;
prmUserOrganisation.OrganisationMembersOnly = true;
prmUserOrganisation.OrganisationRolesAny.AddRange(requiredRoles);
prmUserOrganisation.OrganisationRolesAny.UnionWith(requiredRoles);
prmUserOrganisation.StatusCat = SaxUserOrganisation.StatusCat.ActiveOnly;
if (organisationRole == Sax.OrganisationRole.ScheduleAdmin)
{
prmUserOrganisation.OrganisationHasScheduledEvents = true;
}
// Restrict to specified Organisation.
if (SysId.IsValid(filterOrganisationId))
{
@@ -154,6 +159,10 @@ namespace Saxonite.Net.Core.Web.Online.Controllers
prmUserOrganisation.OrganisationIdsIncluded.Clear();
}
// Clear 'Scheduled Events' flag if no organisations available.
if (prmUserOrganisation.OrganisationHasScheduledEvents && AccountMgr.GetUserOrganisationCount(prmUserOrganisation) < 1)
prmUserOrganisation.OrganisationHasScheduledEvents = false;
// Pick the first valid Organisation.
ColumnDfn colOrganisationId = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.OrganisationId);
ColumnDfn colOrganisationName = AccountMgr.GetUserOrganisationColumnDfn(SaxUserOrganisation.Column.Organisation_Name);
@@ -1,4 +1,6 @@
using Sarand.Net.Standard.Base.App;
using Microsoft.AspNetCore.Mvc.Rendering;
using NPOI.SS.Formula.Functions;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
@@ -16,12 +18,23 @@ namespace Saxonite.Net.Core.Web.Online.Models
//=======================================================================
public class Model_Organisation_Events : SaxModel_Online
{
//-------------------------------------------------------------------
// Definitions.
public enum PeriodType
{
FromThisWeek,
FromThisMonth,
FromLastMonth,
FromNextMonth,
Past,
}
//-------------------------------------------------------------------
// Construction.
public Model_Organisation_Events(SaxLocaliser localiser) :
base(localiser)
{
//AdditionalFiles_CSS.Add("css/sax-org-evt.css");
AdditionalFiles_CSS.Add("css/sax-org-evt.css");
AdditionalFiles_JS.Add("js/sax-org-evt.js");
}
@@ -31,6 +44,14 @@ namespace Saxonite.Net.Core.Web.Online.Models
{
public String OrganisationId { get; set; }
public String OrganisationCaption { get; set; }
public class PeriodData
{
public String Type { get; set; }
public PeriodType PeriodType { get { return EnumUtil.ParseEnum(Type, PeriodType.FromThisWeek); } }
public String FromDate { get; set; }
public String ToDate { get; set; }
}
public PeriodData Period { get; } = new PeriodData();
public String Event { get; set; }
}
public EventFilterData Filter { get; } = new EventFilterData();
@@ -46,14 +67,36 @@ namespace Saxonite.Net.Core.Web.Online.Models
// Region.
public String EventRegionIdCountry { get; set; }
// Event Content.
public String EventDate { get; set; }
public String EventTime { get; set; }
public String EventAtDate { get; set; }
public bool EventAtTimeSet { get; set; }
public String EventAtTime { get; set; }
public String EventDuration { get; set; }
public String EventDurationType { get; set; }
public String EventToDate { get; set; }
public bool EventToDateSet { get; set; }
public String EventToTime { get; set; }
public bool EventToTimeSet { get; set; }
public String EventTypeCode { get; set; }
public String EventSummary { get; set; }
public String EventDetails { get; set; }
public String EventStatusCode { get; set; }
public SaStatus EventStatus { get { return SacsSystem.GetStatusForCode(EventStatusCode); } }
//-------------------------------------------------------------------
// Period types.
public IEnumerable<SelectListItem> EventPeriodTypesForDropdown
{
get
{
List<SelectListItem> values = new List<SelectListItem>();
values.Add(new SelectListItem("From this week", PeriodType.FromThisWeek.ToString(), true));
values.Add(new SelectListItem("From this month", PeriodType.FromThisMonth.ToString()));
values.Add(new SelectListItem("From last month", PeriodType.FromLastMonth.ToString()));
values.Add(new SelectListItem("From next month", PeriodType.FromNextMonth.ToString()));
return values;
}
}
//-------------------------------------------------------------------
// Validation.
//-------------------------------------------------------------------
@@ -63,64 +106,125 @@ namespace Saxonite.Net.Core.Web.Online.Models
// Event type.
if (EventTypeCode != null)
{
String controlName = nameof(EventTypeCode);
if (StringUtil.IsEmpty(EventTypeCode))
responseData.SetControlError(nameof(EventTypeCode), Localiser["msg.validation.mandatory.value"]);
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
}
// Event date.
if (EventDate != null)
// Event At date.
if (EventAtDate != null)
{
DateTime eventOn = ParseDateFromForm(EventDate);
String controlName = nameof(EventAtDate);
DateTime eventOn = ParseDateFromForm(EventAtDate);
if (!DateUtil.IsValid(eventOn))
responseData.SetControlError(nameof(EventDate), Localiser["msg.validation.mandatory.value"]);
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
}
// Event time.
if (EventTime != null)
// Event At Time Set flag.
if (EventAtTimeSet)
{
String controlName = nameof(EventAtTime);
if (StringUtil.IsBlank(EventAtTime))
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
}
// Event At time.
if (EventAtTime != null && EventAtTimeSet)
{
String controlName = nameof(EventAtTime);
DateTime eventAt = DateUtil.ParseExact(EventAtTime, "HH:mm");
if (StringUtil.IsBlank(EventAtTime))
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
else if (!DateUtil.IsValid(eventAt))
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
}
// Event duration.
if (EventDuration != null)
{
String controlName = nameof(EventDuration);
}
// Event duration type.
if (EventDurationType != null)
{
String controlName = nameof(EventDurationType);
}
// Event To date.
if (EventToDate != null && EventToDateSet)
{
String controlName = nameof(EventToDate);
DateTime eventOn = ParseDateFromForm(EventToDate);
if (!DateUtil.IsValid(eventOn))
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
}
// Event To Time Set flag.
if (EventToTimeSet)
{
String controlName = nameof(EventToTime);
if (StringUtil.IsBlank(EventToTime))
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
}
// Event To time.
if (EventToTime != null && EventToTimeSet)
{
String controlName = nameof(EventToTime);
DateTime eventTo = DateUtil.ParseExact(EventToTime, "HH:mm");
if (StringUtil.IsBlank(EventToTime))
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
else if (!DateUtil.IsValid(eventTo))
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
}
// Event summary.
if (EventSummary != null)
{
responseData.SetControlValue(nameof(EventSummary), EventSummary);
String controlName = nameof(EventSummary);
responseData.SetControlValue(controlName, EventSummary);
if (StringUtil.IsEmpty(EventSummary))
responseData.SetControlError(nameof(EventSummary), Localiser["msg.validation.mandatory.value"]);
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
else if (StringUtil.GetLength(EventSummary) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_Summary))
responseData.SetControlError(nameof(EventSummary), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_Summary)]);
responseData.SetControlError(controlName, Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_Summary)]);
}
// Event details.
if (EventDetails != null)
{
responseData.SetControlValue(nameof(EventDetails), EventDetails);
String controlName = nameof(EventDetails);
responseData.SetControlValue(controlName, EventDetails);
if (StringUtil.GetLength(EventDetails) > GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_Details))
responseData.SetControlError(nameof(EventDetails), Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_Details)]);
responseData.SetControlError(controlName, Localiser["msg.validation.maximum.length", GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_Details)]);
}
// Event sport.
if (EventSportIdPrimary != null)
{
String controlName = "EventSportPrimary";
SysId articleSportId = ExtractSysId(EventSportIdPrimary);
if (!SysId.IsValid(articleSportId))
responseData.SetControlError("EventSportPrimary", Localiser["msg.validation.mandatory.value"]);
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
}
// Event region.
if (EventRegionIdCountry != null)
{
String controlName = "EventRegionCountry";
SysId articleRegionId = ExtractSysId(EventRegionIdCountry);
if (!SysId.IsValid(articleRegionId))
responseData.SetControlError("EventRegionCountry", Localiser["msg.validation.mandatory.value"]);
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
}
// Event status.
if (EventStatusCode != null)
{
String controlName = nameof(EventStatus);
if (StringUtil.IsEmpty(EventStatusCode))
responseData.SetControlError(nameof(EventStatus), Localiser["msg.validation.mandatory.value"]);
responseData.SetControlError(controlName, Localiser["msg.validation.mandatory.value"]);
else if (!SaxOrganisationEvent.ValidStatuses.Contains(EventStatus))
responseData.SetControlError(nameof(EventStatus), Localiser["msg.validation.invalid.value"]);
responseData.SetControlError(controlName, Localiser["msg.validation.invalid.value"]);
}
return !responseData.HasControlErrors();
@@ -10,7 +10,8 @@
<ItemGroup>
<PackageReference Include="jQuery.UI.Combined" Version="1.13.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.30" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.31" />
<PackageReference Include="Moment.js" Version="2.30.1" />
<PackageReference Include="System.Collections.Specialized" Version="4.3.0" />
</ItemGroup>
@@ -34,6 +35,10 @@
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Update="wwwroot\css\sax-org-evt.css">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Update="wwwroot\rjs\sax-rjs.css">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
@@ -8,6 +8,7 @@
<script type="text/javascript">
sax.lbl.edit = '@(Localiser.GetJavascriptText("label.edit"))';
sax.lbl.copy = '@(Localiser.GetJavascriptText("label.copy"))';
</script>
@* Filter Form *@
@@ -31,16 +32,18 @@
</div>
<div class="sax-content">
<div class="sax-control row">
<div class="col-sm-4"><div class="sax-label text-left text-sm-right">@Localiser["label.organisation"]</div></div>
<div class="col-sm-8 row">
<div class="col-sm-3"><div class="sax-label text-left text-sm-right">@Localiser["label.organisation"]</div></div>
<div class="col-sm-9 row">
@Html.HiddenFor(model => model.Filter.OrganisationId, new { @id = "ifFilterOrganisationId", @class = "FilterOrganisationId" })
<div class="col"><input type="text" id="ifFilterOrganisation" class="FilterOrganisation sax-input" readonly="readonly" value="@(Model.Filter.OrganisationCaption)" /></div>
<div class="fixed"><button class="sax-button SelectFilterOrganisation">@Localiser["label.select"]</button></div>
</div>
</div>
<div class="sax-control row">
<div class="col-sm-4"><div class="sax-label text-left text-sm-right">@Localiser["label.search"]</div></div>
<div class="col-sm-8"><input type="search" id="ifEventFilter" name="Filter.Event" class="EventFilter sax-input" maxlength="64" autocomplete="off" /></div>
<div class="col-sm-3"><div class="sax-label text-left text-sm-right">@Localiser["label.period"]</div></div>
<div class="col-sm-3">@Html.DropDownListFor(model => model.Filter.Period.Type, Model.EventPeriodTypesForDropdown, new { @id = "cbFilterPeriodType", @class = "FilterPeriodType sax-select" })</div>
<div class="col-sm-3"><div class="sax-label text-left text-sm-right">@Localiser["label.search"]</div></div>
<div class="col-sm-3"><input type="search" id="ifEventFilter" name="Filter.Event" class="EventFilter sax-input" maxlength="64" autocomplete="off" /></div>
</div>
</div>
@@ -59,18 +62,35 @@
@* Results Panel *@
<div class="sax-panel-results">
<div class="sax-panel-messages"></div>
<div class="sax-panel-item-list"></div>
<div class="sax-panel-item-table">
<div class="sax-panel-info" style="min-height:120px;max-height:100%;overflow-y:auto;">
<table class="sax-item-list">
<thead>
<tr>
<th class="center">@Localiser["label.date"]</th>
<th class="center">@Localiser["label.time"]</th>
<th class="">@Localiser["label.summary"]</th>
<th class="center">@Localiser["label.published"]</th>
<th class="center">@Localiser["label.actions"]</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
@* Element templates *@
<div class="sax-panel-item-template">
@* Item template *@
<div class="sax-panel-item Event">
<div class="sax-header row">
<div class="col">
<div class="sax-caption"><div class="sax-action"><span class="EventDate"></span><span class=""></span></div></div>
</div>
<div class="fixed sax-actions">
<table>
<tr class="sax-row-item Event">
<td><div class="EventAtDate center"></div></td>
<td><div class="EventAtTime center"></div></td>
<td><div class="EventSummary pointer"></div></td>
<td><div class="EventPublishedOn center"></div></td>
<td>
<div class="EventActions center">
@* Burger menu *@
<ul class="nav navbar-nav navbar-light navbar-right sax-burger">
<li class="dropdown-toggle caret-off">
@@ -79,20 +99,9 @@
</li>
</ul>
</div>
</div>
<div class="sax-content">
<div class="row">
<div class="col-sm-12"><div class="EventSummary"></div></div>
<div class="col-sm-6"><div class="EventRegionCaption sax-note"></div></div>
<div class="col-sm-6 right"><div class="EventSportCaption sax-note"></div></div>
</div>
<div class="row">
<div class="col-sm-4"><div class="sax-note">@Localiser["label.created"]:&nbsp;<span class="EventCreatedOn"></span></div></div>
<div class="col-sm-4"><div class="EventPublished sax-note">@Localiser["label.published"]:&nbsp;<span class="EventPublishedOn"></span></div></div>
<div class="col-sm-4 right"><div class="EventStatusDesc sax-note"></div></div>
</div>
</div>
</div>
</td>
</tr>
</table>
@* Burger dropdown item template - ul is ignored *@
<ul class="sax-dropdown-menu Event">
@@ -2,6 +2,11 @@
@inject SaxLocaliser Localiser
@{
/* Organisation Events - Event dialog panel */
//Model.AdditionalFiles_CSS.Add("lib/jquery-timepicker/jquery.timepicker.min.css");
//Model.AdditionalFiles_JS.Add("lib/jquery-timepicker/jquery.timepicker.min.js");
//Model.AdditionalFiles_CSS.Add("lib/bootstrap4-datetimepicker/bootstrap-datetimepicker.min.css");
//Model.AdditionalFiles_JS.Add("lib/moment.js/moment.min.js");
//Model.AdditionalFiles_JS.Add("lib/bootstrap4-datetimepicker/bootstrap-datetimepicker.min.js");
}
<script type="text/javascript">
@@ -41,20 +46,80 @@
</div>
</div>
@* Event date and time *@
<div class="sax-form-control EventDate">
@* Event At date and time *@
<div class="sax-form-control EventAtDate">
<div class="row">
<div class="col-sm-3">
<div class="sax-label">
<label for="ifEventDate"><span>@Localiser["label.occurs"]</span><span class="required">&nbsp;*</span></label>
<label for="ifEventAtDate"><span>@Localiser["label.occurs"]</span><span class="required">&nbsp;*</span></label>
</div>
</div>
<div class="col-sm">
<div class="row">
<div class="col-sm">
<div class="sax-control">
<input id="ifEventDate" name="EventDate" class="EventDate sax-input sax-calendar" readonly="readonly" />
<input id="ifEventAtDate" name="EventAtDate" class="EventAtDate sax-input sax-calendar" readonly="readonly" />
</div>
<div class="sax-message"></div>
</div>
<div class="col-sm">
<div class="row">
<div class="col pl-sm-4 pt-2">
@Html.CheckBoxFor(model => model.EventAtTimeSet, new { @id = "chkEventAtTimeSet", @class = "sax-checkbox" })
&nbsp;
<span class="sax-label pointer" onclick="$('#chkEventAtTimeSet').click()">@Localiser["label.starts"]</span>
</div>
<div class="col">
<div class="sax-control">
<input type="time" id="ifEventAtTime" name="EventAtTime" class="EventAtTime sax-input" />
</div>
<div class="sax-message"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@* Event To date and time *@
<div class="sax-form-control EventToDate">
<div class="row">
<div class="col-sm-3 row">
<div class="col">
<div class="sax-label"><span>@Localiser["label.until"]</span></div>
</div>
<div class="fixed">
<div class="pt-2 pr-2">
@Html.CheckBoxFor(model => model.EventToDateSet, new { @id = "chkEventToDateSet", @class = "sax-checkbox" })
</div>
</div>
</div>
<div class="col-sm">
<div class="row">
<div class="col-sm">
<div class="sax-control">
<input id="ifEventToDate" name="EventToDate" class="EventToDate sax-input sax-calendar" readonly="readonly" />
</div>
<div class="sax-message"></div>
</div>
<div class="col-sm">
<div class="row">
<div class="col pl-sm-4 pt-2">
@Html.CheckBoxFor(model => model.EventToTimeSet, new { @id = "chkEventToTimeSet", @class = "sax-checkbox" })
&nbsp;
<span class="sax-label pointer" onclick="$('#chkEventToTimeSet').click()">@Localiser["label.finishes"]</span>
</div>
<div class="col">
<div class="sax-control">
<input type="time" id="ifEventToTime" name="EventToTime" class="EventToTime sax-input" />
</div>
<div class="sax-message"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -64,7 +129,13 @@
<label for="ifEventSummary"><span>@Localiser["label.summary"]</span><span class="required">&nbsp;*</span></label>
</div>
<div class="sax-control">
@Html.TextAreaFor(model => model.EventSummary, new { @id = "ifEventSummary", @class = "EventSummary sax-textarea", @rows = 3, @maxlength = @Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_Summary) })
@Html.TextAreaFor(model => model.EventSummary, new
{
@id = "ifEventSummary",
@class = "EventSummary sax-textarea",
@rows = 3,
@maxlength = @Model.GetControlMaxLength(SaxDbDfn_Core.ColumnIdx.OrganisationEvent_Summary)
})
</div>
<div class="sax-message"></div>
</div>
@@ -86,6 +86,8 @@
/* Contact image */
.sax-profile .sax-contact-image.AccountContact
{
min-width: 48px;
min-height: 48px;
max-width: 160px;
max-height: 160px;
margin: 0 8px;
+78 -21
View File
@@ -62,7 +62,7 @@
.sax-panel-filter > .sax-content .sax-label
{
padding: 2px 12px 2px 0;
padding: 6px 12px 2px 0;
text-align: right;
}
@@ -98,20 +98,20 @@
background-color: #e0e0e0;
}
/* Panel header - Burger */
/* Nav - Burger menu */
.sax-header ul.nav.sax-burger
ul.nav.sax-burger
{
margin: 0;
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu
ul.nav.sax-burger ul.sax-dropdown-menu
{
padding: 4px 8px 4px 4px;
box-shadow: 0 0 8px 2px #80808080;
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item
{
margin: 2px 4px 2px 0;
padding: 2px 4px 2px 30px;
@@ -119,84 +119,89 @@
background-position: left center;
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-refresh
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-refresh
{
background-image: url('../img/action/refresh24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-info
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-info
{
background-image: url('../img/action/info24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-add
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-add
{
background-image: url('../img/action/add24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-edit
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-edit
{
background-image: url('../img/action/edit24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-remove
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-copy
{
background-image: url('../img/action/copy24.png');
}
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-remove
{
background-image: url('../img/action/delete24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-experience
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-experience
{
background-image: url('../img/action/trophy24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-user
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-user
{
background-image: url('../img/action/user24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-users
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-users
{
background-image: url('../img/action/users24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-mail
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-mail
{
background-image: url('../img/action/mail24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-location
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-location
{
background-image: url('../img/action/location-24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-image
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-image
{
background-image: url('../img/action/image-24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-process
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-process
{
background-image: url('../img/action/process24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-close
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item.sax-close
{
background-image: url('../img/action/prev24.png');
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item:hover
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item:hover
{
background-color: #f8f8f8;
box-shadow: none;
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item .sax-label
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item .sax-label
{
margin: 0;
padding: 0 0 0 4px;
}
.sax-header ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item:hover .sax-label
ul.nav.sax-burger ul.sax-dropdown-menu li.sax-action.sax-dropdown-item:hover .sax-label
{
background-color: #f8f8f8;
box-shadow: 0 0 2px 1px #80808080;
@@ -251,6 +256,58 @@
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: separate;
overflow: auto;
}
table.sax-item-list thead tr
{
}
table.sax-item-list thead th
{
position: sticky;
top: 0;
padding: 4px 2px 2px 2px;
z-index: 1;
background-color: #f8f8f8;
border-bottom:1px solid #d0d0d0;
}
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;
}
table.sax-item-list tbody td
{
padding: 0 2px;
}
/* Item */
.sax-panel-item-template
@@ -136,7 +136,7 @@
.sax-form .sax-form-control .sax-caption,
.sax-form .sax-form-control .sax-label
{
margin: 0 0 4px 0;
margin: 4px 0 2px 0;
font-size: 1rem;
line-height: 1.25;
}
@@ -195,9 +195,9 @@
.sax-form .sax-input:read-only, .sax-form .sax-textarea:read-only, .sax-form .sax-select:disabled
{
color: #202020;
color: #404040;
opacity: 1;
background-color: #f8f8f8;
background-color: #f0f0f0;
}
.sax-form .sax-form-control.sax-error .sax-input, .sax-form .sax-form-control.sax-error .sax-textarea, .sax-form .sax-form-control.sax-error .sax-select
@@ -0,0 +1,12 @@
/*
Organisation Events stylesheet.
*/
/* Item Burger */
.dropdown-menu.sax-dropdown-menu
{
left: -18px !important;
}
/* The End */
@@ -1,5 +1,5 @@
/*
Admin - Code Selection stylesheet.
Organisation selection stylesheet.
*/
/* Panels */
@@ -139,6 +139,22 @@
}
});
}
sax.initTimePickers = function (sel, opt)
{
if (window.jQuery().timepicker)
{
opt = opt || {};
opt.format = opt.format || 'H:i';
$(sel).timepicker(opt);
return;
}
if (window.jQuery().datetimepicker)
{
opt = opt || {};
opt.format = opt.format || 'HH:mm';
return $(sel).datetimepicker(opt);
}
}
sax.refreshPaging = function (response, context, refreshFn)
{
if (sax.mdl.resultsPaging.fn.refreshPaging)
+104 -29
View File
@@ -5,7 +5,7 @@
{
"use strict";
let oe = sax.OrgEvt = { data: {}, fn: {} };
let $pnl = oe.$pnl = {}, $frm = oe.$frm = {}, $dlg = oe.$dlg = {};
let $pnl = oe.$pnl = {}, $frm = oe.$frm = {}, $ctrl = oe.$ctrl = {}, $dlg = oe.$dlg = {};
//--------------------------------------------------------------
oe.refreshResults = function (delay)
{
@@ -13,8 +13,8 @@
if (!sax.awaitingRefreshResponse)
{
$('.sax-burger', $pnl.filter).hide();
$('.sax-panel-item-list', $pnl.results).fadeOut(200).empty();
$('.sax-panel-messages', $pnl.results).hide().empty().append($('<div class="sax-message">' + sax.msg.dataQuerying + '</div>')).fadeIn(200);
$('tbody tr', $pnl.table).remove();
$pnl.msgs.hide().empty();//.append($('<div class="sax-message">' + sax.msg.dataQuerying + '</div>')).fadeIn(200);
}
sax.ajax.refreshResults = sax.ajax.refreshResults || { url: sax.url.base + 'Organisation/Ajax/GetEventList', formId: 'frmEventFilter', callbackFn: oe.doRefreshResults };
sax.doAjaxRequest(sax.ajax.refreshResults, delay || 50);
@@ -25,13 +25,14 @@
//sax.debug('doRefreshResults', response);
delete sax.awaitingRefreshResponse;
sax.refreshControlValues(response.controlValues);
var $msgs = $('.sax-panel-messages', $pnl.results).hide().empty();
var $items = $('.sax-panel-item-list', $pnl.results).hide().empty();
$pnl.msgs.hide().empty();
$('tbody tr', $pnl.table).remove();
if (!response.success) return;
oe.data.organisation = response.organisation;
// Reference data - Event types.
if (response.eventTypes)
sax.populateSelectCodeDesc('#cbEventType', response.eventTypes);
oe.data.eventTypeDefault = response.eventTypeDefault;
// Menu.
let $bgr = $('.sax-burger', $pnl.filter);
let $mnu = $('ul.sax-dropdown-menu', $bgr).empty();
@@ -42,28 +43,28 @@
// Items.
var items = response.events;
if (!items.length)
return $msgs.append($('<div class="sax-message">' + sax.msg.dataNoneFound + '</div>')).fadeIn(500);
return $pnl.msgs.append($('<div class="sax-message">' + sax.msg.dataNoneFound + '</div>')).fadeIn(500);
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
$items.append(oe.populateItem(oe.getItemTemplate(), items[itemIdx]));
$items.fadeIn(50);
$pnl.table.append(oe.populateItem(oe.getItemRowTemplate(), items[itemIdx]));
}
oe.populateItem = function ($item, item)
{
if (!item) return;
$('.sax-panel-results .sax-panel-messages').hide().empty();
$('.EventType', $item).text(item.typeDesc);
$('.EventDate', $item).text(item.eventDateFmt);
$('.EventTime', $item).text(item.eventTimeFmt);
$('.EventAtDate', $item).text(item.eventAtDateFmt);
$('.EventAtTime', $item).text(item.eventAtTimeFmt || '');
$('.EventToDate', $item).text(item.eventToDateFmt || item.eventAtDateFmt);
$('.EventToTime', $item).text(item.eventToTimeFmt || '');
$('.EventSummary', $item).text(item.summary);
$('.EventDetails', $item).text(item.details);
$('.EventDetails', $item).text(item.details || '');
$('.EventSportCaption', $item).text(item.sportCaptionPrimary);
$('.EventRegionCaption', $item).text(item.regionCaptionCountry);
$('.EventCreatedOn', $item).text(item.createdOnFmt);
$('.EventPublishedOn', $item).text(item.publishedOnFmt);
$('.EventPublishedOn', $item).text(item.publishedOnFmt || '');
$('.EventPublished', $item).toggle(!!item.publishedOnFmt);
$('.EventExpiresOn', $item).text(item.expiresOnFmt);
$('.EventExpiresOn', $item).text(item.expiresOnFmt || '');
$('.EventExpires', $item).toggle(!!item.expiresOnFmt);
$('.EventStatusDesc', $item).text(item.statusDesc).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.EventStatusDesc', $item).text(item.statusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sax-status-\S+/g) || []).join(' '); }).addClass('sax-status-' + item.statusCode.toLowerCase());
let $bgr = $('.sax-burger', $item);
let $mnu = $('ul.sax-dropdown-menu', $bgr).empty();
@@ -72,8 +73,10 @@
if (sax.data.userCanManageEvents)
{
let fnUpd = function () { oe.updateItem(item, $item) };
let fnCopy = function () { oe.copyItem(item, $item) };
$mnu.append(oe.getItemMenuOption(sax.lbl.edit, fnUpd, 'sax-edit'));
$('.sax-caption .sax-action', $item).off('click').on('click', fnUpd);
$mnu.append(oe.getItemMenuOption(sax.lbl.copy, fnCopy, 'sax-copy'));
$('td div.EventSummary,.sax-caption .sax-action', $item).off('click').on('click', fnUpd);
$item.off('dblclick').on('dblclick', fnUpd);
}
}
@@ -86,9 +89,9 @@
{
return $('.sax-panel-item-template .sax-dropdown-menu.Events li.sax-dropdown-item', sax.$pnl.filter).clone();
}
oe.getItemTemplate = function ()
oe.getItemRowTemplate = function ()
{
return $('.sax-panel-item-template .sax-panel-item.Event', sax.$pnl.results).clone();
return $('.sax-panel-item-template table tr.sax-row-item.Event', sax.$pnl.results).clone();
}
oe.getItemDropdownTemplate = function ()
{
@@ -162,7 +165,7 @@
{
if (!sax.data.userCanManageEvents) return;
oe.clearItem();
$('#cbEventType', $frm.evt).prepend($("<option>", { value: '', selected: true }));
$('#cbEventType', $frm.evt).prepend($("<option>", { value: '' })).val(oe.data.eventTypeDefault || '');
$('#ifEventSportIdPrimary', $frm.evt).val(oe.data.organisation.sportId);
$('#ifEventSportCaptionPrimary', $frm.evt).val(oe.data.organisation.sportName);
$('#ifEventRegionIdCountry', $frm.evt).val(oe.data.organisation.regionId);
@@ -175,7 +178,9 @@
delete oe.$item;
$('#ifEventId,#ifEventExists,#ifEventSportIdPrimary,#ifEventRegionIdCountry,input[type="text"],textarea,select', $frm.evt).val('');
$('#cbEventType', $frm.evt).find('option[value=""]').remove();
$('.EventDate', $frm.evt).datepicker('setDate', 'today');
$('.EventAtDate,.EventToDate', $frm.evt).datepicker('setDate', 'today');
$('.sax-checkbox').prop('checked', false);
$('input[type="time"]', $frm.evt).val('12:00').prop('readonly', true);
sax.clearControlErrors();
}
//--------------------------------------------------------------
@@ -195,8 +200,29 @@
let item = response.event;
$('#ifEventId', $frm.evt).val(item.id);
$('#ifEventExists', $frm.evt).val(1);
oe.populateItemForm(item);
$dlg.event.dialog('option', 'title', sax.dlg.title.updateEvent);
sax.openDialog($dlg.event, 600, 600);
}
oe.populateItemForm = function (item)
{
$('#cbEventType', $frm.evt).val(item.typeCode);
$('#ifEventDate', $frm.evt).val(item.eventOn_Calendar);
$ctrl.atDate.val(item.eventAt_Calendar);
if (!!item.eventAt_HHMM)
{
$ctrl.atTimeSet.prop('checked', true);
$ctrl.atTime.val(item.eventAt_HHMM).prop('readonly', false);
}
$ctrl.toDateSet.prop('checked', !!item.eventTo_Calendar);
$ctrl.toDate.val(item.eventTo_Calendar);
if (!!item.eventTo_HHMM)
{
$ctrl.toTimeSet.prop('checked', true);
$ctrl.toTime.val(item.eventTo_HHMM).prop('readonly', false);
}
oe.onAtTimeSetChange();
oe.onToDateSetChange();
oe.onToTimeSetChange();
$('#ifEventSummary', $frm.evt).val(item.summary);
$('#ifEventDetails', $frm.evt).val(item.details);
$('#ifEventSportIdPrimary', $frm.evt).val(item.sportIdPrimary);
@@ -205,10 +231,48 @@
$('#ifEventRegionCaptionCountry', $frm.evt).val(item.regionCaptionCountry);
$('#cbEventStatusCode', $frm.evt).val(item.statusCode);
sax.clearControlErrors();
$dlg.event.dialog('option', 'title', sax.dlg.title.updateEvent);
}
//--------------------------------------------------------------
oe.copyItem = function (item, $item)
{
if (!sax.data.userCanManageEvents) return;
oe.clearItem();
delete oe.$item;
$('.EventId', $frm.evtId).val(item.id);
sax.ajax.copyItem = sax.ajax.copyItem || { url: sax.url.base + 'Organisation/Ajax/GetEvent', formId: 'frmEventId', callbackFn: oe.onCopyItem };
sax.doAjaxRequest(sax.ajax.copyItem, 50);
}
oe.onCopyItem = function (response)
{
//sax.debug('onCopyItem', response);
if (!response.success) return;
oe.populateItemForm(response.event);
$dlg.event.dialog('option', 'title', sax.dlg.title.createEvent);
sax.openDialog($dlg.event, 600, 600);
}
//--------------------------------------------------------------
oe.onAtTimeSetChange = function ()
{
let atTimeSet = !!$ctrl.atTimeSet.prop('checked');
$ctrl.atTime.prop('readonly', !atTimeSet);
if (!atTimeSet) $ctrl.toTimeSet.prop('checked', false).prop('readonly', true).trigger('change');
else $ctrl.toTimeSet.prop('readonly', false);
}
oe.onToDateSetChange = function ()
{
let toDateSet = !!$ctrl.toDateSet.prop('checked');
$ctrl.toDate.datepicker('option', 'disabled', !toDateSet);
if (toDateSet && !$ctrl.toDate.val())
$ctrl.toDate.val($ctrl.atDate.val());
}
oe.onToTimeSetChange = function ()
{
if (!!$ctrl.toTimeSet.prop('readonly'))
$ctrl.toTimeSet.prop('checked', false);
let toTimeSet = !!$ctrl.toTimeSet.prop('checked');
$ctrl.toTime.prop('readonly', !toTimeSet);
}
//--------------------------------------------------------------
oe.storeItem = function ()
{
sax.ajax.storeItem = sax.ajax.storeItem || { url: sax.url.base + 'Organisation/Ajax/StoreEvent', formId: 'frmEvent', callbackFn: oe.onStoreItem };
@@ -224,8 +288,8 @@
var item = response.event;
if (!oe.$item || oe.$item.length != 1)
{
oe.$item = $('.sax-panel-item-template .sax-panel-item', $pnl.results).clone();
$('.sax-panel-item-list', $pnl.results).prepend(oe.$item).show();
oe.$item = oe.getItemRowTemplate();
$('tbody', $pnl.table).prepend(oe.$item);
}
oe.populateItem(oe.$item, item)
}
@@ -235,24 +299,35 @@
$pnl.events = $('.sax-panel.Events');
$pnl.filter = $('.sax-panel-filter', $pnl.events);
$pnl.results = $('.sax-panel-results', $pnl.events);
$pnl.msgs = $('.sax-panel-messages', $pnl.results);
$pnl.table = $('.sax-item-list', $pnl.results);
$frm.filter = $('#frmEventFilter', $pnl.events);
$frm.filter.on('change', '.FilterPeriodType', function () { oe.refreshResults(250); });
$('.EventFilter', $frm.filter).on('input', function () { oe.refreshResults(250); }).on('keypress', function (event)
{
if (event.keyCode == 13) setTimeout(oe.refreshResults, 50);
});
$frm.filter.on('dblclick', 'input.FilterOrganisation', oe.selectFilterOrganisation).on('click', 'button.SelectFilterOrganisation', oe.selectFilterOrganisation);
$frm.evtId = $('#frmEventId');
$frm.evt = $('#frmEvent');
$('.sax-input', $frm.evt).on('input', function () { sax.clearControlError(this); });
sax.initCalendars('#frmEvent .sax-input.sax-calendar', { maxDate: '+700' });
$frm.evt.on('dblclick', 'input.EventSportCaptionPrimary', oe.selectSportPrimary).on('click', 'button.SelectEventSportPrimary', oe.selectSportPrimary);
$frm.evt.on('dblclick', 'input.EventRegionCaptionCountry', oe.selectRegionCountry).on('click', 'button.SelectEventRegionCountry', oe.selectRegionCountry);
var opt = sax.dlgOpts();
opt.buttons[sax.dlg.btn.ok] = function () { oe.storeItem(); };
opt.buttons[sax.dlg.btn.cancel] = function () { $(this).dialog('close'); };
$dlg.event = $('#dlgEvent').dialog(opt);
$frm.evt = $('#frmEvent');
$('.sax-input', $frm.evt).on('input', function () { sax.clearControlError(this); });
sax.initCalendars('#frmEvent .sax-input.sax-calendar', { maxDate: '+700' });
$ctrl.atDate = $('#ifEventAtDate', $frm.evt);
$ctrl.atTimeSet = $('.sax-checkbox#chkEventAtTimeSet', $frm.evt).on('change', oe.onAtTimeSetChange);
$ctrl.atTime = $('#ifEventAtTime', $frm.evt);
$ctrl.toDateSet = $('.sax-checkbox#chkEventToDateSet', $frm.evt).on('change', oe.onToDateSetChange);
$ctrl.toDate = $('#ifEventToDate', $frm.evt);
$ctrl.toTimeSet = $('.sax-checkbox#chkEventToTimeSet', $frm.evt).on('change', oe.onToTimeSetChange);
$ctrl.toTime = $('#ifEventToTime', $frm.evt);
$frm.evt.on('dblclick', 'input.EventSportCaptionPrimary', oe.selectSportPrimary).on('click', 'button.SelectEventSportPrimary', oe.selectSportPrimary);
$frm.evt.on('dblclick', 'input.EventRegionCaptionCountry', oe.selectRegionCountry).on('click', 'button.SelectEventRegionCountry', oe.selectRegionCountry);
setTimeout(oe.refreshResults, 250);
});
//--------------------------------------------------------------
@@ -54,7 +54,7 @@
$('.MemberDisplayName', $item).text(item.displayName);
$('.MemberRoles', $item).text(item.memberRoles);
$('.MemberAdminComment', $item).text(item.adminComment);
$('.MemberStatus', $item).text(item.statusDesc).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.MemberStatus', $item).text(item.statusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sax-status-\S+/g) || []).join(' '); }).addClass('sax-status-' + item.statusCode.toLowerCase());
let $bgr = $('.sax-burger', $item);
let $mnu = $('ul.sax-dropdown-menu', $bgr).empty();
if (sax.data.userCanManageMembers)
@@ -61,7 +61,7 @@
$('.OpportunityPublished', $item).toggle(!!item.publishedOnFmt);
$('.OpportunityExpiresOn', $item).text(item.expiresOnFmt);
$('.OpportunityExpires', $item).toggle(!!item.expiresOnFmt);
$('.OpportunityStatusDesc', $item).text(item.statusDesc).addClass('sax-status-' + item.statusCode.toLowerCase());
$('.OpportunityStatusDesc', $item).text(item.statusDesc).removeClass(function (idx, name) { return (name.match(/(^|\s)sax-status-\S+/g) || []).join(' '); }).addClass('sax-status-' + item.statusCode.toLowerCase());
let $bgr = $('.sax-burger', $item);
let $mnu = $('ul.sax-dropdown-menu', $bgr).empty();
@@ -0,0 +1,262 @@
.sr-only, .bootstrap-datetimepicker-widget .btn[data-action="incrementHours"]::after, .bootstrap-datetimepicker-widget .btn[data-action="incrementMinutes"]::after, .bootstrap-datetimepicker-widget .btn[data-action="decrementHours"]::after, .bootstrap-datetimepicker-widget .btn[data-action="decrementMinutes"]::after, .bootstrap-datetimepicker-widget .btn[data-action="showHours"]::after, .bootstrap-datetimepicker-widget .btn[data-action="showMinutes"]::after, .bootstrap-datetimepicker-widget .btn[data-action="togglePeriod"]::after, .bootstrap-datetimepicker-widget .btn[data-action="clear"]::after, .bootstrap-datetimepicker-widget .btn[data-action="today"]::after, .bootstrap-datetimepicker-widget .picker-switch::after, .bootstrap-datetimepicker-widget table th.prev::after, .bootstrap-datetimepicker-widget table th.next::after {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
/*!
* Datetimepicker for Bootstrap 3
* ! version : 4.7.14
* https://github.com/Eonasdan/bootstrap-datetimepicker/
*/
.bootstrap-datetimepicker-widget {
list-style: none;
}
.bootstrap-datetimepicker-widget.dropdown-menu {
margin: 2px 0;
padding: 4px;
width: 19em;
}
@media (min-width: 540px) {
.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {
width: 38em;
}
}
@media (min-width: 720px) {
.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {
width: 38em;
}
}
@media (min-width: 960px) {
.bootstrap-datetimepicker-widget.dropdown-menu.timepicker-sbs {
width: 38em;
}
}
.bootstrap-datetimepicker-widget.dropdown-menu:before, .bootstrap-datetimepicker-widget.dropdown-menu:after {
content: '';
display: inline-block;
position: absolute;
}
.bootstrap-datetimepicker-widget.dropdown-menu.bottom:before {
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-bottom-color: rgba(0, 0, 0, 0.2);
top: -7px;
left: 7px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.bottom:after {
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid white;
top: -6px;
left: 8px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.top:before {
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-top: 7px solid #ccc;
border-top-color: rgba(0, 0, 0, 0.2);
bottom: -7px;
left: 6px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.top:after {
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid white;
bottom: -6px;
left: 7px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.pull-right:before {
left: auto;
right: 6px;
}
.bootstrap-datetimepicker-widget.dropdown-menu.pull-right:after {
left: auto;
right: 7px;
}
.bootstrap-datetimepicker-widget .list-unstyled {
margin: 0;
}
.bootstrap-datetimepicker-widget a[data-action] {
padding: 6px 0;
}
.bootstrap-datetimepicker-widget a[data-action]:active {
box-shadow: none;
}
.bootstrap-datetimepicker-widget .timepicker-hour, .bootstrap-datetimepicker-widget .timepicker-minute, .bootstrap-datetimepicker-widget .timepicker-second {
width: 54px;
font-weight: bold;
font-size: 1.2em;
margin: 0;
}
.bootstrap-datetimepicker-widget button[data-action] {
padding: 6px;
}
.bootstrap-datetimepicker-widget .btn[data-action="incrementHours"]::after {
content: "Increment Hours";
}
.bootstrap-datetimepicker-widget .btn[data-action="incrementMinutes"]::after {
content: "Increment Minutes";
}
.bootstrap-datetimepicker-widget .btn[data-action="decrementHours"]::after {
content: "Decrement Hours";
}
.bootstrap-datetimepicker-widget .btn[data-action="decrementMinutes"]::after {
content: "Decrement Minutes";
}
.bootstrap-datetimepicker-widget .btn[data-action="showHours"]::after {
content: "Show Hours";
}
.bootstrap-datetimepicker-widget .btn[data-action="showMinutes"]::after {
content: "Show Minutes";
}
.bootstrap-datetimepicker-widget .btn[data-action="togglePeriod"]::after {
content: "Toggle AM/PM";
}
.bootstrap-datetimepicker-widget .btn[data-action="clear"]::after {
content: "Clear the picker";
}
.bootstrap-datetimepicker-widget .btn[data-action="today"]::after {
content: "Set the date to today";
}
.bootstrap-datetimepicker-widget .picker-switch {
text-align: center;
}
.bootstrap-datetimepicker-widget .picker-switch::after {
content: "Toggle Date and Time Screens";
}
.bootstrap-datetimepicker-widget .picker-switch td {
padding: 0;
margin: 0;
height: auto;
width: auto;
line-height: inherit;
}
.bootstrap-datetimepicker-widget .picker-switch td span {
line-height: 2.5;
height: 2.5em;
width: 100%;
}
.bootstrap-datetimepicker-widget table {
width: 100%;
margin: 0;
}
.bootstrap-datetimepicker-widget table td, .bootstrap-datetimepicker-widget table th {
text-align: center;
border-radius: 0.25rem;
}
.bootstrap-datetimepicker-widget table th {
height: 20px;
line-height: 20px;
width: 20px;
}
.bootstrap-datetimepicker-widget table th.picker-switch {
width: 145px;
}
.bootstrap-datetimepicker-widget table th.disabled, .bootstrap-datetimepicker-widget table th.disabled:hover {
background: none;
color: #636c72;
cursor: not-allowed;
}
.bootstrap-datetimepicker-widget table th.prev::after {
content: "Previous Month";
}
.bootstrap-datetimepicker-widget table th.next::after {
content: "Next Month";
}
.bootstrap-datetimepicker-widget table thead tr:first-child th {
cursor: pointer;
}
.bootstrap-datetimepicker-widget table thead tr:first-child th:hover {
background: #eceeef;
}
.bootstrap-datetimepicker-widget table td {
height: 54px;
line-height: 54px;
width: 54px;
}
.bootstrap-datetimepicker-widget table td.cw {
font-size: .8em;
height: 20px;
line-height: 20px;
color: #636c72;
}
.bootstrap-datetimepicker-widget table td.day {
height: 20px;
line-height: 20px;
width: 20px;
padding: 5px;
}
.bootstrap-datetimepicker-widget table td.day:hover, .bootstrap-datetimepicker-widget table td.hour:hover, .bootstrap-datetimepicker-widget table td.minute:hover, .bootstrap-datetimepicker-widget table td.second:hover {
background: #eceeef;
cursor: pointer;
}
.bootstrap-datetimepicker-widget table td.old, .bootstrap-datetimepicker-widget table td.new {
color: #636c72;
}
.bootstrap-datetimepicker-widget table td.today {
position: relative;
}
.bootstrap-datetimepicker-widget table td.today:before {
content: '';
display: inline-block;
border: solid transparent;
border-width: 0 0 7px 7px;
border-bottom-color: #0275d8;
border-top-color: rgba(0, 0, 0, 0.2);
position: absolute;
bottom: 4px;
right: 4px;
}
.bootstrap-datetimepicker-widget table td.active, .bootstrap-datetimepicker-widget table td.active:hover {
background-color: #0275d8;
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.bootstrap-datetimepicker-widget table td.active.today:before {
border-bottom-color: #fff;
}
.bootstrap-datetimepicker-widget table td.disabled, .bootstrap-datetimepicker-widget table td.disabled:hover {
background: none;
color: #636c72;
cursor: not-allowed;
}
.bootstrap-datetimepicker-widget table td span {
display: inline-block;
width: 54px;
height: 54px;
line-height: 54px;
margin: 2px 1.5px;
cursor: pointer;
border-radius: 0.25rem;
}
.bootstrap-datetimepicker-widget table td span:hover {
background: #eceeef;
}
.bootstrap-datetimepicker-widget table td span.active {
background-color: #0275d8;
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.bootstrap-datetimepicker-widget table td span.old {
color: #636c72;
}
.bootstrap-datetimepicker-widget table td span.disabled, .bootstrap-datetimepicker-widget table td span.disabled:hover {
background: none;
color: #636c72;
cursor: not-allowed;
}
.bootstrap-datetimepicker-widget.usetwentyfour td.hour {
height: 27px;
line-height: 27px;
}
.input-group.date .input-group-addon {
cursor: pointer;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,67 @@
.ui-timepicker-wrapper {
overflow-y: auto;
max-height: 150px;
width: auto;
background: #fff;
border: 1px solid #ddd;
-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);
-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);
box-shadow:0 5px 10px rgba(0,0,0,0.2);
outline: none;
z-index: 10052;
margin: 0;
}
.ui-timepicker-wrapper .ui-timepicker-list li {
padding-right: 20px;
}
.ui-timepicker-list {
margin: 0;
padding: 0;
list-style: none;
}
.ui-timepicker-duration {
margin-left: 5px; color: #888;
}
.ui-timepicker-list:hover .ui-timepicker-duration {
color: #888;
}
.ui-timepicker-list li {
padding: 3px 0 3px 5px;
cursor: pointer;
white-space: nowrap;
color: #000;
list-style: none;
margin: 0;
}
.ui-timepicker-list:hover .ui-timepicker-selected {
background: #fff; color: #000;
}
li.ui-timepicker-selected,
.ui-timepicker-list li:hover,
.ui-timepicker-list .ui-timepicker-selected:hover {
background: #1980EC; color: #fff;
}
li.ui-timepicker-selected .ui-timepicker-duration,
.ui-timepicker-list li:hover .ui-timepicker-duration {
color: #ccc;
}
.ui-timepicker-list li.ui-timepicker-disabled,
.ui-timepicker-list li.ui-timepicker-disabled:hover,
.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled {
color: #888;
cursor: default;
}
.ui-timepicker-list li.ui-timepicker-disabled:hover,
.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled {
background: #f2f2f2;
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,67 @@
.ui-timepicker-wrapper {
overflow-y: auto;
max-height: 150px;
width: auto;
background: #fff;
border: 1px solid #ddd;
-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);
-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);
box-shadow:0 5px 10px rgba(0,0,0,0.2);
outline: none;
z-index: 10052;
margin: 0;
}
.ui-timepicker-wrapper .ui-timepicker-list li {
padding-right: 20px;
}
.ui-timepicker-list {
margin: 0;
padding: 0;
list-style: none;
}
.ui-timepicker-duration {
margin-left: 5px; color: #888;
}
.ui-timepicker-list:hover .ui-timepicker-duration {
color: #888;
}
.ui-timepicker-list li {
padding: 3px 0 3px 5px;
cursor: pointer;
white-space: nowrap;
color: #000;
list-style: none;
margin: 0;
}
.ui-timepicker-list:hover .ui-timepicker-selected {
background: #fff; color: #000;
}
li.ui-timepicker-selected,
.ui-timepicker-list li:hover,
.ui-timepicker-list .ui-timepicker-selected:hover {
background: #1980EC; color: #fff;
}
li.ui-timepicker-selected .ui-timepicker-duration,
.ui-timepicker-list li:hover .ui-timepicker-duration {
color: #ccc;
}
.ui-timepicker-list li.ui-timepicker-disabled,
.ui-timepicker-list li.ui-timepicker-disabled:hover,
.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled {
color: #888;
cursor: default;
}
.ui-timepicker-list li.ui-timepicker-disabled:hover,
.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled {
background: #f2f2f2;
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -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 : 15;
public static int MinsBetweenExecution { get; set; } = SacsSystem.DebugMode ? 8 : 12;
public static int HoursBetweenCountryLookup { get; set; } = SacsSystem.DebugMode ? 24 : 24 * 5;
}
}
+2 -1
View File
@@ -18,7 +18,7 @@ namespace Saxonite.Net.Standard.Base.App
//-------------------------------------------------------------------
public static class Version
{
private static String version { get; } = "1.2.11.11";
private static String version { get; } = "1.2.11.12";
// Retrieve version.
public static String GetFullVersion () { return version; }
public static String GetAppVersion ()
@@ -44,6 +44,7 @@ namespace Saxonite.Net.Standard.Base.App
// - Organisation associations, admin download. [Feb24]
// - Basic Api app. [Apr24]
// - Admin Database and logs pages evolved. [May24]
// - Online events upgraded. [Aug24]
// 1.2.10 11-Oct-2022
// - Online organisations display issue fixed.
// - User Sport 'Preparing' options.
+11
View File
@@ -19,6 +19,7 @@ namespace Saxonite.Net.Standard.Base.App
YesNo,
DataItemType,
Gender,
SportGrouping,
SportSpecialityLabel,
SportContactType,
SportParticipating,
@@ -187,6 +188,16 @@ namespace Saxonite.Net.Standard.Base.App
SystemReviewer,
}
//-------------------------------------------------------------------
/// <summary>Sport Grouping</summary>
public enum SportGrouping
{
/* Do not change the values/codes - tied to database. */
Specific = 10,
Banner = 20,
Group = 30,
}
//-------------------------------------------------------------------
/// <summary>Sport Speciality Label</summary>
public enum SportSpecialityLabel
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 18-Jun-2024 10:19:29
// Code generated by Sarand Database Utilities Tue 6-Aug-2024 14:50:13
//---------------------------------------------------------------------------
namespace Saxonite.Base.App
{
@@ -197,6 +197,7 @@ namespace Saxonite.Base.App
OrganisationEvent_SportIdPrimary,
OrganisationEvent_RegionIdCountry,
OrganisationEvent_EventAt,
OrganisationEvent_EventTo,
OrganisationEvent_EventTypeCode,
OrganisationEvent_Summary,
OrganisationEvent_Details,
@@ -248,6 +249,7 @@ namespace Saxonite.Base.App
Region_UpdateBy,
Region_UpdateHost,
Sport_Id,
Sport_Grouping,
Sport_SportIdParent,
Sport_Name,
Sport_SpecialityLabel,
@@ -422,7 +424,7 @@ namespace Saxonite.Base.App
//-------------------------------------------------------------------
// Data members.
private static readonly int tableCount = 22;
private static readonly int columnCount = 371;
private static readonly int columnCount = 373;
private static ulong maxTextLen = 0;
//-------------------------------------------------------------------
@@ -791,6 +793,7 @@ namespace Saxonite.Base.App
new ColumnDfn(9,"SportIdPrimary",4,4,false,10),
new ColumnDfn(9,"RegionIdCountry",4,4,false,10),
new ColumnDfn(9,"EventAt",9,93,false,16),
new ColumnDfn(9,"EventTo",9,93,false,16),
new ColumnDfn(9,"EventTypeCode",0,12,false,3),
new ColumnDfn(9,"Summary",0,-9,false,200),
new ColumnDfn(9,"Details",0,-9,false,2000),
@@ -842,6 +845,7 @@ namespace Saxonite.Base.App
new ColumnDfn(11,"UpdateBy",4,4,false,10),
new ColumnDfn(11,"UpdateHost",0,12,false,100),
new ColumnDfn(12,"Id",4,4,true,10),
new ColumnDfn(12,"Grouping",3,5,false,5),
new ColumnDfn(12,"SportIdParent",4,4,false,10),
new ColumnDfn(12,"Name",0,-9,false,100),
new ColumnDfn(12,"SpecialityLabel",3,5,false,5),
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 18-Jun-2024 10:19:29
// Code generated by Sarand Database Utilities Tue 6-Aug-2024 14:50:13
//---------------------------------------------------------------------------
namespace Saxonite.Base.App
{
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Tue 18-Jun-2024 10:19:30
// Code generated by Sarand Database Utilities Tue 6-Aug-2024 14:50:13
//---------------------------------------------------------------------------
namespace Saxonite.Base.App
{
@@ -105,6 +105,7 @@ namespace Saxonite.Net.Standard.Base.App
public List<TypeCodeDesc> DataItemTypeCodes { get { return GetCodesOfType(Sax.CodeType.DataItemType); } }
public List<TypeCodeDesc> YesNoCodes { get { return GetCodesOfType(Sax.CodeType.YesNo); } }
public List<TypeCodeDesc> GenderCodes { get { return GetCodesOfType(Sax.CodeType.Gender); } }
public List<TypeCodeDesc> SportGroupingCodes { get { return GetCodesOfType(Sax.CodeType.SportGrouping); } }
public List<TypeCodeDesc> SportSpecialityLabelCodes { get { return GetCodesOfType(Sax.CodeType.SportSpecialityLabel); } }
public List<TypeCodeDesc> SportContactTypeCodes { get { return GetCodesOfType(Sax.CodeType.SportContactType); } }
public List<TypeCodeDesc> SportParticipatingCodes { get { return GetCodesOfType(Sax.CodeType.SportParticipating); } }
@@ -16,6 +16,7 @@ namespace Saxonite.Net.Standard.Base.App
private static readonly List<TypeCodeDesc> yesNoCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> dataItemTypeCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> genderCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportGroupingCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportSpecialityLabelCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportContactCodes = new List<TypeCodeDesc>();
private static readonly List<TypeCodeDesc> sportParticipatingCodes = new List<TypeCodeDesc>();
@@ -52,6 +53,8 @@ namespace Saxonite.Net.Standard.Base.App
return new List<TypeCodeDesc>(dataItemTypeCodes);
case Sax.CodeType.Gender:
return new List<TypeCodeDesc>(genderCodes);
case Sax.CodeType.SportGrouping:
return new List<TypeCodeDesc>(sportGroupingCodes);
case Sax.CodeType.SportSpecialityLabel:
return new List<TypeCodeDesc>(sportSpecialityLabelCodes);
case Sax.CodeType.SportContactType:
@@ -139,6 +142,12 @@ namespace Saxonite.Net.Standard.Base.App
genderCodes.Add(Sax.Gender.Nonconforming, "Nonconforming", "Nonconforming");
genderCodes.Add(Sax.Gender.PreferNotToSay, "PreferNotToSay", "Prefer not to say");
//---------------------------------------------------------------
// Sport grouping.
sportGroupingCodes.Add(Sax.SportGrouping.Specific, "SPC", "Specific");
sportGroupingCodes.Add(Sax.SportGrouping.Banner, "BNR", "Banner");
sportGroupingCodes.Add(Sax.SportGrouping.Group, "GRP", "Group");
//---------------------------------------------------------------
// Sport speciality label.
sportSpecialityLabelCodes.Add(Sax.SportSpecialityLabel.Positon, "POS", "Positon");
@@ -2,6 +2,7 @@
using NPOI.SS.Formula.Functions;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -156,10 +157,9 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
this.data.PopulateFrom(data);
}
public String CountryCode
@@ -218,7 +218,8 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference
public List<SysId> IdsExcluded { get; } = new List<SysId>();
/// <summary>Generic filter - partial country code or name.</summary>
public String CountryFilter { get; set; }
public String CountryCodeFull { get; set; }
/// <summary>Restrict the results by code.</summary>
public HashSet<String> CountryCodesIncluded { get; } = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
public String CountryNameFull { get; set; }
public String CountryNamePartial { get; set; }
// Flags.
@@ -1,6 +1,7 @@
using NPOI.SS.Formula.Functions;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -261,10 +262,9 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
this.data.PopulateFrom(data);
}
public SysId FacilityId
@@ -1,6 +1,7 @@
using NPOI.SS.Formula.Functions;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -213,10 +214,9 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
this.data.PopulateFrom(data);
}
public SysId ProvinceId
@@ -1,6 +1,7 @@
using NPOI.SS.Formula.Functions;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -229,10 +230,9 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
this.data.PopulateFrom(data);
}
public SysId CourseId
@@ -1,6 +1,7 @@
using NPOI.SS.Formula.Functions;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -165,10 +166,9 @@ namespace Saxonite.Net.Standard.Base.Bus.Reference
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
this.data.PopulateFrom(data);
}
public SysId CountryId
@@ -134,12 +134,11 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
if (ItemId.IsValid(ItemId) && ItemId.Type != data.ItemId.Type && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
throw new NotSupportedException(fn + " Item Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Item Id cannot be changed");
this.data.PopulateFrom(data);
}
public ItemId ItemId
@@ -220,16 +220,15 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
if (ItemId.IsValid(ItemId) && ItemId.Type != data.ItemId.Type && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
throw new NotSupportedException(fn + " Item Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Item Id cannot be changed");
if (SysId.IsValid(SportId) && SysId.ToInt(SportId) != SysId.ToInt(data.SportId))
throw new NotSupportedException(fn + " Sport Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Sport Id cannot be changed");
if (SysId.IsValid(RegionId) && SysId.ToInt(RegionId) != SysId.ToInt(data.RegionId))
throw new NotSupportedException(fn + " Region Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Region Id cannot be changed");
this.data.PopulateFrom(data);
}
public ItemId ItemId
@@ -80,7 +80,6 @@ namespace Saxonite.Net.Standard.Base.Bus
/// </summary>
public static ContentData ExtractContent(String contentData)
{
String fn = typeof(ContentData).FullName + ".ExtractContent";
ContentData content = new ContentData();
if (StringUtil.IsEmpty(contentData)) return content;
@@ -120,7 +119,7 @@ namespace Saxonite.Net.Standard.Base.Bus
XElement htmlElement = bodyChildElement;
segment.Body.Html = htmlElement.Value;
}
else SaLogger.Warn(fn + " Unexpected 'Segment' child element: " + segmentChildElementName);
else SaLogger.Warn($"{SysUtil.Fn} Unexpected 'Segment' child element: " + segmentChildElementName);
}
}
else if (segmentChildElementName.EqualsCI(ElementName_Image))
@@ -136,24 +135,24 @@ namespace Saxonite.Net.Standard.Base.Bus
XElement imageIdElement = imageChildElement;
segment.Image.ItemImageId = imageIdElement.Value.ToSysId();
}
else SaLogger.Warn(fn + " Unexpected 'Segment' child element: " + segmentChildElementName);
else SaLogger.Warn($"{SysUtil.Fn} Unexpected 'Segment' child element: " + segmentChildElementName);
}
}
else SaLogger.Warn(fn + " Unexpected 'Segment' child element: " + segmentChildElementName);
else SaLogger.Warn($"{SysUtil.Fn} Unexpected 'Segment' child element: " + segmentChildElementName);
}
// Add this segment to the list.
if (segment.IsValid())
content.Segments.Add(segment);
}
else SaLogger.Warn(fn + " Unexpected 'Segments' child element: " + segmentsChildElementName);
else SaLogger.Warn($"{SysUtil.Fn} Unexpected 'Segments' child element: " + segmentsChildElementName);
}
}
else SaLogger.Warn(fn + " Unexpected 'Root' child element: " + rootChildElementName);
else SaLogger.Warn($"{SysUtil.Fn} Unexpected 'Root' child element: " + rootChildElementName);
}
}
catch (Exception exc)
{
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
SaLogger.Warn($"{SysUtil.Fn} " + ExceptionUtil.GetLogMessage(exc));
}
return content;
@@ -165,8 +164,6 @@ namespace Saxonite.Net.Standard.Base.Bus
/// </summary>
public static String GetContentData(ContentData content)
{
String fn = typeof(ContentData).FullName + ".GetContentData";
try
{
XDocument doc = new XDocument();
@@ -195,7 +192,7 @@ namespace Saxonite.Net.Standard.Base.Bus
}
catch (Exception exc)
{
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
SaLogger.Warn($"{SysUtil.Fn} " + ExceptionUtil.GetLogMessage(exc));
}
return "";
+4 -4
View File
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -210,14 +211,13 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
if (SysId.IsValid(UserAccountIdAuthor) && SysId.ToInt(UserAccountIdAuthor) != SysId.ToInt(data.UserAccountIdAuthor))
throw new NotSupportedException(fn + " UserAccountIdAuthor cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} UserAccountIdAuthor cannot be changed");
if (SysId.IsValid(OrganisationId) && SysId.ToInt(OrganisationId) != SysId.ToInt(data.OrganisationId))
throw new NotSupportedException(fn + " OrganisationId cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} OrganisationId cannot be changed");
this.data.PopulateFrom(data);
}
public SysId UserAccountIdAuthor
@@ -82,7 +82,6 @@ namespace Saxonite.Net.Standard.Base.Bus
/// </summary>
private void ExtractContactData(String contactData)
{
String fn = typeof(SaxContactData).FullName + ".ExtractContent";
contactMethods.Clear();
if (StringUtil.IsEmpty(contactData)) return;
@@ -108,14 +107,14 @@ namespace Saxonite.Net.Standard.Base.Bus
};
contactMethods.Add(method, contactMethod);
}
else SaLogger.Warn(fn + " Unrecognised contact method: " + methodValue);
else SaLogger.Warn($"{SysUtil.Fn} Unrecognised contact method: " + methodValue);
}
else SaLogger.Warn(fn + " Unexpected 'Root' child element: " + rootChildElementName);
else SaLogger.Warn($"{SysUtil.Fn} Unexpected 'Root' child element: " + rootChildElementName);
}
}
catch (Exception exc)
{
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
SaLogger.Warn($"{SysUtil.Fn} " + ExceptionUtil.GetLogMessage(exc));
}
}
@@ -125,7 +124,6 @@ namespace Saxonite.Net.Standard.Base.Bus
/// </summary>
public String GetContactData()
{
String fn = typeof(SaxContactData).FullName + ".GetContactData";
try
{
XDocument doc = new XDocument();
@@ -140,7 +138,7 @@ namespace Saxonite.Net.Standard.Base.Bus
}
catch (Exception exc)
{
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
SaLogger.Warn($"{SysUtil.Fn} " + ExceptionUtil.GetLogMessage(exc));
}
return "";
}
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -311,14 +312,13 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
if (ItemId.IsValid(ItemId) && ItemId.Type != data.ItemId.Type && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
throw new NotSupportedException(fn + " Item Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Item Id cannot be changed");
if (SysId.IsValid(RegionIdProvince) && SysId.ToInt(RegionIdProvince) != SysId.ToInt(data.RegionIdProvince))
throw new NotSupportedException(fn + " Address Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Address Id cannot be changed");
this.data.PopulateFrom(data);
}
public ItemId ItemId
@@ -238,14 +238,13 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
if (ItemId.IsValid(ItemIdFrom) && ItemIdFrom.Type != data.ItemIdFrom.Type && SysId.ToInt(ItemIdFrom.Id) != SysId.ToInt(data.ItemIdFrom.Id))
throw new NotSupportedException(fn + " From Item Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} From Item Id cannot be changed");
if (ItemId.IsValid(ItemIdTo) && ItemIdTo.Type != data.ItemIdTo.Type && SysId.ToInt(ItemIdTo.Id) != SysId.ToInt(data.ItemIdTo.Id))
throw new NotSupportedException(fn + " To Item Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} To Item Id cannot be changed");
this.data.PopulateFrom(data);
}
public ItemId ItemIdFrom
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -226,7 +227,7 @@ namespace Saxonite.Net.Standard.Base.Bus
case Sax.DataItemType.UserAccount:
case Sax.DataItemType.Organisation:
case Sax.DataItemType.Article:
return new List<Sacs.MimeType> { Sacs.MimeType.Jpeg, Sacs.MimeType.Webp, Sacs.MimeType.Png };
return new List<Sacs.MimeType> { Sacs.MimeType.Jpeg, Sacs.MimeType.Webp, Sacs.MimeType.Png, Sacs.MimeType.Svg };
}
return new List<Sacs.MimeType>();
}
@@ -237,7 +238,7 @@ namespace Saxonite.Net.Standard.Base.Bus
case Sax.DataItemType.UserAccount:
case Sax.DataItemType.Organisation:
case Sax.DataItemType.Article:
return new List<string> { "image/jpg", "image/jpeg", "image/webp", "image/png" };
return new List<string> { "image/jpg", "image/jpeg", "image/webp", "image/png", "image/svg+xml" };
}
return new List<string>();
}
@@ -247,14 +248,13 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
if (ItemId.IsValid(ItemId) && ItemId.Type != data.ItemId.Type && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
throw new NotSupportedException(fn + " Item Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Item Id cannot be changed");
if (ImageType > 0 && ImageType != data.ImageType)
throw new NotSupportedException(fn + " Image Type cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Image Type cannot be changed");
this.data.PopulateFrom(data);
}
public ItemId ItemId
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -144,14 +145,13 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
if (ItemId.IsValid(ItemId) && ItemId.Type != data.ItemId.Type && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
throw new NotSupportedException(fn + " Item Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Item Id cannot be changed");
if (SysId.IsValid(SportId) && SysId.ToInt(SportId) != SysId.ToInt(data.SportId))
throw new NotSupportedException(fn + " Sport Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Sport Id cannot be changed");
this.data.PopulateFrom(data);
}
public ItemId ItemId
@@ -220,10 +220,9 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
this.data.PopulateFrom(data);
}
public String Name
@@ -293,17 +292,17 @@ namespace Saxonite.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
public HashSet<SysId> IdsIncluded { get; } = new HashSet<SysId>();
public HashSet<SysId> IdsExcluded { get; } = new HashSet<SysId>();
public String NameFull { get; set; }
public String NamePartial { get; set; }
public Sax.OrganisationCategory OrganisationCategory { get; set; } = Sax.OrganisationCategory.Unknown;
public List<Sax.OrganisationCategory> OrganisationCategoriesExcluded { get; } = new List<Sax.OrganisationCategory>();
public HashSet<Sax.OrganisationCategory> OrganisationCategoriesExcluded { get; } = new HashSet<Sax.OrganisationCategory>();
public Sax.OrganisationType OrganisationType { get; set; } = Sax.OrganisationType.Unknown;
/// <summary>Partial match on a number of fields, including name, sport, address, etc.</summary>
public String OrganisationFilter { get; set; }
public List<SysId> SportIdsIncluded { get; } = new List<SysId>();
public List<SysId> RegionIdsIncluded { get; } = new List<SysId>();
public HashSet<SysId> SportIdsIncluded { get; } = new HashSet<SysId>();
public HashSet<SysId> RegionIdsIncluded { get; } = new HashSet<SysId>();
// Common properties.
public String NotesPartial { get; set; }
public StatusCat StatusCat { get; set; } = StatusCat.ActiveOnly;
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -31,6 +32,8 @@ namespace Saxonite.Net.Standard.Base.Bus
// Event.
EventAt_Date,
EventAt_DateTime,
EventTo_Date,
EventTo_DateTime,
EventTypeCode,
EventType_Desc,
Summary,
@@ -58,6 +61,7 @@ namespace Saxonite.Net.Standard.Base.Bus
public SysId SportIdPrimary { get; set; }
public SysId RegionIdCountry { get; set; }
public DateTime EventAt { get; set; }
public DateTime? EventTo { get; set; }
public Sax.EventType EventType { get; set; }
public String Summary { get; set; } = String.Empty;
public String Details { get; set; } = String.Empty;
@@ -98,6 +102,11 @@ namespace Saxonite.Net.Standard.Base.Bus
get { return data.EventAt; }
set { CheckChanged(data.EventAt, value); data.EventAt = value; }
}
public DateTime? EventTo
{
get { return data.EventTo; }
set { CheckChangedNullable(data.EventTo, value); data.EventTo = value; }
}
public Sax.EventType EventType
{
get { return data.EventType; }
@@ -135,6 +144,7 @@ namespace Saxonite.Net.Standard.Base.Bus
SportIdPrimary = data.SportIdPrimary;
RegionIdCountry = data.RegionIdCountry;
EventAt = data.EventAt;
EventTo = data.EventTo;
EventType = data.EventType;
Summary = data.Summary;
Details = data.Details;
@@ -160,6 +170,7 @@ namespace Saxonite.Net.Standard.Base.Bus
public ValidValue SportIdPrimary { get; set; } = ValidValue.Valid;
public ValidValue RegionIdCountry { get; set; } = ValidValue.Valid;
public ValidValue EventAt { get; set; } = ValidValue.Valid;
public ValidValue EventTo { get; set; } = ValidValue.Valid;
public ValidValue EventType { get; set; } = ValidValue.Valid;
public ValidValue Summary { get; set; } = ValidValue.Valid;
public ValidValue Details { get; set; } = ValidValue.Valid;
@@ -206,17 +217,35 @@ namespace Saxonite.Net.Standard.Base.Bus
return new ItemId((short)Sax.DataItemType.OrganisationEvent, Id);
}
/// <summary>
/// Time of exactly midnight is treated as invalid.
/// <para>- Valid start time of midnight is stored with at least +1 minute (00:01:00).</para>
/// </summary>
public static bool HasValidEventTime(DateTime? eventDateTime)
{
return DateUtil.IsValid(eventDateTime) && DateUtil.Format(eventDateTime, "HH:mm:ss") != "00:00:00";
}
public bool HasValidEventAtTime()
{
return HasValidEventTime(EventAt);
}
public bool HasValidEventToTime()
{
return HasValidEventTime(EventTo);
}
//-------------------------------------------------------------------
// Properties.
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
if (SysId.IsValid(OrganisationId) && SysId.ToInt(OrganisationId) != SysId.ToInt(data.OrganisationId))
throw new NotSupportedException(fn + " Organisation Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Organisation Id cannot be changed");
this.data.PopulateFrom(data);
}
public SysId OrganisationId
@@ -239,6 +268,11 @@ namespace Saxonite.Net.Standard.Base.Bus
get { return data.EventAt; }
set { data.EventAt = value; }
}
public DateTime? EventTo
{
get { return data.EventTo; }
set { data.EventTo = value; }
}
public Sax.EventType EventType
{
get { return data.EventType; }
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -201,12 +202,11 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
if (SysId.IsValid(OrganisationId) && SysId.ToInt(OrganisationId) != SysId.ToInt(data.OrganisationId))
throw new NotSupportedException(fn + " Organisation Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Organisation Id cannot be changed");
this.data.PopulateFrom(data);
}
public SysId OrganisationId
+2 -2
View File
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -206,10 +207,9 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
this.data.PopulateFrom(data);
}
public Sax.RegionType RegionType
+26 -2
View File
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -18,6 +19,8 @@ namespace Saxonite.Net.Standard.Base.Bus
{
Pos,
Id,
Grouping,
Grouping_Desc,
SportIdParent,
ParentSport_Name,
Name,
@@ -38,6 +41,7 @@ namespace Saxonite.Net.Standard.Base.Bus
/// <summary>Properties other than common.</summary>
public class DataProperties
{
public Sax.SportGrouping Grouping { get; set; }
public SysId SportIdParent { get; set; }
public String Name { get; set; } = String.Empty;
public Sax.SportSpecialityLabel SpecialityLabel { get; set; }
@@ -55,6 +59,11 @@ namespace Saxonite.Net.Standard.Base.Bus
Status = DefaultStatus;
}
// Properties.
public Sax.SportGrouping Grouping
{
get { return data.Grouping; }
set { CheckChanged((short)data.Grouping, (short)value); data.Grouping = value; }
}
public SysId SportIdParent
{
get { return data.SportIdParent; }
@@ -73,6 +82,7 @@ namespace Saxonite.Net.Standard.Base.Bus
// Population.
internal void PopulateFrom(Data data)
{
Grouping = data.Grouping;
SportIdParent = data.SportIdParent;
Name = data.Name;
SpecialityLabel = data.SpecialityLabel;
@@ -91,6 +101,7 @@ namespace Saxonite.Net.Standard.Base.Bus
public new class ErrField : SacsHierarchyItem.ErrField
{
// Identifies the field that has invalid data.
public ValidValue Grouping { get; set; } = ValidValue.Valid;
public ValidValue SportIdParent { get; set; } = ValidValue.Valid;
public ValidValue Name { get; set; } = ValidValue.Valid;
public ValidValue SpecialityLabel { get; set; } = ValidValue.Valid;
@@ -138,12 +149,16 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
this.data.PopulateFrom(data);
}
public Sax.SportGrouping Grouping
{
get { return data.Grouping; }
set { data.Grouping = value; }
}
public SysId SportIdParent
{
get { return data.SportIdParent; }
@@ -171,6 +186,14 @@ namespace Saxonite.Net.Standard.Base.Bus
// P a r a m s
//-------------------------------------------------------------------
// List parameters.
public enum SportGroupingCat
{
Any,
Specific,
Banner,
BannerOrSpecific,
Group,
}
public enum StatusCat
{
Any,
@@ -187,6 +210,7 @@ namespace Saxonite.Net.Standard.Base.Bus
// List filtering.
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
public SportGroupingCat SportGroupingCat { get; set; } = SportGroupingCat.BannerOrSpecific;
public SysId SportIdParent { get; set; }
/// <summary>Generic filter - partial sport name, or other matching value (tbd).</summary>
public String SportFilter { get; set; }
@@ -152,7 +152,6 @@ namespace Saxonite.Net.Standard.Base.Bus
/// <summary>Serialise as XML.</summary>
public String ToXml()
{
String fn = typeof(SaxContactData).FullName + ".ToXml";
try
{
XDocument doc = new XDocument();
@@ -178,7 +177,7 @@ namespace Saxonite.Net.Standard.Base.Bus
}
catch (Exception exc)
{
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
SaLogger.Warn($"{SysUtil.Fn} " + ExceptionUtil.GetLogMessage(exc));
}
return "";
}
@@ -187,7 +186,6 @@ namespace Saxonite.Net.Standard.Base.Bus
/// <summary>Deserialise from XML data.</summary>
private void FromXml(String contactsData)
{
String fn = typeof(SaxContactData).FullName + ".FromXml";
contacts.Clear();
if (StringUtil.IsEmpty(contactsData)) return;
@@ -218,14 +216,14 @@ namespace Saxonite.Net.Standard.Base.Bus
};
contacts.Add(contactType, contactData);
}
else SaLogger.Warn(fn + " Unrecognised contact type: " + contactType);
else SaLogger.Warn($"{SysUtil.Fn} Unrecognised contact type: " + contactType);
}
else SaLogger.Warn(fn + " Unexpected 'Root' child element: " + rootChildElementName);
else SaLogger.Warn($"{SysUtil.Fn} Unexpected 'Root' child element: " + rootChildElementName);
}
}
catch (Exception exc)
{
SaLogger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
SaLogger.Warn($"{SysUtil.Fn} " + ExceptionUtil.GetLogMessage(exc));
}
}
@@ -350,10 +350,9 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
this.data.PopulateFrom(data);
}
public String EmailAddress
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -218,14 +219,13 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
throw new NotSupportedException(fn + " User Account Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} User Account Id cannot be changed");
if (ItemId.IsValid(ItemId) && ItemId.Type != data.ItemId.Type && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
throw new NotSupportedException(fn + " Item Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Item Id cannot be changed");
this.data.PopulateFrom(data);
}
public SysId UserAccountId
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -122,14 +123,13 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
throw new NotSupportedException(fn + " User Account Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} User Account Id cannot be changed");
if (ConfigType != data.ConfigType)
throw new NotSupportedException(fn + " Config Type cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Config Type cannot be changed");
this.data.PopulateFrom(data);
}
public SysId UserAccountId
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Base.App;
using Saxonite.Net.Standard.Base.App;
using System;
@@ -204,16 +205,15 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
throw new NotSupportedException(fn + " User Account Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} User Account Id cannot be changed");
if (SysId.IsValid(RegionId) && SysId.ToInt(RegionId) != SysId.ToInt(data.RegionId))
throw new NotSupportedException(fn + " Region Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Region Id cannot be changed");
if (EligibilityType == 0 && (int)EligibilityType != (int)EligibilityType)
throw new NotSupportedException(fn + " User Eligibility cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} User Eligibility cannot be changed");
this.data.PopulateFrom(data);
}
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Saxonite.Net.Standard.Base.App;
using System;
using System.Collections.Generic;
@@ -100,10 +101,9 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
throw new NotSupportedException(fn + " User Account Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} User Account Id cannot be changed");
this.data.PopulateFrom(data);
}
/// <summary>User Account Id. NB Can only be set where previously invalid.</summary>
@@ -259,14 +259,13 @@ namespace Saxonite.Net.Standard.Base.Bus
public Data GetData() { return data.Clone(); }
public void SetData(Data data)
{
String fn = GetType().Name + ".SetData";
// Properties that cannot be changed if previously specified.
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
throw new NotSupportedException(fn + " Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
if (SysId.IsValid(UserAccountId) && SysId.ToInt(UserAccountId) != SysId.ToInt(data.UserAccountId))
throw new NotSupportedException(fn + " User Account Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} User Account Id cannot be changed");
if (SysId.IsValid(OrganisationId) && SysId.ToInt(OrganisationId) != SysId.ToInt(data.OrganisationId))
throw new NotSupportedException(fn + " Organisation Id cannot be changed");
throw new NotSupportedException($"{SysUtil.Fn} Organisation Id cannot be changed");
this.data.PopulateFrom(data);
}
/// <summary>User Account Id. NB Can only be set where previously invalid.</summary>
@@ -347,20 +346,28 @@ namespace Saxonite.Net.Standard.Base.Bus
public new class Params : SacsHierarchyItem.Params
{
// List filtering.
public List<SysId> IdsIncluded { get; } = new List<SysId>();
public List<SysId> IdsExcluded { get; } = new List<SysId>();
public List<SysId> UserAccountIdsIncluded { get; } = new List<SysId>();
public HashSet<SysId> IdsIncluded { get; } = new HashSet<SysId>();
public HashSet<SysId> IdsExcluded { get; } = new HashSet<SysId>();
// User Account properties.
public HashSet<SysId> UserAccountIdsIncluded { get; } = new HashSet<SysId>();
public SaxUserAccount.StatusCat UserAccountStatusCat { get; set; } = SaxUserAccount.StatusCat.NotDeleted;
public List<SysId> OrganisationIdsIncluded { get; } = new List<SysId>();
public SaxOrganisation.StatusCat OrganisationStatusCat { get; set; } = SaxOrganisation.StatusCat.NotDeleted;
/// <summary>Set true to restruct to User Organisations with at least one Organisation Role.</summary>
public bool OrganisationMembersOnly { get; set; }
public List<Sax.OrganisationRole> OrganisationRoles { get; } = new List<Sax.OrganisationRole>();
public List<Sax.OrganisationRole> OrganisationRolesAny { get; } = new List<Sax.OrganisationRole>();
/// <summary>Exact match on various user account properties including name, email etc.</summary>
public String UserFilter { get; set; }
/// <summary>Partial match on various user account properties including name, countries etc.</summary>
public String UserFilterPartial { get; set; }
// Organisation properties.
public HashSet<SysId> OrganisationIdsIncluded { get; } = new HashSet<SysId>();
/// <summary>Exclude organisations with no upcoming events (from 7 days ago).</summary>
public bool OrganisationHasScheduledEvents { get; set; }
public SaxOrganisation.StatusCat OrganisationStatusCat { get; set; } = SaxOrganisation.StatusCat.NotDeleted;
// Organisation User properties.
/// <summary>Set true to restruct to User Organisations with at least one Organisation Role.</summary>
public bool OrganisationMembersOnly { get; set; }
public HashSet<Sax.OrganisationRole> OrganisationRoles { get; } = new HashSet<Sax.OrganisationRole>();
public HashSet<Sax.OrganisationRole> OrganisationRolesAny { get; } = new HashSet<Sax.OrganisationRole>();
// Common properties.
public String NotesPartial { get; set; }
public StatusCat StatusCat { get; set; } = StatusCat.NotDeleted;

Some files were not shown because too many files have changed in this diff Show More