chore: add Imagoverum fleet management package
This commit is contained in:
@@ -0,0 +1 @@
|
||||
call %~dps0..\..\TeamBuildEvent.cmd %1 %2 %3 "/Solutions/FleetManagement"
|
||||
@@ -0,0 +1,49 @@
|
||||
using Matrix42.Behaviors.Contracts;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using update4u.SPS.Security;
|
||||
|
||||
namespace Imagoverum.FleetManagement.BizLogic
|
||||
{
|
||||
public class CarBehavior() : CustomGenericBehavior
|
||||
{
|
||||
private static readonly string Secured = "***Secured***";
|
||||
|
||||
private const string PasswordField = "FuelCardPinCode";
|
||||
|
||||
public override void OnAdding(DbRecord dbRecord, BehaviorActionContext context)
|
||||
{
|
||||
if (dbRecord.Data["IMGVCarClass"]["Name"].ToString() == "Test")
|
||||
{
|
||||
dbRecord.Data["IMGVCarClass"]["Name"] = "Specify choice";
|
||||
}
|
||||
|
||||
EncryptPasswordField(dbRecord, context, isNew: true);
|
||||
|
||||
base.OnAdding(dbRecord, context);
|
||||
}
|
||||
|
||||
public override void OnModifing(DbRecord dbRecord, BehaviorActionContext context)
|
||||
{
|
||||
EncryptPasswordField(dbRecord, context, isNew: false);
|
||||
|
||||
base.OnModifing(dbRecord, context);
|
||||
}
|
||||
|
||||
private void EncryptPasswordField(DbRecord dbRecord, BehaviorActionContext context, bool isNew)
|
||||
{
|
||||
if (isNew || dbRecord.Data["IMGVCarClass"][PasswordField].ToString() != Secured)
|
||||
{
|
||||
dbRecord.Data["IMGVCarClass"][PasswordField] = CryptoManager.Instance.EncryptDBText(dbRecord.Data["IMGVCarClass"][PasswordField].ToString());
|
||||
}
|
||||
else if (dbRecord.Data["IMGVCarClass"][PasswordField].ToString() == Secured)
|
||||
{
|
||||
var oldRecordData = context?.OldValue?.Data;
|
||||
if (oldRecordData != null)
|
||||
{
|
||||
dbRecord.Data["IMGVCarClass"][PasswordField] = oldRecordData["IMGVCarClass"][PasswordField];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Imagoverum.FleetManagement.BizLogic
|
||||
{
|
||||
public static class CarTester
|
||||
{
|
||||
public static bool IsCarWorkingProperly()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<LangVersion>latestmajor</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Matrix42.Behaviors.Contracts">
|
||||
<HintPath>..\..\..\..\Root\bin\Matrix42.Behaviors.Contracts.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="update4u.SPS.Security">
|
||||
<HintPath>..\..\..\..\Root\bin\update4u.SPS.Security.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<M42ExtensionId>22be0879-4587-cf4b-333c-08de16408acb</M42ExtensionId>
|
||||
<M42AssemblyPattern>$(MSBuildProjectName)*.*</M42AssemblyPattern>
|
||||
<M42EnableRidBuild>false</M42EnableRidBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\..\..\Extension.Assemblies.targets" Condition="Exists('..\..\..\Extension.Assemblies.targets')" />
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
""
|
||||
{
|
||||
"FILE_VERSION" = "9237"
|
||||
"ENLISTMENT_CHOICE" = "NEVER"
|
||||
"PROJECT_FILE_RELATIVE_PATH" = ""
|
||||
"NUMBER_OF_EXCLUDED_FILES" = "0"
|
||||
"ORIGINAL_PROJECT_FILE_PATH" = ""
|
||||
"NUMBER_OF_NESTED_PROJECTS" = "0"
|
||||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
REM %robodir%robocopy %targetDir% %basedir%BasePackage\Assemblies\ Imagoverum.FleetManagement*.* /s %roboOptions%
|
||||
|
||||
exit /b 0
|
||||
@@ -0,0 +1,78 @@
|
||||
using Imagoverum.FleetManagement.BizLogic;
|
||||
using Matrix42.Blob.Contracts;
|
||||
using Matrix42.WebApi.Contracts;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Imagoverum.FleetManagement.Services
|
||||
{
|
||||
[RoutePrefix("api/car")]
|
||||
public class CarController(IBlobManager blobManager) : ApiController
|
||||
{
|
||||
[HttpGet, Route("geoposition")]
|
||||
public GeoLocation GetLocation(string region = "world")
|
||||
{
|
||||
return GeoLocation.GetRandom(region);
|
||||
}
|
||||
|
||||
[HttpPost, Route("test")]
|
||||
public string TestCar()
|
||||
{
|
||||
var blobState = blobManager.IsBlobConfigured()
|
||||
? "With Configured Cloud"
|
||||
: "Without Configured Cloud";
|
||||
|
||||
return CarTester.IsCarWorkingProperly()
|
||||
? $"Car test successful completed ({blobState}) on {RuntimeInformation.OSDescription} environment at " + DateTime.UtcNow.ToString("o")
|
||||
: $"Car test failed ({blobState}) on {RuntimeInformation.OSDescription} environment at " + DateTime.UtcNow.ToString("o");
|
||||
}
|
||||
|
||||
[Route("error")]
|
||||
[HttpGet]
|
||||
public IHttpActionResult Throw()
|
||||
{
|
||||
throw new Exception("Boom! Unhandled!");
|
||||
}
|
||||
|
||||
public class GeoLocation(double latitude, double longitude)
|
||||
{
|
||||
/// <summary>
|
||||
/// Latitude in decimal degrees. Valid range: -90 to 90.
|
||||
/// </summary>
|
||||
public double Latitude { get; set; } = latitude;
|
||||
|
||||
/// <summary>
|
||||
/// Longitude in decimal degrees. Valid range: -180 to 180.
|
||||
/// </summary>
|
||||
public double Longitude { get; set; } = longitude;
|
||||
|
||||
/// <summary>
|
||||
/// Generates a random geographic location.
|
||||
/// If a region is specified, limits the random coordinates within that region.
|
||||
/// </summary>
|
||||
/// <param name="region">Optional region: "europe", "asia", "north-america", "south-america", "africa", "australia", or "world" (default).</param>
|
||||
public static GeoLocation GetRandom(string region = "world")
|
||||
{
|
||||
var rnd = new Random();
|
||||
|
||||
// Define approximate bounding boxes for major regions
|
||||
(double latMin, double latMax, double lonMin, double lonMax) bounds = region.ToLower() switch
|
||||
{
|
||||
"europe" => (35, 71, -25, 45),
|
||||
"asia" => (-10, 81, 25, 180),
|
||||
"north-america" => (5, 83, -170, -30),
|
||||
"south-america" => (-56, 13, -82, -34),
|
||||
"africa" => (-35, 37, -18, 52),
|
||||
"australia" => (-47, -10, 110, 155),
|
||||
_ => (-90, 90, -180, 180) // whole world
|
||||
};
|
||||
|
||||
double latitude = rnd.NextDouble() * (bounds.latMax - bounds.latMin) + bounds.latMin;
|
||||
double longitude = rnd.NextDouble() * (bounds.lonMax - bounds.lonMin) + bounds.lonMin;
|
||||
|
||||
return new GeoLocation(latitude, longitude);
|
||||
}
|
||||
|
||||
public override string ToString() => $"Lat: {Latitude:F5}, Lon: {Longitude:F5}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
<!-- Build can target either RID from CLI/YAML; locally we'll build both via the target below -->
|
||||
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
|
||||
<AppendRuntimeIdentifierToOutputPath>true</AppendRuntimeIdentifierToOutputPath>
|
||||
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<LangVersion>latestmajor</LangVersion>
|
||||
|
||||
<!-- Where to mirror outputs (project-relative, stable in CI & local) -->
|
||||
<!-- Adjust ..\..\..\ if your folder depth differs -->
|
||||
<BasePackageAssembliesDir>$(MSBuildProjectDirectory)\..\..\..\BasePackage\Assemblies\</BasePackageAssembliesDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Imagoverum.FleetManagement.BizLogic\Imagoverum.FleetManagement.BizLogic.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Matrix42.Blob.Contracts">
|
||||
<HintPath>..\..\..\..\Root\bin\Matrix42.Blob.Contracts.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Matrix42.WebApi.Contracts">
|
||||
<HintPath>..\..\..\..\Root\bin\Matrix42.WebApi.Contracts.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Imagoverum.FleetManagement.Services.dll.host.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<M42ExtensionId>22be0879-4587-cf4b-333c-08de16408acb</M42ExtensionId>
|
||||
<M42AssemblyPattern>$(MSBuildProjectName)*.*</M42AssemblyPattern>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\..\..\Extension.Assemblies.targets" Condition="Exists('..\..\..\Extension.Assemblies.targets')" />
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<host xmlns="urn:m42/host.config">
|
||||
<modules>
|
||||
<module assembly="Matrix42.DataLayer.Persistence" />
|
||||
<module assembly="Matrix42.Blob.BizLogic" />
|
||||
</modules>
|
||||
<sections></sections>
|
||||
</host>
|
||||
@@ -0,0 +1,3 @@
|
||||
REM %robodir%robocopy %targetDir% %basedir%BasePackage\Assemblies\ Imagoverum.FleetManagement*.* /s %roboOptions%
|
||||
|
||||
exit /b 0
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"profiles": {
|
||||
"Matrix42.Imagoverum.FleetManagement.Services": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:63088;http://localhost:63089"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36310.24
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Imagoverum.FleetManagement.Services", "Imagoverum.FleetManagement.Services\Imagoverum.FleetManagement.Services.csproj", "{A0E718BE-9056-A2E9-1301-C9F9704ECDF3}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
BuildEvent.cmd = BuildEvent.cmd
|
||||
..\..\azure-pipelines-ci.yaml = ..\..\azure-pipelines-ci.yaml
|
||||
..\..\Extension.Assemblies.targets = ..\..\Extension.Assemblies.targets
|
||||
..\..\TeamBuildEvent.cmd = ..\..\TeamBuildEvent.cmd
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Imagoverum.FleetManagement.BizLogic", "Imagoverum.FleetManagement.BizLogic\Imagoverum.FleetManagement.BizLogic.csproj", "{E72B0A73-F3EC-46F6-8464-D6C891DCA67C}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{FE1C91D1-E02F-4A92-B4E6-23DC3DCDF5D1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Imagoverum.FleetManagement.Tests", "Tests\Imagoverum.FleetManagement.Tests\Imagoverum.FleetManagement.Tests.csproj", "{E9179E67-0E80-4E87-A0D7-B537252E15A5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A0E718BE-9056-A2E9-1301-C9F9704ECDF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A0E718BE-9056-A2E9-1301-C9F9704ECDF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A0E718BE-9056-A2E9-1301-C9F9704ECDF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A0E718BE-9056-A2E9-1301-C9F9704ECDF3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E72B0A73-F3EC-46F6-8464-D6C891DCA67C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E72B0A73-F3EC-46F6-8464-D6C891DCA67C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E72B0A73-F3EC-46F6-8464-D6C891DCA67C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E72B0A73-F3EC-46F6-8464-D6C891DCA67C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E9179E67-0E80-4E87-A0D7-B537252E15A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E9179E67-0E80-4E87-A0D7-B537252E15A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E9179E67-0E80-4E87-A0D7-B537252E15A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E9179E67-0E80-4E87-A0D7-B537252E15A5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{E9179E67-0E80-4E87-A0D7-B537252E15A5} = {FE1C91D1-E02F-4A92-B4E6-23DC3DCDF5D1}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {16277959-19C9-48D5-BD44-3C53F3DDB02E}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="MSTest" Version="3.6.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1 @@
|
||||
[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)]
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Imagoverum.FleetManagement.Tests
|
||||
{
|
||||
[TestClass]
|
||||
public sealed class Test1
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestMethod1()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user