Merge branch 'laa_prod_web_230417' into 'main'
Laa prod web 230417 See merge request la_operations/laa_production!6
This commit is contained in:
@@ -10,8 +10,12 @@
|
||||
|
||||
IEnumerable<T> ExecuteReader<T>(string query, Func<ISqlReader, T> reader, SqlInfoMessageEventHandler errorCallback = null);
|
||||
|
||||
IEnumerable<T> ExecuteReader<T>(string query, Func<ISqlReader, T> reader, Action<string[]> columns, SqlInfoMessageEventHandler errorCallback = null);
|
||||
|
||||
IEnumerable<T> ExecuteReader<T>(string query, Action<SqlParameters> parameters, Func<ISqlReader, T> reader, SqlInfoMessageEventHandler errorCallback = null);
|
||||
|
||||
IEnumerable<T> ExecuteReader<T>(string query, Action<SqlParameters> parameters, Func<ISqlReader, T> reader, Action<string[]> columns, SqlInfoMessageEventHandler errorCallback = null);
|
||||
|
||||
T ExecuteScalar<T>(string query, Action<SqlParameters> parameters, SqlInfoMessageEventHandler errorCallback = null);
|
||||
|
||||
T FirstOrDefault<T>(string query, Func<ISqlReader, T> reader, SqlInfoMessageEventHandler errorCallback = null);
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
return rowsAffected;
|
||||
}
|
||||
|
||||
public IEnumerable<T> ExecuteReader<T>(string query, Func<ISqlReader, T> output, SqlInfoMessageEventHandler errorCallback = null)
|
||||
public IEnumerable<T> ExecuteReader<T>(string query, Func<ISqlReader, T> reader, SqlInfoMessageEventHandler errorCallback = null)
|
||||
{
|
||||
using (var sqlConnection = new SqlConnection(this.connectionString))
|
||||
{
|
||||
@@ -48,14 +48,14 @@
|
||||
{
|
||||
while (sqlReader.Read())
|
||||
{
|
||||
yield return output(sqlReader);
|
||||
yield return reader(sqlReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<T> ExecuteReader<T>(string query, Action<SqlParameters> parameters, Func<ISqlReader, T> output, SqlInfoMessageEventHandler errorCallback = null)
|
||||
public IEnumerable<T> ExecuteReader<T>(string query, Action<SqlParameters> parameters, Func<ISqlReader, T> reader, SqlInfoMessageEventHandler errorCallback = null)
|
||||
{
|
||||
using (var sqlConnection = new SqlConnection(this.connectionString))
|
||||
{
|
||||
@@ -71,7 +71,55 @@
|
||||
{
|
||||
while (sqlReader.Read())
|
||||
{
|
||||
yield return output(sqlReader);
|
||||
yield return reader(sqlReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<T> ExecuteReader<T>(string query, Func<ISqlReader, T> reader, Action<string[]> columns, SqlInfoMessageEventHandler errorCallback = null)
|
||||
{
|
||||
using (var sqlConnection = new SqlConnection(this.connectionString))
|
||||
{
|
||||
sqlConnection.OpenWithErrorHandling(errorCallback);
|
||||
|
||||
using (var sqlCommand = sqlConnection.CreateCommand())
|
||||
{
|
||||
sqlCommand.CommandText = query;
|
||||
|
||||
using (SqlReader sqlReader = sqlCommand.ExecuteReader())
|
||||
{
|
||||
columns(sqlReader.GetColumns());
|
||||
|
||||
while (sqlReader.Read())
|
||||
{
|
||||
yield return reader(sqlReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<T> ExecuteReader<T>(string query, Action<SqlParameters> parameters, Func<ISqlReader, T> reader, Action<string[]> columns, SqlInfoMessageEventHandler errorCallback = null)
|
||||
{
|
||||
using (var sqlConnection = new SqlConnection(this.connectionString))
|
||||
{
|
||||
sqlConnection.OpenWithErrorHandling(errorCallback);
|
||||
|
||||
using (var sqlCommand = sqlConnection.CreateCommand())
|
||||
{
|
||||
parameters(sqlCommand.Parameters);
|
||||
|
||||
sqlCommand.CommandText = query;
|
||||
|
||||
using (SqlReader sqlReader = sqlCommand.ExecuteReader())
|
||||
{
|
||||
columns(sqlReader.GetColumns());
|
||||
|
||||
while (sqlReader.Read())
|
||||
{
|
||||
yield return reader(sqlReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,7 +152,7 @@
|
||||
return scalarResult;
|
||||
}
|
||||
|
||||
public T FirstOrDefault<T>(string query, Func<ISqlReader, T> output, SqlInfoMessageEventHandler errorCallback = null)
|
||||
public T FirstOrDefault<T>(string query, Func<ISqlReader, T> reader, SqlInfoMessageEventHandler errorCallback = null)
|
||||
{
|
||||
var firstOrDefaultResult = default(T);
|
||||
|
||||
@@ -120,7 +168,7 @@
|
||||
{
|
||||
if (sqlReader.Read())
|
||||
{
|
||||
firstOrDefaultResult = output(sqlReader);
|
||||
firstOrDefaultResult = reader(sqlReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,7 +177,7 @@
|
||||
return firstOrDefaultResult;
|
||||
}
|
||||
|
||||
public T FirstOrDefault<T>(string query, Action<SqlParameters> parameters, Func<ISqlReader, T> output, SqlInfoMessageEventHandler errorCallback = null)
|
||||
public T FirstOrDefault<T>(string query, Action<SqlParameters> parameters, Func<ISqlReader, T> reader, SqlInfoMessageEventHandler errorCallback = null)
|
||||
{
|
||||
var firstOrDefaultResult = default(T);
|
||||
|
||||
@@ -147,7 +195,7 @@
|
||||
{
|
||||
if (sqlReader.Read())
|
||||
{
|
||||
firstOrDefaultResult = output(sqlReader);
|
||||
firstOrDefaultResult = reader(sqlReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,11 @@
|
||||
public byte[] GetBytes(int index = -1)
|
||||
{
|
||||
var bytes = default(byte[]);
|
||||
index = Math.Max(index, this.column++);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
index = this.column++;
|
||||
}
|
||||
|
||||
if (!this.sqlDataReader.IsDBNull(index))
|
||||
{
|
||||
@@ -33,9 +37,25 @@
|
||||
return bytes ?? Array.Empty<byte>();
|
||||
}
|
||||
|
||||
internal string[] GetColumns()
|
||||
{
|
||||
var columnsCount = this.sqlDataReader.FieldCount;
|
||||
var columns = new string[columnsCount];
|
||||
|
||||
for (int i = 0; i < columnsCount; i++)
|
||||
{
|
||||
columns[i] = this.sqlDataReader.GetName(i);
|
||||
}
|
||||
|
||||
return columns;
|
||||
}
|
||||
|
||||
public string GetString(int index = -1)
|
||||
{
|
||||
index = Math.Max(index, this.column++);
|
||||
if (index < 0)
|
||||
{
|
||||
index = this.column++;
|
||||
}
|
||||
|
||||
if (!this.sqlDataReader.IsDBNull(index))
|
||||
{
|
||||
@@ -47,7 +67,10 @@
|
||||
|
||||
public T GetValue<T>(int index = -1)
|
||||
{
|
||||
index = Math.Max(index, this.column++);
|
||||
if (index < 0)
|
||||
{
|
||||
index = this.column++;
|
||||
}
|
||||
|
||||
if (!this.sqlDataReader.IsDBNull(index))
|
||||
{
|
||||
|
||||
@@ -4,187 +4,29 @@
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
using LaaProductionWeb.Services.Models;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class AccountService : IAccountService
|
||||
{
|
||||
private readonly ISqlClient dbContext;
|
||||
private readonly ISqlClient sqlClient;
|
||||
|
||||
public AccountService(ISqlClient dbContext)
|
||||
=> this.dbContext = dbContext;
|
||||
public AccountService(ISqlClient sqlClient)
|
||||
=> this.sqlClient = sqlClient;
|
||||
|
||||
public WindowsUser GetOrCreateWindowsUser(string primarySID, string domainName, string userName)
|
||||
public Employee FindEmployee(string firstName, string lastName)
|
||||
{
|
||||
var user = this.dbContext.FirstOrDefault($@"
|
||||
DECLARE @userId INT;
|
||||
|
||||
SELECT @userId = [Account].[WindowsUsers].[UserId]
|
||||
FROM [Account].[WindowsUsers]
|
||||
WHERE [Account].[WindowsUsers].[PrimarySID] = @{nameof(primarySID)}
|
||||
|
||||
IF @userId IS NULL
|
||||
INSERT INTO [Account].[WindowsUsers] (
|
||||
[PrimarySID]
|
||||
, [DomainName]
|
||||
, [UserName])
|
||||
OUTPUT [Inserted].[UserId]
|
||||
VALUES (@{nameof(primarySID)}
|
||||
, @{nameof(domainName)}
|
||||
, @{nameof(userName)})
|
||||
ELSE SELECT @userId",
|
||||
var permissions = this.sqlClient.ExecuteReader($@"
|
||||
SELECT [MitarbeiterRechte].[Recht]
|
||||
FROM [Mitarbeiter]
|
||||
JOIN [MitarbeiterRechte]
|
||||
ON [MitarbeiterRechte].[MitarbeiterNr] = [Mitarbeiter].[MitarbeiterNr]
|
||||
WHERE [Vorname] LIKE @{nameof(firstName)}
|
||||
AND [Name] LIKE @{nameof(lastName)}
|
||||
AND [MitarbeiterRechte].[Recht] LIKE 'WEB_%'",
|
||||
parameters => parameters
|
||||
.Add(nameof(primarySID), primarySID)
|
||||
.Add(nameof(domainName), domainName)
|
||||
.Add(nameof(userName), userName),
|
||||
reader => new WindowsUser
|
||||
{
|
||||
UserId = reader.GetValue<int>(0)
|
||||
})
|
||||
?? new WindowsUser();
|
||||
|
||||
user.Roles = this
|
||||
.GetUserRoles(user.UserId)
|
||||
.Select(x => x.RoleName);
|
||||
.Add(nameof(firstName), firstName)
|
||||
.Add(nameof(lastName), lastName),
|
||||
reader => reader.GetString());
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
public PermissionsModel GetPermissionModelForUser(int userId, string role)
|
||||
{
|
||||
var roleModel = this.GetRoleForUser(role);
|
||||
|
||||
return new PermissionsModel
|
||||
{
|
||||
UserId = userId,
|
||||
Role = roleModel
|
||||
};
|
||||
}
|
||||
|
||||
public UserRole GetRoleForUser(string role)
|
||||
=> this.dbContext.FirstOrDefault($@"
|
||||
SELECT [Account].[Roles].[RoleId]
|
||||
, [Account].[Roles].[RoleName]
|
||||
, [Account].[Roles].[DisplayName]
|
||||
, [Account].[UsersRoles].[Approved]
|
||||
FROM [Account].[Roles]
|
||||
LEFT JOIN [Account].[UsersRoles]
|
||||
ON [Account].[UsersRoles].[RoleId] = [Account].[Roles].[RoleId]
|
||||
WHERE [Account].[Roles].[RoleName] = @{nameof(role)}",
|
||||
parameters => parameters.Add(nameof(role), role),
|
||||
reader => new UserRole
|
||||
{
|
||||
RoleId = reader.GetValue<int>(0),
|
||||
RoleName = reader.GetString(1),
|
||||
DisplayName = reader.GetString(2),
|
||||
Pending = reader.GetValue<bool?>(3),
|
||||
}) ?? new UserRole();
|
||||
|
||||
public IEnumerable<UserRole> GetUserRoles(int userId)
|
||||
=> this.dbContext.ExecuteReader($@"
|
||||
SELECT [Account].[Roles].[RoleId]
|
||||
, [Account].[Roles].[RoleName]
|
||||
, [Account].[Roles].[DisplayName]
|
||||
FROM [Account].[Roles]
|
||||
JOIN [Account].[UsersRoles]
|
||||
ON [Account].[UsersRoles].[RoleId] = [Account].[Roles].[RoleId]
|
||||
AND [Account].[UsersRoles].[UserId] = @{nameof(userId)}
|
||||
AND [Account].[UsersRoles].[Approved] = 1",
|
||||
parameters => parameters.Add(nameof(userId), userId),
|
||||
reader => new UserRole
|
||||
{
|
||||
RoleId = reader.GetValue<int>(0),
|
||||
RoleName = reader.GetString(1),
|
||||
DisplayName = reader.GetString(2),
|
||||
});
|
||||
|
||||
public List<UserPermissions> GetUsersWithPendingRoles()
|
||||
=> this.dbContext.ExecuteReader($@"
|
||||
SELECT [Account].[Users].[UserId]
|
||||
, [Account].[Users].[FirstName] + ' ' + [Account].[Users].[LastName]
|
||||
, [Account].[Roles].[RoleId]
|
||||
, [Account].[Roles].[RoleName]
|
||||
, [Account].[UsersRoles].[Approved]
|
||||
FROM [Account].[UsersRoles]
|
||||
JOIN [Account].[Roles] ON [Account].[Roles].[RoleId] = [Account].[UsersRoles].[RoleId]
|
||||
JOIN [Account].[Users] ON [Account].[Users].[UserId] = [Account].[UsersRoles].[UserId]
|
||||
WHERE [Account].[UsersRoles].[Approved] = 0",
|
||||
reader => new
|
||||
{
|
||||
UserId = reader.GetValue<int>(0),
|
||||
DisplayName = reader.GetString(1),
|
||||
RoleId = reader.GetValue<int>(2),
|
||||
RoleName = reader.GetString(3),
|
||||
Approved = reader.GetValue<bool>(4)
|
||||
})
|
||||
.GroupBy(x => new UserPermissions
|
||||
{
|
||||
UserId = x.UserId,
|
||||
DisplayName = x.DisplayName
|
||||
}, UserPermissionsComparer.Current)
|
||||
.Select(x => new UserPermissions
|
||||
{
|
||||
UserId = x.Key.UserId,
|
||||
DisplayName = x.Key.DisplayName,
|
||||
Roles = x
|
||||
.AsEnumerable()
|
||||
.Select(r => new RoleModel
|
||||
{
|
||||
RoleId = r.RoleId,
|
||||
RoleName = r.RoleName,
|
||||
Approved = r.Approved
|
||||
})
|
||||
.ToList()
|
||||
})
|
||||
.ToList();
|
||||
|
||||
public void RequestPermissions(PermissionsModel model)
|
||||
{
|
||||
this.dbContext.ExecuteNonQuery($@"
|
||||
INSERT INTO [Auftrag].[Account].[Users] (
|
||||
[UserId]
|
||||
, [FirstName]
|
||||
, [LastName])
|
||||
VALUES (@{nameof(model.UserId)}
|
||||
, @{nameof(model.FirstName)}
|
||||
, @{nameof(model.LastName)})",
|
||||
parameters => parameters
|
||||
.Add(nameof(model.UserId), model.UserId)
|
||||
.Add(nameof(model.FirstName), model.FirstName)
|
||||
.Add(nameof(model.LastName), model.LastName));
|
||||
|
||||
model.Role.Pending = this.dbContext.ExecuteNonQuery($@"
|
||||
INSERT INTO [Auftrag].[Account].[UsersRoles] (
|
||||
[UserId]
|
||||
, [RoleId])
|
||||
VALUES (@{nameof(model.UserId)}
|
||||
, @{nameof(model.Role.RoleId)})",
|
||||
parameters => parameters
|
||||
.Add(nameof(model.UserId), model.UserId)
|
||||
.Add(nameof(model.Role.RoleId), model.Role.RoleId)) == 1;
|
||||
}
|
||||
|
||||
public void SaveUserPermissions(IEnumerable<UserPermissions> usersPermissions)
|
||||
{
|
||||
foreach (var user in usersPermissions)
|
||||
{
|
||||
foreach (var role in user.Roles)
|
||||
{
|
||||
this.dbContext.ExecuteNonQuery(
|
||||
role.Deleted
|
||||
? $@"DELETE FROM [Account].[UsersRoles]
|
||||
WHERE [Account].[UsersRoles].[UserId] = @{nameof(user.UserId)}
|
||||
AND [Account].[UsersRoles].[RoleId] = @{nameof(role.RoleId)}"
|
||||
: $@"UPDATE [Account].[UsersRoles]
|
||||
SET [Approved] = @{nameof(role.Approved)}
|
||||
WHERE [Account].[UsersRoles].[UserId] = @{nameof(user.UserId)}
|
||||
AND [Account].[UsersRoles].[RoleId] = @{nameof(role.RoleId)}",
|
||||
parameters => parameters
|
||||
.Add(nameof(user.UserId), user.UserId)
|
||||
.Add(nameof(role.RoleId), role.RoleId)
|
||||
.Add(nameof(role.Approved), role.Approved));
|
||||
}
|
||||
}
|
||||
return new Employee(permissions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,22 +2,8 @@
|
||||
{
|
||||
using LaaProductionWeb.Services.Models;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IAccountService : ITransient
|
||||
{
|
||||
WindowsUser GetOrCreateWindowsUser(string primarySID, string domainName, string userName);
|
||||
|
||||
PermissionsModel GetPermissionModelForUser(int userId, string role);
|
||||
|
||||
IEnumerable<UserRole> GetUserRoles(int userId);
|
||||
|
||||
List<UserPermissions> GetUsersWithPendingRoles();
|
||||
|
||||
UserRole GetRoleForUser(string role);
|
||||
|
||||
void RequestPermissions(PermissionsModel model);
|
||||
|
||||
void SaveUserPermissions(IEnumerable<UserPermissions> usersPermissions);
|
||||
Employee FindEmployee(string firstName, string lastName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,5 +9,7 @@
|
||||
HeliumReportModel LoadHeliumPressureReport(HeliumReportModel model = null);
|
||||
|
||||
IEnumerable<HeliumPressurePoint> LoadHeliumPressureResults(int testId);
|
||||
|
||||
byte[] LoadHeliumPressureReportAsCSV(HeliumReportModel model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
<Compile Include="Interfaces\IReportService.cs" />
|
||||
<Compile Include="Interfaces\IShipmentsService.cs" />
|
||||
<Compile Include="Interfaces\ITransient.cs" />
|
||||
<Compile Include="Models\Employee.cs" />
|
||||
<Compile Include="Models\HeliumPressurePoint.cs" />
|
||||
<Compile Include="Models\HeliumReportFilter.cs" />
|
||||
<Compile Include="Models\HeliumReportFilterProperty.cs" />
|
||||
@@ -76,10 +77,6 @@
|
||||
<Compile Include="Models\PalletPosition.cs" />
|
||||
<Compile Include="Models\ProductionApproval.cs" />
|
||||
<Compile Include="Models\ProductionOrders.cs" />
|
||||
<Compile Include="Models\RoleModel.cs" />
|
||||
<Compile Include="Models\UserRole.cs" />
|
||||
<Compile Include="Models\UserPermissions.cs" />
|
||||
<Compile Include="Models\WindowsUser.cs" />
|
||||
<Compile Include="Models\BatchPrintModel.cs" />
|
||||
<Compile Include="Models\OrderClientModel.cs" />
|
||||
<Compile Include="Models\OrderInfoModel.cs" />
|
||||
@@ -88,7 +85,6 @@
|
||||
<Compile Include="Models\OrderScanModel.cs" />
|
||||
<Compile Include="Models\OrdersFoundModel.cs" />
|
||||
<Compile Include="Models\PalletsBatchModel.cs" />
|
||||
<Compile Include="Models\PermissionsModel.cs" />
|
||||
<Compile Include="Models\Result.cs" />
|
||||
<Compile Include="Models\SerialNr.cs" />
|
||||
<Compile Include="Models\ShipmentModel.cs" />
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace LaaProductionWeb.Services.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class Employee
|
||||
{
|
||||
public Employee(IEnumerable<string> permissions)
|
||||
=> this.Permissions = permissions;
|
||||
|
||||
public IEnumerable<string> Permissions { get; }
|
||||
= Array.Empty<string>();
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace LaaProductionWeb.Services.Models
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
public class PermissionsModel
|
||||
{
|
||||
public int UserId { get; set; }
|
||||
|
||||
[Display(Name = "Vorname")]
|
||||
[Required(ErrorMessage = "Die Vorname ist erforderlich.")]
|
||||
public string FirstName { get; set; }
|
||||
|
||||
[Display(Name = "Name")]
|
||||
[Required(ErrorMessage = "Die Name ist erforderlich.")]
|
||||
public string LastName { get; set; }
|
||||
|
||||
public UserRole Role { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace LaaProductionWeb.Services.Models
|
||||
{
|
||||
public class RoleModel
|
||||
{
|
||||
public int RoleId { get; set; }
|
||||
|
||||
public string RoleName { get; set; }
|
||||
|
||||
public bool Approved { get; set; }
|
||||
|
||||
public bool Deleted { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
namespace LaaProductionWeb.Services.Models
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class UserPermissions
|
||||
{
|
||||
public int UserId { get; set; }
|
||||
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
public List<RoleModel> Roles { get; set; }
|
||||
}
|
||||
|
||||
public class UserPermissionsComparer : IEqualityComparer<UserPermissions>
|
||||
{
|
||||
public bool Equals(UserPermissions x, UserPermissions y)
|
||||
=> x?.UserId == y?.UserId;
|
||||
|
||||
public int GetHashCode(UserPermissions obj)
|
||||
=> obj?.UserId ?? default(int);
|
||||
|
||||
public static UserPermissionsComparer Current
|
||||
= new UserPermissionsComparer();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace LaaProductionWeb.Services.Models
|
||||
{
|
||||
public class UserRole
|
||||
{
|
||||
public int RoleId { get; set; }
|
||||
|
||||
public string RoleName { get; set; }
|
||||
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
public bool? Pending { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace LaaProductionWeb.Services.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class WindowsUser
|
||||
{
|
||||
public int UserId { get; set; } = -1;
|
||||
|
||||
public IEnumerable<string> Roles { get; set; } = Array.Empty<string>();
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,14 @@
|
||||
|
||||
public class OrdersService : IOrdersService
|
||||
{
|
||||
private readonly ISqlClient dbContext;
|
||||
private readonly ISqlClient sqlClient;
|
||||
|
||||
public OrdersService(ISqlClient dbContext)
|
||||
=> this.dbContext = dbContext;
|
||||
public OrdersService(ISqlClient sqlClient)
|
||||
=> this.sqlClient = sqlClient;
|
||||
|
||||
public OrdersFoundModel FindOrders(string search)
|
||||
{
|
||||
var ordersFound = this.dbContext.ExecuteReader(
|
||||
var ordersFound = this.sqlClient.ExecuteReader(
|
||||
query: $@"
|
||||
SELECT DISTINCT
|
||||
[AlleAuftragPositionen].[AuftragNr] -- 0
|
||||
@@ -26,8 +26,7 @@
|
||||
ORDER BY [AlleAuftragPositionen].[AuftragNr]
|
||||
, [AlleAuftragPositionen].[FertigungsauftragNr]
|
||||
, [Kunde].[Name]",
|
||||
parameters: parameters => parameters
|
||||
.Add(nameof(search), $"%{search}%"),
|
||||
parameters: parameters => parameters.Add(nameof(search), $"%{search}%"),
|
||||
reader: reader => new OrderInfoModel
|
||||
{
|
||||
OrderNr = reader.GetValue<int>(0),
|
||||
@@ -40,7 +39,7 @@
|
||||
|
||||
public OrderPositions FindPositions(string orderNr)
|
||||
{
|
||||
var positionsFound = this.dbContext.ExecuteReader(
|
||||
var positionsFound = this.sqlClient.ExecuteReader(
|
||||
query: $@"
|
||||
SELECT DISTINCT
|
||||
[AlleAuftragPositionen].[PositionNr] -- 0
|
||||
@@ -56,7 +55,7 @@
|
||||
|
||||
public ProductionOrders FindProductionOrders(string productionNr)
|
||||
{
|
||||
var ordersFound = this.dbContext.ExecuteReader($@"
|
||||
var ordersFound = this.sqlClient.ExecuteReader($@"
|
||||
SELECT DISTINCT
|
||||
[AlleAuftragPositionen].[FertigungsauftragNr] -- 1
|
||||
FROM [AlleAuftragPositionen]
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
|
||||
public class ProtocolService : IProtocolService
|
||||
{
|
||||
private readonly ISqlClient dbContext;
|
||||
private readonly ISqlClient sqlClient;
|
||||
|
||||
public ProtocolService(ISqlClient dbContext)
|
||||
=> this.dbContext = dbContext;
|
||||
public ProtocolService(ISqlClient sqlClient)
|
||||
=> this.sqlClient = sqlClient;
|
||||
|
||||
public bool DeleteFile(int fileId)
|
||||
=> this.dbContext.ExecuteScalar<int>($@"
|
||||
=> this.sqlClient.ExecuteScalar<int>($@"
|
||||
DELETE FROM [File]
|
||||
WHERE [FileId] = @{nameof(fileId)};
|
||||
DELETE FROM [FilesOrders]
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
public string FileContent(int? fileId)
|
||||
{
|
||||
var fileContent = this.dbContext.FirstOrDefault(
|
||||
var fileContent = this.sqlClient.FirstOrDefault(
|
||||
query: $@"
|
||||
SELECT [dbo].[File].[FileContent]
|
||||
FROM [dbo].[File]
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
public OrderClientModel FindOrder(int orderId)
|
||||
{
|
||||
var orderClientModel = this.dbContext.FirstOrDefault(
|
||||
var orderClientModel = this.sqlClient.FirstOrDefault(
|
||||
query: $@"
|
||||
SELECT DISTINCT
|
||||
[APG].[AuftragNr]
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
if (orderClientModel != null && orderId > 0)
|
||||
{
|
||||
orderClientModel.FileId = this.dbContext.FirstOrDefault($@"
|
||||
orderClientModel.FileId = this.sqlClient.FirstOrDefault($@"
|
||||
SELECT [FileId]
|
||||
FROM [FilesOrders]
|
||||
WHERE [OrderId] = @{nameof(orderId)}
|
||||
@@ -85,7 +85,7 @@
|
||||
}
|
||||
|
||||
public IEnumerable<KeyValuePair<int, string>> FindOrdersById(int orderno)
|
||||
=> this.dbContext.ExecuteReader($@"
|
||||
=> this.sqlClient.ExecuteReader($@"
|
||||
SELECT DISTINCT
|
||||
[APG].[AuftragNr]
|
||||
, [K].[Name]
|
||||
@@ -104,7 +104,7 @@
|
||||
value: reader.GetString(1)));
|
||||
|
||||
public IEnumerable<KeyValuePair<int, string>> FindOrdersByClient(string clientName)
|
||||
=> this.dbContext.ExecuteReader(
|
||||
=> this.sqlClient.ExecuteReader(
|
||||
query: $@"
|
||||
SELECT DISTINCT
|
||||
[APG].[AuftragNr]
|
||||
@@ -124,7 +124,7 @@
|
||||
value: reader.GetString(1)));
|
||||
|
||||
public IEnumerable<TestStatus> LoadTestStatus(int orderId)
|
||||
=> this.dbContext.ExecuteReader(
|
||||
=> this.sqlClient.ExecuteReader(
|
||||
query: $@"
|
||||
SELECT DISTINCT
|
||||
[APS].[PositionNr] AS [PosNr] -- 0
|
||||
@@ -165,7 +165,7 @@
|
||||
|
||||
public bool OrderCompleted(int orderId)
|
||||
{
|
||||
var sumResults = this.dbContext.ExecuteReader($@"
|
||||
var sumResults = this.sqlClient.ExecuteReader($@"
|
||||
SELECT CAST(CASE WHEN ISNULL([CPT].[CordonelPressureTest_Valid], 1) = 1 THEN 0 ELSE 1 END AS INT)
|
||||
+ CAST(CASE WHEN ISNULL([DP].[Dicht], 1) = 1 THEN 0 ELSE 1 END AS INT)
|
||||
+ ISNULL(MAX([APS].[StatusFertigung]) - 30, 0)
|
||||
@@ -199,7 +199,7 @@
|
||||
var fileName = $"{clientId}_{orderId}.pdf";
|
||||
var fileContent = this.GetBuffer(fileStream);
|
||||
|
||||
return this.dbContext.ExecuteScalar<int>(
|
||||
return this.sqlClient.ExecuteScalar<int>(
|
||||
query: $@"
|
||||
INSERT INTO [dbo].[File] (
|
||||
[FileName]
|
||||
|
||||
@@ -7,13 +7,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
public class ReportService : IReportService
|
||||
{
|
||||
private readonly ISqlClient dbContext;
|
||||
private readonly ISqlClient sqlClient;
|
||||
|
||||
public ReportService(ISqlClient dbContext)
|
||||
=> this.dbContext = dbContext;
|
||||
public ReportService(ISqlClient sqlClient)
|
||||
=> this.sqlClient = sqlClient;
|
||||
|
||||
public HeliumReportModel LoadHeliumPressureReport(HeliumReportModel model = null)
|
||||
{
|
||||
@@ -25,7 +26,7 @@
|
||||
var where = model.Filter.Where();
|
||||
var orderBy = model.Filter.OrderBy();
|
||||
|
||||
model.Items = this.dbContext.ExecuteReader($@"
|
||||
model.Items = this.sqlClient.ExecuteReader($@"
|
||||
SELECT [PT].[CordonelPressureTest_FertigungsAuftragsNr] AS [FertigungNr] -- 0 Filter
|
||||
, [POS].[AuftragNr] AS [AuftragNr] -- 1 Filter
|
||||
, [POS].[PositionNr] AS [PositionNr] -- 2 Filter
|
||||
@@ -87,18 +88,108 @@
|
||||
TestDate = reader.GetValue<DateTimeOffset>(16),
|
||||
Text = reader.GetString(17),
|
||||
Tester = reader.GetString(18)
|
||||
})
|
||||
.ToList();
|
||||
});
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
public byte[] LoadHeliumPressureReportAsCSV(HeliumReportModel model)
|
||||
{
|
||||
if (model is null)
|
||||
{
|
||||
model = new HeliumReportModel();
|
||||
}
|
||||
|
||||
var where = model.Filter.Where();
|
||||
var orderBy = model.Filter.OrderBy();
|
||||
var csvItems = new List<object[]>();
|
||||
var headers = Array.Empty<string>();
|
||||
var items = this.sqlClient.ExecuteReader($@"
|
||||
SELECT [PT].[CordonelPressureTest_FertigungsAuftragsNr] AS [FertigungNr] -- 0 Filter
|
||||
, [POS].[AuftragNr] AS [AuftragNr] -- 1 Filter
|
||||
, [POS].[PositionNr] AS [PositionNr] -- 2 Filter
|
||||
, [PCB2SN].[MapPcbIdToSerialNumber_SerialNumber] AS [SerialNr] -- 3
|
||||
, [ID].[IdentNr] AS [IdentNr] -- 4 Filter
|
||||
, [PT_HE].[CordonelPressureTestHe_Id] AS [HeId] -- 5
|
||||
, [PT_HE].[CordonelPressureTestHe_TestID] AS [HeTestId] -- 6
|
||||
, [PT].[CordonelPressureTest_PcbId] AS [PcbId] -- 7 Filter
|
||||
, [ID].[Nennweite] AS [Nennweite] -- 8 Filter
|
||||
, [ID].[Baulaenge] AS [Baulaenge] -- 9 Filter
|
||||
, [ID].[Typ] AS [Typ] -- 10 Filter
|
||||
, [ID].[Druck] AS [Druck] -- 11 Filter
|
||||
, [ID].[Temperatur] AS [Temperatur] -- 12 Filter
|
||||
, [PT_HE].[CordonelPressureTestHe_LeakRate] AS [HeLakeRate] -- 13
|
||||
, [PT_HE].[CordonelPressureTestHe_TestPressure] AS [HeTestPressure] -- 14
|
||||
, [PT].[CordonelPressureTest_Valid] AS [IsValid] -- 15 Filter
|
||||
, [PT].[CordonelPressureTest_Date] AS [TestDate] -- 16 Filter
|
||||
, [PT].[CordonelPressureTest_Text] AS [Text] -- 17 Filter
|
||||
, [PT_HE].[CordonelPressureTestHe_TesterName] AS [Tester] -- 18
|
||||
, [CPT].[CordonelPressureTest_TestPointNr] AS [PointNr] -- 19
|
||||
, CAST([CPT].[CordonelPressureTest_TestPointResult] AS NUMERIC(9, 8)) AS [PointResult] -- 20
|
||||
FROM [Cordonel_PressureTest] AS [PT]
|
||||
JOIN [Cordonel_PressureTest_He] AS [PT_HE] ON [PT_HE].[CordonelPressureTestHe_TestID] = [PT].[CordonelPressureTest_Id]
|
||||
LEFT JOIN [Druckpruefung] AS [DP] ON [DP].[FabNr] = [PT].[CordonelPressureTest_PcbId]
|
||||
JOIN [MapPcbIdToSerialNumber] AS [PCB2SN] ON [PCB2SN].[MapPcbIdToSerialNumber_PcbId] = [PT].[CordonelPressureTest_PcbId]
|
||||
JOIN [AuftragPosition_Gesamt] AS [POS] ON [POS].[FertigungsauftragNr] = [PT].[CordonelPressureTest_FertigungsAuftragsNr]
|
||||
JOIN [Identnr] AS [ID] ON [ID].[IdentNr] = [POS].[Identnr]
|
||||
LEFT JOIN [Cordonel_PressureTest_TestPoints] AS [CPT] ON [CPT].[CordonelPressureTest_Id] = [PT].[CordonelPressureTest_Id]
|
||||
WHERE [CordonelPressureTest_IsDeleted] = 0
|
||||
AND {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 object[]
|
||||
{
|
||||
reader.GetValue<int>(0),
|
||||
reader.GetValue<int>(1),
|
||||
reader.GetValue<short>(2),
|
||||
reader.GetValue<int>(3),
|
||||
reader.GetValue<int>(4),
|
||||
reader.GetValue<int>(5),
|
||||
reader.GetValue<int>(6),
|
||||
reader.GetValue<int>(7),
|
||||
reader.GetValue<int?>(8),
|
||||
reader.GetValue<int?>(9),
|
||||
reader.GetString(10).Replace(',', ' '),
|
||||
reader.GetValue<int?>(11),
|
||||
reader.GetValue<int?>(12),
|
||||
reader.GetString(13).Replace(',', '.'),
|
||||
reader.GetString(14).Replace(',', ' '),
|
||||
reader.GetValue<bool>(15),
|
||||
$"{reader.GetValue<DateTimeOffset>(16):yyyy-MM-dd}",
|
||||
reader.GetString(17).Replace(',', ' '),
|
||||
reader.GetString(18).Replace(',', ' '),
|
||||
reader.GetValue<int>(19),
|
||||
$"{reader.GetValue<decimal>(20):0.000000000}",
|
||||
|
||||
},
|
||||
columns => csvItems.Add(columns))
|
||||
.ToList();
|
||||
|
||||
csvItems.AddRange(items);
|
||||
|
||||
var csvLines = csvItems.Select(x => string.Join(",", x));
|
||||
var csvContent = string.Join(Environment.NewLine, csvLines);
|
||||
|
||||
return Encoding.UTF8.GetBytes(csvContent);
|
||||
}
|
||||
|
||||
public IEnumerable<HeliumPressurePoint> LoadHeliumPressureResults(int testId)
|
||||
=> this.dbContext.ExecuteReader($@"
|
||||
=> this.sqlClient.ExecuteReader($@"
|
||||
SELECT [CordonelPressureTestTestPoints_Id]
|
||||
, [CordonelPressureTest_TestPointNr]
|
||||
, CAST([CordonelPressureTest_TestPointResult] AS NUMERIC(9, 8))
|
||||
FROM [Auftrag].[dbo].[Cordonel_PressureTest_TestPoints]
|
||||
FROM [Cordonel_PressureTest_TestPoints]
|
||||
WHERE [CordonelPressureTest_Id] = @{nameof(testId)}",
|
||||
parameters => parameters.Add(nameof(testId), testId),
|
||||
reader => new HeliumPressurePoint
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
public class ShipmentsService : IShipmentsService
|
||||
{
|
||||
private readonly ISqlClient dbContext;
|
||||
private readonly ISqlClient sqlClient;
|
||||
|
||||
public ShipmentsService(ISqlClient dbContext)
|
||||
=> this.dbContext = dbContext;
|
||||
public ShipmentsService(ISqlClient sqlClient)
|
||||
=> this.sqlClient = sqlClient;
|
||||
|
||||
public OrderScanModel DeletePalletEntry(int id)
|
||||
{
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
public int GetPalletsCount(OrderScanModel model)
|
||||
{
|
||||
var palletsCount = this.dbContext.FirstOrDefault(
|
||||
var palletsCount = this.sqlClient.FirstOrDefault(
|
||||
query: $@"
|
||||
SELECT COUNT(1)
|
||||
FROM (SELECT [PalettenNr] AS [PalletNr]
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
public byte[] LoadBatchBuffer(OrderScanModel model)
|
||||
{
|
||||
var palletLoad = this.dbContext.ExecuteReader(
|
||||
var palletLoad = this.sqlClient.ExecuteReader(
|
||||
query: $@"
|
||||
SELECT [PalettenNr]
|
||||
, [SerienNr]
|
||||
@@ -76,7 +76,7 @@
|
||||
}
|
||||
|
||||
public IEnumerable<SerialNr> LoadBatchItems(OrderScanModel model)
|
||||
=> this.dbContext.ExecuteReader(
|
||||
=> this.sqlClient.ExecuteReader(
|
||||
query: $@"
|
||||
SELECT DISTINCT
|
||||
[PalettenScan].[ID] -- 0
|
||||
@@ -117,7 +117,7 @@
|
||||
const string orderNr = nameof(model.OrderNr);
|
||||
const string palNr = nameof(model.PalletNr);
|
||||
|
||||
var batchModel = this.dbContext.FirstOrDefault(
|
||||
var batchModel = this.sqlClient.FirstOrDefault(
|
||||
query: $@"
|
||||
SELECT TOP 1
|
||||
[Auftrag].[AuftragNr] -- 0
|
||||
@@ -156,7 +156,7 @@
|
||||
}
|
||||
|
||||
private IEnumerable<PalletPosition> LoadBatchPositions(OrderScanModel model, string orderNr, string palNr)
|
||||
=> this.dbContext.ExecuteReader($@"
|
||||
=> this.sqlClient.ExecuteReader($@"
|
||||
SELECT DISTINCT
|
||||
[Auftrag].[PositionNr]
|
||||
, COUNT(1)
|
||||
@@ -223,7 +223,7 @@
|
||||
}
|
||||
|
||||
private OrderScanModel DeletePalletEntryById(int id)
|
||||
=> this.dbContext.FirstOrDefault(
|
||||
=> this.sqlClient.FirstOrDefault(
|
||||
query: $@"
|
||||
DELETE
|
||||
FROM [PalettenScan]
|
||||
@@ -240,7 +240,7 @@
|
||||
});
|
||||
|
||||
private OrderIdentity UpdateOrderIdentifiers(int? orderNr, int? positionNr, string serialNr)
|
||||
=> this.dbContext.FirstOrDefault(
|
||||
=> this.sqlClient.FirstOrDefault(
|
||||
query: $@"
|
||||
SELECT DISTINCT TOP 1
|
||||
[AuftragPositionSerienNr].[PositionNr] -- 0
|
||||
@@ -263,7 +263,7 @@
|
||||
});
|
||||
|
||||
private int InsertPalletEntry(OrderScanModel model)
|
||||
=> this.dbContext.ExecuteNonQuery($@"
|
||||
=> this.sqlClient.ExecuteNonQuery($@"
|
||||
INSERT
|
||||
INTO [PalettenScan] (
|
||||
[PalettenNr]
|
||||
@@ -289,7 +289,7 @@
|
||||
.Add(nameof(model.Place), model.Place));
|
||||
|
||||
private bool PalletsEntryExists(int? orderNr, int? positionNr, string serialNr)
|
||||
=> this.dbContext.FirstOrDefault($@"
|
||||
=> this.sqlClient.FirstOrDefault($@"
|
||||
SELECT CAST(CASE WHEN [PalettenScan].[ID] IS NULL THEN 0 ELSE 1 END AS BIT)
|
||||
FROM [PalettenScan]
|
||||
WHERE [PalettenScan].[AuftragNr] = @{nameof(orderNr)}
|
||||
@@ -300,7 +300,7 @@
|
||||
reader => reader.GetValue<bool>(0));
|
||||
|
||||
private bool UpdatePalletsNr(OrderScanModel model)
|
||||
=> this.dbContext.FirstOrDefault($@"
|
||||
=> this.sqlClient.FirstOrDefault($@"
|
||||
BEGIN TRANSACTION
|
||||
------------------------------------------------------------------------
|
||||
DECLARE @rowsByAuftragPosition INT = (
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
{
|
||||
if (filterContext.HttpContext.User is ClaimsPrincipal claimsPrincipal)
|
||||
{
|
||||
filterContext.Result = new RedirectResult($"/Account/Authorize?role={this.Roles}");
|
||||
filterContext.Controller.TempData["Unauthorized"] = "Dir fehlen berechtigungen.";
|
||||
filterContext.Result = new RedirectResult($"/");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,48 +1,34 @@
|
||||
namespace LaaProductionWeb.App_Infrastructure
|
||||
{
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
|
||||
using System;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.DirectoryServices.AccountManagement;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Principal;
|
||||
using System.Web.Mvc;
|
||||
|
||||
public class AuthorizationFilter : IAuthorizationFilter
|
||||
{
|
||||
public void OnAuthorization(AuthorizationContext filterContext)
|
||||
{
|
||||
if (filterContext.HttpContext.User is ClaimsPrincipal claimsPrincipal)
|
||||
if (filterContext.HttpContext.User is WindowsPrincipal windowsPrincipal)
|
||||
{
|
||||
this.GetWindowsUser(claimsPrincipal, out string primarySID, out string domainName, out string userName);
|
||||
|
||||
var accountService = ServiceProvider.Current.GetService<IAccountService>();
|
||||
var windowsUser = accountService.GetOrCreateWindowsUser(primarySID, domainName, userName);
|
||||
var claims = new List<Claim> { new Claim(ClaimTypes.NameIdentifier, $"{windowsUser.UserId}") };
|
||||
|
||||
foreach (var role in windowsUser.Roles)
|
||||
using (var principalContext = new PrincipalContext(ContextType.Domain))
|
||||
{
|
||||
claims.Add(new Claim(ClaimTypes.Role, role));
|
||||
var userPrincipal = UserPrincipal.FindByIdentity(principalContext, windowsPrincipal.Identity.Name);
|
||||
var accountService = ServiceProvider.Current.GetService<IAccountService>();
|
||||
var employee = accountService.FindEmployee(userPrincipal.GivenName, userPrincipal.Surname);
|
||||
var permissionsClaims = new List<Claim> { new Claim(ClaimTypes.Name, $"{userPrincipal.GivenName} {userPrincipal.Surname}") };
|
||||
|
||||
foreach (var permission in employee.Permissions)
|
||||
{
|
||||
permissionsClaims.Add(new Claim(ClaimTypes.Role, permission));
|
||||
}
|
||||
|
||||
windowsPrincipal.AddIdentity(new ClaimsIdentity(permissionsClaims, nameof(ClaimsPrincipal), ClaimTypes.Name, ClaimTypes.Role));
|
||||
}
|
||||
|
||||
var claimsIdentity = new ClaimsIdentity(claims, nameof(ClaimsPrincipal), ClaimTypes.Name, ClaimTypes.Role);
|
||||
|
||||
claimsPrincipal.AddIdentity(claimsIdentity);
|
||||
}
|
||||
}
|
||||
|
||||
private void GetWindowsUser(ClaimsPrincipal claimsPrincipal, out string primarySID, out string domainName, out string userName)
|
||||
{
|
||||
var nameTokens = claimsPrincipal
|
||||
.FindFirst(ClaimTypes.Name)
|
||||
?.Value
|
||||
?.ToLower()
|
||||
?.Split(new[] { '\\', '/' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
?? Array.Empty<string>();
|
||||
|
||||
primarySID = claimsPrincipal.FindFirst(ClaimTypes.PrimarySid)?.Value;
|
||||
domainName = nameTokens.FirstOrDefault();
|
||||
userName = nameTokens.LastOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,24 +38,16 @@
|
||||
return serviceProvider;
|
||||
}
|
||||
|
||||
public static int NameIdentifier(this IPrincipal principal)
|
||||
public static string Name(this IPrincipal principal)
|
||||
{
|
||||
if (principal is ClaimsPrincipal claimsPrincipal)
|
||||
{
|
||||
var nameIdentifier = claimsPrincipal.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
if (int.TryParse($"{nameIdentifier}", out int userId))
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
return claimsPrincipal
|
||||
.FindAll(ClaimTypes.Name)
|
||||
.LastOrDefault()?.Value;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static T NameIdentifier<T>(this ViewContext viewContext)
|
||||
{
|
||||
return default(T);
|
||||
return "<unknown>";
|
||||
}
|
||||
|
||||
public static string Display<T>(this T model, Expression<Func<T, object>> expression)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace LaaProductionWeb.App_Infrastructure
|
||||
{
|
||||
public class UserRoles
|
||||
{
|
||||
public const string WEB_Admin = nameof(WEB_Admin);
|
||||
public const string WEB_HeReport = nameof(WEB_HeReport);
|
||||
public const string WEB_PalettenScan = nameof(WEB_PalettenScan);
|
||||
public const string WEB_ProdApproval = nameof(WEB_ProdApproval);
|
||||
public const string WEB_PuneProtokoll = nameof(WEB_PuneProtokoll);
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
namespace LaaProductionWeb.Controllers
|
||||
{
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
using LaaProductionWeb.Services.Models;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
|
||||
[Authorize]
|
||||
public class AccountController : Controller
|
||||
{
|
||||
private readonly IAccountService accountService;
|
||||
|
||||
public AccountController(IAccountService accountService)
|
||||
=> this.accountService = accountService;
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult Authorize(string role)
|
||||
{
|
||||
var userId = this.User.NameIdentifier();
|
||||
var permissionsModel = this.accountService
|
||||
.GetPermissionModelForUser(userId, role);
|
||||
|
||||
return this.View(model: permissionsModel);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Authorize(PermissionsModel model)
|
||||
{
|
||||
if (this.ModelState.IsValid)
|
||||
{
|
||||
this.accountService.RequestPermissions(model);
|
||||
}
|
||||
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[AllowedRoles("Admin")]
|
||||
public ActionResult Permissions()
|
||||
{
|
||||
var model = this.accountService.GetUsersWithPendingRoles();
|
||||
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[AllowedRoles("Admin")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Permissions(List<UserPermissions> model)
|
||||
{
|
||||
this.accountService.SaveUserPermissions(model);
|
||||
|
||||
model = this.accountService.GetUsersWithPendingRoles();
|
||||
|
||||
return this.View(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace LaaProductionWeb.Controllers
|
||||
{
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
|
||||
using System.Web.Mvc;
|
||||
|
||||
[Authorize]
|
||||
[AllowedRoles(UserRoles.WEB_Admin)]
|
||||
public class AdminController : Controller
|
||||
{
|
||||
private readonly IAccountService accountService;
|
||||
|
||||
public AdminController(IAccountService accountService)
|
||||
=> this.accountService = accountService;
|
||||
|
||||
public ActionResult Index()
|
||||
=> this.View();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
namespace LaaProductionWeb.Controllers
|
||||
{
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
using LaaProductionWeb.Services.Models;
|
||||
|
||||
@@ -7,6 +8,7 @@
|
||||
using System.Web.Mvc;
|
||||
|
||||
[Authorize]
|
||||
[AllowedRoles(UserRoles.WEB_ProdApproval)]
|
||||
public class ApprovalsController : Controller
|
||||
{
|
||||
private readonly IApprovalsService approvals;
|
||||
@@ -18,7 +20,7 @@
|
||||
public ActionResult Add()
|
||||
=> this.View(new ProductionApproval
|
||||
{
|
||||
ApproverName = this.User.Identity.Name,
|
||||
ApproverName = this.User.Name(),
|
||||
ApprovalDate = DateTime.Now
|
||||
});
|
||||
|
||||
@@ -29,7 +31,7 @@
|
||||
if (this.ModelState.IsValid)
|
||||
{
|
||||
approval.ApprovalDate = DateTime.Now;
|
||||
approval.ApproverName = this.User.Identity.Name;
|
||||
approval.ApproverName = this.User.Name();
|
||||
|
||||
var addResult = this.approvals.Add(approval);
|
||||
|
||||
@@ -45,7 +47,5 @@
|
||||
|
||||
return this.View(approval);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
{
|
||||
using System.Web.Mvc;
|
||||
|
||||
[Authorize]
|
||||
public class HomeController : Controller
|
||||
{
|
||||
[HttpGet]
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
namespace LaaProductionWeb.Controllers
|
||||
{
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
using LaaProductionWeb.Services.Models;
|
||||
|
||||
using System.Web.Mvc;
|
||||
|
||||
[Authorize]
|
||||
// [AllowedRoles("Protocol")]
|
||||
[AllowedRoles(UserRoles.WEB_PuneProtokoll)]
|
||||
public class ProtocolController : Controller
|
||||
{
|
||||
public const string FilePDF = nameof(FilePDF);
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
namespace LaaProductionWeb.Controllers
|
||||
{
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
using LaaProductionWeb.Services.Models;
|
||||
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
|
||||
[Authorize]
|
||||
// [AllowedRoles("HeReport")]
|
||||
[AllowedRoles(UserRoles.WEB_HeReport)]
|
||||
public class ReportController : Controller
|
||||
{
|
||||
private readonly IReportService reportService;
|
||||
@@ -30,6 +31,18 @@
|
||||
return this.View(model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult CSV(HeliumReportModel model)
|
||||
{
|
||||
var csvReport = this.reportService.LoadHeliumPressureReportAsCSV(model);
|
||||
var fileName = $"HeReport_{DateTime.Now:yyyyMMddhhmmss}.csv";
|
||||
|
||||
this.Response.AddHeader("Content-Disposition", $"attachment;filename={fileName}");
|
||||
|
||||
return this.File(csvReport, "application/csv");
|
||||
}
|
||||
|
||||
public ActionResult Results(int testId = 0)
|
||||
{
|
||||
var results = this.reportService.LoadHeliumPressureResults(testId);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
namespace LaaProductionWeb.Controllers
|
||||
{
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
using LaaProductionWeb.Services.Models;
|
||||
|
||||
@@ -13,7 +14,7 @@
|
||||
using SystemFile = System.IO.File;
|
||||
|
||||
[Authorize]
|
||||
// [AllowedRoles("Shipment")]
|
||||
[AllowedRoles(UserRoles.WEB_PalettenScan)]
|
||||
public class ShipmentsController : Controller
|
||||
{
|
||||
private readonly IShipmentsService shipmentsService;
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.DirectoryServices.AccountManagement" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.9\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||
@@ -72,6 +73,9 @@
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Principal.Windows, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Principal.Windows.5.0.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -137,12 +141,13 @@
|
||||
<Compile Include="App_Infrastructure\ExceptionFilter.cs" />
|
||||
<Compile Include="App_Infrastructure\AllowedRolesAttribute.cs" />
|
||||
<Compile Include="App_Infrastructure\ServiceProvider.cs" />
|
||||
<Compile Include="App_Infrastructure\UserRoles.cs" />
|
||||
<Compile Include="App_Start\BundleConfig.cs" />
|
||||
<Compile Include="App_Start\FilterConfig.cs" />
|
||||
<Compile Include="App_Start\RouteConfig.cs" />
|
||||
<Compile Include="App_Start\ServicesConfig.cs" />
|
||||
<Compile Include="App_Start\WebApiConfig.cs" />
|
||||
<Compile Include="Controllers\AccountController.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Controllers\ApprovalsController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Controllers\ProtocolController.cs" />
|
||||
@@ -176,9 +181,6 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<Content Include="Views\Shared\_PrintLayout.cshtml" />
|
||||
<Content Include="Views\Account\Authorize.cshtml" />
|
||||
<Content Include="Views\Account\UserRole.cshtml" />
|
||||
<Content Include="Views\Account\Permissions.cshtml" />
|
||||
<Content Include="Views\Report\Index.cshtml" />
|
||||
<Content Include="Views\Report\Filter.cshtml" />
|
||||
<Content Include="Views\Report\Results.cshtml" />
|
||||
@@ -186,6 +188,8 @@
|
||||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
|
||||
<Content Include="Views\Approvals\Add.cshtml" />
|
||||
<Content Include="Views\Search\Production.cshtml" />
|
||||
<Content Include="Views\Admin\Index.cshtml" />
|
||||
<Content Include="Views\Report\HiddenFilter.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="App_Content\font\fonts\bootstrap-icons.woff" />
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
@model PermissionsModel
|
||||
|
||||
@using LaaProductionWeb.Services.Models
|
||||
|
||||
<div class="d-flex justify-content-center align-items-center h-100">
|
||||
@if (this.Model.Role.Pending is null)
|
||||
{
|
||||
<div class="col-md-3 card p-5">
|
||||
<form action="/Account/Authorize" method="post" autocomplete="off">
|
||||
@this.Html.AntiForgeryToken()
|
||||
@this.Html.HiddenFor(x => x.UserId)
|
||||
@this.Html.Partial(nameof(UserRole), this.Model.Role, new ViewDataDictionary { { "namePattern", $"{nameof(this.Model.Role)}.{{0}}" } })
|
||||
<h5 class="mb-3">Ihnen fehlt die Berechtigung – '@this.Model.Role.DisplayName'.</h5>
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextBoxFor(x => x.FirstName, new { @class = "form-control", placeholder = "Vorname" })
|
||||
@this.Html.LabelFor(x => x.FirstName, new { @class = "text-secondary" })
|
||||
@this.Html.ValidationMessageFor(x => x.FirstName, string.Empty, new { @class = "small text-danger" })
|
||||
</div>
|
||||
<div class="form-floating mb-3">
|
||||
@this.Html.TextBoxFor(x => x.LastName, new { @class = "form-control", placeholder = "Vorname" })
|
||||
@this.Html.LabelFor(x => x.LastName, new { @class = "text-secondary" })
|
||||
@this.Html.ValidationMessageFor(x => x.LastName, string.Empty, new { @class = "small text-danger" })
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary py-3 w-100">Berechtigung anfordern</button>
|
||||
</form>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-md-3 card p-5 border-success">
|
||||
<h1 class="text-center text-success"><i class="bi bi-shield-exclamation"></i></h1>
|
||||
<h6 class="text-center text-success">Ihre anfrage für die berechtigung – '@this.Model.Role.DisplayName' ist in bearbeitung ...</h6>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -1,60 +0,0 @@
|
||||
@model List<LaaProductionWeb.Services.Models.UserPermissions>
|
||||
|
||||
@if (this.Model.Any())
|
||||
{
|
||||
<form action="/Account/Permissions" method="post" autocomplete="off">
|
||||
@this.Html.AntiForgeryToken()
|
||||
<ul class="list-group list-group-flush mb-3">
|
||||
@{
|
||||
var usersCount = this.Model.Count;
|
||||
|
||||
for (int userIndex = 0; userIndex < usersCount; userIndex++)
|
||||
{
|
||||
var user = this.Model[userIndex];
|
||||
var hiddenUserId = $"[{userIndex}].{nameof(user.UserId)}";
|
||||
var hiddenUserName = $"[{userIndex}].{nameof(user.DisplayName)}";
|
||||
|
||||
<li class="list-group-item">
|
||||
<input type="hidden" name="@hiddenUserId" value="@user.UserId" />
|
||||
<input type="hidden" name="@hiddenUserName" value="@user.DisplayName" />
|
||||
<h5>@user.DisplayName</h5>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-secondary white-space-nowrap small px-3">Role Id</th>
|
||||
<th class="text-secondary white-space-nowrap small px-3">Role Name</th>
|
||||
<th class="text-secondary white-space-nowrap small px-3">Is Approved</th>
|
||||
<th class="text-secondary white-space-nowrap small px-3">Is Deleted</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@{
|
||||
var rolesCount = user.Roles.Count;
|
||||
|
||||
for (int roleIndex = 0; roleIndex < rolesCount; roleIndex++)
|
||||
{
|
||||
var role = user.Roles[roleIndex];
|
||||
var hiddenRoleId = $"[{userIndex}].{nameof(user.Roles)}[{roleIndex}].{nameof(role.RoleId)}";
|
||||
var hiddenRoleName = $"[{userIndex}].{nameof(user.Roles)}[{roleIndex}].{nameof(role.RoleName)}";
|
||||
var roleApproved = $"[{userIndex}].{nameof(user.Roles)}[{roleIndex}].{nameof(role.Approved)}";
|
||||
var roleDeleted = $"[{userIndex}].{nameof(user.Roles)}[{roleIndex}].{nameof(role.Deleted)}";
|
||||
|
||||
<tr>
|
||||
<td class="px-3">@role.RoleId <input type="hidden" name="@hiddenRoleId" value="@role.RoleId" /></td>
|
||||
<td class="px-3">@role.RoleName <input type="hidden" name="@hiddenRoleName" value="@role.RoleName" /></td>
|
||||
<td class="px-3">@this.Html.CheckBox(roleApproved, role.Approved, new { @class = "form-check-input" })</td>
|
||||
<td class="px-3">@this.Html.CheckBox(roleDeleted, role.Deleted, new { @class = "form-check-input" })</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
<button type="submit" class="btn btn-primary py-2 px-5 ms-3">Änderungen speichern</button>
|
||||
</form>
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
@model LaaProductionWeb.Services.Models.UserRole
|
||||
|
||||
@{
|
||||
var namePattern = "{0}";
|
||||
|
||||
if (this.ViewData.TryGetValue(nameof(namePattern), out object value))
|
||||
{
|
||||
namePattern = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
@this.Html.Hidden(string.Format(namePattern, nameof(this.Model.RoleId)), this.Model.RoleId)
|
||||
@this.Html.Hidden(string.Format(namePattern, nameof(this.Model.RoleName)), this.Model.RoleName)
|
||||
@this.Html.Hidden(string.Format(namePattern, nameof(this.Model.DisplayName)), this.Model.DisplayName)
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
<h2 class="mt-5">Hallo admin</h2>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
@model LaaProductionWeb.Services.Models.HeliumReportFilterProperty
|
||||
|
||||
<input type="hidden" name="@this.Model.TypeName" value="@this.Model.Type" />
|
||||
<input type="hidden" name="@this.Model.IndexName" value="@this.Model.Index" />
|
||||
<input type="hidden" name="@this.Model.ColumnName" value="@this.Model.Column" />
|
||||
<input type="hidden" name="@this.Model.PropertyName" value="@this.Model.Property" />
|
||||
<input type="hidden" name="@this.Model.LikeName" value="@this.Model.Like" />
|
||||
<input type="hidden" name="@this.Model.OrderByName" value="@this.Model.OrderBy" />
|
||||
@@ -42,37 +42,48 @@
|
||||
<tbody>
|
||||
@foreach (var item in this.Model.Items)
|
||||
{
|
||||
<tr>
|
||||
<td class="text-nowrap p-2">@item.FertigungNr</td>
|
||||
<td class="text-nowrap p-2">@item.AuftragNr</td>
|
||||
<td class="text-nowrap p-2">@item.PositionNr</td>
|
||||
<td class="text-nowrap p-2">@item.SerialNr</td>
|
||||
<td class="text-nowrap p-2">@item.IdentNr</td>
|
||||
<td class="text-nowrap p-2">@item.HeId</td>
|
||||
<td class="text-nowrap p-2">
|
||||
<a class="text-decoration-none cursor-pointer" href="#@item.HeTestId">
|
||||
@item.HeTestId
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-nowrap p-2">@item.PcbId</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.Typ</td>
|
||||
<td class="text-nowrap p-2">@item.Druck</td>
|
||||
<td class="text-nowrap p-2">@item.Temperatur</td>
|
||||
<td class="text-nowrap p-2">@item.HeLakeRate</td>
|
||||
<td class="text-nowrap p-2">@item.HeTestPressure</td>
|
||||
<td class="text-nowrap p-2"><i class="bi bi-bold @(item.IsValid ? "bi-check text-success" : "bi-x text-danger")"></i></td>
|
||||
<td class="p-2">@item.Text</td>
|
||||
<td class="text-nowrap p-2">@($"{item.TestDate:dd.MM.yyyy}")</td>
|
||||
<td class="text-nowrap p-2">@item.Tester</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-nowrap p-2">@item.FertigungNr</td>
|
||||
<td class="text-nowrap p-2">@item.AuftragNr</td>
|
||||
<td class="text-nowrap p-2">@item.PositionNr</td>
|
||||
<td class="text-nowrap p-2">@item.SerialNr</td>
|
||||
<td class="text-nowrap p-2">@item.IdentNr</td>
|
||||
<td class="text-nowrap p-2">@item.HeId</td>
|
||||
<td class="text-nowrap p-2">
|
||||
<a class="text-decoration-none cursor-pointer" href="#@item.HeTestId">
|
||||
@item.HeTestId
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-nowrap p-2">@item.PcbId</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.Typ</td>
|
||||
<td class="text-nowrap p-2">@item.Druck</td>
|
||||
<td class="text-nowrap p-2">@item.Temperatur</td>
|
||||
<td class="text-nowrap p-2">@item.HeLakeRate</td>
|
||||
<td class="text-nowrap p-2">@item.HeTestPressure</td>
|
||||
<td class="text-nowrap p-2"><i class="bi bi-bold @(item.IsValid ? "bi-check text-success" : "bi-x text-danger")"></i></td>
|
||||
<td class="p-2">@item.Text</td>
|
||||
<td class="text-nowrap p-2">@($"{item.TestDate:dd.MM.yyyy}")</td>
|
||||
<td class="text-nowrap p-2">@item.Tester</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form action="/Report/CSV" method="post" autocomplete="off" class="position-fixed bottom-0 end-0 m-2">
|
||||
@this.Html.AntiForgeryToken()
|
||||
@foreach (var filter in this.Model.Filter)
|
||||
{
|
||||
this.Html.Partial("HiddenFilter", filter);
|
||||
}
|
||||
<button class="btn btn-light border-success" type="submit">
|
||||
<i class="bi bi-filetype-csv text-success"></i>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<button id="modal_btn" class="d-none" data-bs-toggle="modal" data-bs-target="#modal"></button>
|
||||
|
||||
<!-- Modal -->
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
@{
|
||||
var user = this.User
|
||||
?.Identity
|
||||
?.Name
|
||||
?.Split('\\')
|
||||
?.LastOrDefault()
|
||||
?.ToLower();
|
||||
}
|
||||
@using LaaProductionWeb.App_Infrastructure
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
@@ -29,23 +22,44 @@
|
||||
</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="/Shipments">Paletten Scan</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="/Protocol">Prüfprotokoll</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="/Report">[He] Report</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="/Approvals/Add">Production Approval</a>
|
||||
</li>
|
||||
@if (this.User.IsInRole(UserRoles.WEB_PalettenScan))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="/Shipments">Paletten Scan</a>
|
||||
</li>
|
||||
}
|
||||
@if (this.User.IsInRole(UserRoles.WEB_PuneProtokoll))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="/Protocol">Prüfprotokoll</a>
|
||||
</li>
|
||||
}
|
||||
@if (this.User.IsInRole(UserRoles.WEB_HeReport))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="/Report">[He] Report</a>
|
||||
</li>
|
||||
}
|
||||
@if (this.User.IsInRole(UserRoles.WEB_ProdApproval))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="/Approvals/Add">Production Approval</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<span class="nav-link text-smallcaps">Benutzer: @user</span>
|
||||
</li>
|
||||
@if (this.User.IsInRole(UserRoles.WEB_Admin))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="/Admin">Admin: @this.User.Name()</a>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item">
|
||||
<span class="nav-link text-smallcaps">Benutzer: @this.User.Name()</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<add key="webpages:Enabled" value="false" />
|
||||
<add key="ClientValidationEnabled" value="true" />
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||
<add key="ConnectionString" value="Data Source=SLASQL01.emea.sensus.net;Initial Catalog=Auftrag;Password=ServiceParingfile;Persist Security Info=True;User ID=ServiceParingfile;"/>
|
||||
<add key="ConnectionString" value="Data Source=SLASQL01.emea.sensus.net;Initial Catalog=Auftrag;Password=ServiceParingfile;Persist Security Info=True;User ID=ServiceParingfile;" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.6.2" />
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="7.0.0" targetFramework="net462" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="2.0.0" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" />
|
||||
<package id="System.DirectoryServices.AccountManagement" version="7.0.0" targetFramework="net462" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net462" />
|
||||
<package id="System.Security.Principal.Windows" version="5.0.0" targetFramework="net462" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
|
||||
<package id="WebGrease" version="1.6.0" targetFramework="net462" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user