refactor: Projektdateien migriert. Cloud-NuGet-Pakete durch lokale NuGet-Projekte ersetzt.

This commit is contained in:
Developer 02
2024-08-01 18:44:39 +02:00
parent 0d82f7af6f
commit 62ddd4873f
206 changed files with 10927 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
using HRD.WebApi.DAL;
namespace DAL._Shared.SharedModels
{
public partial class WebAppEmployeeInfo : BaseEntity
{
public int WebAppEmployeeInfoId { get; set; }
public string EmployeeNo { get; set; }
public string Salutation { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string ShortName { get; set; }
public string Title { get; set; }
public string Position { get; set; }
public string LoginName { get; set; }
public string Email { get; set; }
public int DepartmentId { get; set; }
public string ExtendedDepartmentIdList { get; set; }
public string DepartmentName { get; set; }
public int EmployeeId { get; set; }
public int CostCentreId { get; set; }
public string RangShortname { get; set; }
public string RangName { get; set; }
public int RangOrder { get; set; }
public int ClientId { get; set; }
public int WebAppId { get; set; }
//generic Id
public override int GetEntityId() => WebAppEmployeeInfoId;
//generic ToString()
public override string ToString() => $"WebAppEmployeeInfoId: {GetEntityId()}; Name: {LoginName}";
//generic EntityInfo()
public override string EntityInfo() => base.EntityInfo();
}
}

View File

@@ -0,0 +1,59 @@
using HRD.WebApi.DAL;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace DAL._Shared.SharedModels
{
public partial class WebAppUser : BaseEntity
{
public WebAppUser()
{
}
public WebAppUser(string loginName, string shortName, string roleList, string name)
{
LoginName = loginName;
ShortName = shortName;
RoleList = roleList;
Name = name;
}
public int WebAppUserId { get; set; }
public string Name { get; set; }
public string ShortName { get; set; }
public string LoginName { get; set; }
public string Password { get; set; } = string.Empty;
public string RoleList { get; set; }
public string WebAppRoleList { get; set; } = string.Empty;
public DateTime? JwtExpiredOn { get; set; }
public DateTime? LastLogin { get; set; }
[NotMapped]
public string Token { get; set; }
public string ClientVersion { get; set; }
[NotMapped]
public int TimeZoneOffsetInMin { get; set; }
public string Language { get; set; }
public string Culture { get; set; }
public bool IsGermanCulture() => Culture?.Substring(0, 2).ToLower() == "de";
//generic Id
public override int GetEntityId() => WebAppUserId;
//generic ToString()
public override string ToString() => $"WebAppUserId: {GetEntityId()}; Name: {Name}";
//generic EntityInfo()
public override string EntityInfo()
{
return $"WebAppUserId: {GetEntityId()}; Loginname:{LoginName}; JwtExpiredOn:{JwtExpiredOn}";
}
}
}

View File

@@ -0,0 +1,114 @@
using DAL._Shared.SharedModels;
using HRD.LDAPService;
using HRD.WebApi.Repositories;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace DAL._Shared.SharedRepositories
{
public class WebAppEmployeeInfoRepository : BaseRepository<WebAppEmployeeInfo>
{
public WebAppEmployeeInfoRepository() : base(new WebApiContext())
{
}
private IQueryable<WebAppEmployeeInfo> PrepareList(List<int> departmentIds)
{
IQueryable<WebAppEmployeeInfo> items = RepositoryContext.Set<WebAppEmployeeInfo>().AsNoTracking();
return items.Where(x => departmentIds.Contains(x.DepartmentId));
}
public async Task<List<string>> GetEmailListForDepartmentsAsync(List<int> departmentIds)
{
return await PrepareList(departmentIds).Select(x => x.Email).ToListAsync();
}
public async Task<List<string>> GetLoginnameListForDepartmentsAsync(List<int> departmentIds)
{
return await PrepareList(departmentIds).Select(x => x.LoginName).ToListAsync();
}
public async Task<List<string>> GetShortnameListForDepartmentsAsync(List<int> departmentIds)
{
return await PrepareList(departmentIds).Select(x => x.ShortName).ToListAsync();
}
public async Task<string> GetShortnameForLoginAsync(string loginname)
{
return (await RepositoryContext.Set<WebAppEmployeeInfo>().FirstAsync(x => x.LoginName == loginname)).ShortName;
}
//----------------
public List<string> GetEmailListForDepartments(List<int> departmentIds)
{
return PrepareList(departmentIds).Select(x => x.Email).ToList();
}
public List<string> GetLoginnameListForDepartments(List<int> departmentIds)
{
return PrepareList(departmentIds).Select(x => x.LoginName).ToList();
}
public List<string> GetShortnameListForDepartments(List<int> departmentIds)
{
return PrepareList(departmentIds).Select(x => x.ShortName).ToList();
}
public string GetShortnameForLogin(string loginname)
{
return RepositoryContext.Set<WebAppEmployeeInfo>().First(x => x.LoginName == loginname).ShortName;
}
//----------------
public bool PrepareForUserLoginnameOrLoginnameListFilter(LdapUser ldapUser, ref string loginName, ref List<string> loginNameList)
{
if (ldapUser.IsAdmin() || ldapUser.IsMaster())
{
}
else if (ldapUser.IsDepartmentMaster() || ldapUser.IsDepartmentUser())
{
loginNameList = GetLoginnameListForDepartments(ldapUser.DepartmentIdListAll());
loginName = default;
}
else if (ldapUser.IsUser())
{
loginNameList = default;
loginName = ldapUser.LoginName;
}
else
{
return false; //shouldn't happen
}
return true;
}
public bool PrepareForUserEmailOrEmailListFilter(LdapUser ldapUser, ref string EmailBV, ref List<string> EmailBVList)
{
if (string.IsNullOrEmpty(EmailBV)) //check for user & master
{
if (ldapUser.IsAdmin() || ldapUser.IsMaster())
{
// No correction
}
else if (ldapUser.IsDepartmentMaster() || ldapUser.IsDepartmentUser())
{
EmailBVList = GetEmailListForDepartments(ldapUser.DepartmentIdListAll());
EmailBV = default;
}
else if (ldapUser.IsUser())
{
EmailBVList = default;
EmailBV = ldapUser.Email;
}
else
{
return false; //shouldn't happen
}
}
return true;
}
}
}

View File

@@ -0,0 +1,12 @@
using DAL._Shared.SharedModels;
using HRD.WebApi.Repositories;
namespace DAL._Shared.SharedRepositories
{
public class WebAppUserRepository : BaseRepository<WebAppUser>
{
public WebAppUserRepository() : base(new WebApiContext())
{
}
}
}

View File

@@ -0,0 +1,2 @@
dotnet ef dbcontext scaffold "Server=192.168.110.105\\DEV1;Database=ctx;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -o ModelCTX
pause