-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
3,099 additions
and
2 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<RootNamespace>Topo.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.8" /> | ||
</ItemGroup> | ||
|
||
</Project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions
2
Topo/Model/Program/ProgramPageViewModel.cs → Model/Program/ProgramPageViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<RootNamespace>Topo.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.EJ2.AspNet.Core" Version="20.2.0.38" /> | ||
<PackageReference Include="Syncfusion.Licensing" Version="20.2.0.38" /> | ||
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="20.2.0.38" /> | ||
<PackageReference Include="Syncfusion.XlsIORenderer.Net.Core" Version="20.2.0.38" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Model\Model.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,288 @@ | ||
using Amazon.Lambda.APIGatewayEvents; | ||
using Amazon.Lambda.Core; | ||
using Newtonsoft.Json; | ||
using Syncfusion.Pdf; | ||
using Syncfusion.XlsIO; | ||
using Syncfusion.XlsIORenderer; | ||
using System.Globalization; | ||
using Topo.Model.Program; | ||
using Topo.Model.Members; | ||
using Topo.Model.Milestone; | ||
using Topo.Model.OAS; | ||
using Topo.Model.ReportGeneration; | ||
using Topo.Model.SIA; | ||
using Topo.Model.Logbook; | ||
using Topo.Model.Wallchart; | ||
using Topo.Model.AdditionalAwards; | ||
using Topo.Services; | ||
using Topo.Model.Approvals; | ||
|
||
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. | ||
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] | ||
|
||
namespace TopoReportFunction; | ||
|
||
public class Function | ||
{ | ||
private ReportService reportService = new ReportService(); | ||
|
||
/// <summary> | ||
/// Returns a Member List Report in a base 64 string of the PDF or XLSX | ||
/// </summary> | ||
/// <param name="reportData">A ReportGenerationRequest object containing the report request</param> | ||
/// <param name="context"></param> | ||
/// <returns></returns> | ||
public string FunctionHandler(APIGatewayProxyRequest request, ILambdaContext context) | ||
{ | ||
try | ||
{ | ||
System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("en-AU"); | ||
CultureInfo.DefaultThreadCurrentCulture = cultureInfo; | ||
CultureInfo.DefaultThreadCurrentUICulture = cultureInfo; | ||
|
||
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("Mgo+DSMBMAY9C3t2VVhiQlFadVdJXGFWfVJpTGpQdk5xdV9DaVZUTWY/P1ZhSXxRdkJiUX9YdHZRRGheVkQ="); | ||
|
||
var requestBody = request.Body; | ||
Console.WriteLine(requestBody); | ||
var reportGenerationRequest = JsonConvert.DeserializeObject<ReportGenerationRequest>(requestBody); | ||
if (reportGenerationRequest != null) | ||
{ | ||
var workbook = reportService.CreateWorkbookWithSheets(1); | ||
switch (reportGenerationRequest.ReportType) | ||
{ | ||
case ReportType.MemberList: | ||
workbook = GenerateMemberListWorkbook(reportGenerationRequest); | ||
break; | ||
case ReportType.PatrolList: | ||
workbook = GeneratePatrolListWorkbook(reportGenerationRequest); | ||
break; | ||
case ReportType.PatrolSheets: | ||
workbook = GeneratePatrolSheetsWorkbook(reportGenerationRequest); | ||
break; | ||
case ReportType.SignInSheet: | ||
workbook = GenerateSignInSheetWorkbook(reportGenerationRequest); | ||
break; | ||
case ReportType.EventAttendance: | ||
workbook = GenerateEventAttendanceWorkbook(reportGenerationRequest); | ||
break; | ||
case ReportType.Attendance: | ||
workbook = GenerateAttendanceReportWorkbook(reportGenerationRequest); | ||
break; | ||
case ReportType.OASWorksheet: | ||
workbook = GenerateOASWorksheetWorkbook(reportGenerationRequest); | ||
break; | ||
case ReportType.SIA: | ||
workbook = GenerateSIAWorkbook(reportGenerationRequest); | ||
break; | ||
case ReportType.Milestone: | ||
workbook = GenerateMilestoneWorkbook(reportGenerationRequest); | ||
break; | ||
case ReportType.Logbook: | ||
workbook = GenerateLogbookWorkbook(reportGenerationRequest); | ||
break; | ||
case ReportType.Wallchart: | ||
workbook = GenerateWallchartWorkbook(reportGenerationRequest); | ||
break; | ||
case ReportType.AdditionalAwards: | ||
workbook = GenerateAdditionalAwardsWorkbook(reportGenerationRequest); | ||
break; | ||
case ReportType.Approvals: | ||
workbook = GenerateApprovalsWorkbook(reportGenerationRequest); | ||
break; | ||
} | ||
|
||
if (workbook != null) | ||
{ | ||
MemoryStream strm = new MemoryStream(); | ||
workbook.Version = ExcelVersion.Excel2016; | ||
|
||
if (reportGenerationRequest.OutputType == OutputType.PDF) | ||
{ | ||
//Initialize XlsIO renderer. | ||
XlsIORenderer renderer = new XlsIORenderer(); | ||
|
||
//Convert Excel document into PDF document | ||
PdfDocument pdfDocument = renderer.ConvertToPDF(workbook); | ||
pdfDocument.Save(strm); | ||
} | ||
|
||
if (reportGenerationRequest.OutputType == OutputType.Excel) | ||
{ | ||
//Stream as Excel file | ||
workbook.SaveAs(strm); | ||
} | ||
|
||
// return stream in browser | ||
return Convert.ToBase64String(strm.ToArray()); | ||
|
||
} | ||
} | ||
} | ||
|
||
catch(Exception ex) | ||
{ | ||
Console.WriteLine(ex.ToString()); | ||
} | ||
|
||
|
||
return ""; | ||
} | ||
|
||
private IWorkbook GenerateMemberListWorkbook(ReportGenerationRequest reportGenerationRequest) | ||
{ | ||
var reportData = JsonConvert.DeserializeObject<List<MemberListModel>>(reportGenerationRequest.ReportData); | ||
if (reportData != null) | ||
{ | ||
var workbook = reportService.GenerateMemberListWorkbook(reportData, reportGenerationRequest.GroupName, reportGenerationRequest.Section | ||
, reportGenerationRequest.UnitName); | ||
return workbook; | ||
} | ||
return reportService.CreateWorkbookWithSheets(1); | ||
} | ||
|
||
private IWorkbook GeneratePatrolListWorkbook(ReportGenerationRequest reportGenerationRequest) | ||
{ | ||
var reportData = JsonConvert.DeserializeObject<List<MemberListModel>>(reportGenerationRequest.ReportData); | ||
if (reportData != null) | ||
{ | ||
var workbook = reportService.GeneratePatrolListWorkbook(reportData, reportGenerationRequest.GroupName, reportGenerationRequest.Section | ||
, reportGenerationRequest.UnitName, reportGenerationRequest.IncludeLeaders); | ||
return workbook; | ||
} | ||
return reportService.CreateWorkbookWithSheets(1); | ||
} | ||
|
||
private IWorkbook GeneratePatrolSheetsWorkbook(ReportGenerationRequest reportGenerationRequest) | ||
{ | ||
var reportData = JsonConvert.DeserializeObject<List<MemberListModel>>(reportGenerationRequest.ReportData); | ||
if (reportData != null) | ||
{ | ||
var workbook = reportService.GeneratePatrolSheetsWorkbook(reportData, reportGenerationRequest.Section); | ||
return workbook; | ||
} | ||
return reportService.CreateWorkbookWithSheets(1); | ||
} | ||
|
||
private IWorkbook GenerateSignInSheetWorkbook(ReportGenerationRequest reportGenerationRequest) | ||
{ | ||
var reportData = JsonConvert.DeserializeObject<List<MemberListModel>>(reportGenerationRequest.ReportData); | ||
if (reportData != null) | ||
{ | ||
var workbook = reportService.GenerateSignInSheetWorkbook(reportData, reportGenerationRequest.GroupName, reportGenerationRequest.Section | ||
, reportGenerationRequest.UnitName, reportGenerationRequest.EventName); | ||
return workbook; | ||
} | ||
return reportService.CreateWorkbookWithSheets(1); | ||
} | ||
|
||
private IWorkbook GenerateEventAttendanceWorkbook(ReportGenerationRequest reportGenerationRequest) | ||
{ | ||
var reportData = JsonConvert.DeserializeObject<EventListModel>(reportGenerationRequest.ReportData); | ||
if (reportData != null) | ||
{ | ||
var workbook = reportService.GenerateEventAttendanceWorkbook(reportData, reportGenerationRequest.GroupName, reportGenerationRequest.Section | ||
, reportGenerationRequest.UnitName); | ||
return workbook; | ||
} | ||
return reportService.CreateWorkbookWithSheets(1); | ||
} | ||
|
||
private IWorkbook GenerateAttendanceReportWorkbook(ReportGenerationRequest reportGenerationRequest) | ||
{ | ||
var reportData = JsonConvert.DeserializeObject<AttendanceReportModel>(reportGenerationRequest.ReportData); | ||
if (reportData != null) | ||
{ | ||
var workbook = reportService.GenerateAttendanceReportWorkbook(reportData, reportGenerationRequest.GroupName, reportGenerationRequest.Section | ||
, reportGenerationRequest.UnitName, reportGenerationRequest.FromDate, reportGenerationRequest.ToDate | ||
, reportGenerationRequest.OutputType == OutputType.PDF); | ||
return workbook; | ||
} | ||
return reportService.CreateWorkbookWithSheets(1); | ||
} | ||
|
||
private IWorkbook GenerateOASWorksheetWorkbook(ReportGenerationRequest reportGenerationRequest) | ||
{ | ||
var reportData = JsonConvert.DeserializeObject<List<OASWorksheetAnswers>>(reportGenerationRequest.ReportData); | ||
if (reportData != null) | ||
{ | ||
var workbook = reportService.GenerateOASWorksheetWorkbook(reportData, reportGenerationRequest.GroupName, reportGenerationRequest.Section | ||
, reportGenerationRequest.UnitName, reportGenerationRequest.OutputType == OutputType.PDF, reportGenerationRequest.FormatLikeTerrain | ||
, reportGenerationRequest.BreakByPatrol); | ||
return workbook; | ||
} | ||
return reportService.CreateWorkbookWithSheets(1); | ||
} | ||
|
||
private IWorkbook GenerateSIAWorkbook(ReportGenerationRequest reportGenerationRequest) | ||
{ | ||
var reportData = JsonConvert.DeserializeObject<List<SIAProjectListModel>>(reportGenerationRequest.ReportData); | ||
if (reportData != null) | ||
{ | ||
var workbook = reportService.GenerateSIAWorkbook(reportData, reportGenerationRequest.GroupName, reportGenerationRequest.Section | ||
, reportGenerationRequest.UnitName, reportGenerationRequest.OutputType == OutputType.PDF); | ||
return workbook; | ||
} | ||
return reportService.CreateWorkbookWithSheets(1); | ||
} | ||
|
||
private IWorkbook GenerateMilestoneWorkbook(ReportGenerationRequest reportGenerationRequest) | ||
{ | ||
var reportData = JsonConvert.DeserializeObject<List<MilestoneSummaryListModel>>(reportGenerationRequest.ReportData); | ||
if (reportData != null) | ||
{ | ||
var workbook = reportService.GenerateMilestoneWorkbook(reportData, reportGenerationRequest.GroupName, reportGenerationRequest.Section | ||
, reportGenerationRequest.UnitName, reportGenerationRequest.OutputType == OutputType.PDF); | ||
return workbook; | ||
} | ||
return reportService.CreateWorkbookWithSheets(1); | ||
} | ||
|
||
private IWorkbook GenerateLogbookWorkbook(ReportGenerationRequest reportGenerationRequest) | ||
{ | ||
var reportData = JsonConvert.DeserializeObject<List<MemberLogbookReportViewModel>>(reportGenerationRequest.ReportData); | ||
if (reportData != null) | ||
{ | ||
var workbook = reportService.GenerateLogbookWorkbook(reportData, reportGenerationRequest.GroupName, reportGenerationRequest.Section | ||
, reportGenerationRequest.UnitName, reportGenerationRequest.OutputType == OutputType.PDF); | ||
return workbook; | ||
} | ||
return reportService.CreateWorkbookWithSheets(1); | ||
} | ||
|
||
private IWorkbook GenerateWallchartWorkbook(ReportGenerationRequest reportGenerationRequest) | ||
{ | ||
var reportData = JsonConvert.DeserializeObject<List<WallchartItemModel>>(reportGenerationRequest.ReportData); | ||
if (reportData != null) | ||
{ | ||
var workbook = reportService.GenerateWallchartWorkbook(reportData, reportGenerationRequest.GroupName, reportGenerationRequest.Section | ||
, reportGenerationRequest.UnitName, reportGenerationRequest.OutputType == OutputType.PDF); | ||
return workbook; | ||
} | ||
return reportService.CreateWorkbookWithSheets(1); | ||
} | ||
|
||
private IWorkbook GenerateAdditionalAwardsWorkbook(ReportGenerationRequest reportGenerationRequest) | ||
{ | ||
var reportData = JsonConvert.DeserializeObject<AdditionalAwardsReportDataModel>(reportGenerationRequest.ReportData); | ||
if (reportData != null) | ||
{ | ||
var workbook = reportService.GenerateAdditionalAwardsWorkbook(reportData.AwardSpecificationsList, reportData.SortedAdditionalAwardsList, reportData.DistinctAwards, reportGenerationRequest.GroupName, reportGenerationRequest.Section | ||
, reportGenerationRequest.UnitName); | ||
return workbook; | ||
} | ||
return reportService.CreateWorkbookWithSheets(1); | ||
} | ||
|
||
private IWorkbook GenerateApprovalsWorkbook(ReportGenerationRequest reportGenerationRequest) | ||
{ | ||
var reportData = JsonConvert.DeserializeObject<List<ApprovalsListModel>>(reportGenerationRequest.ReportData); | ||
if (reportData != null) | ||
{ | ||
var workbook = reportService.GenerateApprovalsWorkbook(reportData, reportGenerationRequest.GroupName, reportGenerationRequest.Section | ||
, reportGenerationRequest.UnitName, reportGenerationRequest.FromDate, reportGenerationRequest.ToDate, reportGenerationRequest.GroupByMember | ||
, reportGenerationRequest.OutputType == OutputType.PDF); | ||
return workbook; | ||
} | ||
return reportService.CreateWorkbookWithSheets(1); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"profiles": { | ||
"Mock Lambda Test Tool": { | ||
"commandName": "Executable", | ||
"commandLineArgs": "--port 5050", | ||
"workingDirectory": ".\\bin\\$(Configuration)\\net6.0", | ||
"executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-6.0.exe" | ||
} | ||
} | ||
} |
Oops, something went wrong.