v1.3.0 Restructure Saxonite workspace and upgrade to .NET 10 (#1)
Move Saxonite’s projects into a dedicated `Workspace` folder and align the solution with .NET 10 and the current Common workspace. Update encryption integration, test project structure and coverage, and repository guidance and upgrade notes. - Relocate application and library projects while retaining Git rename history. - Split tests into Admin, Online, and Shared projects; add representative behavioral and serialization tests. - Update Common integration, application version, and repository documentation. Application version: 1.3.0 Reviewed-on: #1 Co-authored-by: andy <andy@sarand.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -0,0 +1,178 @@
|
||||
using DocumentFormat.OpenXml.InkML;
|
||||
using HtmlAgilityPack;
|
||||
using MailKit;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
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.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;
|
||||
using Saxonite.Net.Standard.Base.Bus.Reference;
|
||||
using Saxonite.Net.Standard.Base.Mgr.Reference;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
|
||||
namespace Saxonite.Net.Core.Web.Base.Procs
|
||||
{
|
||||
//======================================================================
|
||||
public partial class SaxOrganisationEventsLookup : SaxProcess_Web
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
public enum Task
|
||||
{
|
||||
LookupEvents
|
||||
}
|
||||
|
||||
public new class Config : SaxProcess_Web.Config
|
||||
{
|
||||
public Config(SaxSessionContext sessionContext, DbUpdateInfo dbUpdateInfo) : base(sessionContext, dbUpdateInfo)
|
||||
{ }
|
||||
/// <summary>Organisations.</summary>
|
||||
public HashSet<SysId> OrganisationIdsIncluded { get; } = new HashSet<SysId>();
|
||||
/// <summary>Tasks to be run under this instance of the USGA Data Lookup process.</summary>
|
||||
public HashSet<Task> Tasks { get; } = new HashSet<Task>();
|
||||
}
|
||||
|
||||
private class EventData
|
||||
{
|
||||
public DateTime EventAt { get; set; }
|
||||
public String Caption { get; set; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private Config config;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public SaxOrganisationEventsLookup(Config config) : base(config)
|
||||
{
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
|
||||
public override string ProcessDescription => "Organisation Events Lookup";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Run the process.
|
||||
protected override bool Run()
|
||||
{
|
||||
// Execute selected tasks.
|
||||
foreach (Task task in config.Tasks)
|
||||
{
|
||||
switch (task)
|
||||
{
|
||||
case Task.LookupEvents:
|
||||
LookupEventsForOrganisations();
|
||||
break;
|
||||
}
|
||||
if (!OK) break;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Event lookup.
|
||||
//------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Organisation event lookup.
|
||||
/// </summary>
|
||||
private bool LookupEventsForOrganisations()
|
||||
{
|
||||
if (!OK) return false;
|
||||
|
||||
using (DisposableCollection<IDisposable> disposableItems = new DisposableCollection<IDisposable>())
|
||||
{
|
||||
foreach (SysId organisationId in config.OrganisationIdsIncluded)
|
||||
{
|
||||
SaxOrganisation organisation = AccountMgr.GetOrganisationById(organisationId);
|
||||
if (organisation == null)
|
||||
{
|
||||
AddWarningMessage($"Organisation not found for Id: {organisationId}.");
|
||||
continue;
|
||||
}
|
||||
LookupOrganisationEvents(organisation);
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Organisation event lookup.
|
||||
/// </summary>
|
||||
private bool LookupOrganisationEvents(SaxOrganisation organisation)
|
||||
{
|
||||
List<EventData> eventsData = new List<EventData>();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
// Query Countries on USGA website.
|
||||
CancellationToken cancelToken = new CancellationToken();
|
||||
SacsHttpRequestData request = new SacsHttpRequestData(cancelToken) { Url = "https://ncrdb.usga.org/" };
|
||||
SacsHttpResponseData response = SacsHttpClient.DoRequest(request).Result;
|
||||
String data = response.Data;
|
||||
|
||||
if (!StringUtil.IsBlank(response.Data))
|
||||
{
|
||||
// Parse HTML.
|
||||
HtmlDocument htmlDoc = new HtmlDocument();
|
||||
htmlDoc.LoadHtml(response.Data);
|
||||
|
||||
// Identify type of event schedule on page.
|
||||
HtmlNode mobiscrollEventCalendarNode = htmlDoc.GetElementbyId("mobiscroll-event-calendar");
|
||||
if (mobiscrollEventCalendarNode != null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (eventsData.Any())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} {ExceptionUtil.GetLogMessage(exc, "querying organisation events", 8)}");
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Organisation event lookup by MobiScroll calendar.
|
||||
/// </summary>
|
||||
private bool LookupOrganisationEvents_MobiScrollCalendar(SaxOrganisation organisation, List<EventData> eventsData, HtmlNode calendarNode)
|
||||
{
|
||||
|
||||
HtmlNode headerNode = calendarNode.Descendants("div").First(node => node.HasClass("mbsc-calendar-header"));
|
||||
if (headerNode != null)
|
||||
{
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
}
|
||||
//======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user