This commit is contained in:
2022-12-10 12:06:16 -07:00
commit a3938d1916
116 changed files with 17236 additions and 0 deletions

1
Shared/.vscode/format-report.json vendored Normal file
View File

@ -0,0 +1 @@
[]

12
Shared/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,12 @@
{
"coverage-gutters.coverageBaseDir": "../.vscode/TestResults/*",
"cSpell.words": [
"Antiforgery",
"Blazor",
"HSTS",
"Infineon",
"Serilog",
"Setpoint"
],
"watch": "set ASPNETCORE_ENVIRONMENT=Development&& dotnet watch run"
}

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Text.Json" Version="7.0.0" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,7 @@
using System.Text.Json.Serialization;
namespace Expose.MyIT.Shared.Models;
public record AdditionalData(
[property: JsonPropertyName("ServiceId")] string ServiceId
);

View File

@ -0,0 +1,9 @@
using System.Text.Json.Serialization;
namespace Expose.MyIT.Shared.Models;
public record AllowedActions(
[property: JsonPropertyName("Incident")] bool Incident,
[property: JsonPropertyName("Accept")] bool Accept,
[property: JsonPropertyName("Reorder")] bool Reorder
);

18
Shared/Models/Booking.cs Normal file
View File

@ -0,0 +1,18 @@
using System.Text.Json.Serialization;
namespace Expose.MyIT.Shared.Models;
public record Booking(
[property: JsonPropertyName("Catalog")] Catalog Catalog,
[property: JsonPropertyName("Name")] string Name,
[property: JsonPropertyName("Description")] string Description,
[property: JsonPropertyName("PaymentMethod")] int PaymentMethod,
[property: JsonPropertyName("Service")] Service Service,
[property: JsonPropertyName("Order")] Order Order,
[property: JsonPropertyName("ApprovalStatus")] int ApprovalStatus,
[property: JsonPropertyName("AllowedActions")] AllowedActions AllowedActions,
[property: JsonPropertyName("ObjectId")] string ObjectId,
[property: JsonPropertyName("Id")] string Id,
[property: JsonPropertyName("Quantity")] int Quantity,
[property: JsonPropertyName("AdditionalData")] AdditionalData AdditionalData
);

9
Shared/Models/Catalog.cs Normal file
View File

@ -0,0 +1,9 @@
using System.Text.Json.Serialization;
namespace Expose.MyIT.Shared.Models;
public record Catalog(
[property: JsonPropertyName("Id")] string Id,
[property: JsonPropertyName("Name")] string Name,
[property: JsonPropertyName("CurrencyCode")] string CurrencyCode
);

View File

@ -0,0 +1,11 @@
namespace Expose.MyIT.Shared.Models.Stateless;
public interface IServiceShopOrderController
{
enum Action : int
{
All = 0
}
}

View File

@ -0,0 +1,11 @@
namespace Expose.MyIT.Shared.Models.Stateless;
public interface ISsaOrderController
{
enum Action : int
{
All = 0
}
}

View File

@ -0,0 +1,9 @@
namespace Expose.MyIT.Shared.Models.Methods;
public interface IServiceShopOrderRepository
{
Task<ViewModels.ServiceShopOrder[]> GetAllServiceShopOrders();
Task<ViewModels.ServiceShopOrder[]> GetServiceShopOrders(string id);
}

View File

@ -0,0 +1,9 @@
namespace Expose.MyIT.Shared.Models.Methods;
public interface ISsaOrderRepository
{
Task<ViewModels.SsaOrder[]> GetAllSsaOrders();
Task<ViewModels.SsaOrder[]> GetSsaOrders(string id);
}

26
Shared/Models/Order.cs Normal file
View File

@ -0,0 +1,26 @@
using System.Text.Json.Serialization;
namespace Expose.MyIT.Shared.Models;
public record Order(
[property: JsonPropertyName("Bookings")] IReadOnlyList<Booking> Bookings,
[property: JsonPropertyName("AllowedActions")] AllowedActions AllowedActions,
[property: JsonPropertyName("Id")] string Id,
[property: JsonPropertyName("ObjectId")] string ObjectId,
[property: JsonPropertyName("Name")] string Name,
[property: JsonPropertyName("Type")] string Type,
[property: JsonPropertyName("TypeId")] int TypeId,
[property: JsonPropertyName("State")] string State,
[property: JsonPropertyName("StateId")] int StateId,
[property: JsonPropertyName("StateIcon")] string StateIcon,
[property: JsonPropertyName("StateColor")] string StateColor,
[property: JsonPropertyName("ItemNumber")] string ItemNumber,
[property: JsonPropertyName("CreatedDate")] DateTime CreatedDate,
[property: JsonPropertyName("DecidedDate")] DateTime DecidedDate,
[property: JsonPropertyName("CostCenterId")] string CostCenterId,
[property: JsonPropertyName("CostCenterName")] string CostCenterName,
[property: JsonPropertyName("Recipient")] string Recipient,
[property: JsonPropertyName("RecipientId")] string RecipientId,
[property: JsonPropertyName("Requestor")] string Requestor,
[property: JsonPropertyName("RequestorId")] string RequestorId
);

