adding nuget package from gitlab

This commit is contained in:
Stoyan Zlatev
2023-06-12 13:48:12 +02:00
parent 8eb09bdabf
commit 65261c8ade
45 changed files with 355 additions and 1225 deletions
@@ -12,9 +12,9 @@
public class AccountService : IAccountService
{
private readonly IFluentSQL sqlClient;
private readonly IFluentSQLConnection sqlClient;
public AccountService(IFluentSQL sqlClient)
public AccountService(IFluentSQLConnection sqlClient)
=> this.sqlClient = sqlClient;
public Employee FindEmployee(short userId)
@@ -7,9 +7,9 @@
public class ApprovalsService : IApprovalsService
{
private readonly IFluentSQL fluentSQL;
private readonly IFluentSQLConnection fluentSQL;
public ApprovalsService(IFluentSQL fluentSQL)
public ApprovalsService(IFluentSQLConnection fluentSQL)
=> this.fluentSQL = fluentSQL;
public Result Add(ProductionApproval approval)
@@ -0,0 +1,13 @@
namespace LaaProductionWeb.Services.Interfaces
{
using LaaProductionWeb.Services.Models;
using System.Collections.Generic;
public interface ISearchService
{
IEnumerable<WildcardResult> Find(WildcardInputModel model);
IEnumerable<string> Options();
}
}
@@ -13,6 +13,8 @@
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -32,8 +34,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentSQL, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\FluentSQL.1.0.0\lib\netstandard2.0\FluentSQL.dll</HintPath>
<Reference Include="FluentSQLClient, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\FluentSQLClient.1.0.0\lib\netstandard2.0\FluentSQLClient.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -42,17 +44,11 @@
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.SqlClient, Version=4.6.1.5, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SqlClient.4.8.5\lib\net461\System.Data.SqlClient.dll</HintPath>
</Reference>
<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.Net.Http" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xml" />
</ItemGroup>
@@ -67,6 +63,7 @@
<Compile Include="Interfaces\IOrdersService.cs" />
<Compile Include="Interfaces\IProtocolService.cs" />
<Compile Include="Interfaces\IReportService.cs" />
<Compile Include="Interfaces\ISearchService.cs" />
<Compile Include="Interfaces\IShipmentsService.cs" />
<Compile Include="Interfaces\ISoftwareService.cs" />
<Compile Include="LoggerService.cs" />
@@ -101,6 +98,8 @@
<Compile Include="Models\Reports\ReportFilter.cs" />
<Compile Include="Models\Result.cs" />
<Compile Include="Models\Search\SearchWildcardModel.cs" />
<Compile Include="Models\Search\WildcardInputModel.cs" />
<Compile Include="Models\Search\WildcardResult.cs" />
<Compile Include="Models\SerialNr.cs" />
<Compile Include="Models\ShipmentModel.cs" />
<Compile Include="Models\Reports\SqlExpression.cs" />
@@ -115,6 +114,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProtocolService.cs" />
<Compile Include="ReportService.cs" />
<Compile Include="SearchService.cs" />
<Compile Include="ShipmentsService.cs" />
<Compile Include="SoftwareService.cs" />
</ItemGroup>
@@ -8,9 +8,9 @@
public class LoggerService : ILoggerService
{
private readonly IFluentSQL fluentSQL;
private readonly IFluentSQLConnection fluentSQL;
public LoggerService(IFluentSQL fluentSQL)
public LoggerService(IFluentSQLConnection fluentSQL)
=> this.fluentSQL = fluentSQL;
public class Actions
@@ -0,0 +1,38 @@
namespace LaaProductionWeb.Services.Models
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
public class WildcardInputModel
{
private string token;
private IEnumerable<string> fields = Array.Empty<string>();
[Required]
[StringLength(50, MinimumLength = 1)]
[RegularExpression("^[0-9 a-z-A-Z]+$")]
public string Token
{
get => this.token;
set => this.token = value?.Replace(" ", "")?.Trim();
}
public string Fields
{
get => string.Join(",", this.fields);
set => this.fields = $"{value}".Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
}
internal IEnumerable<string> GetRequiredFields(IEnumerable<string> allFields)
{
if (this.fields.Any())
{
return allFields.Where(x => this.fields.Contains(x, StringComparer.OrdinalIgnoreCase));
}
return allFields;
}
}
}
@@ -0,0 +1,8 @@
namespace LaaProductionWeb.Services.Models
{
using System.Collections.Generic;
public class WildcardResult : Dictionary<string, object>
{
}
}
@@ -7,9 +7,9 @@
public class OrdersService : IOrdersService
{
private readonly IFluentSQL sqlClient;
private readonly IFluentSQLConnection sqlClient;
public OrdersService(IFluentSQL sqlClient)
public OrdersService(IFluentSQLConnection sqlClient)
=> this.sqlClient = sqlClient;
public OrdersFoundModel FindOrders(string search)
@@ -13,9 +13,9 @@
public class ProtocolService : IProtocolService
{
private readonly IFluentSQL fluentSQL;
private readonly IFluentSQLConnection fluentSQL;
public ProtocolService(IFluentSQL fluentSQL)
public ProtocolService(IFluentSQLConnection fluentSQL)
=> this.fluentSQL = fluentSQL;
public bool DeleteFile(int fileId)
@@ -12,9 +12,9 @@
public partial class ReportService : IReportService
{
private readonly IFluentSQL fluentSQL;
private readonly IFluentSQLConnection fluentSQL;
public ReportService(IFluentSQL fluentSQL)
public ReportService(IFluentSQLConnection fluentSQL)
=> this.fluentSQL = fluentSQL;
public CordonelPressureSensorModel LoadCordonelPressureSensorReport(CordonelPressureSensorModel model = null)
@@ -0,0 +1,131 @@
namespace LaaProductionWeb.Services
{
using FluentSQLClient.Interfaces;
using LaaProductionWeb.Services.Models;
using LaaProductionWeb.Services.Interfaces;
using System.Collections.Generic;
public class SearchService : ISearchService
{
private readonly IFluentSQLConnection fluentSQLClient;
public SearchService(IFluentSQLConnection fluentSQLClient)
=> this.fluentSQLClient = fluentSQLClient;
public IEnumerable<WildcardResult> Find(WildcardInputModel model)
{
var requiredFields = model.GetRequiredFields(this.Options());
var ordersFound = fluentSQLClient
.CreateCommand($@"
DECLARE @serienNr TABLE([Nr] VARCHAR(50));
-----------------------------------------------------------------------------
-- 1. LOOK FOR SERIAL NUMBER ------------------------------------------------
-----------------------------------------------------------------------------
INSERT INTO @serienNr
SELECT [APS].[SerienNr]
FROM [AuftragPositionSerienNr] AS [APS]
WHERE [APS].[SerienNr] LIKE @{nameof(model.Token)}
OR [APS].[KundeneigeneSerienNr] LIKE @{nameof(model.Token)}
OR REPLACE([APS].[KundeneigeneSerienNr], ' ', '') LIKE @{nameof(model.Token)};
-----------------------------------------------------------------------------
-- 2. LOOK FOR PCB NUMBER ---------------------------------------------------
-----------------------------------------------------------------------------
INSERT INTO @serienNr
SELECT [PCBS].[MapPcbIdToSerialNumber_SerialNumber]
FROM [MapPcbIdToSerialNumber] AS [PCBS]
WHERE [PCBS].[MapPcbIdToSerialNumber_PcbId] LIKE @{nameof(model.Token)};
-----------------------------------------------------------------------------
-- 3. LOOK FOR FUNK ADDRESS E-REGISTER --------------------------------------
-----------------------------------------------------------------------------
INSERT INTO @serienNr
SELECT [ER].[Seriennummer]
FROM [eRegister] AS [ER]
WHERE [ER].[Adresse] LIKE @{nameof(model.Token)};
-----------------------------------------------------------------------------
-- 4. LOOK FOR FUNK ADDRESS GENESIS -----------------------------------------
-----------------------------------------------------------------------------
INSERT INTO @serienNr
SELECT [GM].[Seriennummer]
FROM [Genesis_Meter] AS [GM]
WHERE [GM].[Adresse] LIKE @{nameof(model.Token)};
-----------------------------------------------------------------------------
-- 5. TAKE ORDERS INFO ------------------------------------------------------
-----------------------------------------------------------------------------
SELECT DISTINCT
[KN].[KundenNr] AS [CustomerNo]
, [KN].[Name] AS [Customer]
, [AP].[FertigungsauftragNr] AS [ProductionOrderNo]
, [APS].[AuftragNr] AS [CustomerOrderNo]
, [APS].[PositionNr] AS [PosNo]
, [APS].[SerienNr] AS [SerialNo]
, [APS].[KundeneigeneSerienNr] AS [CustomerSerialNo]
, [IDN].[KurzBez] AS [KurzBez]
, [IDN].[Typ] AS [Typ]
, [IDN].[Nennweite] AS [Nennweite]
, [IDN].[Baulaenge] AS [Baulaenge]
, [AP].[Menge] AS [Quantity]
, [APS].[FabNr] AS [FabricNo]
, [IDN].[IdentNr] AS [IdentNr]
, [PCBS].[MapPcbIdToSerialNumber_PcbId] AS [PcbId]
, [ER].[Adresse] AS [ErRadioAddress]
, [GM].[Adresse] AS [GmRadioAddress]
FROM [AuftragPositionSerienNr] AS [APS]
LEFT JOIN [AuftragPosition_Gesamt] AS [AP]
ON [AP].[AuftragNr] = [APS].[AuftragNr]
AND [AP].[PositionNr] = [APS].[PositionNr]
LEFT JOIN [Auftrag_Gesamt] AS [AG]
ON [AG].[AuftragNr] = [APS].[AuftragNr]
LEFT JOIN [Kunde] AS [KN]
ON [KN].[KundenNr] = [AG].[KundenNr]
LEFT JOIN [Identnr] AS [IDN]
ON [IDN].[IdentNr] = [AP].[Identnr]
LEFT JOIN [MapPcbIdToSerialNumber] AS [PCBS]
ON [PCBS].[MapPcbIdToSerialNumber_SerialNumber] = [APS].[SerienNr]
LEFT JOIN [eRegister] AS [ER]
ON [ER].[Seriennummer] = [APS].[SerienNr]
LEFT JOIN [Genesis_Meter] AS [GM]
ON [GM].[Seriennummer] = [APS].[SerienNr]
WHERE [APS].[SerienNr] IN (SELECT [Nr] FROM @serienNr)")
.SetParameter(nameof(model.Token), model.Token)
.ExecuteReader(reader => this.ToWildcardResult(reader, requiredFields));
return ordersFound;
}
public IEnumerable<string> Options()
=> new string[]
{
"CustomerNo",
"Customer",
"ProductionOrderNo",
"CustomerOrderNo",
"PosNo",
"SerialNo",
"CustomerSerialNo",
"KurzBez",
"Typ",
"Nennweite",
"Baulaenge",
"Quantity",
"FabricNo",
"IdentNr",
"PcbId",
"ErRadioAddress",
"GmRadioAddress",
};
internal WildcardResult ToWildcardResult(IFluentSQLReader reader, IEnumerable<string> fields)
{
var wildcardResult = new WildcardResult();
foreach (var field in fields)
{
wildcardResult[field] = reader.GetValue(field);
}
return wildcardResult;
}
}
}
@@ -12,9 +12,9 @@
public class ShipmentsService : IShipmentsService
{
private readonly IFluentSQL fluentSQL;
private readonly IFluentSQLConnection fluentSQL;
public ShipmentsService(IFluentSQL fluentSQL)
public ShipmentsService(IFluentSQLConnection fluentSQL)
=> this.fluentSQL = fluentSQL;
public OrderScanModel DeletePalletEntry(int id)
@@ -13,9 +13,9 @@
public class SoftwareService : ISoftwareService
{
private readonly IFluentSQL fluentSQL;
private readonly IFluentSQLConnection fluentSQL;
public SoftwareService(IFluentSQL fluentSQL)
public SoftwareService(IFluentSQLConnection fluentSQL)
=> this.fluentSQL = fluentSQL;
public void AddFunction(short appId, string name)