Mearge software functions web UI
This commit is contained in:
@@ -155,7 +155,7 @@
|
||||
</site>
|
||||
<site name="MeterProcessState" id="2">
|
||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\laa_production\Common\Service\MeterProcessState" />
|
||||
<virtualDirectory path="/" physicalPath="C:\Users\SZLATEV\source\repos\laa_production\Common\Service\MeterProcessState" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:56011:localhost" />
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
namespace LaaProductionWeb.API.Areas.Account.Controllers
|
||||
{
|
||||
using LaaProductionWeb.Standart.Interfaces;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
public class PWDController : AccountBaseController
|
||||
{
|
||||
public PWDController(IAccountService accountService) : base(accountService)
|
||||
{
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult Post([FromForm(Name = "username")]string username, [FromForm(Name = "password")]string password)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(password))
|
||||
{
|
||||
return this.BadRequest("Invalid password.");
|
||||
}
|
||||
else if (this.accountService.ResetPassword(username, password) == 1)
|
||||
{
|
||||
return this.Ok();
|
||||
}
|
||||
|
||||
return this.BadRequest("Password was not reseted.");
|
||||
}
|
||||
|
||||
[HttpDelete("{username}")]
|
||||
public IActionResult Delete(string username)
|
||||
{
|
||||
if (this.accountService.ResetPassword(username) == 1)
|
||||
{
|
||||
return this.Ok();
|
||||
}
|
||||
|
||||
return this.BadRequest("Password was not reseted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LaaProductionWeb.Data\LaaProductionWeb.Data.csproj" />
|
||||
<ProjectReference Include="..\LaaProductionWeb.Standart\LaaProductionWeb.Standart.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -30,4 +31,8 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Areas\Account\Models\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
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;
|
||||
@@ -28,6 +30,7 @@
|
||||
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 =>
|
||||
@@ -56,8 +59,8 @@
|
||||
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
|
||||
routes.MapRoute(name: "areas", template: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
|
||||
routes.MapRoute(name: "areas", template: "{area:exists}/{controller}/{action}/{id?}");
|
||||
routes.MapRoute(name: "default", template: "{controller}/{action}/{id?}");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
public T FirstOrDefault<T>(Func<ISqlReader, T> expression)
|
||||
=> this.sqlClient.FirstOrDefault(this, expression);
|
||||
|
||||
public int ExecuteNonQuery()
|
||||
=> this.sqlClient.ExecuteNonQuery(this);
|
||||
|
||||
public IEnumerable<T> ExecuteReader<T>(Func<ISqlReader, T> expression)
|
||||
=> this.sqlClient.ExecuteReader(this, expression);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,30 @@
|
||||
return rowsAffected;
|
||||
}
|
||||
|
||||
internal int ExecuteNonQuery(SQLCommand command)
|
||||
{
|
||||
var rowsAffected = 0;
|
||||
|
||||
using (var sqlConnection = new SqlConnection(this.connectionString))
|
||||
{
|
||||
sqlConnection.OpenWithErrorHandling();
|
||||
|
||||
using (var sqlCommand = sqlConnection.CreateCommand())
|
||||
{
|
||||
sqlCommand.CommandText = command.CommandText;
|
||||
|
||||
foreach (var kvp in command.Parameters)
|
||||
{
|
||||
sqlCommand.Parameters.Add(new SqlParameter(kvp.Key, kvp.Value));
|
||||
}
|
||||
|
||||
rowsAffected = sqlCommand.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
return rowsAffected;
|
||||
}
|
||||
|
||||
internal IEnumerable<T> ExecuteReader<T>(SQLCommand command, Func<ISqlReader, T> expression)
|
||||
{
|
||||
using (var sqlConnection = new SqlConnection(this.connectionString))
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
{
|
||||
using LaaProductionWeb.Data.Interfaces;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
using LaaProductionWeb.Services.Models;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class AccountService : IAccountService
|
||||
{
|
||||
@@ -13,30 +10,6 @@
|
||||
public AccountService(ISqlClient sqlClient)
|
||||
=> this.sqlClient = sqlClient;
|
||||
|
||||
public Employee FindEmployee(int userId)
|
||||
{
|
||||
var employeIdentity = this.sqlClient.FirstOrDefault($@"
|
||||
SELECT TOP 1
|
||||
[MitarbeiterNr]
|
||||
, [Vorname] + ' ' + [Name]
|
||||
FROM [Mitarbeiter]
|
||||
WHERE [MitarbeiterNr] = @{nameof(userId)}",
|
||||
parameters => parameters.Add(nameof(userId), userId),
|
||||
reader => new KeyValuePair<int, string>(
|
||||
key: reader.GetValue<short>(),
|
||||
value: reader.GetString()));
|
||||
|
||||
var permissions = this.sqlClient.ExecuteReader($@"
|
||||
SELECT [MitarbeiterRechte].[Recht]
|
||||
FROM [MitarbeiterRechte]
|
||||
WHERE [MitarbeiterNr] = @{nameof(employeIdentity.Key)}
|
||||
AND [MitarbeiterRechte].[Recht] LIKE 'WEB_%'",
|
||||
parameters => parameters.Add(nameof(employeIdentity.Key), employeIdentity.Key),
|
||||
reader => reader.GetString());
|
||||
|
||||
return new Employee(employeIdentity.Value, permissions);
|
||||
}
|
||||
|
||||
public int Login(string username, string password)
|
||||
=> this.sqlClient.FirstOrDefault($@"
|
||||
SELECT TOP 1 [MitarbeiterNr]
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
public interface IAccountService : ITransient
|
||||
{
|
||||
Employee FindEmployee(int userId);
|
||||
|
||||
int Login(string username, string password);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
public interface IReportService : ITransient
|
||||
{
|
||||
CordonelPressureSensorModel LoadCordonelPressureSensorReport(CordonelPressureSensorModel model = null);
|
||||
|
||||
HeliumReportModel LoadHeliumPressureReport(HeliumReportModel model = null);
|
||||
|
||||
IEnumerable<HeliumPressurePoint> LoadHeliumPressureResults(int testId);
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
namespace LaaProductionWeb.Services.Interfaces
|
||||
{
|
||||
using LaaProductionWeb.Services.Models.Software;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface ISoftwareService : ITransient
|
||||
{
|
||||
void AddFunction(short appId, string name);
|
||||
|
||||
void DeleteFunction(int funcId);
|
||||
|
||||
IEnumerable<string> FindSoftwareForUser(short appId, string username, string password);
|
||||
|
||||
IEnumerable<SoftwareFunction> GetAllSoftwareFunctions();
|
||||
|
||||
IEnumerable<SoftwareFunction> GetSoftwareFunctions(short appId);
|
||||
|
||||
SoftwareOverview GetSoftwareOverview(short appId);
|
||||
|
||||
IEnumerable<Software> GetSoftwareVersions(short appId);
|
||||
IEnumerable<SoftwareOverview> GetSoftwares();
|
||||
|
||||
IEnumerable<SoftwareUser> GetUsers(string username = null);
|
||||
|
||||
IEnumerable<SoftwareUser> GetUsersWithFunctions(int id = -1, string username = null);
|
||||
|
||||
int ResetPassword(short userId);
|
||||
|
||||
int ResetPassword(short userId, string password);
|
||||
|
||||
void UpdateFunction(int funcId, string name);
|
||||
|
||||
void UpdateUsersFunctions(Action<UserFunctions> mapper);
|
||||
|
||||
void UpdateUsersFunctions(Action<FunctionUsers> mapper);
|
||||
|
||||
void UpdatePasswordHashes();
|
||||
}
|
||||
}
|
||||
@@ -60,10 +60,14 @@
|
||||
<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" />
|
||||
<Compile Include="Models\Reports\CordonelPressureSensorFilter.cs" />
|
||||
<Compile Include="Models\Reports\CordonelPressureSensorItem.cs" />
|
||||
<Compile Include="Models\Reports\CordonelPressureSensorModel.cs" />
|
||||
<Compile Include="Models\Reports\HeliumPressurePoint.cs" />
|
||||
<Compile Include="Models\Reports\HeliumReportFilter.cs" />
|
||||
<Compile Include="Models\Reports\KottmannReportFilter.cs" />
|
||||
@@ -93,12 +97,19 @@
|
||||
<Compile Include="Models\ShipmentModel.cs" />
|
||||
<Compile Include="Models\Reports\SqlExpression.cs" />
|
||||
<Compile Include="Models\Reports\TestStatus.cs" />
|
||||
<Compile Include="Models\Software\FunctionUsers.cs" />
|
||||
<Compile Include="Models\Software\Software.cs" />
|
||||
<Compile Include="Models\Software\SoftwareFunction.cs" />
|
||||
<Compile Include="Models\Software\SoftwareOverview.cs" />
|
||||
<Compile Include="Models\Software\SoftwareUser.cs" />
|
||||
<Compile Include="Models\Software\UserFunctions.cs" />
|
||||
<Compile Include="OrdersService.cs" />
|
||||
<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" />
|
||||
@@ -108,6 +119,10 @@
|
||||
<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>
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
namespace LaaProductionWeb.Services.Models.Reports
|
||||
{
|
||||
public class CordonelPressureSensorFilter : ReportFilter
|
||||
{
|
||||
public CordonelPressureSensorFilter()
|
||||
{
|
||||
var model = default(CordonelPressureSensorItem);
|
||||
|
||||
this.Add(model.Text(x => x.AuftragNr, this.Count));
|
||||
this.Add(model.Text(x => x.PosNr, this.Count));
|
||||
this.Add(model.Text(x => x.SerialNr, this.Count));
|
||||
this.Add(model.Text(x => x.CustomerSerialNr, this.Count));
|
||||
this.Add(model.Text(x => x.IdentNr, this.Count));
|
||||
this.Add(model.Text(x => x.PcbId, this.Count));
|
||||
this.Add(model.Text(x => x.TypeI, this.Count));
|
||||
this.Add(model.Text(x => x.TypeII, this.Count));
|
||||
this.Add(model.Text(x => x.Nennweite, this.Count));
|
||||
this.Add(model.Text(x => x.Baulaenge, this.Count));
|
||||
this.Add(model.Text(x => x.AVGPressure, this.Count));
|
||||
this.Add(model.Boolean(x => x.TestPassed, this.Count));
|
||||
this.Add(model.DateTime(x => x.TestDate, this.Count, -1));
|
||||
}
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
namespace LaaProductionWeb.Services.Models.Reports
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
public class CordonelPressureSensorItem
|
||||
{
|
||||
[Display(Name = "Auftrag Nr")]
|
||||
[Column("[APS].[AuftragNr]")]
|
||||
public int? AuftragNr { get; set; }
|
||||
|
||||
[Display(Name = "Position Nr")]
|
||||
[Column("[APS].[PositionNr]")]
|
||||
public short? PosNr { get; set; }
|
||||
|
||||
[Display(Name = "Serial Nr")]
|
||||
[Column("[APS].[SerienNr]")]
|
||||
public int? SerialNr { get; set; }
|
||||
|
||||
[Display(Name = "Kundenserial Nr")]
|
||||
[Column("[APS].[KundeneigeneSerienNr]")]
|
||||
public string CustomerSerialNr { get; set; }
|
||||
|
||||
[Display(Name = "IdentNr")]
|
||||
[Column("[ID].[IdentNr]")]
|
||||
public int? IdentNr { get; set; }
|
||||
|
||||
[Display(Name = "PcbId")]
|
||||
[Column("[CPSTR].[PcbId]")]
|
||||
public int PcbId { get; set; }
|
||||
|
||||
[Display(Name = "Typ")]
|
||||
[Column("[ID].[Typ]")]
|
||||
public string TypeI { get; set; }
|
||||
|
||||
[Display(Name = "Zusatz")]
|
||||
[Column("[ID].[Typzusatz]")]
|
||||
public string TypeII { get; set; }
|
||||
|
||||
[Display(Name = "Nennweite")]
|
||||
[Column("[ID].[Nennweite]")]
|
||||
public int? Nennweite { get; set; }
|
||||
|
||||
[Display(Name = "Baulänge")]
|
||||
[Column("[ID].[Baulaenge]")]
|
||||
public int? Baulaenge { get; set; }
|
||||
|
||||
[Display(Name = "AVG Pressure")]
|
||||
[Column("[CPSTR].[AvgPressureInBar]")]
|
||||
public float AVGPressure { get; set; }
|
||||
|
||||
[Display(Name = "Test passed")]
|
||||
[Column("[CPSTR].[TestPassed]")]
|
||||
public bool TestPassed { get; set; }
|
||||
|
||||
[Display(Name = "Test Date")]
|
||||
[Column("[CPSTR].[TestDate]")]
|
||||
public DateTime TestDate { get; set; }
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
namespace LaaProductionWeb.Services.Models.Reports
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
public class CordonelPressureSensorModel
|
||||
{
|
||||
public CordonelPressureSensorFilter Filter { get; set; }
|
||||
= new CordonelPressureSensorFilter();
|
||||
|
||||
public IEnumerable<CordonelPressureSensorItem> Items { get; set; }
|
||||
= Array.Empty<CordonelPressureSensorItem>();
|
||||
|
||||
public static implicit operator CordonelPressureSensorModel(CordonelPressureSensorFilter filter)
|
||||
=> new CordonelPressureSensorModel { Filter = filter };
|
||||
|
||||
public string Display(Expression<Func<CordonelPressureSensorItem, object>> expression)
|
||||
=> ReportModelExtensions.Display(expression);
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,9 @@
|
||||
this.Add(model.Text(x => x.FertigungsNr, this.Count));
|
||||
this.Add(model.Text(x => x.SerialNr, this.Count));
|
||||
this.Add(model.Text(x => x.PcbId, this.Count));
|
||||
this.Add(model.Text(x => x.Typ, this.Count));
|
||||
this.Add(model.Text(x => x.Nennweite, this.Count));
|
||||
this.Add(model.Text(x => x.Baulaenge, this.Count));
|
||||
this.Add(model.Text(x => x.Typ, this.Count));
|
||||
this.Add(model.Text(x => x.StartDruck, this.Count));
|
||||
this.Add(model.Text(x => x.EndDruck, this.Count));
|
||||
this.Add(model.Text(x => x.DruckZeit, this.Count));
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace LaaProductionWeb.Services.Models.Software
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class FunctionUsers
|
||||
{
|
||||
public int FunctionId { get; set; }
|
||||
|
||||
public IEnumerable<short> Users { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
namespace LaaProductionWeb.Services.Models.Software
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
public class Software
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public short AppId { get; set; }
|
||||
|
||||
[StringLength(50)]
|
||||
public string FullName { get; set; }
|
||||
|
||||
public int MajorV { get; set; }
|
||||
|
||||
public int MinorV { get; set; }
|
||||
|
||||
public int BuildV { get; set; }
|
||||
|
||||
public DateTime ValidTo { get; set; }
|
||||
|
||||
[StringLength(150)]
|
||||
public string Description { get; set; }
|
||||
|
||||
public IEnumerable<SoftwareFunction> Functions { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace LaaProductionWeb.Services.Models.Software
|
||||
{
|
||||
public class SoftwareFunction
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public short AppId { get; set; }
|
||||
|
||||
public string Function { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace LaaProductionWeb.Services.Models.Software
|
||||
{
|
||||
public class SoftwareOverview
|
||||
{
|
||||
public short AppId { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public int Versions { get; set; }
|
||||
|
||||
public int Functions { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace LaaProductionWeb.Services.Models.Software
|
||||
{
|
||||
public class SoftwareUser
|
||||
{
|
||||
public short Id { get; set; }
|
||||
|
||||
public string FirstName { get; set; }
|
||||
|
||||
public string LastName { get; set; }
|
||||
|
||||
public string Username { get; set; }
|
||||
|
||||
public int FunctionsCount { get; set; }
|
||||
|
||||
public bool HasPassword { get; set; }
|
||||
|
||||
public string Functions { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace LaaProductionWeb.Services.Models.Software
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class UserFunctions
|
||||
{
|
||||
public short UserId { get; set; }
|
||||
|
||||
public IEnumerable<int> Functions { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,72 @@
|
||||
public ReportService(ISqlClient sqlClient)
|
||||
=> this.sqlClient = sqlClient;
|
||||
|
||||
public CordonelPressureSensorModel LoadCordonelPressureSensorReport(CordonelPressureSensorModel model = null)
|
||||
{
|
||||
if (model is null)
|
||||
{
|
||||
model = new CordonelPressureSensorModel();
|
||||
}
|
||||
|
||||
var where = model.Filter.Where();
|
||||
var orderBy = model.Filter.OrderBy();
|
||||
|
||||
model.Items = this.sqlClient.ExecuteReader($@"
|
||||
SELECT [APS].[AuftragNr] AS [AuftragNr]
|
||||
, [APS].[PositionNr] AS [PosNr]
|
||||
, [APS].[SerienNr] AS [SerialNr]
|
||||
, [APS].[KundeneigeneSerienNr] AS [CustomerSerialNr]
|
||||
, [ID].[IdentNr] AS [IdentNr]
|
||||
, [CPSTR].[PcbId] AS [PcbId]
|
||||
, [ID].[Typ] AS [TypeI]
|
||||
, [ID].[Typzusatz] AS [TypeII]
|
||||
, [ID].[Nennweite] AS [Nennweite]
|
||||
, [ID].[Baulaenge] AS [Baulaenge]
|
||||
, [CPSTR].[AvgPressureInBar] AS [AvgPressure]
|
||||
, [CPSTR].[TestPassed] AS [TestPassed]
|
||||
, [CPSTR].[TestDate] AS [TestDate]
|
||||
FROM [Cordonel_PressureSensor_TestResults] AS [CPSTR]
|
||||
LEFT JOIN [AuftragPositionSerienNr] AS [APS]
|
||||
ON [APS].[FabNr] = [CPSTR].[PcbId]
|
||||
LEFT JOIN [AuftragPosition_Gesamt] AS [APG]
|
||||
ON [APG].[AuftragNr] = [APS].[AuftragNr]
|
||||
AND [APG].[PositionNr] = [APS].[PositionNr]
|
||||
LEFT JOIN [Identnr] AS [ID]
|
||||
ON [ID].[IdentNr] = [APG].[Identnr]
|
||||
WHERE {where.Query}
|
||||
ORDER BY {orderBy.Query}",
|
||||
parameters =>
|
||||
{
|
||||
foreach (var kvp in where.Parameters)
|
||||
{
|
||||
parameters.Add(kvp.Key, kvp.Value);
|
||||
}
|
||||
|
||||
foreach (var kvp in orderBy.Parameters)
|
||||
{
|
||||
parameters.Add(kvp.Key, kvp.Value);
|
||||
}
|
||||
},
|
||||
reader => new CordonelPressureSensorItem
|
||||
{
|
||||
AuftragNr = reader.GetValue<int?>(),
|
||||
PosNr = reader.GetValue<short?>(),
|
||||
SerialNr = reader.GetValue<int?>(),
|
||||
CustomerSerialNr = reader.GetString(),
|
||||
IdentNr = reader.GetValue<int?>(),
|
||||
PcbId = reader.GetValue<int>(),
|
||||
TypeI = reader.GetString(),
|
||||
TypeII = reader.GetString(),
|
||||
Nennweite = reader.GetValue<int?>(),
|
||||
Baulaenge = reader.GetValue<int?>(),
|
||||
AVGPressure = reader.GetValue<float>(),
|
||||
TestPassed = reader.GetValue<bool>(),
|
||||
TestDate = reader.GetValue<DateTime>(),
|
||||
});
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
public HeliumReportModel LoadHeliumPressureReport(HeliumReportModel model = null)
|
||||
{
|
||||
if (model is null)
|
||||
|
||||
@@ -0,0 +1,336 @@
|
||||
namespace LaaProductionWeb.Services
|
||||
{
|
||||
using LaaProductionWeb.Data.Interfaces;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
using LaaProductionWeb.Services.Models.Software;
|
||||
using LaaProductionWeb.Standart;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
public class SoftwareService : ISoftwareService
|
||||
{
|
||||
private readonly ISqlClient sqlClient;
|
||||
|
||||
public SoftwareService(ISqlClient sqlClient)
|
||||
=> this.sqlClient = sqlClient;
|
||||
|
||||
public void AddFunction(short appId, string name)
|
||||
=> this.sqlClient
|
||||
.CreateCommand($@"
|
||||
INSERT INTO [SoftwareFunctions] (
|
||||
[AppId]
|
||||
, [Function])
|
||||
VALUES (@{nameof(appId)}
|
||||
, @{nameof(name)})")
|
||||
.AddParameter(nameof(appId), appId)
|
||||
.AddParameter(nameof(name), name)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public void DeleteFunction(int funcId)
|
||||
=> this.sqlClient
|
||||
.CreateCommand($@"
|
||||
DELETE FROM [SoftwareFunctions]
|
||||
WHERE [Id] = @{nameof(funcId)}")
|
||||
.AddParameter(nameof(funcId), funcId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public IEnumerable<string> FindSoftwareForUser(short appId, string username, string password)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<SoftwareFunction> GetAllSoftwareFunctions()
|
||||
=> this.sqlClient
|
||||
.CreateCommand($@"
|
||||
SELECT [Id]
|
||||
, [AppId]
|
||||
, [Function]
|
||||
FROM [SoftwareFunctions]")
|
||||
.ExecuteReader(f => new SoftwareFunction
|
||||
{
|
||||
Id = f.GetInt(),
|
||||
AppId = f.GetSmallint(),
|
||||
Function = f.GetString()
|
||||
});
|
||||
|
||||
public IEnumerable<SoftwareFunction> GetSoftwareFunctions(short appId)
|
||||
=> this.sqlClient
|
||||
.CreateCommand($@"
|
||||
SELECT [Id]
|
||||
, [AppId]
|
||||
, [Function]
|
||||
FROM [SoftwareFunctions]
|
||||
WHERE [AppId] = @{nameof(appId)}")
|
||||
.AddParameter(nameof(appId), appId)
|
||||
.ExecuteReader(f => new SoftwareFunction
|
||||
{
|
||||
Id = f.GetInt(),
|
||||
AppId = f.GetSmallint(),
|
||||
Function = f.GetString()
|
||||
});
|
||||
|
||||
public SoftwareOverview GetSoftwareOverview(short appId)
|
||||
=> this.sqlClient
|
||||
.CreateCommand($@"
|
||||
SELECT [vsa].[AppID]
|
||||
, [vsa].[SoftwareAccess_Program]
|
||||
, COUNT([vsa].[AppID])
|
||||
, (SELECT COUNT(1)
|
||||
FROM [SoftwareFunctions]
|
||||
WHERE [AppId] = [vsa].[AppID]) AS [CountF]
|
||||
FROM [VersionSoftwareAccess] AS [vsa]
|
||||
WHERE [vsa].[AppID] = @{nameof(appId)}
|
||||
GROUP BY [vsa].[AppID]
|
||||
, [vsa].[SoftwareAccess_Program]")
|
||||
.AddParameter(nameof(appId), appId)
|
||||
.FirstOrDefault(x => new SoftwareOverview
|
||||
{
|
||||
AppId = x.GetSmallint(),
|
||||
Name = x.GetString(),
|
||||
Versions = x.GetInt(),
|
||||
Functions = x.GetInt()
|
||||
});
|
||||
|
||||
public IEnumerable<Software> GetSoftwareVersions(short appId)
|
||||
=> this.sqlClient
|
||||
.CreateCommand($@"
|
||||
SELECT [SoftwareAccess_ID]
|
||||
, [AppID]
|
||||
, [SoftwareAccess_Program]
|
||||
, [SoftwareAccess_MajorVersion]
|
||||
, [SoftwareAccess_MinorVersion]
|
||||
, [SoftwareAccess_BuildVersion]
|
||||
, [SoftwareAccess_VaildTo]
|
||||
, [SoftwareAccess_Desc]
|
||||
FROM [VersionSoftwareAccess]
|
||||
WHERE [AppId] = @{nameof(appId)}
|
||||
ORDER BY [SoftwareAccess_VaildTo] DESC
|
||||
, [SoftwareAccess_MajorVersion] DESC
|
||||
, [SoftwareAccess_MinorVersion] DESC
|
||||
, [SoftwareAccess_BuildVersion] DESC")
|
||||
.AddParameter(nameof(appId), appId)
|
||||
.ExecuteReader(x => new Software
|
||||
{
|
||||
Id = x.GetInt(),
|
||||
AppId = x.GetSmallint(),
|
||||
FullName = x.GetString(),
|
||||
MajorV = x.GetInt(),
|
||||
MinorV = x.GetInt(),
|
||||
BuildV = x.GetInt(),
|
||||
ValidTo = x.GetDate(),
|
||||
Description = x.GetString()
|
||||
});
|
||||
|
||||
public IEnumerable<SoftwareOverview> GetSoftwares()
|
||||
=> this.sqlClient
|
||||
.CreateCommand(@"
|
||||
SELECT [VSA].[AppId] AS [AppId]
|
||||
, [VSA].[SoftwareAccess_Program] AS [Program]
|
||||
, COUNT([VSA].[AppId]) AS [Versions]
|
||||
, (SELECT COUNT(1)
|
||||
FROM [SoftwareFunctions]
|
||||
WHERE [AppId] = [VSA].[AppID]) AS [Functions]
|
||||
FROM [VersionSoftwareAccess] AS [VSA]
|
||||
GROUP BY [VSA].[AppId]
|
||||
, [VSA].[SoftwareAccess_Program]")
|
||||
.ExecuteReader(x => new SoftwareOverview
|
||||
{
|
||||
AppId = x.GetSmallint(),
|
||||
Name = x.GetString(),
|
||||
Versions = x.GetInt(),
|
||||
Functions = x.GetInt(),
|
||||
});
|
||||
|
||||
public IEnumerable<SoftwareUser> GetUsers(string username = null)
|
||||
=> this.sqlClient
|
||||
.CreateCommand($@"
|
||||
SELECT [U].[MitarbeiterNr]
|
||||
, [U].[Vorname]
|
||||
, [U].[Name]
|
||||
, [U].[Benutzername]
|
||||
, COUNT([UF].[UserId])
|
||||
, CAST(CASE WHEN [U].[PasswordHash] IS NULL THEN 0 ELSE 1 END AS BIT)
|
||||
FROM [Mitarbeiter] AS [U]
|
||||
LEFT JOIN [UsersFunctions] AS [UF]
|
||||
ON [UF].[UserId] = [U].[MitarbeiterNr]
|
||||
WHERE [U].[Vorname] LIKE @{nameof(username)}
|
||||
OR [U].[Name] LIKE @{nameof(username)}
|
||||
OR [U].[Benutzername] LIKE @{nameof(username)}
|
||||
GROUP BY [U].[MitarbeiterNr]
|
||||
, [U].[Vorname]
|
||||
, [U].[Name]
|
||||
, [U].[Benutzername]
|
||||
, [U].[PasswordHash]
|
||||
ORDER BY [U].[Vorname]
|
||||
, [U].[Name]
|
||||
, [U].[Benutzername]")
|
||||
.AddParameter(nameof(username), $"%{username}%")
|
||||
.ExecuteReader(x => new SoftwareUser
|
||||
{
|
||||
Id = x.GetSmallint(),
|
||||
FirstName = x.GetString(),
|
||||
LastName = x.GetString(),
|
||||
Username = x.GetString(),
|
||||
FunctionsCount = x.GetInt(),
|
||||
HasPassword = x.GetBool()
|
||||
});
|
||||
|
||||
public IEnumerable<SoftwareUser> GetUsersWithFunctions(int userId = -1, string username = null)
|
||||
=> this.sqlClient
|
||||
.CreateCommand($@"
|
||||
SELECT [U].[MitarbeiterNr]
|
||||
, [U].[Vorname]
|
||||
, [U].[Name]
|
||||
, [U].[Benutzername]
|
||||
, COUNT([UF].[UserId])
|
||||
, CAST(CASE WHEN [U].[PasswordHash] IS NULL THEN 0 ELSE 1 END AS BIT)
|
||||
, (SELECT CAST([SoftwareFunctionId] * -1 AS VARCHAR(MAX))
|
||||
FROM [UsersFunctions]
|
||||
WHERE [UserId] = [UF].[UserId]
|
||||
ORDER BY [SoftwareFunctionId]
|
||||
FOR XML PATH (''))
|
||||
FROM [Mitarbeiter] AS [U]
|
||||
LEFT JOIN [UsersFunctions] AS [UF]
|
||||
ON [UF].[UserId] = [U].[MitarbeiterNr]
|
||||
WHERE [U].[Vorname] LIKE @{nameof(username)}
|
||||
OR [U].[Name] LIKE @{nameof(username)}
|
||||
OR [U].[Benutzername] LIKE @{nameof(username)}
|
||||
OR [U].[MitarbeiterNr] = @{nameof(userId)}
|
||||
GROUP BY [U].[MitarbeiterNr]
|
||||
, [U].[Vorname]
|
||||
, [U].[Name]
|
||||
, [U].[Benutzername]
|
||||
, [U].[PasswordHash]
|
||||
, [UF].[UserId]
|
||||
ORDER BY [U].[Vorname]
|
||||
, [U].[Name]
|
||||
, [U].[Benutzername]")
|
||||
.AddParameter(nameof(username), $"%{username}%")
|
||||
.AddParameter(nameof(userId), userId)
|
||||
.ExecuteReader(x => new SoftwareUser
|
||||
{
|
||||
Id = x.GetSmallint(),
|
||||
FirstName = x.GetString(),
|
||||
LastName = x.GetString(),
|
||||
Username = x.GetString(),
|
||||
FunctionsCount = x.GetInt(),
|
||||
HasPassword = x.GetBool(),
|
||||
Functions = x.GetString()
|
||||
});
|
||||
|
||||
public void UpdateFunction(int funcId, string name)
|
||||
=> this.sqlClient
|
||||
.CreateCommand($@"
|
||||
UPDATE [SoftwareFunctions]
|
||||
SET [Function] = @{nameof(name)}
|
||||
WHERE [Id] = @{nameof(funcId)}")
|
||||
.AddParameter(nameof(funcId), funcId)
|
||||
.AddParameter(nameof(name), name)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public void UpdatePasswordHashes()
|
||||
{
|
||||
var pwdUsers = this.sqlClient
|
||||
.CreateCommand($@"
|
||||
SELECT [MitarbeiterNr]
|
||||
, [Kennwort]
|
||||
FROM [Mitarbeiter]
|
||||
WHERE [Kennwort] IS NOT NULL
|
||||
AND [PasswordHash] IS NULL")
|
||||
.ExecuteReader(x => new KeyValuePair<short, string>(
|
||||
key: x.GetSmallint(),
|
||||
value: x.GetString()));
|
||||
var sha256 = SHA256.Create();
|
||||
|
||||
foreach (var kvp in pwdUsers)
|
||||
{
|
||||
var userId = kvp.Key;
|
||||
var password = sha256.ComputeHash(kvp.Value);
|
||||
|
||||
this.sqlClient
|
||||
.CreateCommand($@"
|
||||
UPDATE [Mitarbeiter]
|
||||
SET [PasswordHash] = @{nameof(password)}
|
||||
WHERE [MitarbeiterNr] = @{nameof(userId)}")
|
||||
.AddParameter(nameof(userId), userId)
|
||||
.AddParameter(nameof(password), password)
|
||||
.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public int ResetPassword(short userId)
|
||||
=> this.sqlClient
|
||||
.CreateCommand($@"
|
||||
UPDATE [Mitarbeiter]
|
||||
SET [PasswordHash] = NULL
|
||||
WHERE [MitarbeiterNr] = @{nameof(userId)}")
|
||||
.AddParameter(nameof(userId), userId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public int ResetPassword(short userId, string password)
|
||||
{
|
||||
password = SHA256.Create().ComputeHash(password);
|
||||
|
||||
return this.sqlClient
|
||||
.CreateCommand($@"
|
||||
UPDATE [Mitarbeiter]
|
||||
SET [PasswordHash] = @{nameof(password)}
|
||||
WHERE [MitarbeiterNr] = @{nameof(userId)}")
|
||||
.AddParameter(nameof(userId), userId)
|
||||
.AddParameter(nameof(password), password)
|
||||
.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public void UpdateUsersFunctions(Action<UserFunctions> mapper)
|
||||
{
|
||||
var model = new UserFunctions();
|
||||
mapper(model);
|
||||
|
||||
var userId = model.UserId;
|
||||
|
||||
this.sqlClient
|
||||
.CreateCommand($@"DELETE FROM [UsersFunctions] WHERE [UserId] = @{nameof(userId)}")
|
||||
.AddParameter(nameof(userId), userId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
foreach (var funcId in model.Functions ?? Array.Empty<int>())
|
||||
{
|
||||
this.sqlClient
|
||||
.CreateCommand($@"
|
||||
INSERT
|
||||
INTO [UsersFunctions] ([UserId] ,[SoftwareFunctionId])
|
||||
VALUES (@{nameof(userId)}, @{nameof(funcId)})")
|
||||
.AddParameter(nameof(userId), userId)
|
||||
.AddParameter(nameof(funcId), funcId)
|
||||
.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateUsersFunctions(Action<FunctionUsers> mapper)
|
||||
{
|
||||
var model = new FunctionUsers();
|
||||
mapper(model);
|
||||
|
||||
var funcId = model.FunctionId;
|
||||
|
||||
this.sqlClient
|
||||
.CreateCommand($@"DELETE FROM [UsersFunctions] WHERE [SoftwareFunctionId] = @{nameof(funcId)}")
|
||||
.AddParameter(nameof(funcId), funcId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
foreach (var userId in model.Users ?? Array.Empty<short>())
|
||||
{
|
||||
this.sqlClient
|
||||
.CreateCommand($@"
|
||||
INSERT
|
||||
INTO [UsersFunctions] ([UserId] ,[SoftwareFunctionId])
|
||||
VALUES (@{nameof(userId)}, @{nameof(funcId)})")
|
||||
.AddParameter(nameof(userId), userId)
|
||||
.AddParameter(nameof(funcId), funcId)
|
||||
.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LaaProductionWeb.Data\LaaProductionWeb.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,12 @@
|
||||
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)));
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LaaProductionWeb.API", "Laa
|
||||
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}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -44,6 +46,10 @@ Global
|
||||
{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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -78,15 +78,15 @@ tr {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
tr.is_scaned_0::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
tr.is_scaned_0::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.a-4 {
|
||||
width: 21cm;
|
||||
@@ -105,12 +105,12 @@ table.table table.table {
|
||||
border-bottom: 0 !important;
|
||||
}
|
||||
|
||||
table.table table.table th:first-child,
|
||||
table.table table.table th:first-child,
|
||||
table.table table.table td:first-child {
|
||||
border-left: 0 !important;
|
||||
}
|
||||
|
||||
table.table table.table th:last-child,
|
||||
table.table table.table th:last-child,
|
||||
table.table table.table td:last-child {
|
||||
border-right: 0 !important;
|
||||
}
|
||||
@@ -145,3 +145,32 @@ label.bi-search:before {
|
||||
position: relative !important;
|
||||
left: -.5rem !important;
|
||||
}
|
||||
|
||||
.list-group.list-group-transparent {
|
||||
--bs-list-group-color: gray;
|
||||
--bs-list-group-bg: transparent !important;
|
||||
--bs-list-group-action-color: black !important;
|
||||
--bs-list-group-action-hover-color: #495057 !important;
|
||||
--bs-list-group-action-hover-bg: transparent !important;
|
||||
--bs-list-group-action-active-color: black !important;
|
||||
--bs-list-group-action-active-bg: transparent !important;
|
||||
--bs-list-group-active-color: black !important;
|
||||
--bs-list-group-active-bg: transparent !important;
|
||||
--bs-list-group-active-border-color: black !important;
|
||||
}
|
||||
|
||||
.list-group-item.active {
|
||||
border-top-color: var(--bs-list-group-border-color);
|
||||
}
|
||||
|
||||
.bi-small::before {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
span.td-error {
|
||||
position: absolute;
|
||||
bottom: -.5rem;
|
||||
font-size: 75%;
|
||||
color: var(--bs-danger);
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
@@ -13,48 +13,16 @@
|
||||
/// </summary>
|
||||
public static class ControllersExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds controllers of type <see cref="IController"/> loaded by reflection from the current assembly to the <see cref="IServiceCollection"/>.
|
||||
/// On this way all required services are loaded into the controller constructors.
|
||||
/// </summary>
|
||||
/// <param name="services"><see cref="IServiceCollection"/> provided from the extension method.</param>
|
||||
/// <returns>The same <see cref="IServiceCollection"/> with added services.</returns>
|
||||
public static IServiceCollection AddControllers(this IServiceCollection services)
|
||||
public static TDST Map<TSRC, TDST>(this TSRC model, Func<TSRC, TDST> mapper)
|
||||
where TDST : class
|
||||
where TSRC : class
|
||||
{
|
||||
var controllersMap = typeof(ControllersExtensions)
|
||||
.Assembly
|
||||
.GetTypes()
|
||||
.Where(x => !x.IsAbstract && typeof(IController).IsAssignableFrom(x))
|
||||
.Select(x => new
|
||||
{
|
||||
x.Name,
|
||||
Path = x.FullName
|
||||
.Replace("LaaProductionWeb.Controllers.", string.Empty)
|
||||
.Replace(x.Name, string.Empty)
|
||||
})
|
||||
.GroupBy(x => x.Path)
|
||||
.ToList();
|
||||
|
||||
var controllers = typeof(ControllersExtensions)
|
||||
.Assembly
|
||||
.GetTypes()
|
||||
.Where(x => !x.IsAbstract && typeof(IController).IsAssignableFrom(x));
|
||||
|
||||
foreach (var controller in controllers)
|
||||
if (model is null)
|
||||
{
|
||||
services.AddTransient(controller);
|
||||
return default(TDST);
|
||||
}
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceProvider BuildControllerFactory(this IServiceProvider serviceProvider)
|
||||
{
|
||||
var controllerFactory = new ControllerFactory(serviceProvider);
|
||||
|
||||
ControllerBuilder.Current.SetControllerFactory(controllerFactory);
|
||||
|
||||
return serviceProvider;
|
||||
return mapper(model);
|
||||
}
|
||||
|
||||
public static string ClaimName(this IPrincipal principal)
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
namespace LaaProductionWeb.Areas.Administration
|
||||
{
|
||||
using System.Web.Mvc;
|
||||
|
||||
public class AdministrationAreaRegistration : AreaRegistration
|
||||
{
|
||||
public override string AreaName => "Administration";
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
context.MapRoute(
|
||||
name: "Administration_WithId",
|
||||
url: "Administration/{controller}/{action}/{id}",
|
||||
defaults: new { action = "Index", id = UrlParameter.Optional });
|
||||
}
|
||||
}
|
||||
}
|
||||
+326
@@ -0,0 +1,326 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Controllers
|
||||
{
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Areas.Administration.Models.Software;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
|
||||
[RouteArea("Administration")]
|
||||
[Authorize(Roles = UserRoles.WEB_Admin)]
|
||||
public class SoftwareController : Controller
|
||||
{
|
||||
private readonly ISoftwareService softwareService;
|
||||
|
||||
public SoftwareController()
|
||||
=> this.softwareService = ServiceProvider.Current.GetService<ISoftwareService>();
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult Index()
|
||||
{
|
||||
var model = new SoftwareModel
|
||||
{
|
||||
SoftwareInfo = this.softwareService
|
||||
.GetSoftwares()
|
||||
.Select(x => new SoftwareOverviewModel
|
||||
{
|
||||
AppId = x.AppId,
|
||||
Name = x.Name
|
||||
.Split('.')
|
||||
.LastOrDefault(),
|
||||
Versions = x.Versions,
|
||||
Functions = x.Functions
|
||||
})
|
||||
};
|
||||
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult SoftwareVersions(short? id)
|
||||
{
|
||||
var model = new SoftwareVersionsModel();
|
||||
|
||||
if (id.HasValue)
|
||||
{
|
||||
var appId = id.Value;
|
||||
|
||||
model = this.softwareService
|
||||
.GetSoftwareOverview(appId)
|
||||
.Map(x => new SoftwareVersionsModel
|
||||
{
|
||||
AppId = x.AppId,
|
||||
Name = x.Name
|
||||
.Split('.')
|
||||
.LastOrDefault(),
|
||||
Versions = x.Versions,
|
||||
Functions = x.Functions
|
||||
});
|
||||
|
||||
if (model != null)
|
||||
{
|
||||
model.SoftwareVersions = this.softwareService
|
||||
.GetSoftwareVersions(appId)
|
||||
.Select(x => new SoftwareVersionModel
|
||||
{
|
||||
AppId = x.AppId,
|
||||
BuildV = x.BuildV,
|
||||
Description = x.Description,
|
||||
FullName = x.FullName,
|
||||
Id = x.Id,
|
||||
MajorV = x.MajorV,
|
||||
MinorV = x.MinorV,
|
||||
ValidTo = x.ValidTo
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult SoftwareFunctions(short? id)
|
||||
{
|
||||
var appId = id ?? 0;
|
||||
var model = new SoftwareFunctionsModel();
|
||||
|
||||
if (appId > 0)
|
||||
{
|
||||
model = this.softwareService
|
||||
.GetSoftwareOverview(appId)
|
||||
.Map(x => new SoftwareFunctionsModel
|
||||
{
|
||||
AppId = x.AppId,
|
||||
Name = x.Name
|
||||
.Split('.')
|
||||
.LastOrDefault(),
|
||||
Versions = x.Versions,
|
||||
Functions = x.Functions
|
||||
}) ?? model;
|
||||
|
||||
model.SoftwareFunctions = this.softwareService
|
||||
.GetSoftwareFunctions(appId)
|
||||
.Select(x => new SoftwareFunctionModel
|
||||
{
|
||||
Id = x.Id,
|
||||
AppId = x.AppId,
|
||||
Function = x.Function
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
model.SoftwareFunctions = this.softwareService
|
||||
.GetAllSoftwareFunctions()
|
||||
.Select(x => new SoftwareFunctionModel
|
||||
{
|
||||
Id = x.Id,
|
||||
AppId = x.AppId,
|
||||
Function = x.Function
|
||||
});
|
||||
}
|
||||
|
||||
model.Users = this.softwareService
|
||||
.GetUsersWithFunctions()
|
||||
.Select(x => new UserFunctions
|
||||
{
|
||||
Id = x.Id,
|
||||
FirstName = x.FirstName,
|
||||
LastName = x.LastName,
|
||||
Username = x.Username,
|
||||
FunctionsCount = x.FunctionsCount,
|
||||
HasPassword = x.HasPassword,
|
||||
Functions = x.Functions
|
||||
?.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
?.Select(f => int.TryParse(f, out int funcId) ? funcId : 0)
|
||||
?.Where(f => f > 0)
|
||||
?? Array.Empty<int>()
|
||||
});
|
||||
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult SoftwareFunctions(FunctionUsersInputModel model)
|
||||
{
|
||||
if (this.ModelState.IsValid)
|
||||
{
|
||||
this.softwareService.UpdateUsersFunctions(x =>
|
||||
{
|
||||
x.FunctionId = model.FunctionId.Value;
|
||||
x.Users = model.Users;
|
||||
});
|
||||
}
|
||||
|
||||
return this.Redirect(this.Request.UrlReferrer.ToString());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult SoftwareListGroup()
|
||||
{
|
||||
var softwareList = this.softwareService
|
||||
.GetSoftwares()
|
||||
.Select(x => new SoftwareOverviewModel
|
||||
{
|
||||
AppId = x.AppId,
|
||||
Name = x.Name
|
||||
.Split('.')
|
||||
.LastOrDefault(),
|
||||
Versions = x.Versions,
|
||||
Functions = x.Functions
|
||||
});
|
||||
|
||||
return this.PartialView(softwareList);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public string AddFunction(AddFunctionModel model)
|
||||
{
|
||||
var appId = model.AppId.Value;
|
||||
|
||||
if (this.ModelState.IsValid)
|
||||
{
|
||||
this.softwareService.AddFunction(appId, model.Function);
|
||||
}
|
||||
|
||||
return this.ModelState
|
||||
.SelectMany(x => x.Value.Errors.Select(e => e.ErrorMessage))
|
||||
.FirstOrDefault(x => !string.IsNullOrWhiteSpace(x));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public string EditFunction(EditFunctionModel model)
|
||||
{
|
||||
if (this.ModelState.IsValid)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(model.Function))
|
||||
{
|
||||
this.softwareService.DeleteFunction(model.FuncId.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.softwareService.UpdateFunction(model.FuncId.Value, model.Function);
|
||||
}
|
||||
}
|
||||
|
||||
return this.ModelState
|
||||
.SelectMany(x => x.Value.Errors.Select(e => e.ErrorMessage))
|
||||
.FirstOrDefault(x => !string.IsNullOrWhiteSpace(x));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult Users()
|
||||
{
|
||||
var usersModel = this.softwareService
|
||||
.GetUsers()
|
||||
.Select(x => new SoftwareUser
|
||||
{
|
||||
Id = x.Id,
|
||||
FirstName = x.FirstName,
|
||||
LastName = x.LastName,
|
||||
Username = x.Username,
|
||||
FunctionsCount = x.FunctionsCount,
|
||||
HasPassword = x.HasPassword
|
||||
});
|
||||
|
||||
return this.View(usersModel);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Users(string username)
|
||||
{
|
||||
var usersModel = this.softwareService
|
||||
.GetUsers(username)
|
||||
.Select(x => new SoftwareUser
|
||||
{
|
||||
Id = x.Id,
|
||||
FirstName = x.FirstName,
|
||||
LastName = x.LastName,
|
||||
Username = x.Username,
|
||||
FunctionsCount = x.FunctionsCount,
|
||||
HasPassword = x.HasPassword
|
||||
});
|
||||
|
||||
return this.View(usersModel);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult UpdatePWDS()
|
||||
{
|
||||
this.softwareService.UpdatePasswordHashes();
|
||||
|
||||
return this.RedirectToAction(nameof(Users));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public bool ResetPWD(short id)
|
||||
{
|
||||
this.softwareService.ResetPassword(id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult UsersFunctions(int? id, string username)
|
||||
{
|
||||
object model;
|
||||
|
||||
if (id > 0)
|
||||
{
|
||||
model = this.UsersFunctionsModel(id: id.Value, username: $"{id}");
|
||||
}
|
||||
else
|
||||
{
|
||||
model = this.UsersFunctionsModel(username: username);
|
||||
}
|
||||
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult UsersFunctions(UsersFunctionsInputModel model)
|
||||
{
|
||||
if (this.ModelState.IsValid)
|
||||
{
|
||||
this.softwareService.UpdateUsersFunctions(x =>
|
||||
{
|
||||
x.UserId = model.UserId.Value;
|
||||
x.Functions = model.Functions;
|
||||
});
|
||||
}
|
||||
|
||||
return this.Redirect(this.Request.UrlReferrer.ToString());
|
||||
}
|
||||
|
||||
private UsersFunctionsModel UsersFunctionsModel(int id = -1, string username = null)
|
||||
=> new UsersFunctionsModel
|
||||
{
|
||||
Functions = this.softwareService
|
||||
.GetAllSoftwareFunctions()
|
||||
.Select(x => new SoftwareFunctionModel
|
||||
{
|
||||
AppId = x.AppId,
|
||||
Function = x.Function,
|
||||
Id = x.Id,
|
||||
}),
|
||||
UsersFunctions = this.softwareService
|
||||
.GetUsersWithFunctions(id, username)
|
||||
.Select(x => new UserFunctions
|
||||
{
|
||||
Id = x.Id,
|
||||
FirstName = x.FirstName,
|
||||
LastName = x.LastName,
|
||||
Username = x.Username,
|
||||
FunctionsCount = x.FunctionsCount,
|
||||
HasPassword = x.HasPassword,
|
||||
Functions = x.Functions
|
||||
?.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
?.Select(f => int.TryParse(f, out int funcId) ? funcId : 0)
|
||||
?.Where(f => f > 0)
|
||||
?? Array.Empty<int>()
|
||||
})
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
public class AddFunctionModel
|
||||
{
|
||||
[Required]
|
||||
public short? AppId { get; set; }
|
||||
|
||||
[Required]
|
||||
[RegularExpression("[a-zA-Z0-9_]+")]
|
||||
public string Function { get; set; }
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
public class EditFunctionModel
|
||||
{
|
||||
[Required]
|
||||
public short? AppId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int? FuncId { get; set; }
|
||||
|
||||
[RegularExpression("[a-zA-Z0-9_]*")]
|
||||
public string Function { get; set; }
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
public class FunctionUsersInputModel
|
||||
{
|
||||
[Required]
|
||||
public int? FunctionId { get; set; }
|
||||
|
||||
public short[] Users { get; set; }
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class SoftwareEditModel : SoftwareVersionModel
|
||||
{
|
||||
public IEnumerable<SoftwareFunctionModel> Functions { get; set; }
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
public class SoftwareFunctionModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public short AppId { get; set; }
|
||||
|
||||
public string Function { get; set; }
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class SoftwareFunctionsModel : SoftwareOverviewModel
|
||||
{
|
||||
public IEnumerable<SoftwareFunctionModel> SoftwareFunctions { get; set; }
|
||||
|
||||
public IEnumerable<UserFunctions> Users { get; set; }
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class SoftwareModel
|
||||
{
|
||||
public IEnumerable<SoftwareOverviewModel> SoftwareInfo { get; set; }
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
public class SoftwareOverviewModel
|
||||
{
|
||||
public short AppId { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public int Versions { get; set; }
|
||||
|
||||
public int Functions { get; set; }
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
public class SoftwareUser
|
||||
{
|
||||
public short Id { get; set; }
|
||||
|
||||
public string FirstName { get; set; }
|
||||
|
||||
public string LastName { get; set; }
|
||||
|
||||
public string Username { get; set; }
|
||||
|
||||
public int FunctionsCount { get; set; }
|
||||
|
||||
public bool HasPassword { get; set; }
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
public class SoftwareVersionModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public short AppId { get; set; }
|
||||
|
||||
public string Name
|
||||
=> this.FullName
|
||||
?.Split('.')
|
||||
?.LastOrDefault();
|
||||
|
||||
public string FullName { get; set; }
|
||||
|
||||
public int MajorV { get; set; }
|
||||
|
||||
public int MinorV { get; set; }
|
||||
|
||||
public int BuildV { get; set; }
|
||||
|
||||
public DateTime ValidTo { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class SoftwareVersionsModel : SoftwareOverviewModel
|
||||
{
|
||||
public IEnumerable<SoftwareVersionModel> SoftwareVersions { get; set; }
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class UserFunctions : SoftwareUser
|
||||
{
|
||||
public IEnumerable<int> Functions { get; set; }
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
public class UsersFunctionsInputModel
|
||||
{
|
||||
[Required]
|
||||
public short? UserId { get; set; }
|
||||
|
||||
public int[] Functions { get; set; }
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class UsersFunctionsModel
|
||||
{
|
||||
public IEnumerable<SoftwareFunctionModel> Functions { get; set; }
|
||||
= Array.Empty<SoftwareFunctionModel>();
|
||||
|
||||
public IEnumerable<UserFunctions> UsersFunctions { get; set; }
|
||||
= Array.Empty<UserFunctions>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
@using LaaProductionWeb.App_Infrastructure
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="icon" type="image/svg" href="~/favicon.svg">
|
||||
|
||||
@Styles.Render("~/bootstrap_css")
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
|
||||
|
||||
@Styles.Render("~/styles_css")
|
||||
|
||||
<title>Laatzen Production Web</title>
|
||||
</head>
|
||||
<body class="d-flex flex-column vh-100 overflow-hidden">
|
||||
@if (this.User.IsInRole(UserRoles.WEB_Admin))
|
||||
{
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark shadow-sm">
|
||||
<div class="container-fluid">
|
||||
<button class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#mainnav" aria-controls="mainnav" aria-expanded="false">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="mainnav">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/Administration/Software">Software</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/">Exit</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
}
|
||||
|
||||
<main class="h-100 scrollable">
|
||||
@this.RenderBody()
|
||||
</main>
|
||||
|
||||
@Scripts.Render("~/bootstrap_js")
|
||||
@Scripts.Render("~/barcodes_js")
|
||||
@Scripts.Render("~/scripts_js")
|
||||
@this.RenderSection("scripts", required: false)
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<a href="~/Administration/Software" class="list-group-item list-group-item-action bg-light">Software</a>
|
||||
<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">Users Functions</a>
|
||||
<a href="~/Administration/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
</div>
|
||||
@@ -0,0 +1,40 @@
|
||||
@model LaaProductionWeb.Areas.Administration.Models.Software.SoftwareModel
|
||||
|
||||
<div class="container-fluid h-100">
|
||||
<div class="row h-100">
|
||||
<div class="col-2 bg-light">
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<a href="~/Administration/Software" class="list-group-item list-group-item-action bg-light active">Software</a>
|
||||
<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">Users Functions</a>
|
||||
<a href="~/Administration/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-10 p-0">
|
||||
@if (this.Model.SoftwareInfo != null)
|
||||
{
|
||||
<table class="table table-sm table-bordered w-100">
|
||||
<thead class="table-secondary">
|
||||
<tr>
|
||||
<th class="text-nowrap">AppId</th>
|
||||
<th class="w-100">Name</th>
|
||||
<th class="text-nowrap">Versions</th>
|
||||
<th class="text-nowrap">Functions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in this.Model.SoftwareInfo)
|
||||
{
|
||||
<tr>
|
||||
<td>@item.AppId</td>
|
||||
<td class="text-smallcaps">@item.Name</td>
|
||||
<td><a href="~/Administration/Software/SoftwareVersions/@item.AppId" class="btn btn-sm btn-light border-0 d-block text-start fw-bold">@item.Versions</a></td>
|
||||
<td><a href="~/Administration/Software/SoftwareFunctions/@item.AppId" class="btn btn-sm btn-light border-0 d-block text-start text-smallcaps fw-bold">@item.Functions</a></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+238
@@ -0,0 +1,238 @@
|
||||
@model LaaProductionWeb.Areas.Administration.Models.Software.SoftwareFunctionsModel
|
||||
|
||||
@{
|
||||
var softwareSelected = (this.Model?.AppId ?? 0) > 0;
|
||||
var hasAnyFunctions = this.Model?.SoftwareFunctions?.Any() ?? false;
|
||||
}
|
||||
|
||||
<div class="container-fluid h-100">
|
||||
<div class="row h-100 overflow-hidden">
|
||||
<div class="col-2 bg-light h-100">
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<a href="~/Administration/Software" class="list-group-item list-group-item-action bg-light">Software</a>
|
||||
@if (softwareSelected)
|
||||
{
|
||||
<a href="~/Administration/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light active">
|
||||
<i class="bi bi-caret-left-fill bi-small"></i> Software Functions
|
||||
</a>
|
||||
<div class="list-group-item list-group-item-action bg-light">
|
||||
<table class="table table-sm table-borderless w-100 m-0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="text-smallcaps small">AppId</td>
|
||||
<td class="text-smallcaps small">@this.Model.AppId</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-smallcaps small">Name</td>
|
||||
<td class="text-smallcaps small">@this.Model.Name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-smallcaps small">Versions</td>
|
||||
<td class="text-smallcaps small">@this.Model.Versions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-smallcaps small">Functions</td>
|
||||
<td class="text-smallcaps small">@this.Model.Functions</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a href="~/Administration/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light active">
|
||||
Software Functions
|
||||
</a>
|
||||
<div class="list-group-item list-group-item-action bg-light">
|
||||
@{
|
||||
this.Html.RenderAction("SoftwareListGroup");
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<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">Users</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-10 p-0 h-100 scrollable-sm">
|
||||
<table class="table table-sm table-bordered w-100">
|
||||
<thead class="table-secondary">
|
||||
<tr>
|
||||
<th class="text-nowrap">App Id</th>
|
||||
<th class="text-nowrap">Function Id</th>
|
||||
<th class="text-nowrap">Function Name</th>
|
||||
<th class="text-nowrap">Function Users</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (softwareSelected)
|
||||
{
|
||||
if (hasAnyFunctions)
|
||||
{
|
||||
foreach (var function in this.Model.SoftwareFunctions)
|
||||
{
|
||||
<tr>
|
||||
<td>@function.AppId</td>
|
||||
<td>@function.Id</td>
|
||||
<td class="position-relative">
|
||||
<input id="func_@function.Id"
|
||||
class="form-control form-control-sm rounded-0 border-0"
|
||||
data-id="@function.Id"
|
||||
value="@function.Function"
|
||||
onchange="javascript:editFunction(this.getAttribute('data-id'), this.value)" />
|
||||
</td>
|
||||
<td>
|
||||
<div class="dropdown btn-group w-100">
|
||||
<button class="btn btn-light btn-sm border-0 dropdown-toggle w-100 text-start" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
Users
|
||||
</button>
|
||||
<div class="dropdown-menu w-100">
|
||||
<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">
|
||||
@foreach (var u in this.Model.Users)
|
||||
{
|
||||
var id = $"f_{function.Id}_{u.Id}";
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input"
|
||||
type="checkbox"
|
||||
value="@u.Id"
|
||||
name="Users[]"
|
||||
@(u.Functions.Contains(function.Id) ? "checked=\"checked\"" : null)>
|
||||
<label class="form-check-label text-nowrap">@u.FirstName @u.LastName - (@u.Username)</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<button class="btn btn-light btn-sm w-100 border fw-bold" type="submit">Aktualizieren</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
<tr>
|
||||
<td>@this.Model.AppId</td>
|
||||
<td>#</td>
|
||||
<td class="position-relative">
|
||||
<input id="add_func"
|
||||
class="form-control form-control-sm rounded-0 border-0"
|
||||
onchange="javascript:addFunction(this.value)" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
else if (hasAnyFunctions)
|
||||
{
|
||||
foreach (var function in this.Model.SoftwareFunctions)
|
||||
{
|
||||
<tr>
|
||||
<td>@function.AppId</td>
|
||||
<td>@function.Id</td>
|
||||
<td>@function.Function</td>
|
||||
<td>
|
||||
<div class="dropdown btn-group w-100">
|
||||
<button class="btn btn-light btn-sm border-0 dropdown-toggle w-100 text-start" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
Users
|
||||
</button>
|
||||
<div class="dropdown-menu w-100">
|
||||
<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">
|
||||
@foreach (var u in this.Model.Users)
|
||||
{
|
||||
var id = $"f_{function.Id}_{u.Id}";
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input"
|
||||
type="checkbox"
|
||||
value="@u.Id"
|
||||
name="Users[]"
|
||||
@(u.Functions.Contains(function.Id) ? "checked=\"checked\"" : null)>
|
||||
<label class="form-check-label text-nowrap">@u.FirstName @u.LastName - (@u.Username)</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<button class="btn btn-light btn-sm w-100 border fw-bold" type="submit">Aktualizieren</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section scripts {
|
||||
<script>
|
||||
const appId = @Model.AppId;
|
||||
const fetchOptions = {
|
||||
credentials: 'same-origin',
|
||||
mode: 'same-origin',
|
||||
method: 'POST',
|
||||
body: '',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
};
|
||||
|
||||
function showError(funcId, text) {
|
||||
if (text) {
|
||||
let spanError = document.createElement('span');
|
||||
spanError.classList.add('td-error');
|
||||
spanError.classList.add('px-2');
|
||||
spanError.innerText = text;
|
||||
|
||||
let td = document
|
||||
.getElementById(funcId ? `func_${funcId}` : 'add_func')
|
||||
.parentElement;
|
||||
td.append(spanError);
|
||||
td.classList.add('border');
|
||||
td.classList.add('border-danger');
|
||||
} else {
|
||||
location.reload(true);
|
||||
}
|
||||
}
|
||||
|
||||
function addFunction(funcName) {
|
||||
fetchOptions.body = JSON.stringify({ AppId: appId, Function: funcName });
|
||||
|
||||
fetch('@this.Url.Content("~/Administration/Software/AddFunction")', fetchOptions)
|
||||
.then(response => response.text())
|
||||
.then(text => showError(0, text));
|
||||
}
|
||||
|
||||
function editFunction(funcId, funcName) {
|
||||
fetchOptions.body = JSON.stringify({ AppId: appId, FuncId: funcId, Function: funcName });
|
||||
|
||||
fetch('@this.Url.Content("~/Administration/Software/EditFunction")', fetchOptions)
|
||||
.then(response => response.text())
|
||||
.then(text => showError(funcId, text));
|
||||
}
|
||||
|
||||
function filterUsers(e) {
|
||||
let input = e.target;
|
||||
let value = input.value.toLowerCase();
|
||||
let formChecks = input
|
||||
.nextElementSibling
|
||||
.querySelectorAll('.form-check');
|
||||
|
||||
formChecks.forEach(function (x) {
|
||||
let innerText = x.lastElementChild.innerText.toLowerCase();
|
||||
|
||||
if (innerText.includes(value)) {
|
||||
x.classList.remove('d-none');
|
||||
} else {
|
||||
x.classList.add('d-none');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document
|
||||
.querySelectorAll('input[id^="user_serach_"]')
|
||||
.forEach(input => input.oninput = filterUsers);
|
||||
</script>
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
@model IEnumerable<LaaProductionWeb.Areas.Administration.Models.Software.SoftwareOverviewModel>
|
||||
|
||||
@if (this.Model?.Any() ?? false)
|
||||
{
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
@foreach (var software in this.Model)
|
||||
{
|
||||
<a href="~/Administration/Software/SoftwareFunctions/@software.AppId" class="list-group-item list-group-item-action bg-light small d-flex justify-content-between text-dark">
|
||||
@software.Name <i class="bi bi-caret-right bi-small"></i>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
@model LaaProductionWeb.Areas.Administration.Models.Software.SoftwareVersionsModel
|
||||
|
||||
<div class="container-fluid h-100">
|
||||
<div class="row h-100 overflow-hidden">
|
||||
<div class="col-2 bg-light h-100">
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<a href="~/Administration/Software" class="list-group-item list-group-item-action bg-light active"><i class="bi bi-caret-left-fill bi-small"></i> Software</a>
|
||||
<div class="list-group-item list-group-item-action bg-light">
|
||||
<table class="table table-sm table-borderless w-100 m-0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="text-smallcaps small">AppId</td>
|
||||
<td class="text-smallcaps small">@this.Model.AppId</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-smallcaps small">Name</td>
|
||||
<td class="text-smallcaps small">@this.Model.Name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-smallcaps small">Versions</td>
|
||||
<td class="text-smallcaps small">@this.Model.Versions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-smallcaps small"><a href="~/Administration/Software/SoftwareFunctions/@this.Model.AppId">Functions</a></td>
|
||||
<td class="text-smallcaps small">@this.Model.Functions</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<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">Users Functions</a>
|
||||
<a href="~/Administration/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-10 p-0 h-100 scrollable-sm">
|
||||
@if (this.Model.SoftwareVersions != null)
|
||||
{
|
||||
<table class="table table-sm table-bordered w-100">
|
||||
<thead class="table-secondary">
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>FullName</th>
|
||||
<th>Major</th>
|
||||
<th>Minor</th>
|
||||
<th>Build</th>
|
||||
<th>Valid to</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var version in this.Model.SoftwareVersions)
|
||||
{
|
||||
<tr>
|
||||
<td>@version.Id</td>
|
||||
<td>@version.FullName</td>
|
||||
<td>@version.MajorV</td>
|
||||
<td>@version.MinorV</td>
|
||||
<td>@version.BuildV</td>
|
||||
<td>@version.ValidTo.ToString("yyyy-MM-dd")</td>
|
||||
<td>@version.Description</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,92 @@
|
||||
@model IEnumerable<LaaProductionWeb.Areas.Administration.Models.Software.SoftwareUser>
|
||||
|
||||
@using LaaProductionWeb.App_Infrastructure
|
||||
|
||||
<div class="container-fluid h-100">
|
||||
<div class="row h-100 overflow-hidden">
|
||||
<div class="col-2 bg-light h-100">
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<a href="~/Administration/Software" class="list-group-item list-group-item-action bg-light">Software</a>
|
||||
<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">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="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>
|
||||
</div>
|
||||
</form>
|
||||
@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>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-10 p-0 h-100 scrollable-sm">
|
||||
<table class="table table-sm table-bordered w-100">
|
||||
<thead class="table-secondary">
|
||||
<tr>
|
||||
<th>Vorname</th>
|
||||
<th>Name</th>
|
||||
<th>Benutzername</th>
|
||||
<th class="w-auto">Funktionenanzahl</th>
|
||||
<th class="w-auto"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (this.Model != null)
|
||||
{
|
||||
foreach (var user in this.Model)
|
||||
{
|
||||
<tr>
|
||||
<td>@user.FirstName</td>
|
||||
<td>@user.LastName</td>
|
||||
<td>@user.Username</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-light border-0 w-100 text-start fw-bold" href="~/Administration/Software/UsersFunctions/@user.Id">
|
||||
@user.FunctionsCount
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
@if (user.HasPassword)
|
||||
{
|
||||
<a class="btn btn-sm btn-light border-0 w-100 text-start fw-bold" id="pwd_@user.Id">
|
||||
<i class="bi bi-exclamation-circle"></i> Passwort zurücksetzen
|
||||
</a>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
document
|
||||
.querySelectorAll('a[id^="pwd_"]')
|
||||
.forEach(x => x.onclick = resetPassword);
|
||||
</script>
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
@model LaaProductionWeb.Areas.Administration.Models.Software.UsersFunctionsModel
|
||||
|
||||
@using System.Linq
|
||||
|
||||
<div class="container-fluid h-100">
|
||||
<div class="row h-100 overflow-hidden">
|
||||
<div class="col-2 bg-light h-100">
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<a href="~/Administration/Software" class="list-group-item list-group-item-action bg-light">Software</a>
|
||||
<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="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>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<a href="~/Administration/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-10 p-0 h-100 scrollable-sm">
|
||||
<table class="table table-sm table-bordered w-100">
|
||||
<thead class="table-secondary">
|
||||
<tr>
|
||||
<th>Vorname</th>
|
||||
<th>Name</th>
|
||||
<th>Benutzername</th>
|
||||
<th>Funktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (this.Model != null)
|
||||
{
|
||||
foreach (var user in this.Model.UsersFunctions)
|
||||
{
|
||||
<tr>
|
||||
<td>@user.FirstName</td>
|
||||
<td>@user.LastName</td>
|
||||
<td>@user.Username</td>
|
||||
<td>
|
||||
<div class="dropdown btn-group w-100">
|
||||
<button class="btn btn-light btn-sm border-0 dropdown-toggle w-100 text-start" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
@user.FunctionsCount Functionen
|
||||
</button>
|
||||
<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="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>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
@{
|
||||
this.Layout = "~/Areas/Administration/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
@@ -75,5 +75,21 @@
|
||||
|
||||
return this.File(csvReport, "application/csv");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult CordonelPressureSensor()
|
||||
{
|
||||
var model = this.reportService.LoadCordonelPressureSensorReport();
|
||||
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult CordonelPressureSensor(CordonelPressureSensorModel model)
|
||||
{
|
||||
model = this.reportService.LoadCordonelPressureSensorReport(model);
|
||||
|
||||
return this.View(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,6 +145,22 @@
|
||||
<Compile Include="App_Start\FilterConfig.cs" />
|
||||
<Compile Include="App_Start\RouteConfig.cs" />
|
||||
<Compile Include="App_Start\ServicesConfig.cs" />
|
||||
<Compile Include="Areas\Administration\AdministrationAreaRegistration.cs" />
|
||||
<Compile Include="Areas\Administration\Controllers\SoftwareController.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\AddFunctionModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\EditFunctionModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\FunctionUsersInputModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareEditModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareFunctionModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareFunctionsModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareOverviewModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareUser.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareVersionModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareVersionsModel.cs" />
|
||||
<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="Controllers\AdminController.cs" />
|
||||
<Compile Include="Controllers\ApprovalsController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
@@ -176,6 +192,16 @@
|
||||
<Content Include="Views\Shared\_Layout.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Areas\Administration\Views\Shared\_Layout.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\Shared\_SoftwareSidebar.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\Software\Index.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\Software\SoftwareFunctions.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\Software\SoftwareListGroup.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\Software\SoftwareVersions.cshtml" />
|
||||
<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" />
|
||||
@@ -190,6 +216,7 @@
|
||||
<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" />
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
@model CordonelPressureSensorModel
|
||||
|
||||
@using LaaProductionWeb.Services.Models.Reports
|
||||
|
||||
<form action="~/Report/Kottmann" method="post" autocomplete="off" class="h-100" id="cor_report">
|
||||
<div class="table-responsive h-100 mh-100">
|
||||
<table class="table table-sm table-bordered mb-0">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="text-nowrap p-2">@this.Model.Display(x => x.AuftragNr)</th>
|
||||
<th class="text-nowrap p-2">@this.Model.Display(x => x.PosNr)</th>
|
||||
<th class="text-nowrap p-2">@this.Model.Display(x => x.SerialNr)</th>
|
||||
<th class="text-nowrap p-2">@this.Model.Display(x => x.CustomerSerialNr)</th>
|
||||
<th class="text-nowrap p-2">@this.Model.Display(x => x.IdentNr)</th>
|
||||
<th class="text-nowrap p-2">@this.Model.Display(x => x.PcbId)</th>
|
||||
<th class="text-nowrap p-2">@this.Model.Display(x => x.TypeI)</th>
|
||||
<th class="text-nowrap p-2">@this.Model.Display(x => x.TypeII)</th>
|
||||
<th class="text-nowrap p-2">@this.Model.Display(x => x.Nennweite)</th>
|
||||
<th class="text-nowrap p-2">@this.Model.Display(x => x.Baulaenge)</th>
|
||||
<th class="text-nowrap p-2">@this.Model.Display(x => x.AVGPressure)</th>
|
||||
<th class="text-nowrap p-2">@this.Model.Display(x => x.TestPassed)</th>
|
||||
<th class="text-nowrap p-2">@this.Model.Display(x => x.TestDate)</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@foreach (var filter in this.Model.Filter)
|
||||
{
|
||||
if (filter.Type == PropertyType.Date)
|
||||
{
|
||||
<td>@this.Html.Partial("DateFilter", filter)</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>@this.Html.Partial("Filter", filter)</td>
|
||||
}
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in this.Model.Items)
|
||||
{
|
||||
<tr>
|
||||
<td class="text-nowrap p-2">@item.AuftragNr</td>
|
||||
<td class="text-nowrap p-2">@item.PosNr</td>
|
||||
<td class="text-nowrap p-2">@item.SerialNr</td>
|
||||
<td class="text-nowrap p-2">@item.CustomerSerialNr</td>
|
||||
<td class="text-nowrap p-2">@item.IdentNr</td>
|
||||
<td class="text-nowrap p-2">@item.PcbId</td>
|
||||
<td class="text-nowrap p-2">@item.TypeI</td>
|
||||
<td class="text-nowrap p-2">@item.TypeII</td>
|
||||
<td class="text-nowrap p-2">@item.Nennweite</td>
|
||||
<td class="text-nowrap p-2">@item.Baulaenge</td>
|
||||
<td class="text-nowrap p-2">@item.AVGPressure</td>
|
||||
<td class="text-nowrap p-2"><i class="bi bi-bold @(item.TestPassed ? "bi-check text-success" : "bi-x text-danger")"></i></td>
|
||||
<td class="text-nowrap p-2">@($"{item.TestDate:dd.MM.yyyy}")</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section scripts {
|
||||
<script>
|
||||
let form = document.getElementById('cor_report');
|
||||
let inputFields = form
|
||||
.querySelectorAll('input')
|
||||
.forEach(x => x.onchange = () => form.submit());
|
||||
</script>
|
||||
}
|
||||
@@ -85,15 +85,15 @@
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<button id="modal_btn" class="d-none" data-bs-toggle="modal" data-bs-target="#modal"></button>
|
||||
<button id="modal_btn" class="d-none" data-bs-toggle="he_modal" data-bs-target="#he_modal"></button>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="modal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal fade" id="he_modal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="exampleModalLabel">Testergebnisse</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="he_modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table class="table table-sm table-bordered">
|
||||
@@ -119,10 +119,10 @@
|
||||
.forEach(x => x.onchange = () => form.submit());
|
||||
|
||||
let tbody = this.document.getElementById('tbody');
|
||||
let modal = this.document.getElementById('modal');
|
||||
let heModal = this.document.getElementById('he_modal');
|
||||
let modalBtn = this.document.getElementById('modal_btn');
|
||||
|
||||
modal.addEventListener('hide.bs.modal', x => this.location.hash = '');
|
||||
heModal.addEventListener('hide.bs.modal', _ => this.location.hash = '');
|
||||
|
||||
window.addEventListener('hashchange', function () {
|
||||
tbody.innerHTML = null;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
@using LaaProductionWeb.Services.Models.Reports
|
||||
|
||||
<form action="~/Report/Helium" method="post" autocomplete="off" class="h-100" id="he_report">
|
||||
<form action="~/Report/Kottmann" method="post" autocomplete="off" class="h-100" id="kot_report">
|
||||
<div class="table-responsive h-100 mh-100">
|
||||
<table class="table table-sm table-bordered mb-0">
|
||||
<thead class="bg-light">
|
||||
@@ -65,4 +65,35 @@
|
||||
<button class="btn btn-light border-success" type="submit">
|
||||
<i class="bi bi-filetype-csv text-success"></i>
|
||||
</button>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
@section scripts {
|
||||
<script>
|
||||
let form = document.getElementById('kot_report');
|
||||
let inputFields = form
|
||||
.querySelectorAll('input')
|
||||
.forEach(x => x.onchange = () => form.submit());
|
||||
|
||||
@*let tbody = this.document.getElementById('tbody');
|
||||
let modal = this.document.getElementById('modal');
|
||||
let modalBtn = this.document.getElementById('modal_btn');
|
||||
|
||||
modal.addEventListener('hide.bs.modal', x => this.location.hash = '');
|
||||
|
||||
window.addEventListener('hashchange', function () {
|
||||
tbody.innerHTML = null;
|
||||
if (location.hash) {
|
||||
let testId = location.hash.substring(1);
|
||||
if (testId) {
|
||||
fetch(`@this.Url.Action("HeliumResults", "Report")?testId=${testId}`)
|
||||
.then(response => response.text())
|
||||
.then(function (html) {
|
||||
tbody.innerHTML = html;
|
||||
modalBtn.click();
|
||||
})
|
||||
.catch(x => console.log(x));
|
||||
}
|
||||
}
|
||||
});*@
|
||||
</script>
|
||||
}
|
||||
@@ -46,6 +46,7 @@
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="~/Report/Helium">Helium</a></li>
|
||||
<li><a class="dropdown-item" href="~/Report/Kottmann">Kottmann</a></li>
|
||||
<li><a class="dropdown-item" href="~/Report/CordonelPressureSensor">Cordonel Pressure Sensor</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
@@ -59,8 +60,11 @@
|
||||
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
||||
@if (this.User.IsInRole(UserRoles.WEB_Admin))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/Admin">Admin: @this.User.ClaimName()</a>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link text-smallcaps dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" href="#">@this.User.ClaimName()</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="~/Administration/Software">Software</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user