Commit 49c92dc6 authored by Jason Ouellet's avatar Jason Ouellet

Ajout solution de base

parent e314be4c
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
\ No newline at end of file
This diff is collapsed.
using System;
namespace HereTruckDistance.Core
{
public class CalculateRouteModel
{
}
}
using System;
using System.Runtime.Serialization;
namespace HereTruckDistance.Core
{
[Serializable]
public class ConfigurationException : Exception
{
private const string MessageFormat = "La valeur {0} n'est pas configuré correctement";
public ConfigurationException()
{
}
public ConfigurationException(string configValue) :
base(string.Format(MessageFormat, configValue))
{
}
public ConfigurationException(string configValue, Exception innerException) :
base(string.Format(MessageFormat, configValue), innerException)
{
}
protected ConfigurationException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
namespace HereTruckDistance.Core
{
public class HereConfig : IHereConfig
{
public string HereUri { get; set; }
public string HereAppId { get; set; }
public string HereAppCode { get; set; }
public IDictionary<String, String> Services { get; set; }
public HereConfig()
{
}
}
}
\ No newline at end of file
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using System;
using System.Runtime.Serialization;
namespace HereTruckDistance.Core
{
public abstract class HereRequest
{
public string Uri { get { return _config.HereUri; } }
public string AppId { get { return _config.HereAppId; } }
public string AppCode { get { return _config.HereAppCode; } }
public string Service { get; set; }
protected readonly HereConfig _config;
protected HereRequest(IConfiguration config)
{
_config = new HereConfig();
_config.HereUri = config.GetSection("HereConfig:HereUri").Value;
_config.HereAppId = config.GetSection("HereConfig:HereAppId").Value;
_config.HereAppCode = config.GetSection("HereConfig:HereAppCode").Value;
}
public Uri GetUri()
{
Valider();
var retourUri = new UriBuilder(Uri);
retourUri.Query = Service;
return retourUri.Uri;
}
private void Valider()
{
if (Uri is null || Uri.Length == 0) {
throw new ConfigurationException(nameof(Uri));
}
if (AppId is null || AppId.Length == 0)
{
throw new ConfigurationException(nameof(AppId));
}
if (AppCode is null || AppCode.Length == 0)
{
throw new ConfigurationException(nameof(AppCode));
}
if (Service is null || Service.Length == 0)
{
throw new ConfigurationException(nameof(Service));
}
}
}
}
\ No newline at end of file
using Microsoft.Extensions.Configuration;
namespace HereTruckDistance.Core
{
public class HereRouteRequest : HereRequest
{
public HereRouteRequest(IConfiguration config) :base(config)
{
Service = _config.Services["HereSrvRoute"].ToString();
}
}
}
\ No newline at end of file
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Globalization;
namespace HereTruckDistance.Core
{
public class HereRouteTruckRequest : HereRequest, IHereRouteRequest
{
public Localisation PointDepart { get; set; }
public Localisation PointDestination { get; set; }
public IList<string> Mode { get; set; }
public bool Trafic { get; set; }
public decimal LimitePoids { get; set; }
public decimal Height { get; set; }
public string ShippedHazardousGoods { get; set; }
public HereRouteTruckRequest(IConfiguration config) : base(config)
{
PointDepart = new Localisation(52.5m, 13.4m);
PointDestination = new Localisation(52.5m, 13.45m);
Mode = new List<string> { "fastest", "truck", "traffic:disabled" };
LimitePoids = 30.5m;
Height = 30.5m;
ShippedHazardousGoods = "harmfulToWater";
}
public Uri GetRequest()
{
//TODO: À changer pour un string builder
UriBuilder uri = new UriBuilder(Uri);
uri.Query = string.Format("app_id={0}&app_code={1}" +
"&waypoint0=geo!{2}" +
"&waypoint1=geo!{3}" +
"&mode=fastest;truck;traffic:disabled" +
"&limitedWeight={4}" +
"&height={5}" +
"&shippedHazardousGoods=harmfulToWater",
AppId,
AppCode,
PointDepart.Point,
PointDestination.Point,
LimitePoids.ToString(CultureInfo.InvariantCulture),
Height.ToString(CultureInfo.InvariantCulture)
);
return uri.Uri;
}
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
</ItemGroup>
</Project>
using System.Collections.Generic;
namespace HereTruckDistance.Core
{
public interface IHereConfig
{
string HereAppCode { get; set; }
string HereAppId { get; set; }
string HereUri { get; set; }
IDictionary<string, string> Services { get; set; }
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Text;
namespace HereTruckDistance.Core
{
public interface IHereRouteRequest
{
Localisation PointDepart { get; set; }
Localisation PointDestination { get; set; }
IList<string> Mode { get; set; }
bool Trafic { get; set; }
decimal LimitePoids { get; set; }
decimal Height { get; set; }
string ShippedHazardousGoods { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace HereTruckDistance.Core
{
public class Localisation
{
public decimal Latitude { get; set; }
public decimal Longitude { get; set; }
public string Point { get { return string.Format("{0},{1}", Latitude.ToString(CultureInfo.InvariantCulture), Longitude.ToString(CultureInfo.InvariantCulture)); }}
public Localisation(decimal latitude, decimal longitude)
{
Latitude = latitude;
Longitude = longitude;
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace HereTruckDistance.Core
{
public enum RouteMode
{
fastest,
car,
truck,
}
}
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v3.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v3.0": {
"HereTruckDistance.Core/1.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration": "3.0.0",
"Microsoft.Extensions.Configuration.Binder": "3.0.0",
"Microsoft.Extensions.Configuration.Json": "3.0.0",
"Newtonsoft.Json": "12.0.2"
},
"runtime": {
"HereTruckDistance.Core.dll": {}
}
},
"Microsoft.Extensions.Configuration/3.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "3.0.0"
},
"runtime": {
"lib/netcoreapp3.0/Microsoft.Extensions.Configuration.dll": {
"assemblyVersion": "3.0.0.0",
"fileVersion": "3.0.19.46305"
}
}
},
"Microsoft.Extensions.Configuration.Abstractions/3.0.0": {
"dependencies": {
"Microsoft.Extensions.Primitives": "3.0.0"
},
"runtime": {
"lib/netcoreapp3.0/Microsoft.Extensions.Configuration.Abstractions.dll": {
"assemblyVersion": "3.0.0.0",
"fileVersion": "3.0.19.46305"
}
}
},
"Microsoft.Extensions.Configuration.Binder/3.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration": "3.0.0"
},
"runtime": {
"lib/netcoreapp3.0/Microsoft.Extensions.Configuration.Binder.dll": {
"assemblyVersion": "3.0.0.0",
"fileVersion": "3.0.19.46305"
}
}
},
"Microsoft.Extensions.Configuration.FileExtensions/3.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration": "3.0.0",
"Microsoft.Extensions.FileProviders.Physical": "3.0.0"
},
"runtime": {
"lib/netcoreapp3.0/Microsoft.Extensions.Configuration.FileExtensions.dll": {
"assemblyVersion": "3.0.0.0",
"fileVersion": "3.0.19.46305"
}
}
},
"Microsoft.Extensions.Configuration.Json/3.0.0": {
"dependencies": {
"Microsoft.Extensions.Configuration": "3.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "3.0.0"
},
"runtime": {
"lib/netcoreapp3.0/Microsoft.Extensions.Configuration.Json.dll": {
"assemblyVersion": "3.0.0.0",
"fileVersion": "3.0.19.46305"
}
}
},
"Microsoft.Extensions.FileProviders.Abstractions/3.0.0": {
"dependencies": {
"Microsoft.Extensions.Primitives": "3.0.0"
},
"runtime": {
"lib/netcoreapp3.0/Microsoft.Extensions.FileProviders.Abstractions.dll": {
"assemblyVersion": "3.0.0.0",
"fileVersion": "3.0.19.46305"
}
}
},
"Microsoft.Extensions.FileProviders.Physical/3.0.0": {
"dependencies": {
"Microsoft.Extensions.FileProviders.Abstractions": "3.0.0",
"Microsoft.Extensions.FileSystemGlobbing": "3.0.0"
},
"runtime": {
"lib/netcoreapp3.0/Microsoft.Extensions.FileProviders.Physical.dll": {
"assemblyVersion": "3.0.0.0",
"fileVersion": "3.0.19.46305"
}
}
},
"Microsoft.Extensions.FileSystemGlobbing/3.0.0": {
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.FileSystemGlobbing.dll": {
"assemblyVersion": "3.0.0.0",
"fileVersion": "3.0.19.46305"
}
}
},
"Microsoft.Extensions.Primitives/3.0.0": {
"runtime": {
"lib/netcoreapp3.0/Microsoft.Extensions.Primitives.dll": {
"assemblyVersion": "3.0.0.0",
"fileVersion": "3.0.19.46305"
}
}
},
"Newtonsoft.Json/12.0.2": {
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {
"assemblyVersion": "12.0.0.0",
"fileVersion": "12.0.2.23222"
}
}
}
}
},
"libraries": {
"HereTruckDistance.Core/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Microsoft.Extensions.Configuration/3.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-KECbOpM0EySVbKTQDN9o0swdnZpwpdhuYngnnJGzXdcAc+JR1mv7iF4lOyK00KSH8OZjobO0TUeo3mn7J2rdrA==",
"path": "microsoft.extensions.configuration/3.0.0",
"hashPath": "microsoft.extensions.configuration.3.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.Abstractions/3.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Lge/PbXC53jI1MF2J92X5EZOeKV8Q/rlB1aV3H9I/ZTDyQGOyBcL03IAvnviWpHKj43BDkNy6kU2KKoh8kAS0g==",
"path": "microsoft.extensions.configuration.abstractions/3.0.0",
"hashPath": "microsoft.extensions.configuration.abstractions.3.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.Binder/3.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-iw3UL25Cw9GBILJOs8srwcId2UCz5+BxTu//EN5dO2dOFNtHcNJgnUiqIlmcGi0orIco0pDuDXuIDvhkrY/sGQ==",
"path": "microsoft.extensions.configuration.binder/3.0.0",
"hashPath": "microsoft.extensions.configuration.binder.3.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.FileExtensions/3.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ldGkKUHp1l0ylmPvWFV9loI3r7odsK5v+FXhBN3+fC/Dzw1mSCRvarqdbfWvzV9asVoVxWOD8+kPd/o8puUZrQ==",
"path": "microsoft.extensions.configuration.fileextensions/3.0.0",
"hashPath": "microsoft.extensions.configuration.fileextensions.3.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Configuration.Json/3.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-OPRsOom05WwlPfuN3ufHc+w/SyovJYpByn45+XrnqogXdS8z5UH03lrC/VKvEEBU0hmiw5wWCM0b2rnaMiEKdA==",
"path": "microsoft.extensions.configuration.json/3.0.0",
"hashPath": "microsoft.extensions.configuration.json.3.0.0.nupkg.sha512"
},
"Microsoft.Extensions.FileProviders.Abstractions/3.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-kahEeykb6FyQytoZNNXuz74X85B4weIEt8Kd+0klK48bkXDWOIHAOvNjlGsPMcS9CL935Te8QGQS83JqCbpdHA==",
"path": "microsoft.extensions.fileproviders.abstractions/3.0.0",
"hashPath": "microsoft.extensions.fileproviders.abstractions.3.0.0.nupkg.sha512"
},
"Microsoft.Extensions.FileProviders.Physical/3.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-76yB1N8hvzDaTqx3epda5sl/3HATw2FskztmmLmfWuvaooaNgbDa37Jyc7IyBCC4PreXEW/XLEET9w6fiJZOFg==",
"path": "microsoft.extensions.fileproviders.physical/3.0.0",
"hashPath": "microsoft.extensions.fileproviders.physical.3.0.0.nupkg.sha512"
},
"Microsoft.Extensions.FileSystemGlobbing/3.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-E1GcUu8JvY/8QfqMUYTs6HlDLefMYhEzeHsjrhRqOZguBmDTFU8d8m+mGtHEyYHWMRT1TEiha0a8I2AuozDUWQ==",
"path": "microsoft.extensions.filesystemglobbing/3.0.0",
"hashPath": "microsoft.extensions.filesystemglobbing.3.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Primitives/3.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-6gwewTbmOh+ZVBicVkL1XRp79sx4O7BVY6Yy+7OYZdwn3pyOKe9lOam+3gXJ3TZMjhJZdV0Ub8hxHt2vkrmN5Q==",
"path": "microsoft.extensions.primitives/3.0.0",
"hashPath": "microsoft.extensions.primitives.3.0.0.nupkg.sha512"
},
"Newtonsoft.Json/12.0.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-rTK0s2EKlfHsQsH6Yx2smvcTCeyoDNgCW7FEYyV01drPlh2T243PR2DiDXqtC5N4GDm4Ma/lkxfW5a/4793vbA==",
"path": "newtonsoft.json/12.0.2",
"hashPath": "newtonsoft.json.12.0.2.nupkg.sha512"
}
}
}
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// Ce code a été généré par un outil.
// Version du runtime :4.0.30319.42000
//
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("HereTruckDistance.Core")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("HereTruckDistance.Core")]
[assembly: System.Reflection.AssemblyTitleAttribute("HereTruckDistance.Core")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Généré par la classe MSBuild WriteCodeFragment.
E:\Travail\GitHub\Services-Conseils-TI-PME\HereTruckDistance\HereTruckDistance.Core\obj\Debug\netcoreapp3.0\HereTruckDistance.Core.csprojAssemblyReference.cache
E:\Travail\GitHub\Services-Conseils-TI-PME\HereTruckDistance\HereTruckDistance.Core\obj\Debug\netcoreapp3.0\HereTruckDistance.Core.AssemblyInfoInputs.cache
E:\Travail\GitHub\Services-Conseils-TI-PME\HereTruckDistance\HereTruckDistance.Core\obj\Debug\netcoreapp3.0\HereTruckDistance.Core.AssemblyInfo.cs
E:\Travail\GitHub\Services-Conseils-TI-PME\HereTruckDistance\HereTruckDistance.Core\bin\Debug\netcoreapp3.0\HereTruckDistance.Core.deps.json
E:\Travail\GitHub\Services-Conseils-TI-PME\HereTruckDistance\HereTruckDistance.Core\bin\Debug\netcoreapp3.0\HereTruckDistance.Core.dll
E:\Travail\GitHub\Services-Conseils-TI-PME\HereTruckDistance\HereTruckDistance.Core\bin\Debug\netcoreapp3.0\HereTruckDistance.Core.pdb
E:\Travail\GitHub\Services-Conseils-TI-PME\HereTruckDistance\HereTruckDistance.Core\obj\Debug\netcoreapp3.0\HereTruckDistance.Core.dll
E:\Travail\GitHub\Services-Conseils-TI-PME\HereTruckDistance\HereTruckDistance.Core\obj\Debug\netcoreapp3.0\HereTruckDistance.Core.pdb