Merge branch 'laa_web'

This commit is contained in:
Stoyan Zlatev
2023-06-01 14:25:38 +02:00
86 changed files with 781 additions and 1953 deletions
@@ -1,26 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="nunit" Version="3.10.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LaaProductionWeb.API\LaaProductionWeb.API.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Mvc.Abstractions">
<HintPath>..\..\..\..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.abstractions\2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Abstractions.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
@@ -1,171 +0,0 @@
namespace LaaProductionWeb.Tests.Models
{
using LaaProductionWeb.API.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using NUnit.Framework;
using System.Linq;
using System.Reflection;
public class ModelResultTests
{
[Test]
public void ModelResult_ShouldBeImplicitlyCreated_FromModelStateDictionary()
{
// Act
ModelResult<string> modelResult = default(ModelStateDictionary);
// Assert
Assert.IsNotNull(modelResult);
}
[Test]
public void ModelResult_ShouldInitializeModelErrors_WhenCreatedFrom_ModelStateDictionary()
{
// Act
ModelResult<string> modelResult = default(ModelStateDictionary);
// Assert
Assert.IsNotNull(modelResult.ModelErrors);
}
[Test]
public void ModelResult_ShouldNotSucceeded_WhenCreatedFrom_ModelStateDictionary()
{
// Act
ModelResult<string> modelResult = default(ModelStateDictionary);
// Assert
Assert.IsFalse(modelResult.Succeeded);
}
[Test]
public void ModelResult_ShouldBeImplicitlyCreated_FromOtherObjects()
{
// Act
ModelResult<dynamic> modelResult = default(object);
// Assert
Assert.IsNotNull(modelResult);
}
[Test]
public void ModelResult_ShouldSucceeded_WhenCreated_FromOtherObjects()
{
// Act
ModelResult<dynamic> modelResult = default(object);
// Assert
Assert.IsTrue(modelResult.Succeeded);
}
[Test]
public void ModelResult_ShouldHaveSameValue_WhenCreated_FromOtherObjects()
{
// Arrange
var value = nameof(ModelResult<dynamic>);
ModelResult<string> modelResult = value;
// Act
var fieldValue = typeof(ModelResult<string>)
.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)
.FirstOrDefault(x => x.Name == nameof(value))
?.GetValue(modelResult);
// Assert
Assert.AreEqual(value, fieldValue);
}
[Test]
public void ModelResult_AddModelError_ShuldNotAddError_WhenKeyIsNull()
{
// Arrange
ModelResult<dynamic> modelResult = default(ModelStateDictionary);
var modelErrors = modelResult.ModelErrors;
// Act
var errorsCountBefore = modelErrors.Count;
modelResult.AddModelError(null, null);
var errorsCountAfter = modelErrors.Count;
// Assert
Assert.AreEqual(errorsCountBefore, errorsCountAfter);
}
[Test]
public void ModelResult_AddModelError_ShuldAddErrors_WhenKeyIsNotNull()
{
// Arrange
ModelResult<dynamic> modelResult = default(ModelStateDictionary);
var modelErrors = modelResult.ModelErrors;
// Act
var errorsCountBefore = modelErrors.Count;
modelResult.AddModelError(string.Empty, null);
var errorsCountAfter = modelErrors.Count;
// Assert
Assert.Greater(errorsCountAfter, errorsCountBefore);
}
[Test]
public void ModelResult_AddModelError_ShuldOverrideError_WhenKeyExists()
{
// Arrange
ModelResult<dynamic> modelResult = default(ModelStateDictionary);
var modelErrors = modelResult.ModelErrors;
// Act
modelResult.AddModelError(string.Empty, "1");
var valueBefore = modelErrors[string.Empty];
modelResult.AddModelError(string.Empty, "2");
var valueAfter = modelErrors[string.Empty];
// Assert
Assert.AreNotEqual(valueBefore, valueAfter);
}
[Test]
public void ModelResult_ReturnsNotFoundResult_WhenModelResult_IsNull()
{
// Arrange
ModelResult<dynamic> modelResult = null;
// Act
ActionResult actionResult = modelResult;
// Assert
Assert.AreEqual(actionResult.GetType(), typeof(NotFoundResult));
}
[Test]
public void ModelResult_ReturnsBadRequestObjectResult_WhenCreatedFrom_ModelStateDictionary()
{
// Arrange
ModelResult<dynamic> modelResult = default(ModelStateDictionary);
// Act
ActionResult actionResult = modelResult;
// Assert
Assert.AreEqual(actionResult.GetType(), typeof(BadRequestObjectResult));
}
[Test]
public void ModelResult_ReturnsOkObjectResult_WhenCreatedWhitValue()
{
// Arrange
ModelResult<dynamic> modelResult = default(string);
// Act
ActionResult actionResult = modelResult;
// Assert
Assert.AreEqual(actionResult.GetType(), typeof(OkObjectResult));
}
}
}
@@ -1,145 +0,0 @@
namespace LaaProductionWeb.Tests.Models
{
using LaaProductionWeb.API.Areas.Serach.Models;
using NUnit.Framework;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
public class WildcardInputModelTests
{
private readonly WildcardInputModel model;
private readonly PropertyInfo tokenPropertyInfo;
public WildcardInputModelTests()
{
this.model = new WildcardInputModel();
this.tokenPropertyInfo = typeof(WildcardInputModel)
.GetProperty(nameof(WildcardInputModel.Token), BindingFlags.Instance | BindingFlags.Public);
}
[Test]
public void ModelValidation_ShouldNotValidate_WhenTokenIsNull()
{
// Arrange
var errorMessage = this.ValidateModelWhitValue(default(string));
// Act
var attributeMessage = this.GetAttributeMessage<RequiredAttribute>();
// Assert
Assert.AreEqual(errorMessage, attributeMessage);
}
[Test]
public void ModelValidation_ShouldNotValidate_WhenTokenIsUnder_1CharLength()
{
// Arrange
var errorMessage = this.ValidateModelWhitValue(string.Empty);
// Act
var attributeMessage = this.GetAttributeMessage<StringLengthAttribute>();
// Assert
Assert.AreEqual(errorMessage, attributeMessage);
}
[Test]
public void ModelValidation_ShouldNotValidate_WhenTokenIsOver_50CharsLength()
{
// Arrange
var errorMessage = this.ValidateModelWhitValue(new string('0', 51));
// Act
var attributeMessage = this.GetAttributeMessage<StringLengthAttribute>();
// Assert
Assert.AreEqual(errorMessage, attributeMessage);
}
[Test]
[TestCase("^")]
[TestCase("°")]
[TestCase("\"")]
[TestCase("§")]
[TestCase("$")]
[TestCase("%")]
[TestCase("&")]
[TestCase("/")]
[TestCase("(")]
[TestCase(")")]
[TestCase("=")]
[TestCase("?")]
[TestCase("`")]
[TestCase("´")]
[TestCase("'")]
[TestCase("#")]
[TestCase("*")]
[TestCase("+")]
[TestCase("|")]
[TestCase("\t")]
[TestCase("\n")]
[TestCase("<")]
[TestCase(">")]
[TestCase(".")]
[TestCase(";")]
[TestCase(":")]
[TestCase("_")]
[TestCase("ä")]
[TestCase("ö")]
[TestCase("ü")]
[TestCase("Ä")]
[TestCase("Ö")]
[TestCase("Ü")]
[TestCase("ß")]
public void ModelValidation_ShouldNotValidate_WhenTokenContains_NonWordCharachters(string token)
{
// Arrange
var errorMessage = this.ValidateModelWhitValue(token);
// Act
var attributeMessage = this.GetAttributeMessage<RegularExpressionAttribute>();
// Assert
Assert.AreEqual(errorMessage, attributeMessage);
}
[Test]
[TestCase("0123245 5575689-ARWQGVVJALR fasdkfawe irfoelvm")]
public void ModelValidation_ShouldValidate_WhenTokenIsValidNr(string token)
{
// Arrange
var nullMessage = default(string);
// Act
var errorMessage = this.ValidateModelWhitValue(token);
// Assert
Assert.AreEqual(errorMessage, nullMessage);
}
private string ValidateModelWhitValue(string value)
{
var validationResults = new List<ValidationResult>();
var validationContext = new ValidationContext(this.model);
if (Validator.TryValidateObject(this.model, validationContext, validationResults))
{
return validationResults
.Where(x => x.MemberNames.Contains(nameof(WildcardInputModel.Token)))
.FirstOrDefault(x => !string.IsNullOrWhiteSpace(x.ErrorMessage))
?.ErrorMessage ?? default(string);
}
return default(string);
}
private string GetAttributeMessage<T>() where T : ValidationAttribute
=> this.tokenPropertyInfo
.GetCustomAttribute<RequiredAttribute>()
.ErrorMessage;
}
}
@@ -1,16 +0,0 @@
namespace LaaProductionWeb.API.Areas.Account.Controllers
{
using LaaProductionWeb.Standart.Interfaces;
using Microsoft.AspNetCore.Mvc;
[ApiController]
[Area("Account")]
[Route("[area]/[controller]")]
public class AccountBaseController : ControllerBase
{
protected readonly IAccountService accountService;
public AccountBaseController(IAccountService accountService)
=> this.accountService = accountService;
}
}
@@ -1,40 +0,0 @@
namespace LaaProductionWeb.API.Areas.Account.Controllers
{
using LaaProductionWeb.Standart.Interfaces;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class FunctionsController : AccountBaseController
{
public FunctionsController(IAccountService accountService) : base(accountService)
{
}
[HttpGet]
public ActionResult<IEnumerable<string>> Get([FromHeader(Name = "Authorization")]string bearer)
{
var values = bearer
.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
.Select(x => Encoding.UTF8.GetString(Convert.FromBase64String(x)))
.LastOrDefault()
?.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries)
?? Array.Empty<string>();
if (values.Length != 3 || !short.TryParse(values[0], out short appId))
{
return this.BadRequest("Endpoint expects bearer authorization header with appId:username:password base64 encoded.");
}
var username = values[1];
var password = values[2];
var functions = this.accountService.FindUserFunctions(appId, username, password);
return this.Ok(functions);
}
}
}
@@ -1,10 +0,0 @@
namespace LaaProductionWeb.API.Areas
{
using Microsoft.AspNetCore.Mvc;
[ApiController]
[Route("[area]/[controller]")]
public class AreaController : ControllerBase
{
}
}
@@ -1,23 +0,0 @@
namespace LaaProductionWeb.API.Areas.Serach.Controllers
{
using LaaProductionWeb.API.Areas.Serach.Models;
using LaaProductionWeb.API.Areas.Serach.Models.Interfaces;
using Microsoft.AspNetCore.Mvc;
public class WildcardController : SearchController
{
private readonly IWildcardModel wildcardModel;
public WildcardController(IWildcardModel wildcardModel)
=> this.wildcardModel = wildcardModel;
[HttpOptions]
public ActionResult Options()
=> this.wildcardModel.Options();
[HttpGet]
public ActionResult Get([FromQuery] WildcardInputModel model)
=> this.wildcardModel.Find(this.ModelState, model);
}
}
@@ -1,9 +0,0 @@
namespace LaaProductionWeb.API.Areas.Serach
{
using Microsoft.AspNetCore.Mvc;
[Area("Search")]
public class SearchController : AreaController
{
}
}
@@ -1,20 +0,0 @@
namespace LaaProductionWeb.API.Areas.Shipment.Controllers.Scanned
{
using LaaProductionWeb.API.Areas.Shipment.Models.Interfaces;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
public class ScannedController : ShipmentController
{
private readonly IScanModel scanModel;
public ScannedController(IScanModel scanModel)
=> this.scanModel = scanModel;
[HttpGet("Serial/{serialNo}")]
public async Task<ActionResult> GetAsync([FromRoute] string serialNo)
=> await this.scanModel.SerialScannedAsync(serialNo);
}
}
@@ -1,9 +0,0 @@
namespace LaaProductionWeb.API.Areas.Shipment
{
using Microsoft.AspNetCore.Mvc;
[Area("Shipment")]
public class ShipmentController : AreaController
{
}
}
@@ -1,90 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace LaaProductionWeb.API {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class ErrorMessages {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal ErrorMessages() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LaaProductionWeb.API.ErrorMessages", typeof(ErrorMessages).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Field {0} is not well formatted..
/// </summary>
public static string RegularExpression {
get {
return ResourceManager.GetString("RegularExpression", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Field {0} is required..
/// </summary>
public static string Required {
get {
return ResourceManager.GetString("Required", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Field {0} requires at liest {2} and up to {1} charachters..
/// </summary>
public static string StringLength {
get {
return ResourceManager.GetString("StringLength", resourceCulture);
}
}
}
}
@@ -1,129 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="RegularExpression" xml:space="preserve">
<value>Field {0} is not well formatted.</value>
</data>
<data name="Required" xml:space="preserve">
<value>Field {0} is required.</value>
</data>
<data name="StringLength" xml:space="preserve">
<value>Field {0} requires at liest {2} and up to {1} charachters.</value>
</data>
</root>
@@ -1,38 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<UserSecretsId>1fb61288-8dc8-4657-b44c-193c6aad5f65</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.9" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LaaProductionWeb.Data\LaaProductionWeb.Data.csproj" />
<ProjectReference Include="..\LaaProductionWeb.Standart\LaaProductionWeb.Standart.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="ErrorMessages.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>ErrorMessages.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="ErrorMessages.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>ErrorMessages.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Areas\Account\Models\" />
</ItemGroup>
</Project>
@@ -1,30 +0,0 @@
namespace LaaProductionWeb.API
{
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
/// <summary>
/// Application startup class contining the <seealso cref="Program.Main(string[])"/> method.
/// </summary>
public class Program
{
/// <summary>
/// Default start point for the application.
/// </summary>
/// <param name="args"><see cref="string[]"/> arguments provided from server on application start.</param>
public static void Main(string[] args)
=> CreateWebHostBuilder(args)
.Build()
.Run();
/// <summary>
/// !Important do not refactor. This method is used from other frameworks, like EntityFramework.
/// </summary>
/// <param name="args"><see cref="string[]"/> arguments provided from for creating the <seealso cref="WebHost"/>.</param>
/// <returns>Created and configured <see cref="IWebHostBuilder"/>.</returns>
public static IWebHostBuilder CreateWebHostBuilder(string[] args)
=> WebHost
.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
}
@@ -1,30 +0,0 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:59262",
"sslPort": 44346
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"LaaProductionWeb.API": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
@@ -1,67 +0,0 @@
namespace LaaProductionWeb.API
{
using LaaProductionWeb.Data;
using LaaProductionWeb.Data.Interfaces;
using LaaProductionWeb.API.Areas.Serach.Models;
using LaaProductionWeb.API.Areas.Serach.Models.Interfaces;
using LaaProductionWeb.API.Areas.Shipment.Models.Interfaces;
using LaaProductionWeb.API.Areas.Shipment.Models;
using LaaProductionWeb.API.Models;
using LaaProductionWeb.API.Models.SMTP;
using LaaProductionWeb.Standart.Interfaces;
using LaaProductionWeb.Standart;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
public class Startup
{
private readonly IConfiguration configuration;
public Startup(IConfiguration configuration)
=> this.configuration = configuration;
public void ConfigureServices(IServiceCollection services)
{
var connectionString = this.configuration
.GetConnectionString(nameof(ConnectionStrings.DefaultConnection));
services.AddTransient<ISqlClient, SqlClient>(_ => new SqlClient(connectionString));
services.AddTransient<IAccountService, AccountService>();
services.AddTransient<IWildcardModel, WildcardModel>();
services.AddTransient<IScanModel, ScanModel>();
services.AddTransient(serviceProvider =>
{
var optionsMonitor = serviceProvider.GetService<IOptionsMonitor<SMTPSettings>>();
return new SMTPClient(optionsMonitor?.CurrentValue);
});
services.Configure<ApiBehaviorOptions>(options =>
{
options.SuppressModelStateInvalidFilter = true;
});
services.Configure<SMTPSettings>(this.configuration.GetSection(nameof(SMTPSettings)));
services
.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Latest);
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseHsts();
app.UseDeveloperExceptionPage();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseMvc(routes =>
{
routes.MapRoute(name: "areas", template: "{area:exists}/{controller}/{action}/{id?}");
routes.MapRoute(name: "default", template: "{controller}/{action}/{id?}");
});
}
}
}
@@ -1,11 +0,0 @@
{
"ConnectionStrings": {
"DefaultConnection": "Data Source=SLASQL01.emea.sensus.net;Initial Catalog=Auftrag;Password=ServiceParingfile;Persist Security Info=True;User ID=ServiceParingfile;"
},
"SMTPSettings": {
"Host": "smtp.xylem.com",
"Port": 587,
"Username": "",
"Password": ""
}
}
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LaaProductionWeb.Data</RootNamespace>
<AssemblyName>LaaProductionWeb.Data</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
@@ -11,21 +11,8 @@
{
private readonly string connectionString;
public SqlClient(string connectionString)
{
this.connectionString = connectionString;
#if DEBUG
//var connectionBuilder = new SqlConnectionStringBuilder(connectionString);
//connectionBuilder.PersistSecurityInfo = false;
//connectionBuilder.Password = string.Empty;
//connectionBuilder.UserID = string.Empty;
//connectionBuilder.IntegratedSecurity = true;
//connectionBuilder.InitialCatalog = "AuftragKopie";
//this.connectionString = connectionBuilder.ToString();
#endif
}
public SqlClient(string connectionString)
=> this.connectionString = connectionString;
public SQLCommand CreateCommand(string commandText)
=> new SQLCommand(this, commandText);
@@ -8,4 +8,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1"/></startup></configuration>
@@ -2,6 +2,12 @@
{
using LaaProductionWeb.Data.Interfaces;
using LaaProductionWeb.Services.Interfaces;
using LaaProductionWeb.Services.Models;
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
public class AccountService : IAccountService
{
@@ -10,15 +16,90 @@
public AccountService(ISqlClient sqlClient)
=> this.sqlClient = sqlClient;
public int Login(string username, string password)
public Employee FindEmployee(short userId)
=> this.sqlClient
.CreateCommand($@"
SELECT [Vorname] + ' ' + [Name]
FROM [Mitarbeiter]
WHERE [MitarbeiterNr] = @{nameof(userId)}")
.AddParameter(nameof(userId), userId)
.FirstOrDefault(x => new Employee
{
Name = x.GetString().Trim(),
Permissions = this.sqlClient
.CreateCommand($@"
SELECT DISTINCT [Recht]
FROM [MitarbeiterRechte]
WHERE [MitarbeiterNr] = @{nameof(userId)}")
.AddParameter(nameof(userId), userId)
.ExecuteReader(p => p.GetString())
});
public IEnumerable<string> FindUserFunctions(short appId, string username, string password)
=> this.sqlClient
.CreateCommand($@"
SELECT [SF].[Function]
FROM [Mitarbeiter] AS [U]
JOIN [UsersFunctions] AS [UF]
ON [UF].[UserId] = [U].[MitarbeiterNr]
JOIN [SoftwareFunctions] AS [SF]
ON [SF].[Id] = [UF].[SoftwareFunctionId]
WHERE [U].[Benutzername] = @{nameof(username)}
AND [U].[PasswordHash] = @{nameof(password)}
AND [SF].[AppId] = @{nameof(appId)}")
.AddParameter(nameof(username), username)
.AddParameter(nameof(password), password)
.AddParameter(nameof(appId), appId)
.ExecuteReader(x => x.GetString());
public short Login(string username, string password)
=> this.sqlClient.FirstOrDefault($@"
SELECT TOP 1 [MitarbeiterNr]
FROM [Mitarbeiter]
WHERE [Benutzername] LIKE @{nameof(username)}
AND [Kennwort] LIKE @{nameof(password)}",
AND [PasswordHash] LIKE @{nameof(password)}",
parameters => parameters
.Add(nameof(username), username)
.Add(nameof(password), password),
reader => reader.GetValue<short>());
reader => reader.GetSmallint());
public int ResetPassword(string username)
=> this.sqlClient
.CreateCommand($@"
UPDATE [Mitarbeiter]
SET [PasswordHash] = NULL
WHERE [Benutzername] = @{nameof(username)}")
.AddParameter(nameof(username), username)
.ExecuteNonQuery();
public int ResetPassword(string username, string password)
=> this.sqlClient
.CreateCommand($@"
UPDATE [Mitarbeiter]
SET [PasswordHash] = @{nameof(password)}
WHERE [Benutzername] = @{nameof(username)}")
.AddParameter(nameof(username), username)
.AddParameter(nameof(password), password)
.ExecuteNonQuery();
}
public static class AccountExtensions
{
public static string ComputeHash(this HashAlgorithm hashAlgorithm, string value)
{
if (!string.IsNullOrWhiteSpace(value))
{
var bytes = Encoding.UTF8.GetBytes(value);
var hash = hashAlgorithm.ComputeHash(bytes);
var base64 = Convert.ToBase64String(hash);
return base64;
}
return value;
}
public static string ComputeHash(this string value)
=> SHA256.Create().ComputeHash(value);
}
}
@@ -2,8 +2,18 @@
{
using LaaProductionWeb.Services.Models;
public interface IAccountService : ITransient
using System.Collections.Generic;
public interface IAccountService
{
int Login(string username, string password);
Employee FindEmployee(short userId);
IEnumerable<string> FindUserFunctions(short appId, string username, string password);
short Login(string username, string password);
int ResetPassword(string username, string password);
int ResetPassword(string username);
}
}
@@ -2,7 +2,7 @@
{
using LaaProductionWeb.Services.Models;
public interface IApprovalsService : ITransient
public interface IApprovalsService
{
Result Add(ProductionApproval approval);
}
@@ -2,7 +2,7 @@
{
using LaaProductionWeb.Services.Models;
public interface IOrdersService : ITransient
public interface IOrdersService
{
OrdersFoundModel FindOrders(string search);
@@ -6,7 +6,7 @@
using System.Collections.Generic;
using System.IO;
public interface IProtocolService : ITransient
public interface IProtocolService
{
bool DeleteFile(int fileId);
@@ -4,7 +4,7 @@
using System.Collections.Generic;
public interface IReportService : ITransient
public interface IReportService
{
CordonelPressureSensorModel LoadCordonelPressureSensorReport(CordonelPressureSensorModel model = null);
@@ -3,7 +3,7 @@
using LaaProductionWeb.Services.Models;
using System.Collections.Generic;
public interface IShipmentsService : ITransient
public interface IShipmentsService
{
OrderScanModel DeletePalletEntry(int id);
@@ -1,6 +0,0 @@
namespace LaaProductionWeb.Services.Interfaces
{
public interface ISingleton
{
}
}
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
public interface ISoftwareService : ITransient
public interface ISoftwareService
{
void AddFunction(short appId, string name);
@@ -1,6 +0,0 @@
namespace LaaProductionWeb.Services.Interfaces
{
public interface ITransient
{
}
}
@@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LaaProductionWeb.Services</RootNamespace>
<AssemblyName>LaaProductionWeb.Services</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -39,13 +40,18 @@
<HintPath>..\..\..\..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\newtonsoft.json\11.0.2\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
@@ -59,9 +65,7 @@
<Compile Include="Interfaces\IProtocolService.cs" />
<Compile Include="Interfaces\IReportService.cs" />
<Compile Include="Interfaces\IShipmentsService.cs" />
<Compile Include="Interfaces\ISingleton.cs" />
<Compile Include="Interfaces\ISoftwareService.cs" />
<Compile Include="Interfaces\ITransient.cs" />
<Compile Include="Models\Employee.cs" />
<Compile Include="Models\HttpResponseModel.cs" />
<Compile Include="Models\MissingItem.cs" />
@@ -107,22 +111,18 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProtocolService.cs" />
<Compile Include="ReportService.cs" />
<Compile Include="ServicesExtensions.cs" />
<Compile Include="ShipmentsService.cs" />
<Compile Include="SoftwareService.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LaaProductionWeb.Data\LaaProductionWeb.Data.csproj">
<Project>{4B5BF112-D3BE-4E84-9A8E-74A0E314BBA7}</Project>
<Name>LaaProductionWeb.Data</Name>
</ProjectReference>
<ProjectReference Include="..\LaaProductionWeb.Standart\LaaProductionWeb.Standart.csproj">
<Project>{b779d025-bd3a-4a0d-bcc1-a5d4c731f697}</Project>
<Name>LaaProductionWeb.Standart</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -5,18 +5,12 @@
public class Employee
{
public Employee(string name, IEnumerable<string> permissions)
{
this.Name = name;
this.IsValid = !string.IsNullOrWhiteSpace(name);
this.Permissions = permissions ?? Array.Empty<string>();
}
public string Name { get; set; }
public bool IsValid { get; }
public bool IsValid
=> !string.IsNullOrWhiteSpace(this.Name);
public IEnumerable<string> Permissions { get; }
public IEnumerable<string> Permissions { get; set; }
= Array.Empty<string>();
}
}
@@ -1,76 +0,0 @@
namespace LaaProductionWeb.Services
{
using LaaProductionWeb.Services.Interfaces;
using Microsoft.Extensions.DependencyInjection;
using System.Linq;
public static class ServicesExtensions
{
public static IServiceCollection AddTransientServices(this IServiceCollection services)
{
var transient = typeof(ITransient);
var assemblyServices = transient
.Assembly
.GetTypes()
.Where(x => !x.IsAbstract
&& transient.IsAssignableFrom(x));
foreach (var service in assemblyServices)
{
var interfaces = service
.GetInterfaces()
.Where(x => x != transient);
if (!interfaces.Any())
{
services.AddTransient(service);
continue;
}
foreach (var @interface in interfaces)
{
services.AddTransient(@interface, service);
}
}
return services;
}
public static IServiceCollection AddHttpClient(this IServiceCollection services, string baseAddress)
=> services.AddSingleton<IHttpService>(_ => new HttpService(baseAddress));
public static IServiceCollection AddSingletonServices(this IServiceCollection services)
{
var transient = typeof(ISingleton);
var assemblyServices = transient
.Assembly
.GetTypes()
.Where(x => !x.IsAbstract
&& transient.IsAssignableFrom(x));
foreach (var service in assemblyServices)
{
var interfaces = service
.GetInterfaces()
.Where(x => x != transient);
if (!interfaces.Any())
{
services.AddTransient(service);
continue;
}
foreach (var @interface in interfaces)
{
services.AddTransient(@interface, service);
}
}
return services;
}
}
}
@@ -3,7 +3,6 @@
using LaaProductionWeb.Data.Interfaces;
using LaaProductionWeb.Services.Interfaces;
using LaaProductionWeb.Services.Models.Software;
using LaaProductionWeb.Standart;
using System;
using System.Collections.Generic;
@@ -29,13 +28,22 @@
.ExecuteNonQuery();
public void DeleteFunction(int funcId)
=> this.sqlClient
{
this.sqlClient
.CreateCommand($@"
DELETE FROM [SoftwareFunctions]
WHERE [Id] = @{nameof(funcId)}")
.AddParameter(nameof(funcId), funcId)
.ExecuteNonQuery();
this.sqlClient
.CreateCommand($@"
DELETE FROM [UsersFunctions]
WHERE [SoftwareFunctionId] = @{nameof(funcId)}")
.AddParameter(nameof(funcId), funcId)
.ExecuteNonQuery();
}
public IEnumerable<string> FindSoftwareForUser(short appId, string username, string password)
{
throw new NotImplementedException();
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1"/></startup></configuration>
@@ -1,52 +0,0 @@
namespace LaaProductionWeb.Standart
{
using LaaProductionWeb.Data.Interfaces;
using LaaProductionWeb.Standart.Interfaces;
using System.Collections.Generic;
using System.Security.Cryptography;
public class AccountService : IAccountService
{
private readonly ISqlClient sqlClient;
public AccountService(ISqlClient sqlClient)
=> this.sqlClient = sqlClient;
public IEnumerable<string> FindUserFunctions(short appId, string username, string password)
=> this.sqlClient
.CreateCommand($@"
SELECT [SF].[Function]
FROM [Mitarbeiter] AS [U]
JOIN [UsersFunctions] AS [UF]
ON [UF].[UserId] = [U].[MitarbeiterNr]
JOIN [SoftwareFunctions] AS [SF]
ON [SF].[Id] = [UF].[SoftwareFunctionId]
WHERE [U].[Benutzername] = @{nameof(username)}
AND [U].[PasswordHash] = @{nameof(password)}
AND [SF].[AppId] = @{nameof(appId)}")
.AddParameter(nameof(username), username)
.AddParameter(nameof(password), SHA256.Create().ComputeHash(password))
.AddParameter(nameof(appId), appId)
.ExecuteReader(x => x.GetString());
public int ResetPassword(string username)
=> this.sqlClient
.CreateCommand($@"
UPDATE [Mitarbeiter]
SET [PasswordHash] = NULL
WHERE [Benutzername] = @{nameof(username)}")
.AddParameter(nameof(username), username)
.ExecuteNonQuery();
public int ResetPassword(string username, string password)
=> this.sqlClient
.CreateCommand($@"
UPDATE [Mitarbeiter]
SET [PasswordHash] = @{nameof(password)}
WHERE [Benutzername] = @{nameof(username)}")
.AddParameter(nameof(username), username)
.AddParameter(nameof(password), SHA256.Create().ComputeHash(password))
.ExecuteNonQuery();
}
}
@@ -1,13 +0,0 @@
namespace LaaProductionWeb.Standart.Interfaces
{
using System.Collections.Generic;
public interface IAccountService
{
IEnumerable<string> FindUserFunctions(short appId, string username, string passwordHash);
int ResetPassword(string username);
int ResetPassword(string username, string password);
}
}
@@ -1,11 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\LaaProductionWeb.Data\LaaProductionWeb.Data.csproj" />
</ItemGroup>
</Project>
@@ -1,12 +0,0 @@
namespace LaaProductionWeb.Standart
{
using System;
using System.Security.Cryptography;
using System.Text;
public static class StandartExtensions
{
public static string ComputeHash(this HashAlgorithm hashAlgorithm, string value)
=> Convert.ToBase64String(hashAlgorithm.ComputeHash(Encoding.UTF8.GetBytes(value)));
}
}
+5 -23
View File
@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.33423.255
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProductionWeb", "LaaProductionWeb\LaaProductionWeb.csproj", "{CC823CBC-1B1D-4669-AF21-D2287E14488D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProductionWeb.Data", "LaaProductionWeb.Data\LaaProductionWeb.Data.csproj", "{4B5BF112-D3BE-4E84-9A8E-74A0E314BBA7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProductionWeb.Services", "LaaProductionWeb.Services\LaaProductionWeb.Services.csproj", "{FF167011-431A-41A7-A7DB-560E08860388}"
@@ -14,11 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Documents", "Documents", "{
..\..\..\..\Downloads\SRS Wildcard Order Info Search.docx = ..\..\..\..\Downloads\SRS Wildcard Order Info Search.docx
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LaaProductionWeb.API", "LaaProductionWeb.API\LaaProductionWeb.API.csproj", "{66C33368-2ABC-4BB6-917C-FF949FAF043B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LaaProductionWeb.API.UnitTests", "LaaProductionWeb.API.UnitTests\LaaProductionWeb.API.UnitTests.csproj", "{EF371C00-4452-4506-A7B6-C2F94C170D2C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProductionWeb.Standart", "LaaProductionWeb.Standart\LaaProductionWeb.Standart.csproj", "{B779D025-BD3A-4A0D-BCC1-A5D4C731F697}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProductionWeb", "LaaProductionWeb\LaaProductionWeb.csproj", "{D1AD077B-00E3-4663-AB9F-23FF65D98D2F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -26,10 +20,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CC823CBC-1B1D-4669-AF21-D2287E14488D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC823CBC-1B1D-4669-AF21-D2287E14488D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC823CBC-1B1D-4669-AF21-D2287E14488D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC823CBC-1B1D-4669-AF21-D2287E14488D}.Release|Any CPU.Build.0 = Release|Any CPU
{4B5BF112-D3BE-4E84-9A8E-74A0E314BBA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B5BF112-D3BE-4E84-9A8E-74A0E314BBA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B5BF112-D3BE-4E84-9A8E-74A0E314BBA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -38,18 +28,10 @@ Global
{FF167011-431A-41A7-A7DB-560E08860388}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF167011-431A-41A7-A7DB-560E08860388}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF167011-431A-41A7-A7DB-560E08860388}.Release|Any CPU.Build.0 = Release|Any CPU
{66C33368-2ABC-4BB6-917C-FF949FAF043B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{66C33368-2ABC-4BB6-917C-FF949FAF043B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66C33368-2ABC-4BB6-917C-FF949FAF043B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66C33368-2ABC-4BB6-917C-FF949FAF043B}.Release|Any CPU.Build.0 = Release|Any CPU
{EF371C00-4452-4506-A7B6-C2F94C170D2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF371C00-4452-4506-A7B6-C2F94C170D2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF371C00-4452-4506-A7B6-C2F94C170D2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF371C00-4452-4506-A7B6-C2F94C170D2C}.Release|Any CPU.Build.0 = Release|Any CPU
{B779D025-BD3A-4A0D-BCC1-A5D4C731F697}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B779D025-BD3A-4A0D-BCC1-A5D4C731F697}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B779D025-BD3A-4A0D-BCC1-A5D4C731F697}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B779D025-BD3A-4A0D-BCC1-A5D4C731F697}.Release|Any CPU.Build.0 = Release|Any CPU
{D1AD077B-00E3-4663-AB9F-23FF65D98D2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D1AD077B-00E3-4663-AB9F-23FF65D98D2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1AD077B-00E3-4663-AB9F-23FF65D98D2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D1AD077B-00E3-4663-AB9F-23FF65D98D2F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@
{
using System.Configuration;
public class ApplicationSettings
public class Appsettings
{
public static string APIURL => ConfigurationManager.AppSettings.Get(nameof(APIURL));
@@ -1,7 +1,6 @@
namespace LaaProductionWeb.App_Infrastructure
{
using LaaProductionWeb.Services.Interfaces;
using LaaProductionWeb.Services.Models;
using System.Collections.Generic;
using System.Security.Claims;
@@ -14,24 +13,22 @@
var httpContext = filterContext.HttpContext;
var userId = httpContext.UserId();
var accountService = ServiceProvider.Current.GetService<IAccountService>();
httpContext.User = new ClaimsPrincipal(new ClaimsIdentity(new Claim[]
{
new Claim(ClaimTypes.Name, string.Empty),
new Claim(ClaimTypes.Role, UserRoles.WEB_Anonymous),
}, nameof(Claim), ClaimTypes.Name, ClaimTypes.Role));
#if DEBUG
var employee = new Employee("DEVELOPER", UserRoles.ALL);
#else
var employee = accountService.FindEmployee(userId);
#endif
var claims = new List<Claim>();
if (employee.IsValid)
if (employee is null)
{
httpContext.User = new ClaimsPrincipal(new ClaimsIdentity(new Claim[]
{
new Claim(ClaimTypes.NameIdentifier, "-1"),
new Claim(ClaimTypes.Name, string.Empty),
new Claim(ClaimTypes.Role, UserRoles.WEB_Anonymous),
}, nameof(ClaimTypes), ClaimTypes.Name, ClaimTypes.Role));
}
else
{
var claims = new List<Claim>();
claims.Add(new Claim(ClaimTypes.NameIdentifier, $"{userId}"));
claims.Add(new Claim(ClaimTypes.Name, employee.Name));
claims.Add(new Claim(ClaimTypes.Name, employee.Name ?? string.Empty));
foreach (var permission in employee.Permissions)
{
@@ -1,93 +0,0 @@
namespace LaaProductionWeb.App_Infrastructure
{
using LaaProductionWeb.Controllers;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.SessionState;
public class ControllerFactory : IControllerFactory
{
const string AREAS_PATTERN = "LaaProductionWeb.Areas.{0}.Controllers{1}.{2}Controller";
const string CONTROLLERS_PATTERN = "LaaProductionWeb.Controllers{0}.{1}Controller";
private readonly IServiceProvider serviceProvider;
public ControllerFactory(IServiceProvider serviceProvider)
=> this.serviceProvider = serviceProvider;
public IController CreateController(RequestContext requestContext, string controllerName)
{
var controllerType = default(Type);
var routeData = requestContext.RouteData;
var routeUrl = string.Empty;
if (routeData.Route is Route route)
{
routeUrl = route.Url;
}
else if (routeData.Route is IEnumerable<RouteBase> routes && routes.FirstOrDefault() is Route _route)
{
routeUrl = _route.Url;
}
var innerPath = string
.Join(".", routeUrl
.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries)
.Where(x => !x.StartsWith("{") && !x.EndsWith("}")));
if (!string.IsNullOrWhiteSpace(innerPath))
{
innerPath = $".{innerPath}";
}
var controllerTypeName = requestContext.RouteData.DataTokens.TryGetValue("area", out object areaName)
? string.Format(AREAS_PATTERN, areaName, innerPath, controllerName)
: string.Format(CONTROLLERS_PATTERN, innerPath, controllerName);
controllerType = Type.GetType(controllerTypeName, throwOnError: false, ignoreCase: true);
if (controllerType is null)
{
controllerTypeName = controllerTypeName.Replace(innerPath, string.Empty);
controllerType = Type.GetType(controllerTypeName, throwOnError: false, ignoreCase: true);
}
if (controllerType != null)
{
if (this.serviceProvider.GetService(controllerType) is IController controller)
{
return controller;
}
}
return this.serviceProvider.GetService<HomeController>() as IController;
}
public SessionStateBehavior GetControllerSessionBehavior(RequestContext requestContext, string controllerName)
=> SessionStateBehavior.Default;
public void ReleaseController(IController controller)
{
if (controller is IDisposable disposable)
{
disposable.Dispose();
}
}
private void RedirectToDefault(object resource, HttpResponseBase response)
{
if (resource is null)
{
response.Redirect("~/", true);
response.End();
}
}
}
}
@@ -1,18 +1,25 @@
namespace LaaProductionWeb.App_Infrastructure
{
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using System;
using System.Linq;
using System.Net;
using System.Security.Claims;
using System.Security.Cryptography;
using System.Security.Principal;
using System.Web.Mvc;
using System.Text;
using System.Web;
/// <summary>
/// Static class with extension methods that run on controller contexts.
/// </summary>
public static class ControllersExtensions
{
const string ORDER_DATA = nameof(ORDER_DATA);
const string URL_REFERER = nameof(URL_REFERER);
const string SESSION_USER = nameof(SESSION_USER);
public static TDST Map<TSRC, TDST>(this TSRC model, Func<TSRC, TDST> mapper)
where TDST : class
where TSRC : class
@@ -36,5 +43,132 @@
return "<unknown>";
}
public static string ClaimId(this IPrincipal principal)
{
if (principal is ClaimsPrincipal claimsPrincipal)
{
return claimsPrincipal
.FindAll(ClaimTypes.NameIdentifier)
.LastOrDefault()?.Value;
}
return "<unknown>";
}
public static string GetUrlReferer(this HttpContextBase httpContext)
=> httpContext
.Request
.Cookies
.Get(URL_REFERER)
?.Value ?? null;
public static void SetUrlReferer(this HttpContextBase httpContext)
=> httpContext
.Response
.Cookies
.Add(new HttpCookie(URL_REFERER, $"{httpContext.Request.Url}"));
public static void SetUserData(this HttpContextBase httpContext, object data)
{
if (data != null)
{
var userId = httpContext.User.ClaimId();
var json = JsonConvert.SerializeObject(data);
var encoded = WebUtility.UrlEncode(json);
var cookie = new HttpCookie($"{ORDER_DATA}_{userId}")
{
Value = encoded,
Expires = DateTime.Now.AddHours(7)
};
httpContext.Response.Cookies.Set(cookie);
}
}
public static T GetUserData<T>(this HttpContextBase httpContext)
{
var userId = httpContext.User.ClaimId();
var cookie = httpContext.Request.Cookies.Get($"{ORDER_DATA}_{userId}");
if (cookie != null && cookie.Value != null)
{
try
{
var json = WebUtility.UrlDecode(cookie.Value);
return JsonConvert.DeserializeObject<T>(json);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
return default(T);
}
public static short UserId(this HttpContextBase httpContext)
{
var requestCookies = httpContext.Request.Cookies;
var sessionUserCookie = requestCookies.Get(SESSION_USER);
if (sessionUserCookie is null)
{
sessionUserCookie = new HttpCookie(SESSION_USER, string.Empty);
}
var value = sessionUserCookie?.Value ?? string.Empty;
if (!string.IsNullOrWhiteSpace(value))
{
value = Encoding.UTF8.GetString(Convert.FromBase64String(value));
}
if (short.TryParse(value, out short userId))
{
sessionUserCookie.Expires = DateTime.Now.AddSeconds(Appsettings.LoginTimeout);
requestCookies.Set(sessionUserCookie);
return userId;
}
return -1;
}
public static void SignIn(this HttpContextBase httpContext, short userId)
{
if (userId > 0)
{
var base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{userId}"));
var cookie = new HttpCookie(SESSION_USER, base64)
{
Expires = DateTime.Now.AddSeconds(Appsettings.LoginTimeout)
};
httpContext.Response.AppendCookie(cookie);
}
}
public static void SignOut(this HttpContextBase httpContext)
=> httpContext
.Response
.Cookies
.Remove(SESSION_USER);
public static string ComputeHash(this string value)
{
if (!string.IsNullOrWhiteSpace(value))
{
var bytes = Encoding.UTF8.GetBytes(value);
var hash = SHA256.Create().ComputeHash(bytes);
var base64 = Convert.ToBase64String(hash);
return base64;
}
return value;
}
}
}
@@ -1,30 +0,0 @@
namespace LaaProductionWeb.App_Infrastructure
{
using System;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Web.Mvc;
public abstract class NestedController : Controller
{
protected ViewResult NestedView([CallerMemberName] string viewName = "", [CallerFilePath] string fileName = "")
{
var viewPath = fileName
?.Split(new[] { "Controllers" }, StringSplitOptions.RemoveEmptyEntries)
?.LastOrDefault()
?.Replace("Controller.cs", $"\\{viewName}");
return this.View($"~\\Views{viewPath}.cshtml");
}
protected ViewResult NestedView(object model, [CallerMemberName] string viewName = "", [CallerFilePath] string fileName = "")
{
var viewPath = fileName
?.Split(new[] { "Controllers" }, StringSplitOptions.RemoveEmptyEntries)
?.LastOrDefault()
?.Replace("Controller.cs", $"\\{viewName}");
return this.View($"~\\Views{viewPath}.cshtml", model);
}
}
}
@@ -1,5 +1,11 @@
namespace LaaProductionWeb.App_Infrastructure
namespace LaaProductionWeb
{
using LaaProductionWeb.App_Infrastructure;
using LaaProductionWeb.Data;
using LaaProductionWeb.Data.Interfaces;
using LaaProductionWeb.Services;
using LaaProductionWeb.Services.Interfaces;
using Microsoft.Extensions.DependencyInjection;
using System;
@@ -25,5 +31,24 @@
internal static void SetServiceProvider(IServiceProvider serviceProvider)
=> Current = new ServiceProvider(serviceProvider);
public static void RegisterServices()
{
var services = new ServiceCollection();
services.AddSingleton<ISqlClient>(_ => new SqlClient(Appsettings.ConnectionString));
services.AddSingleton<IHttpService>(_ => new HttpService(Appsettings.APIURL));
services.AddScoped<IAccountService, AccountService>();
services.AddScoped<IApprovalsService, ApprovalsService>();
services.AddScoped<IOrdersService, OrdersService>();
services.AddScoped<IProtocolService, ProtocolService>();
services.AddScoped<IReportService, ReportService>();
services.AddScoped<IShipmentsService, ShipmentsService>();
services.AddScoped<ISoftwareService, SoftwareService>();
var serviceProvider = services.BuildServiceProvider();
Current = new ServiceProvider(serviceProvider);
}
}
}
@@ -1,14 +0,0 @@
namespace LaaProductionWeb.App_Infrastructure
{
using System;
public static class ServiceProviderExtensions
{
public static IServiceProvider RegisterServiceProvider(this IServiceProvider serviceProvider)
{
ServiceProvider.SetServiceProvider(serviceProvider);
return serviceProvider;
}
}
}
@@ -1,127 +0,0 @@
namespace LaaProductionWeb.App_Infrastructure
{
using Newtonsoft.Json;
using System;
using System.Net;
using System.Web;
public class SessionUser
{
public SessionUser()
=> this.UserId = -1;
public SessionUser(int userId, DateTime expires)
{
this.UserId = userId;
this.Expires = expires;
}
public int UserId { get; }
public DateTime Expires { get; }
public bool IsExpired => this.Expires < DateTime.Now.AddMinutes(30) || this.Expires > DateTime.Now;
}
public static class SessionUserExtensions
{
public static int UserId(this HttpContextBase httpContext)
{
var cookies = httpContext.Request.Cookies;
var userCookie = cookies.Get(nameof(SessionUser));
var cookieUserId = userCookie?.Value ?? string.Empty;
if (int.TryParse(cookieUserId, out int userId))
{
userCookie.Expires = DateTime.Now.AddSeconds(ApplicationSettings.LoginTimeout);
cookies.Set(userCookie);
return userId;
}
return -1;
}
public static bool SignIn(this HttpContextBase httpContext, int userId)
{
if (userId > 0)
{
httpContext.Response.AppendCookie(new HttpCookie(nameof(SessionUser), $"{userId}")
{
Expires = DateTime.Now.AddSeconds(ApplicationSettings.LoginTimeout)
});
return true;
}
return false;
}
public static void SignOut(this HttpContextBase httpContext)
{
var cookieUserId = httpContext
.Response
.Cookies
.Get(nameof(SessionUser))
?.Value ?? string.Empty;
}
const string DATA = nameof(DATA);
public static void SetUserData(this HttpContextBase httpContext, object data)
{
if (data != null)
{
var userId = httpContext.UserId();
var json = JsonConvert.SerializeObject(data);
var encoded = WebUtility.UrlEncode(json);
var cookie = new HttpCookie($"{DATA}_{userId}")
{
Value = encoded,
Expires = DateTime.Now.AddHours(7)
};
httpContext.Response.Cookies.Set(cookie);
}
}
public static T GetUserData<T>(this HttpContextBase httpContext)
{
var userId = httpContext.UserId();
var cookie = httpContext.Request.Cookies.Get($"{DATA}_{userId}");
if (cookie != null && cookie.Value != null)
{
try
{
var json = WebUtility.UrlDecode(cookie.Value);
return JsonConvert.DeserializeObject<T>(json);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
return default(T);
}
const string URL_REFERER = nameof(URL_REFERER);
public static void SetUrlReferer(this HttpContextBase httpContext)
=> httpContext
.Response
.Cookies
.Add(new HttpCookie(URL_REFERER, $"{httpContext.Request.Url}"));
public static string GetUrlReferer(this HttpContextBase httpContext)
=> httpContext
.Request
.Cookies
.Get(URL_REFERER)
?.Value ?? "/";
}
}
@@ -17,11 +17,6 @@
.Add(new StyleBundle("~/bootstrap_css")
.Include("~/App_Content/css/bootstrap.min.css"));
// not loaded - try throught cdn
//bundles
// .Add(new StyleBundle("~/bootstrap_icons")
// .Include("~/App_Content/font/bootstrap-icons.min.css"));
bundles
.Add(new StyleBundle("~/styles_css")
.Include("~/App_Content/css/styles.css"));
@@ -4,19 +4,12 @@
using System.Web.Mvc;
/// <summary>
/// A class that configures custom filters for the application.
/// </summary>
public class FilterConfig
{
/// <summary>
/// Adds custom filters to the <see cref="GlobalFilterCollection"/>.
/// </summary>
/// <param name="filters"><see cref="GlobalFilterCollection"/> - passed by calling this method.</param>
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new ExceptionFilter());
filters.Add(new AuthorizationFilter());
filters.Add(new HandleErrorAttribute());
}
}
}
@@ -3,23 +3,14 @@
using System.Web.Mvc;
using System.Web.Routing;
/// <summary>
/// A class that configures all view route templates for the web application.
/// </summary>
public class RouteConfig
{
/// <summary>
/// Registers all view route templates to the <see cref="RouteCollection"/>.
/// </summary>
/// <param name="bundles"><see cref="RouteCollection"/> - passed by calling this method.</param>
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapMvcAttributeRoutes();
routes.MapRoute(
name: "MVC_Default",
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional });
}
@@ -1,38 +0,0 @@
namespace LaaProductionWeb.App_Start
{
using LaaProductionWeb.App_Infrastructure;
using LaaProductionWeb.Data;
using LaaProductionWeb.Services;
using Microsoft.Extensions.DependencyInjection;
/// <summary>
/// A class for configuring and registering dependency injection.
/// </summary>
public static class ServicesConfig
{
/// <summary>
/// Builds and registers configured services to the service provider.
/// </summary>
public static void RegisterServices()
=> new ServiceCollection()
.ConfigureServices()
.BuildServiceProvider()
.RegisterServiceProvider();
/// <summary>
/// Allows developer to add services to the service collection.
/// </summary>
/// <param name="services"><see cref="IServiceCollection"/> provided from the extension method.</param>
/// <returns>The same <see cref="IServiceCollection"/> with added services.</returns>
static IServiceCollection ConfigureServices(this IServiceCollection services)
{
services
.AddTransientServices()
.AddHttpClient(ApplicationSettings.APIURL)
.AddDbContext(ApplicationSettings.ConnectionString);
return services;
}
}
}
@@ -1,21 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace LaaProductionWeb
namespace LaaProductionWeb
{
using System.Web.Http;
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "AreasApi",
routeTemplate: "api/{area}/{controller}/{id}",
defaults: new { id = RouteParameter.Optional });
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
defaults: new { id = RouteParameter.Optional });
}
}
}
@@ -0,0 +1,54 @@
namespace LaaProductionWeb.Areas.Account.Controllers
{
using LaaProductionWeb.Services.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Http;
[AllowAnonymous]
public class FunctionsController : ApiController
{
private readonly IAccountService accountService;
public FunctionsController()
=> this.accountService = ServiceProvider.Current.GetService<IAccountService>();
[HttpGet]
public IHttpActionResult Get()
{
if (this.ActionContext.Request.Headers.TryGetValues("Authorization", out IEnumerable<string> values) && values.Any())
{
var bearer = values
.FirstOrDefault()
.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
.LastOrDefault();
try
{
var tokens = Encoding.UTF8
.GetString(Convert.FromBase64String(bearer))
.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
if (tokens != null && tokens.Length == 3 && short.TryParse(tokens[0], out short appId))
{
var username = tokens[1];
var password = tokens[2];
var functions = this.accountService.FindUserFunctions(appId, username, password);
return this.Ok(functions);
}
}
catch (Exception)
{
// TODO: Log exception.
}
}
return this.BadRequest("Endpoint expects bearer authorization header with appId:username:password base64 encoded.");
}
}
}
@@ -1,17 +1,18 @@
namespace LaaProductionWeb.API.Areas.Account.Controllers
namespace LaaProductionWeb.Areas.Account.Controllers
{
using LaaProductionWeb.Standart.Interfaces;
using LaaProductionWeb.Services.Interfaces;
using Microsoft.AspNetCore.Mvc;
using System.Web.Http;
public class PWDController : AccountBaseController
public class PWDController : ApiController
{
public PWDController(IAccountService accountService) : base(accountService)
{
}
private readonly IAccountService accountService;
public PWDController()
=> this.accountService = ServiceProvider.Current.GetService<IAccountService>();
[HttpPost]
public IActionResult Post([FromForm(Name = "username")]string username, [FromForm(Name = "password")]string password)
public IHttpActionResult Post(string username, string password)
{
if (string.IsNullOrWhiteSpace(password))
{
@@ -25,8 +26,8 @@
return this.BadRequest("Password was not reseted.");
}
[HttpDelete("{username}")]
public IActionResult Delete(string username)
[HttpDelete]
public IHttpActionResult Delete(string username)
{
if (this.accountService.ResetPassword(username) == 1)
{
@@ -89,7 +89,7 @@
<form action="~/Administration/Software/SoftwareFunctions" method="post" id="form_@function.Id" class="px-3">
<input type="hidden" name="FunctionId" value="@function.Id" />
<input class="form-control form-control-sm" id="user_serach_@function.Id" />
<div class="scrollable-sm" style="max-height: 500px">
<div class="scrollable-sm mt-3" style="max-height: 500px">
@foreach (var u in this.Model.Users)
{
var id = $"f_{function.Id}_{u.Id}";
@@ -104,7 +104,7 @@
</div>
}
</div>
<button class="btn btn-light btn-sm w-100 border fw-bold" type="submit">Aktualizieren</button>
<button class="btn btn-light btn-sm w-100 border fw-bold mt-3" type="submit">Aktualizieren</button>
</form>
</div>
</div>
@@ -154,7 +154,7 @@
</div>
}
</div>
<button class="btn btn-light btn-sm w-100 border fw-bold" type="submit">Aktualizieren</button>
<button class="btn btn-light btn-sm w-100 border fw-bold mt-3" type="submit">Aktualizieren</button>
</form>
</div>
</div>
@@ -11,12 +11,11 @@
<a href="~/Administration/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light">Users Functions</a>
<a href="~/Administration/Software/Users" class="list-group-item list-group-item-action bg-light active">Users</a>
<div class="list-group list-group-flush list-group-transparent">
<form action="~/Administration/Software/Users" method="post" class="list-group-item list-group-item-action bg-light">
<div class="list-group-item list-group-item-action bg-light">
<div class="input-group input-group-sm">
<input class="form-control" name="username">
<button class="btn btn-sm btn-dark input-group-text small" type="submit"><i class="bi bi-search"></i></button>
<input class="form-control form-control-sm" id="user_search">
</div>
</form>
</div>
@if (this.User.IsInRole(UserRoles.WEB_Admin))
{
<a href="~/Administration/Software/UpdatePWDS" class="list-group-item list-group-item-action bg-light small active border-0 py-0">Update users passwords</a>
@@ -68,25 +67,53 @@
@section scripts {
<script>
function resetPassword(e) {
if (e.target.id) {
let id = e.target.id.replace('pwd_', '');
fetch('@this.Url.Content("~/Administration/Software/ResetPWD")', {
credentials: 'same-origin',
mode: 'same-origin',
method: 'POST',
body: JSON.stringify({ id }),
headers: { 'Content-Type': 'application/json' }
})
.then(function (response) {
if (response.ok) {
location.reload(true);
let activeLinks = document.querySelectorAll('a[id^="pwd_"]');
if (activeLinks) {
activeLinks.forEach(a => a.onklick = function resetPassword (e) {
if (e.target.id) {
let id = e.target.id.replace('pwd_', '');
fetch('@this.Url.Content("~/Administration/Software/ResetPWD")', {
credentials: 'same-origin',
mode: 'same-origin',
method: 'POST',
body: JSON.stringify({ id }),
headers: { 'Content-Type': 'application/json' }
})
.then(function (response) {
if (response.ok) {
location.reload(true);
}
});
}
});
}
let searchInput = document.getElementById('user_search');
if (searchInput) {
searchInput.oninput = function (e) {
let value = e.target.value;
if (value) {
value = value.toLowerCase();
}
let tableRows = document.querySelectorAll('tbody > tr');
if (tableRows) {
tableRows.forEach(function (tr) {
if (tr.children) {
let trContent = '';
Array.from(tr.children).forEach(function (td) {
trContent += ' ' + td.innerText;
});
if (trContent.toLowerCase().includes(value)) {
tr.classList.remove('d-none');
} else {
tr.classList.add('d-none');
}
}
});
}
});
}
};
}
document
.querySelectorAll('a[id^="pwd_"]')
.forEach(x => x.onclick = resetPassword);
</script>
}
@@ -10,12 +10,11 @@
<a href="~/Administration/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light">Software Functions</a>
<a href="~/Administration/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light active">Users Functions</a>
<div class="list-group list-group-flush list-group-transparent">
<form action="~/Administration/Software/UsersFunctions" method="get" class="list-group-item list-group-item-action bg-light">
<div class="list-group-item list-group-item-action bg-light">
<div class="input-group input-group-sm">
<input class="form-control" name="username">
<button class="btn btn-sm btn-dark input-group-text small" type="submit"><i class="bi bi-search"></i></button>
<input class="form-control form-control-sm" id="user_search">
</div>
</form>
</div>
</div>
<a href="~/Administration/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
</div>
@@ -47,20 +46,22 @@
<div class="dropdown-menu w-100">
<form action="~/Administration/Software/UsersFunctions" method="post" id="form_@user.Id" class="p-3">
<input type="hidden" name="UserId" value="@user.Id" />
@foreach (var f in this.Model.Functions)
{
var id = $"f_{user.Id}_{f.Id}";
<div class="scrollable-sm mt-3" style="max-height: 500px">
@foreach (var f in this.Model.Functions)
{
var id = $"f_{user.Id}_{f.Id}";
<div class="form-check">
<input class="form-check-input"
type="checkbox"
value="@f.Id"
name="Functions[]"
id="@id" @(user.Functions.Contains(f.Id) ? "checked=\"checked\"" : null)>
<label class="form-check-label">@f.Function</label>
</div>
}
<button class="btn btn-light btn-sm w-100 border-0 fw-bold" type="submit">Aktualizieren</button>
<div class="form-check">
<input class="form-check-input"
type="checkbox"
value="@f.Id"
name="Functions[]"
id="@id" @(user.Functions.Contains(f.Id) ? "checked=\"checked\"" : null)>
<label class="form-check-label">@f.Function</label>
</div>
}
</div>
<button class="btn btn-light btn-sm w-100 border fw-bold mt-3" type="submit">Aktualizieren</button>
</form>
</div>
</div>
@@ -72,4 +73,36 @@
</table>
</div>
</div>
</div>
</div>
@section scripts {
<script>
let searchInput = document.getElementById('user_search');
if (searchInput) {
searchInput.oninput = function (e) {
let value = e.target.value;
if (value) {
value = value.toLowerCase();
}
let tableRows = document.querySelectorAll('tbody > tr');
if (tableRows) {
tableRows.forEach(function (tr) {
if (tr.children) {
let trContent = '';
Array.from(tr.children).forEach(function (td) {
trContent += ' ' + td.innerText;
});
if (trContent.toLowerCase().includes(value)) {
tr.classList.remove('d-none');
} else {
tr.classList.add('d-none');
}
}
});
}
};
}
</script>
}
@@ -0,0 +1,23 @@
namespace LaaProductionWeb.Areas.Serach.Controllers
{
using LaaProductionWeb.Areas.Serach.Models;
using LaaProductionWeb.Areas.Serach.Models.Interfaces;
using LaaProductionWeb.Models;
using System.Collections.Generic;
using System.Web.Http;
public class WildcardController : ApiController
{
private readonly IWildcardModel wildcardModel;
public WildcardController(IWildcardModel wildcardModel)
=> this.wildcardModel = wildcardModel;
public ModelResult<IEnumerable<string>> Options()
=> this.wildcardModel.Options();
public ModelResult<IEnumerable<WildcardResult>> Get(WildcardInputModel model)
=> this.wildcardModel.Find(this.ModelState, model);
}
}
@@ -1,9 +1,9 @@
namespace LaaProductionWeb.API.Areas.Serach.Models.Interfaces
namespace LaaProductionWeb.Areas.Serach.Models.Interfaces
{
using LaaProductionWeb.API.Models;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using LaaProductionWeb.Models;
using System.Collections.Generic;
using System.Web.Http.ModelBinding;
public interface IWildcardModel
{
@@ -1,4 +1,4 @@
namespace LaaProductionWeb.API.Areas.Serach.Models
namespace LaaProductionWeb.Areas.Serach.Models
{
using System;
using System.Collections.Generic;
@@ -9,15 +9,15 @@
{
private IEnumerable<string> fields = Array.Empty<string>();
[Required(ErrorMessageResourceType = typeof(ErrorMessages), ErrorMessageResourceName = nameof(ErrorMessages.Required))]
[StringLength(50, ErrorMessageResourceType = typeof(ErrorMessages), ErrorMessageResourceName = nameof(ErrorMessages.StringLength), MinimumLength = 1)]
[RegularExpression("^[0-9 a-z-A-Z]+$", ErrorMessageResourceType = typeof(ErrorMessages), ErrorMessageResourceName = nameof(ErrorMessages.RegularExpression))]
[Required()]
[StringLength(50, MinimumLength = 1)]
[RegularExpression("^[0-9 a-z-A-Z]+$")]
public string Token { get; set; }
public string Fields
{
get => string.Join(",", this.fields);
set => this.fields = $"{value}".Split(',', StringSplitOptions.RemoveEmptyEntries);
set => this.fields = $"{value}".Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
}
internal IEnumerable<string> GetRequiredFields(IEnumerable<string> allFields)
@@ -1,13 +1,12 @@
namespace LaaProductionWeb.API.Areas.Serach.Models
namespace LaaProductionWeb.Areas.Serach.Models
{
using LaaProductionWeb.Data.Interfaces;
using LaaProductionWeb.API.Areas.Serach.Models.Interfaces;
using LaaProductionWeb.API.Models;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using LaaProductionWeb.Areas.Serach.Models.Interfaces;
using LaaProductionWeb.Models;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http.ModelBinding;
public class WildcardModel : IWildcardModel
{
@@ -99,7 +98,7 @@
return ordersFound.ToList();
}
return KeyValuePair.Create<string, string>(nameof(model.Token), $"Keine ergebnisse gefunden für '{model.Token}'");
return new KeyValuePair<string, string>(nameof(model.Token), $"Keine ergebnisse gefunden für '{model.Token}'");
}
return validationState;
@@ -1,4 +1,4 @@
namespace LaaProductionWeb.API.Areas.Serach.Models
namespace LaaProductionWeb.Areas.Serach.Models
{
using System.Collections.Generic;
@@ -0,0 +1,19 @@
namespace LaaProductionWeb.Areas.Shipment.Controllers.Scanned
{
using LaaProductionWeb.Areas.Shipment.Models.Interfaces;
using LaaProductionWeb.Models;
using System.Threading.Tasks;
using System.Web.Http;
public class ScannedController : ApiController
{
private readonly IScanModel scanModel;
public ScannedController(IScanModel scanModel)
=> this.scanModel = scanModel;
public async Task<ModelResult> GetAsync(string serialNo)
=> await this.scanModel.SerialScannedAsync(serialNo);
}
}
@@ -1,6 +1,6 @@
namespace LaaProductionWeb.API.Areas.Shipment.Models.Interfaces
namespace LaaProductionWeb.Areas.Shipment.Models.Interfaces
{
using LaaProductionWeb.API.Models;
using LaaProductionWeb.Models;
using System.Threading.Tasks;
@@ -1,8 +1,8 @@
namespace LaaProductionWeb.API.Areas.Shipment.Models
namespace LaaProductionWeb.Areas.Shipment.Models
{
using LaaProductionWeb.API.Areas.Shipment.Models.Interfaces;
using LaaProductionWeb.API.Models;
using LaaProductionWeb.API.Models.SMTP;
using LaaProductionWeb.Areas.Shipment.Models.Interfaces;
using LaaProductionWeb.Models;
using LaaProductionWeb.Models.SMTP;
using LaaProductionWeb.Data.Interfaces;
using System.Collections.Generic;
@@ -1,19 +1,19 @@
namespace LaaProductionWeb.API.Controllers
namespace LaaProductionWeb.Controllers
{
using LaaProductionWeb.API.Models.SMTP;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using LaaProductionWeb.Models.SMTP;
[ApiController]
[Route("[controller]")]
public class EmailController : ControllerBase
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Results;
public class EmailController : ApiController
{
private readonly SMTPClient smtp;
public EmailController(SMTPClient smtp)
=> this.smtp = smtp;
public async Task<IActionResult> Get()
public async Task<OkResult> Get()
{
await this.smtp.SendAsync("Test", "It works!!!", "stoyan.zlatev@xylem.com", new[] { "roland.drabesch@xylem.com", "stoyan.zlatev@xylem.com" });
@@ -2,7 +2,7 @@
{
using LaaProductionWeb.App_Infrastructure;
using LaaProductionWeb.Services.Interfaces;
using System.Web.Mvc;
[AllowAnonymous]
@@ -14,7 +14,7 @@
=> this.accountService = ServiceProvider.Current.GetService<IAccountService>();
[HttpGet]
public ActionResult Index()
public ActionResult Index()
=> this.View();
[HttpPost]
@@ -31,10 +31,12 @@
if (this.ModelState.IsValid)
{
var userId = this.accountService.Login(username, password);
var userId = this.accountService.Login(username, password.ComputeHash());
if (this.HttpContext.SignIn(userId))
if (userId > 0)
{
this.HttpContext.SignIn(userId);
return this.Redirect(this.HttpContext.GetUrlReferer());
}
}
@@ -0,0 +1,35 @@
namespace LaaProductionWeb.Controllers
{
using System.Web.Http;
using System.Web.Http.Results;
public class ValuesController : ApiController
{
// GET api/values
public JsonResult<string[]> Get()
{
return this.Json(new string[] { "value1", "value2" });
}
// GET api/values/5
public string Get(int id)
{
return "value";
}
// POST api/values
public void Post([FromBody]string value)
{
}
// PUT api/values/5
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
public void Delete(int id)
{
}
}
}
@@ -1 +1 @@
<%@ Application Codebehind="Global.asax.cs" Inherits="LaaProductionWeb.MvcApplication" Language="C#" %>
<%@ Application Codebehind="Global.asax.cs" Inherits="LaaProductionWeb.WebApiApplication" Language="C#" %>
@@ -1,24 +1,18 @@
namespace LaaProductionWeb
{
using LaaProductionWeb.App_Start;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
/// <summary>
/// MVC base class for registering and configuring user-defined or customized applications.
/// </summary>
public class MvcApplication : HttpApplication
public class WebApiApplication : HttpApplication
{
/// <summary>
/// Default launch method defined by the Asp.Net MVC framework.
/// </summary>
protected void Application_Start()
{
ServicesConfig.RegisterServices();
ServiceProvider.RegisterServices();
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
@@ -7,23 +7,24 @@
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CC823CBC-1B1D-4669-AF21-D2287E14488D}</ProjectGuid>
<ProjectGuid>{D1AD077B-00E3-4663-AB9F-23FF65D98D2F}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LaaProductionWeb</RootNamespace>
<AssemblyName>LaaProductionWeb</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication>disabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>enabled</IISExpressWindowsAuthentication>
<IISExpressUseClassicPipelineMode />
<IISExpressAnonymousAuthentication>enabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>disabled</IISExpressWindowsAuthentication>
<IISExpressUseClassicPipelineMode>false</IISExpressUseClassicPipelineMode>
<UseGlobalApplicationHostFile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -47,8 +48,8 @@
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.3.6.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0\lib\net472\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
@@ -60,44 +61,50 @@
<Reference Include="Microsoft.Web.Infrastructure, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.Infrastructure.2.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\newtonsoft.json\11.0.2\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.OracleClient" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.DirectoryServices.AccountManagement" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.9\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.9\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.9\lib\net45\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.WebHost, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.9\lib\net45\System.Web.Http.WebHost.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.9\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.9\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.Routing" />
<Reference Include="System.Configuration" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web.Optimization">
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.9\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
@@ -107,44 +114,29 @@
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.9\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Net.Http">
</Reference>
<Reference Include="System.Net.Http.WebRequest">
<Reference Include="WebGrease">
<Private>True</Private>
<HintPath>..\packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
</Reference>
<Reference Include="Antlr3.Runtime">
<Private>True</Private>
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="WebGrease, Version=1.6.5135.21930, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="App_Infrastructure\ApplicationSettings.cs" />
<Compile Include="App_Infrastructure\AllowedRolesAttribute.cs" />
<Compile Include="App_Infrastructure\Appsettings.cs" />
<Compile Include="App_Infrastructure\AuthorizationFilter.cs" />
<Compile Include="App_Infrastructure\ControllerFactory.cs" />
<Compile Include="App_Infrastructure\ControllersExtensions.cs" />
<Compile Include="App_Infrastructure\ExceptionFilter.cs" />
<Compile Include="App_Infrastructure\AllowedRolesAttribute.cs" />
<Compile Include="App_Infrastructure\NestedController.cs" />
<Compile Include="App_Infrastructure\ServiceProvider.cs" />
<Compile Include="App_Infrastructure\ServiceProviderExtensions.cs" />
<Compile Include="App_Infrastructure\SessionUser.cs" />
<Compile Include="App_Infrastructure\UserRoles.cs" />
<Compile Include="App_Start\BundleConfig.cs" />
<Compile Include="App_Start\FilterConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="App_Start\ServicesConfig.cs" />
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Areas\Account\Controllers\FunctionsController.cs" />
<Compile Include="Areas\Account\Controllers\PWDController.cs" />
<Compile Include="Areas\Administration\AdministrationAreaRegistration.cs" />
<Compile Include="Areas\Administration\Controllers\SoftwareController.cs" />
<Compile Include="Areas\Administration\Models\Software\AddFunctionModel.cs" />
@@ -161,16 +153,32 @@
<Compile Include="Areas\Administration\Models\Software\UserFunctions.cs" />
<Compile Include="Areas\Administration\Models\Software\UsersFunctionsInputModel.cs" />
<Compile Include="Areas\Administration\Models\Software\UsersFunctionsModel.cs" />
<Compile Include="Areas\Serach\Controllers\WildcardController.cs" />
<Compile Include="Areas\Serach\Models\Interfaces\IWildcardModel.cs" />
<Compile Include="Areas\Serach\Models\WildcardInputModel.cs" />
<Compile Include="Areas\Serach\Models\WildcardModel.cs" />
<Compile Include="Areas\Serach\Models\WildcardResult.cs" />
<Compile Include="Areas\Shipment\Controllers\ScannedController.cs" />
<Compile Include="Areas\Shipment\Models\Interfaces\IScanModel.cs" />
<Compile Include="Areas\Shipment\Models\ScanModel.cs" />
<Compile Include="Controllers\AdminController.cs" />
<Compile Include="Controllers\ApprovalsController.cs" />
<Compile Include="Controllers\EmailController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\ProtocolController.cs" />
<Compile Include="Controllers\ReportController.cs" />
<Compile Include="Controllers\SearchController.cs" />
<Compile Include="Controllers\ShipmentsController.cs" />
<Compile Include="Controllers\ValuesController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Models\ApplicationSettings.cs" />
<Compile Include="Models\ModelResult.cs" />
<Compile Include="Models\ModelResult[T].cs" />
<Compile Include="Models\SMTP\SMTPClient.cs" />
<Compile Include="Models\SMTP\SMTPEmail.cs" />
<Compile Include="Models\SMTP\SMTPSettings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
@@ -181,17 +189,20 @@
<Content Include="App_Content\js\jsbarcode.all.min.js" />
<Content Include="App_Content\js\scripts.js" />
<Content Include="App_Content\svg\sensus_xylem_logo.svg" />
<Content Include="favicon.ico" />
<Content Include="favicon.svg" />
<Content Include="Global.asax" />
<Content Include="Views\Home\Index.cshtml" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Views\Web.config" />
<Content Include="Views\_ViewStart.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Areas\Account\Models\" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Content\css\bootstrap.min.css.map" />
<Content Include="App_Content\font\fonts\bootstrap-icons.woff" />
<Content Include="App_Content\font\fonts\bootstrap-icons.woff2" />
<Content Include="App_Data\client_map.json" />
<Content Include="Areas\Administration\Views\_ViewStart.cshtml" />
<Content Include="Areas\Administration\Views\Shared\_Layout.cshtml" />
<Content Include="Areas\Administration\Views\Shared\_SoftwareSidebar.cshtml" />
<Content Include="Areas\Administration\Views\Software\Index.cshtml" />
@@ -201,44 +212,43 @@
<Content Include="Areas\Administration\Views\Software\Users.cshtml" />
<Content Include="Areas\Administration\Views\Software\UsersFunctions.cshtml" />
<Content Include="Areas\Administration\Views\web.config" />
<Content Include="Areas\Administration\Views\_ViewStart.cshtml" />
<None Include="packages.config" />
<Content Include="Views\Shared\_PrintLayout.cshtml" />
<Content Include="Views\Report\Helium.cshtml" />
<Content Include="Views\Report\Filter.cshtml" />
<Content Include="Views\Report\HeliumResults.cshtml" />
<Content Include="Views\Report\DateFilter.cshtml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<Content Include="Views\Approvals\Add.cshtml" />
<Content Include="Views\Search\Production.cshtml" />
<Content Include="Views\_ViewStart.cshtml" />
<Content Include="Views\Admin\Index.cshtml" />
<Content Include="Views\Report\HiddenFilter.cshtml" />
<Content Include="Views\Report\Kottmann.cshtml" />
<Content Include="Views\Search\Wildcard.cshtml" />
<Content Include="Views\Shipments\Missing.cshtml" />
<Content Include="Views\Report\CordonelPressureSensor.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Content\font\fonts\bootstrap-icons.woff" />
<Content Include="App_Content\font\fonts\bootstrap-icons.woff2" />
<Content Include="App_Content\css\bootstrap.min.css.map" />
<Content Include="App_Data\client_map.json" />
<Content Include="Views\Approvals\Add.cshtml" />
<Content Include="Views\Home\Index.cshtml" />
<Content Include="Views\Protocol\Body.cshtml" />
<Content Include="Views\Protocol\Clients.cshtml" />
<Content Include="Views\Protocol\Document.cshtml" />
<Content Include="Views\Protocol\Index.cshtml" />
<Content Include="Views\Protocol\Orders.cshtml" />
<Content Include="Views\Protocol\Print.cshtml" />
<Content Include="Views\Report\CordonelPressureSensor.cshtml" />
<Content Include="Views\Report\DateFilter.cshtml" />
<Content Include="Views\Report\Filter.cshtml" />
<Content Include="Views\Report\Helium.cshtml" />
<Content Include="Views\Report\HeliumResults.cshtml" />
<Content Include="Views\Report\HiddenFilter.cshtml" />
<Content Include="Views\Report\Kottmann.cshtml" />
<Content Include="Views\Search\Orders.cshtml" />
<Content Include="Views\Search\Positions.cshtml" />
<Content Include="Views\Search\Production.cshtml" />
<Content Include="Views\Search\Wildcard.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="Views\Shared\_PrintLayout.cshtml" />
<Content Include="Views\Shared\Error.cshtml" />
<Content Include="Views\Shipments\Batch.cshtml" />
<Content Include="Views\Shipments\Index.cshtml" />
<Content Include="Views\Shipments\Missing.cshtml" />
<Content Include="Views\Shipments\Print.cshtml" />
<Content Include="Views\Shipments\Scan.cshtml" />
<Content Include="Views\Web.config" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<Content Include="Views\Home\Session.cshtml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LaaProductionWeb.Data\LaaProductionWeb.Data.csproj">
<Project>{4b5bf112-d3be-4e84-9a8e-74a0e314bba7}</Project>
<Project>{4B5BF112-D3BE-4E84-9A8E-74A0E314BBA7}</Project>
<Name>LaaProductionWeb.Data</Name>
</ProjectReference>
<ProjectReference Include="..\LaaProductionWeb.Services\LaaProductionWeb.Services.csproj">
@@ -246,7 +256,6 @@
<Name>LaaProductionWeb.Services</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
@@ -263,8 +272,8 @@
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>54448</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<DevelopmentServerPort>57995</DevelopmentServerPort>
<DevelopmentServerVPath>/LaaProductionWeb</DevelopmentServerVPath>
<IISUrl>http://localhost:54448/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
@@ -275,12 +284,12 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.3.6.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.targets" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.3.6.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.targets')" />
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0\build\net472\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.targets" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0\build\net472\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.3.6.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.3.6.0\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0\build\net472\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0\build\net472\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@@ -1,4 +1,4 @@
namespace LaaProductionWeb.API.Models
namespace LaaProductionWeb.Models
{
/// <summary>
/// C# class representation of the appsettings.json file.
@@ -1,6 +1,6 @@
namespace LaaProductionWeb.API.Models
namespace LaaProductionWeb.Models
{
using Microsoft.AspNetCore.Mvc;
using System.Web.Http.Results;
public class ModelResult
{
@@ -14,17 +14,5 @@
public static implicit operator bool(ModelResult modelResult)
=> modelResult?.state ?? false;
public static implicit operator ActionResult(ModelResult modelResult)
{
if (modelResult)
{
return new OkResult();
}
else
{
return new BadRequestResult();
}
}
}
}
@@ -1,10 +1,8 @@
namespace LaaProductionWeb.API.Models
namespace LaaProductionWeb.Models
{
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http.ModelBinding;
public class ModelResult<T>
{
@@ -60,28 +58,17 @@
var errorKey = entry.Key;
var errorValue = entry.Value;
if (errorValue.ValidationState == ModelValidationState.Invalid && errorValue.Errors.Any())
foreach (var error in errorValue.Errors)
{
validationResults.AddModelError(errorKey, errorValue.Errors.First().ErrorMessage);
if (!string.IsNullOrWhiteSpace(error.ErrorMessage))
{
validationResults.AddModelError(errorKey, error.ErrorMessage);
}
}
}
}
return validationResults;
}
public static implicit operator ActionResult(ModelResult<T> modelState)
{
if (modelState is null)
{
return new NotFoundResult();
}
else if (modelState.Succeeded)
{
return new OkObjectResult(modelState.Value);
}
return new BadRequestObjectResult(modelState.errors);
}
}
}
@@ -1,4 +1,4 @@
namespace LaaProductionWeb.API.Models.SMTP
namespace LaaProductionWeb.Models.SMTP
{
using System;
using System.Collections.Generic;
@@ -1,4 +1,4 @@
namespace LaaProductionWeb.API.Models.SMTP
namespace LaaProductionWeb.Models.SMTP
{
using System.Collections.Generic;
@@ -1,4 +1,4 @@
namespace LaaProductionWeb.API.Models.SMTP
namespace LaaProductionWeb.Models.SMTP
{
public class SMTPSettings
{
@@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("658f4079-1107-4fa5-bec1-246d25832625")]
[assembly: Guid("f61afdb7-cccb-49e9-b73c-b11849eadcad")]
// Version information for an assembly consists of the following four values:
//
@@ -1,30 +0,0 @@
**LaaProductionWeb**
---
[&#129028; Go back to the parent directory](https://slm.sms-esaap.com/la_operations/laa_production/-/tree/main/LaaProductionWeb)
is a **ASP.Net MVC** **[local web application](http://sla12iis01.emea.sensus.net/LaaProductionWeb/)** written under **C# .Net Framework 6.4.2** that contains web services for digitization of the production processes.
- Authentication througth: username, password; initial session time: 10 min; configurable;
- Loading content according to current user permissions
**1. Pallets scan**
- Used to save pallets with their loads in a database. This will help later when creating a pallet load file to ship with the pallet.
**2. QAP test protocol**
- Used to create QAP test protocol automaticaly for particular customers. This protocol should be printet signed and uploaded to the particular order. Is unique for each order.
**3. Reports**
- [He] Report - Statistics for past helium tests, allows user to filter and sort all displayed data and then to download a csv file from that as well.
- Cotman - Statistics for past pressure tests, allows user to filter and sort all displayed data and then to download a csv file from that as well.
**4. Production approval**
- Used to approve particular production orders with different characteristics and notes.
**5. Wildcard search**
- is a none public web interface for searching orders info from one of following: Radio Addresse, PcbId, SerialNr, ClientSerialNr.
@@ -0,0 +1,2 @@
<p>@this.Context.Session["xyz"]</p>
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Error</title>
</head>
<body>
<hgroup>
<h1>Error.</h1>
<h2>An error occurred while processing your request.</h2>
</hgroup>
</body>
</html>
+41 -231
View File
@@ -7,251 +7,61 @@
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="LoginTimeout" value="600" /> <!-- in seconds -->
<add key="ClientValidationEnabled" value="false" />
<add key="UnobtrusiveJavaScriptEnabled" value="false" />
<!-- in seconds -->
<add key="LoginTimeout" value="600" />
<add key="ConnectionString" value="Data Source=SLASQL01.emea.sensus.net;Initial Catalog=Auftrag;Password=ServiceParingfile;Persist Security Info=True;User ID=ServiceParingfile;" />
<add key="APIURL" value="https://localhost:44346/" />
</appSettings>
<!--
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
The following attributes can be set on the <httpRuntime> tag.
<system.Web>
<httpRuntime targetFramework="4.8.1" />
</system.Web>
-->
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.6.2" />
<httpRuntime targetFramework="4.6.2" />
<authentication mode="None" />
<anonymousIdentification enabled="true"/>
<authorization>
<allow users="*" />
<allow users="*"/>
</authorization>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="ADB9793829DDAE60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Xml.XmlSerializer" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Xml.XDocument" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="CC7B13FFCD2DDD51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Timer" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Parallel" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Overlapped" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.RegularExpressions" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encoding.Extensions" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encoding" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.SecureString" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Principal" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Serialization.Xml" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.3.0" newVersion="4.1.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Serialization.Primitives" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Serialization.Json" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Numerics" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Extensions" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Resources.ResourceManager" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Primitives" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Extensions" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ObjectModel" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Sockets" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Requests" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Primitives" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.NetworkInformation" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Linq.Queryable" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Linq.Parallel" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Linq.Expressions" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Linq" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" publicKeyToken="B77A5C561934E089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Globalization.Extensions" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Globalization" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Dynamic.Runtime" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.Tracing" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.Tools" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.Debug" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.Contracts" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data.Common" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ComponentModel.EventBasedAsync" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ComponentModel" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Concurrent" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.11.0" newVersion="4.0.11.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="ADB9793829DDAE60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
<assemblyIdentity name="Microsoft.Web.Infrastructure" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
@@ -265,20 +75,20 @@
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.9.0" newVersion="5.2.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Web.Infrastructure" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.codedom>
<compilers>
<compiler extension=".cs" language="c#;cs;csharp" warningLevel="4" compilerOptions="/langversion:7.0 /nowarn:1659;1699;1701;612;618" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<compiler extension=".vb" language="vb;vbs;visualbasic;vbscript" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008,40000,40008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701;612;618" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008,40000,40008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</compilers>
</system.codedom>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
</configuration>
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

@@ -1,16 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Antlr" version="3.5.0.2" targetFramework="net462" />
<package id="Microsoft.AspNet.Mvc" version="5.2.9" targetFramework="net462" />
<package id="Microsoft.AspNet.Razor" version="3.2.9" targetFramework="net462" />
<package id="Microsoft.AspNet.Mvc" version="5.2.9" targetFramework="net481" />
<package id="Microsoft.AspNet.Razor" version="3.2.9" targetFramework="net481" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net462" />
<package id="Microsoft.AspNet.WebPages" version="3.2.9" targetFramework="net462" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net462" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="3.6.0" targetFramework="net462" />
<package id="Microsoft.Extensions.DependencyInjection" version="7.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="7.0.0" targetFramework="net462" />
<package id="Microsoft.Web.Infrastructure" version="2.0.0" targetFramework="net462" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net462" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
<package id="Microsoft.AspNet.WebApi" version="5.2.9" targetFramework="net481" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.9" targetFramework="net481" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.9" targetFramework="net481" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.9" targetFramework="net481" />
<package id="Microsoft.AspNet.WebPages" version="3.2.9" targetFramework="net481" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net481" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net481" />
<package id="Microsoft.Extensions.DependencyInjection" version="7.0.0" targetFramework="net481" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="7.0.0" targetFramework="net481" />
<package id="Microsoft.Web.Infrastructure" version="2.0.0" targetFramework="net481" />
<package id="Modernizr" version="2.8.3" targetFramework="net462" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net481" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net481" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net481" />
<package id="WebGrease" version="1.6.0" targetFramework="net462" />
</packages>