9
Shared/Models/Order2.cs Normal file
View File

@ -0,0 +1,9 @@
using System.Text.Json.Serialization;
namespace Expose.MyIT.Shared.Models;
public record Order2(
[property: JsonPropertyName("Id")] string Id,
[property: JsonPropertyName("Name")] string Name,
[property: JsonPropertyName("TypeId")] int TypeId
);

7
Shared/Models/Price.cs Normal file
View File

@ -0,0 +1,7 @@
using System.Text.Json.Serialization;
namespace Expose.MyIT.Shared.Models;
public record Price(
[property: JsonPropertyName("CC")] string CC
);

8
Shared/Models/SSA.cs Normal file
View File

@ -0,0 +1,8 @@
using System.Text.Json.Serialization;
namespace Expose.MyIT.Shared.Models;
public record SSA(
[property: JsonPropertyName("Orders")] IReadOnlyList<Order> Orders,
[property: JsonPropertyName("Total")] int Total
);

20
Shared/Models/Service.cs Normal file
View File

@ -0,0 +1,20 @@
using System.Text.Json.Serialization;
namespace Expose.MyIT.Shared.Models;
public record Service(
[property: JsonPropertyName("Id")] string Id,
[property: JsonPropertyName("Quantity")] int Quantity,
[property: JsonPropertyName("PaymentMethod")] int PaymentMethod,
[property: JsonPropertyName("Price")] Price Price,
[property: JsonPropertyName("ObjectId")] string ObjectId,
[property: JsonPropertyName("ConfigurationItemType")] int ConfigurationItemType,
[property: JsonPropertyName("ConfigurationItemTypeName")] string ConfigurationItemTypeName,
[property: JsonPropertyName("ServiceType")] int ServiceType,
[property: JsonPropertyName("CustomFormEntityId")] string CustomFormEntityId,
[property: JsonPropertyName("CustomFormEntityName")] string CustomFormEntityName,
[property: JsonPropertyName("CreateMultipleBookings")] bool CreateMultipleBookings,
[property: JsonPropertyName("AllowIdenticalInstances")] bool AllowIdenticalInstances,
[property: JsonPropertyName("Catalog")] Catalog Catalog,
[property: JsonPropertyName("UninstallationMode")] int? UninstallationMode
);

View File

@ -0,0 +1,8 @@
using System.Text.Json.Serialization;
namespace Expose.MyIT.Shared.Models;
public record ServiceShop(
[property: JsonPropertyName("Orders")] IReadOnlyList<Order> Orders,
[property: JsonPropertyName("Total")] int Total
);

View File

@ -0,0 +1,9 @@
namespace Expose.MyIT.Shared.Models.Stateless.Methods;
public interface IAppSettingsController
{
static string GetRouteName() => nameof(IAppSettingsController)[1..^10];
string[] GetAppSettings();
}

View File

@ -0,0 +1,10 @@
namespace Expose.MyIT.Shared.Models.Stateless.Methods;
public interface IClientSettingsController
{
static string GetRouteName() => nameof(IClientSettingsController)[1..^10];
string[] GetClientSettings();
string GetIpAddress();
}

View File

@ -0,0 +1,10 @@
using System.Runtime.CompilerServices;
namespace Expose.MyIT.Shared.Models.Stateless.Methods;
public interface IMethodName
{
static string? GetActualAsyncMethodName([CallerMemberName] string? name = null) => name;
}

View File

@ -0,0 +1,11 @@
namespace Expose.MyIT.Shared.Models.Stateless.Methods;
public interface IServiceShopOrder
{
ViewModels.ServiceShopOrder[] TestStatic_GetServiceShopOrders(ServiceShop? serviceShop) =>
GetServiceShopOrders(serviceShop);
static ViewModels.ServiceShopOrder[] GetServiceShopOrders(ServiceShop? serviceShop) =>
ServiceShopOrder.GetServiceShopOrders(serviceShop);
}

View File

@ -0,0 +1,10 @@
namespace Expose.MyIT.Shared.Models.Stateless.Methods;
public interface IServiceShopOrderController
{
static string GetRouteName() => nameof(IServiceShopOrderController)[1..^10];
Task<ViewModels.ServiceShopOrder[]> GetAllServiceShopOrders();
Task<ViewModels.ServiceShopOrder[]> GetServiceShopOrders(string id);
}

View File

@ -0,0 +1,11 @@
namespace Expose.MyIT.Shared.Models.Stateless.Methods;
public interface ISsaOrder
{
ViewModels.SsaOrder[] TestStatic_GetSsaOrders(SSA? ssa) =>
GetSsaOrders(ssa);
static ViewModels.SsaOrder[] GetSsaOrders(SSA? ssa) =>
SsaOrder.GetSsaOrders(ssa);
}

View File

@ -0,0 +1,10 @@
namespace Expose.MyIT.Shared.Models.Stateless.Methods;
public interface ISsaOrderController
{
static string GetRouteName() => nameof(ISsaOrderController)[1..^10];
Task<ViewModels.SsaOrder[]> GetAllSsaOrders();
Task<ViewModels.SsaOrder[]> GetSsaOrders(string id);
}

