Files
andy 9f22b522df 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>
2026-10-16 18:24:16 +01:00

80 lines
2.8 KiB
C#

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.Email;
using Sarand.Net.Standard.Base.Helpers;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Proc.Excel;
using Saxonite.Net.Core.Web.Admin.Consoles;
using Saxonite.Net.Core.Web.Admin.Models;
using Saxonite.Net.Core.Web.Admin.Procs;
using Saxonite.Net.Core.Web.Base.Controllers;
using Saxonite.Net.Standard.Base.App;
using Saxonite.Net.Standard.Base.Bus;
using Saxonite.Net.Standard.Base.Helpers;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Saxonite.Net.Core.Web.Admin.Controllers
{
//=======================================================================
// Controller: Organisation - Download
//=======================================================================
partial class OrganisationController
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Download Organisations.
//-------------------------------------------------------------------
[HttpPost]
[Route("Organisation/Download")]
public IActionResult Ajax_DownloadOrganisations(Model_OrganisationDownload model)
{
String fn = GetType().Name + ".Ajax_DownloadOrganisations";
// Validate session.
if (!ValidUserSession)
return Unauthorized();
// Record disposable items as they are created so all can be disposed when needed.
using (DisposableCollection<IDisposable> disposableItems = new DisposableCollection<IDisposable>())
{
// Validate supplied data properties.
if (!model.ValidateProperties())
return BadRequest();
// Export data.
SaxOrganisationExporter.Config exporterConfig = new SaxOrganisationExporter.Config(SessionContext, DbUpdateInfo, GetOrganisationListFilter(model, AccountMgr));
exporterConfig.Format = SaxOrganisationExporter.ExportFormat.Excel_Open;
exporterConfig.IncludeId = StringUtil.ToBool(model.IncludeId);
SaxOrganisationExporter exporter = new SaxOrganisationExporter(exporterConfig);
if (exporter.RunProcess())
{
// Organisations exported successfully.
byte[] data = exporter.GetDocumentData();
using (MemoryStream content = new MemoryStream(data))
{
String contentType = exporter.GetContentType();
var fileName = "Sportierre-Organisations-" + DateTime.Now.ToString("yyyyMMdd") + ".xlsx";
return File(content.ToArray(), contentType, fileName);
}
}
else
{
// Problems occurred.
}
}
return NoContent();
}
//-------------------------------------------------------------------
}
}