View File

@ -0,0 +1,9 @@
namespace Expose.MyIT.Shared.Models.Stateless.Methods;
public interface IWeatherForecastController
{
static string GetRouteName() => nameof(IWeatherForecastController)[1..^10];
Task<ViewModels.WeatherForecast[]> Get();
}

View File

@ -0,0 +1,16 @@
namespace Expose.MyIT.Shared.Models.Stateless.Methods;
internal class ServiceShopOrder
{
internal static ViewModels.ServiceShopOrder[] GetServiceShopOrders(ServiceShop? serviceShop)
{
ViewModels.ServiceShopOrder[] results;
if (serviceShop is null || !serviceShop.Orders.Any())
results = Array.Empty<ViewModels.ServiceShopOrder>();
else
results = serviceShop.Orders.Select(l => new ViewModels.ServiceShopOrder(l)).ToArray();
return results;
}
}

View File

@ -0,0 +1,16 @@
namespace Expose.MyIT.Shared.Models.Stateless.Methods;
internal class SsaOrder
{
internal static ViewModels.SsaOrder[] GetSsaOrders(SSA? ssa)
{
ViewModels.SsaOrder[] results;
if (ssa is null || !ssa.Orders.Any())
results = Array.Empty<ViewModels.SsaOrder>();
else
results = ssa.Orders.Select(l => new ViewModels.SsaOrder(l)).ToArray();
return results;
}
}

View File

@ -0,0 +1,12 @@
namespace Expose.MyIT.Shared.Models;
public class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public string? Summary { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}

View File

@ -0,0 +1,52 @@
using System.Text.Json;
namespace Expose.MyIT.Shared.ViewModels;
public class ServiceShopOrder
{
public string Id { init; get; }
public string Name { init; get; }
public string[] BookingNames { init; get; }
public string Type { init; get; }
public string State { init; get; }
public string ItemNumber { init; get; }
public DateTime CreatedDate { init; get; }
public DateTime DecidedDate { init; get; }
public string Recipient { init; get; }
public string Requestor { init; get; }
public ServiceShopOrder(string id, string name, string[] bookingNames, string type, string state, string itemNumber, DateTime createdDate, DateTime decidedDate, string recipient, string requestor)
{
Id = id;
Name = name;
BookingNames = bookingNames;
Type = type;
State = state;
ItemNumber = itemNumber;
CreatedDate = createdDate;
DecidedDate = decidedDate;
Recipient = recipient;
Requestor = requestor;
}
public ServiceShopOrder(Models.Order order) :
this(order.Id,
order.Name,
order.Bookings is null || !order.Bookings.Any() ? Array.Empty<string>() : order.Bookings.Select(l => l.Name).ToArray(),
order.Type,
order.State,
order.ItemNumber,
order.CreatedDate,
order.DecidedDate,
order.Recipient,
order.Requestor)
{ }
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
}

View File

@ -0,0 +1,52 @@
using System.Text.Json;
namespace Expose.MyIT.Shared.ViewModels;
public class SsaOrder
{
public string Id { init; get; }
public string Name { init; get; }
public string[] BookingNames { init; get; }
public string Type { init; get; }
public string State { init; get; }
public string ItemNumber { init; get; }
public DateTime CreatedDate { init; get; }
public DateTime DecidedDate { init; get; }
public string Recipient { init; get; }
public string Requestor { init; get; }
public SsaOrder(string id, string name, string[] bookingNames, string type, string state, string itemNumber, DateTime createdDate, DateTime decidedDate, string recipient, string requestor)
{
Id = id;
Name = name;
BookingNames = bookingNames;
Type = type;
State = state;
ItemNumber = itemNumber;
CreatedDate = createdDate;
DecidedDate = decidedDate;
Recipient = recipient;
Requestor = requestor;
}
public SsaOrder(Models.Order order) :
this(order.Id,
order.Name,
order.Bookings is null || !order.Bookings.Any() ? Array.Empty<string>() : order.Bookings.Select(l => l.Name).ToArray(),
order.Type,
order.State,
order.ItemNumber,
order.CreatedDate,
order.DecidedDate,
order.Recipient,
order.Requestor)
{ }
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
}

View File

@ -0,0 +1,36 @@
using System.Text.Json;
namespace Expose.MyIT.Shared.ViewModels;
public class WeatherForecast
{
public DateOnly Date { init; get; }
public int TemperatureC { init; get; }
public string? Summary { init; get; }
public int TemperatureF { init; get; }
public WeatherForecast(DateOnly date, int temperatureC, string? summary, int temperatureF)
{
Date = date;
TemperatureC = temperatureC;
Summary = summary;
TemperatureF = temperatureF;
}
public WeatherForecast(Models.WeatherForecast weatherForecast) :
this(weatherForecast.Date,
weatherForecast.TemperatureC,
weatherForecast.Summary,
weatherForecast.TemperatureF)
{ }
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
}