refactor: Projektdateien migriert. Cloud-NuGet-Pakete durch lokale NuGet-Projekte ersetzt.
This commit is contained in:
14
DAL/DAL.csproj
Normal file
14
DAL/DAL.csproj
Normal file
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Version>2.3.7</Version>
|
||||
<AssemblyVersion>2.3.7.0</AssemblyVersion>
|
||||
<FileVersion>2.3.7.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\HRD.LDAPService\HRD.LDAPService.csproj" />
|
||||
<ProjectReference Include="..\HRD.WebApi\HRD.WebApi.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
26
DAL/Models/Entities/AdWebAppToWebAppRole.cs
Normal file
26
DAL/Models/Entities/AdWebAppToWebAppRole.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class AdWebAppToWebAppRole : BaseEntity
|
||||
{
|
||||
public int AdWebAppToWebAppRoleId { get; set; }
|
||||
public int WebAppId { get; set; }
|
||||
public string AdWebAppName { get; set; }
|
||||
public string AdWebAppRoleName { get; set; }
|
||||
|
||||
public string GetAdGrupSuffix()
|
||||
{
|
||||
return $"{AdWebAppName}_{AdWebAppRoleName}";
|
||||
}
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => AdWebAppToWebAppRoleId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"AdWebAppToWebAppRoleId: {GetEntityId()}; AdWebAppRoleName: {AdWebAppRoleName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
20
DAL/Models/Entities/CostCentre.cs
Normal file
20
DAL/Models/Entities/CostCentre.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class CostCentre : BaseEntity
|
||||
{
|
||||
public int CostCentreId { get; set; }
|
||||
public string CostCentreName { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => CostCentreId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"CostCentreId: {GetEntityId()}; Name: {CostCentreName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
41
DAL/Models/Entities/Department.cs
Normal file
41
DAL/Models/Entities/Department.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class Department : BaseEntity
|
||||
{
|
||||
public int DepartmentId { get; set; }
|
||||
public string DepartmentName { get; set; }
|
||||
public int CostCentreId { get; set; }
|
||||
public int DepartmentTypeId { get; set; }
|
||||
public int? HeadofDepartmentId { get; set; }
|
||||
public int? ExecutiveDirectorId { get; set; }
|
||||
public int? ManagingDirectorId { get; set; }
|
||||
public string DepartmentNameFolder { get; set; }
|
||||
public string AdGroupDepartmentName { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
public bool IsVirtual { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string CostCentre { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string HeadofDepartment { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string ExecutiveDirector { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string ManagingDirector { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => DepartmentId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"DepartmentId: {GetEntityId()}; Name: {DepartmentName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class DepartmentToWebAppToEmployeeForWindream : BaseEntity
|
||||
{
|
||||
public int DepartmentToWebAppToEmployeeForWindreamId { get; set; }
|
||||
public int EmployeeId { get; set; }
|
||||
public int DepartmentId { get; set; }
|
||||
public string DepartmentName { get; set; }
|
||||
public string ShortName { get; set; }
|
||||
public string LoginName { get; set; }
|
||||
public int IsMain { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => DepartmentToWebAppToEmployeeForWindreamId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"DepartmentToWebAppToEmployeeForWindreamId: {GetEntityId()}; EmployeeId: {EmployeeId}; DepartmentId: {DepartmentId}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
28
DAL/Models/Entities/DocumentArt.cs
Normal file
28
DAL/Models/Entities/DocumentArt.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class DocumentArt : BaseEntity
|
||||
{
|
||||
public int DocumentArtId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Shortname { get; set; }
|
||||
public string RootPath { get; set; }
|
||||
public string Folder { get; set; }
|
||||
public string Comment { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string DepartmentNamesList { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => DocumentArtId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"DocumentArtId: {GetEntityId()}; Name: {Name}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
32
DAL/Models/Entities/DocumentArtToDepartment.cs
Normal file
32
DAL/Models/Entities/DocumentArtToDepartment.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class DocumentArtToDepartment : BaseEntity
|
||||
{
|
||||
public int DocumentArtToDepartmentId { get; set; }
|
||||
public int DepartmentId { get; set; }
|
||||
public int DocumentArtId { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public bool? UseGlobix { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string DocumentArtName { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string DocumentArtShortname { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string DocumentArtFolder { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => DocumentArtToDepartmentId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"DocumentArtToDepartmentId: {GetEntityId()}; DepartmentId : {DepartmentId}; DocumentArtId : {DocumentArtId}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
58
DAL/Models/Entities/Employee.cs
Normal file
58
DAL/Models/Entities/Employee.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class Employee : BaseEntity
|
||||
{
|
||||
public int EmployeeId { 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? RangId { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public bool? IsActive { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string MandantCode { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public int? MainDepartmentId { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string DepartmentNamesList { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string DepartmentIdList { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WebappNamesList { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WebappIdList { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string AttributeNamesList { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string AttributeIdList { get; set; }
|
||||
|
||||
public string MobilePhoneNo { get; set; }
|
||||
public string PhoneNo { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => EmployeeId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"EmployeeId: {GetEntityId()}; LoginName: {LoginName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
22
DAL/Models/Entities/EmployeeAttribute.cs
Normal file
22
DAL/Models/Entities/EmployeeAttribute.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class EmployeeAttribute : BaseEntity
|
||||
{
|
||||
public int EmployeeAttributeId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Shortname { get; set; }
|
||||
public string RoleList { get; set; }
|
||||
public int? SeqNo { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => EmployeeAttributeId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"EmployeeAttributeId: {GetEntityId()}; Name: {Name}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
19
DAL/Models/Entities/EmployeeStatus.cs
Normal file
19
DAL/Models/Entities/EmployeeStatus.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class EmployeeStatus : BaseEntity
|
||||
{
|
||||
public int EmployeeStatusId { get; set; }
|
||||
public string EmployeeStatusName { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => EmployeeStatusId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"EmployeeStatusId: {GetEntityId()}; Name: {EmployeeStatusName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
21
DAL/Models/Entities/EmployeeToAttribute.cs
Normal file
21
DAL/Models/Entities/EmployeeToAttribute.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class EmployeeToAttribute : BaseEntity
|
||||
{
|
||||
public int EmployeeToAttributeId { get; set; }
|
||||
public int EmployeeId { get; set; }
|
||||
|
||||
public int EmployeeAttributeId { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => EmployeeToAttributeId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"EmployeeToAttributeId: {GetEntityId()}; EmployeeId: {EmployeeId}; EmployeeAttributeId: {EmployeeAttributeId}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
29
DAL/Models/Entities/EmployeeToDepartment.cs
Normal file
29
DAL/Models/Entities/EmployeeToDepartment.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class EmployeeToDepartment : BaseEntity
|
||||
{
|
||||
public int EmployeeToDepartmentId { get; set; }
|
||||
public int EmployeeId { get; set; }
|
||||
|
||||
public int DepartmentId { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string DepartmentName { get; set; }
|
||||
|
||||
public decimal EmployeeBudget { get; set; }
|
||||
public int? EmployeeStatusId { get; set; }
|
||||
public int? RangId { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => EmployeeToDepartmentId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"EmployeeToDepartmentId: {GetEntityId()}; EmployeeId: {EmployeeId}; DepartmentId: {DepartmentId}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
45
DAL/Models/Entities/EmployeeToWebApp.cs
Normal file
45
DAL/Models/Entities/EmployeeToWebApp.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class EmployeeToWebApp : BaseEntity
|
||||
{
|
||||
public int EmployeeToWebAppId { get; set; }
|
||||
public int EmployeeId { get; set; }
|
||||
public int WebAppId { get; set; }
|
||||
|
||||
public int WebAppRoleId { get; set; }
|
||||
public int? DepartmentId { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WebAppRoleName { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WebAppName { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string DepartmentName { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string ExtendedDepartmentNameList { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string ExtendedDepartmentIdList { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string AdditionalRoleNameList { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string AdditionalRoleIdList { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => EmployeeToWebAppId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"EmployeeToWebAppId: {GetEntityId()}; EmployeeId: {EmployeeId}; WebAppId: {WebAppId}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
19
DAL/Models/Entities/Project.cs
Normal file
19
DAL/Models/Entities/Project.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class Project : BaseEntity
|
||||
{
|
||||
public int ProjectId { get; set; }
|
||||
public string ProjectName { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => ProjectId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"ProjectId: {GetEntityId()}; Name: {ProjectName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
21
DAL/Models/Entities/Rang.cs
Normal file
21
DAL/Models/Entities/Rang.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class Rang : BaseEntity
|
||||
{
|
||||
public int RangId { get; set; }
|
||||
public string RangName { get; set; }
|
||||
public string RangShortname { get; set; }
|
||||
public int RangOrder { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => RangId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"RangId: {GetEntityId()}; Name: {RangName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
25
DAL/Models/Entities/Subsidiary.cs
Normal file
25
DAL/Models/Entities/Subsidiary.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class Subsidiary : BaseEntity
|
||||
{
|
||||
public int SubsidiaryId { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string SubsidiaryCode { get; set; }
|
||||
public string Comment { get; set; }
|
||||
|
||||
// [NotMapped]
|
||||
// [DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => SubsidiaryId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"SubsidiaryId: {GetEntityId()}; Name: {Name}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
23
DAL/Models/Entities/WebApp.cs
Normal file
23
DAL/Models/Entities/WebApp.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WebApp : BaseEntity
|
||||
{
|
||||
public int WebAppId { get; set; }
|
||||
public string WebAppName { get; set; }
|
||||
public string WebAppLinkLive { get; set; }
|
||||
public string WebAppLinkDev { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public string AdWebAppName { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WebAppId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WebAppId: {GetEntityId()}; Name: {WebAppName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
21
DAL/Models/Entities/WebAppAdditionalRole.cs
Normal file
21
DAL/Models/Entities/WebAppAdditionalRole.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WebAppAdditionalRole : BaseEntity
|
||||
{
|
||||
public int WebAppAdditionalRoleId { get; set; }
|
||||
public int WebAppId { get; set; }
|
||||
public string WebAppAdditionalRoleName { get; set; }
|
||||
public string AdWebAppAdditionalRoleName { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WebAppAdditionalRoleId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WebAppAdditionalRoleId: {GetEntityId()}; WebAppId: {WebAppId}; WebAppAdditionalRoleName: {WebAppAdditionalRoleName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
20
DAL/Models/Entities/WebAppRole.cs
Normal file
20
DAL/Models/Entities/WebAppRole.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WebAppRole : BaseEntity
|
||||
{
|
||||
public int WebAppRoleId { get; set; }
|
||||
public string WebAppRoleName { get; set; }
|
||||
public int WebAppRoleHierarchy { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WebAppRoleId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WebAppRoleId: {GetEntityId()}; WebAppRoleName: {WebAppRoleName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
24
DAL/Models/Entities/WebAppToDepartment.cs
Normal file
24
DAL/Models/Entities/WebAppToDepartment.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WebAppToDepartment : BaseEntity
|
||||
{
|
||||
public int WebAppToDepartmentId { get; set; }
|
||||
public int EmployeeToWebAppId { get; set; }
|
||||
public int DepartmentId { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string DepartmentName { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WebAppToDepartmentId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WebAppToDepartmentId: {GetEntityId()}; EmployeeToWebAppId: {EmployeeToWebAppId}; DepartmentId: {DepartmentId}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
20
DAL/Models/Entities/WebAppToWebAppAdditionalRole.cs
Normal file
20
DAL/Models/Entities/WebAppToWebAppAdditionalRole.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WebAppToWebAppAdditionalRole : BaseEntity
|
||||
{
|
||||
public int WebAppToWebAppAdditionalRoleId { get; set; }
|
||||
public int WebAppAdditionalRoleId { get; set; }
|
||||
public int EmployeeToWebAppId { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WebAppToWebAppAdditionalRoleId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WebAppToWebAppAdditionalRoleId: {GetEntityId()}; WebAppAdditionalRoleId: {WebAppAdditionalRoleId}; EmployeeToWebAppId: {EmployeeToWebAppId}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
27
DAL/Models/Entities/WebAppToWebAppRole.cs
Normal file
27
DAL/Models/Entities/WebAppToWebAppRole.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WebAppToWebAppRole : BaseEntity
|
||||
{
|
||||
public int WebAppToWebAppRoleId { get; set; }
|
||||
public int WebAppId { get; set; }
|
||||
public int WebAppRoleId { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WebAppRoleName { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public int WebAppRoleHierarchy { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WebAppToWebAppRoleId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WebAppToWebAppRoleId: {GetEntityId()}; WebAppId: {WebAppId}; WebAppRoleId: {WebAppRoleId}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
33
DAL/Models/Entities/WindreamColumnsToDepartment.cs
Normal file
33
DAL/Models/Entities/WindreamColumnsToDepartment.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WindreamColumnsToDepartment : BaseEntity
|
||||
{
|
||||
public int WindreamColumnsToDepartmentId { get; set; }
|
||||
public int AttributeDwAttrId { get; set; }
|
||||
public string AttributeSzColumnName { get; set; }
|
||||
public string Comment { get; set; }
|
||||
public int AttributeDwAttrType { get; set; }
|
||||
public int ComumnLength { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string ObjectTypeAttributeSzName { get; set; }
|
||||
|
||||
public int ClientId { get; set; }
|
||||
public string ObjectTypeszDocTypeName { get; set; }
|
||||
public int DepartmentId { get; set; }
|
||||
public int Seq { get; set; }
|
||||
public int WindreamSearchId { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WindreamColumnsToDepartmentId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WindreamColumnsToDepartmentId: {GetEntityId()}; AttributeSzColumnName: {AttributeSzColumnName}; DepartmentId: {DepartmentId}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
25
DAL/Models/Entities/WindreamIndex.cs
Normal file
25
DAL/Models/Entities/WindreamIndex.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WindreamIndex : BaseEntity
|
||||
{
|
||||
public int WindreamIndexId { get; set; }
|
||||
public int AttributeDwAttrId { get; set; }
|
||||
public string AttributeSzColumnName { get; set; }
|
||||
public string Comment { get; set; }
|
||||
public int? ComumnLength { get; set; }
|
||||
public int? AttributeDwAttrType { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public string ObjectTypeAttributeSzName { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WindreamIndexId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WindreamIndexId: {GetEntityId()}; AttributeSzColumnName: {AttributeSzColumnName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WindreamIndexToWindreamSearchToDepartment : BaseEntity
|
||||
{
|
||||
public int WindreamIndexToWindreamSearchToDepartmentId { get; set; }
|
||||
public int WindreamSearchToDepartmentId { get; set; }
|
||||
public int WindreamIndexId { get; set; }
|
||||
public int Seq { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string AttributeSzColumnName { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string ObjectTypeAttributeSzName { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WindreamIndexToWindreamSearchToDepartmentId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WindreamIndexToWindreamSearchToDepartmentId: {GetEntityId()}; WindreamSearchToDepartmentId: {WindreamSearchToDepartmentId}; AttributeSzColumnName: {AttributeSzColumnName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
22
DAL/Models/Entities/WindreamInputFolder.cs
Normal file
22
DAL/Models/Entities/WindreamInputFolder.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WindreamInputFolder : BaseEntity
|
||||
{
|
||||
public int WindreamInputFolderId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string XMLPath { get; set; }
|
||||
public string Comment { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WindreamInputFolderId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WindreamInputFolderId: {GetEntityId()}; Name: {Name}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
24
DAL/Models/Entities/WindreamSearch.cs
Normal file
24
DAL/Models/Entities/WindreamSearch.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WindreamSearch : BaseEntity
|
||||
{
|
||||
public int WindreamSearchId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string XMLPath { get; set; }
|
||||
public string Comment { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public int? Color { get; set; }
|
||||
public int? SearchIndex { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WindreamSearchId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WindreamSearchId: {GetEntityId()}; Name: {Name}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
30
DAL/Models/Entities/WindreamSearchItem.cs
Normal file
30
DAL/Models/Entities/WindreamSearchItem.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WindreamSearchItem : BaseEntity
|
||||
{
|
||||
public int WindreamSearchItemId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Comment { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public string Caption { get; set; }
|
||||
public string PlaceHolder { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string SearchTemplate { get; set; }
|
||||
|
||||
public string ConnectedList { get; set; }
|
||||
public string AlternativeWindreamSearchItemIdList { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WindreamSearchItemId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WindreamSearchItemId: {GetEntityId()}; Name: {Name}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WindreamSearchItemToWindreamSearchToDepartment : BaseEntity
|
||||
{
|
||||
public int WindreamSearchItemToWindreamSearchToDepartmentId { get; set; }
|
||||
public int WindreamSearchToDepartmentId { get; set; }
|
||||
public int Seq { get; set; }
|
||||
public int WindreamSearchItemId { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public int DepartmentId { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WindreamSearchItemName { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WindreamSearchItemCaption { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WindreamSearchItemPlaceHolder { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WindreamSearchItemSearchTemplate { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WindreamSearchItemTemplate { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WindreamSearchItemConnectedList { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WindreamSearchItemComment { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public int? WindreamSearchIndexType { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WindreamSearchItemToWindreamSearchToDepartmentId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WindreamSearchItemToWindreamSearchToDepartmentId: {GetEntityId()}; WindreamSearchToDepartmentId: {WindreamSearchToDepartmentId}; WindreamSearchItemName: {WindreamSearchItemName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
38
DAL/Models/Entities/WindreamSearchToDepartment.cs
Normal file
38
DAL/Models/Entities/WindreamSearchToDepartment.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using HRD.WebApi.DAL;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DAL.Models.Entities
|
||||
{
|
||||
public partial class WindreamSearchToDepartment : BaseEntity
|
||||
{
|
||||
public int WindreamSearchToDepartmentId { get; set; }
|
||||
public int DepartmentId { get; set; }
|
||||
public int WindreamSearchId { get; set; }
|
||||
public int Seq { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string DepartmentName { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WindreamSearchName { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WindreamSearchXMLPath { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public string WindreamSearchComment { get; set; }
|
||||
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public int? WindreamSearchColor { get; set; }
|
||||
|
||||
//generic Id
|
||||
public override int GetEntityId() => WindreamSearchToDepartmentId;
|
||||
|
||||
//generic ToString()
|
||||
public override string ToString() => $"WindreamSearchToDepartmentId: {GetEntityId()}; DepartmentName: {DepartmentName}; WindreamSearchName: {WindreamSearchName}";
|
||||
|
||||
//generic EntityInfo()
|
||||
public override string EntityInfo() => base.EntityInfo();
|
||||
}
|
||||
}
|
||||
9
DAL/Models/Filters/ClientIdFilter.cs
Normal file
9
DAL/Models/Filters/ClientIdFilter.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Filters
|
||||
{
|
||||
public partial class ClientIdFilter : BaseFilter
|
||||
{
|
||||
public int? ClientId { get; set; }
|
||||
}
|
||||
}
|
||||
10
DAL/Models/Filters/DepartmentFilter.cs
Normal file
10
DAL/Models/Filters/DepartmentFilter.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Filters
|
||||
{
|
||||
public partial class DepartmentFilter : BaseFilter
|
||||
{
|
||||
public int? DepartmentId { get; set; }
|
||||
public int? WindreamSearchId { get; set; }
|
||||
}
|
||||
}
|
||||
9
DAL/Models/Filters/DepartmentFullFilter.cs
Normal file
9
DAL/Models/Filters/DepartmentFullFilter.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Filters
|
||||
{
|
||||
public partial class DepartmentFullFilter : BaseFilter
|
||||
{
|
||||
public string DepartmentName { get; set; }
|
||||
}
|
||||
}
|
||||
11
DAL/Models/Filters/EmployeeFilter.cs
Normal file
11
DAL/Models/Filters/EmployeeFilter.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Filters
|
||||
{
|
||||
public partial class EmployeeFilter : BaseFilter
|
||||
{
|
||||
public int? EmployeeId { get; set; }
|
||||
public string LoginName { get; set; }
|
||||
public string ShortName { get; set; }
|
||||
}
|
||||
}
|
||||
18
DAL/Models/Filters/EmployeeFullFilter.cs
Normal file
18
DAL/Models/Filters/EmployeeFullFilter.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Filters
|
||||
{
|
||||
public partial class EmployeeFullFilter : BaseFilter
|
||||
{
|
||||
public int? EmployeeId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ShortName { get; set; }
|
||||
public string LoginName { get; set; }
|
||||
public string Email { get; set; }
|
||||
public int[] WebappIds { get; set; }
|
||||
public int[] DepartmentIds { get; set; }
|
||||
public int[] AttributeIds { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
public bool? IsActive { get; set; }
|
||||
}
|
||||
}
|
||||
9
DAL/Models/Filters/EmployeeToWebAppFilter.cs
Normal file
9
DAL/Models/Filters/EmployeeToWebAppFilter.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Filters
|
||||
{
|
||||
public partial class EmployeeToWebAppFilter : BaseFilter
|
||||
{
|
||||
public int? EmployeeToWebAppId { get; set; }
|
||||
}
|
||||
}
|
||||
9
DAL/Models/Filters/WebAppFilter.cs
Normal file
9
DAL/Models/Filters/WebAppFilter.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Filters
|
||||
{
|
||||
public partial class WebAppFilter : BaseFilter
|
||||
{
|
||||
public int? WebAppId { get; set; }
|
||||
}
|
||||
}
|
||||
10
DAL/Models/Filters/WindreamInputFolderFilter.cs
Normal file
10
DAL/Models/Filters/WindreamInputFolderFilter.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Filters
|
||||
{
|
||||
public partial class WindreamInputFolderFilter : BaseFilter
|
||||
{
|
||||
public int? WindreamInputFolderId { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
}
|
||||
}
|
||||
10
DAL/Models/Filters/WindreamSearchToDepartmentFilter.cs
Normal file
10
DAL/Models/Filters/WindreamSearchToDepartmentFilter.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
namespace DAL.Models.Filters
|
||||
{
|
||||
public partial class WindreamSearchToDepartmentFilter : BaseFilter
|
||||
{
|
||||
public int? WindreamSearchToDepartmentId { get; set; }
|
||||
public int? DepartmentId { get; set; }
|
||||
}
|
||||
}
|
||||
12
DAL/Repositories/AdWebAppToWebAppRoleRepository.cs
Normal file
12
DAL/Repositories/AdWebAppToWebAppRoleRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using DAL.Models.Entities;
|
||||
using HRD.WebApi.Repositories;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class AdWebAppToWebAppRoleRepository : BaseRepository<AdWebAppToWebAppRole>
|
||||
{
|
||||
public AdWebAppToWebAppRoleRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
12
DAL/Repositories/CostCentreRepository.cs
Normal file
12
DAL/Repositories/CostCentreRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using DAL.Models.Entities;
|
||||
using HRD.WebApi.Repositories;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class CostCentreRepository : BaseRepository<CostCentre>
|
||||
{
|
||||
public CostCentreRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
34
DAL/Repositories/DepartmentRepository.cs
Normal file
34
DAL/Repositories/DepartmentRepository.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class DepartmentRepository : BaseRepository<Department>
|
||||
{
|
||||
public DepartmentRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<Department>> GetDepartmentListAsync(DepartmentFullFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<Department>().AsQueryable();
|
||||
|
||||
if (!string.IsNullOrEmpty(filter.DepartmentName))
|
||||
{
|
||||
items = items.Where(x => EF.Functions.Like(x.DepartmentName, $"%{filter.DepartmentName}%"));
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> ReplaceWindreamTiles(int srcDepartmentId, string trgDepartmentIds)
|
||||
{
|
||||
return await ExecStoredProcedureAsync("webapi.sp_TransferWindreamSettings", $"{srcDepartmentId}, null, \"{trgDepartmentIds}\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class DepartmentToWebAppToEmployeeForWindreamRepository : BaseRepository<DepartmentToWebAppToEmployeeForWindream>
|
||||
{
|
||||
public DepartmentToWebAppToEmployeeForWindreamRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<DepartmentToWebAppToEmployeeForWindream>> GetListByFilterAsync(EmployeeFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<DepartmentToWebAppToEmployeeForWindream>().AsQueryable();
|
||||
|
||||
if (filter.EmployeeId != null && filter.EmployeeId != 0)
|
||||
{
|
||||
items = items.Where(x => x.EmployeeId == filter.EmployeeId);
|
||||
return asNoTracking ? await items.ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(filter.ShortName))
|
||||
{
|
||||
items = items.Where(x => x.ShortName == filter.ShortName);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(filter.LoginName))
|
||||
{
|
||||
items = items.Where(x => x.LoginName.ToLower() == filter.LoginName.ToLower());
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.OrderBy(x => x.DepartmentName).AsNoTracking().ToListAsync() : await items.OrderBy(x => x.DepartmentName).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
DAL/Repositories/DocumentArtRepository.cs
Normal file
12
DAL/Repositories/DocumentArtRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using DAL.Models.Entities;
|
||||
using HRD.WebApi.Repositories;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class DocumentArtRepository : BaseRepository<DocumentArt>
|
||||
{
|
||||
public DocumentArtRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
29
DAL/Repositories/DocumentArtToDepartmentRepository.cs
Normal file
29
DAL/Repositories/DocumentArtToDepartmentRepository.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class DocumentArtToDepartmentRepository : BaseRepository<DocumentArtToDepartment>
|
||||
{
|
||||
public DocumentArtToDepartmentRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<DocumentArtToDepartment>> GetListByFilterAsync(DepartmentFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<DocumentArtToDepartment>().AsQueryable();
|
||||
|
||||
if (filter.DepartmentId != null && filter.DepartmentId != 0)
|
||||
{
|
||||
items = items.Where(x => x.DepartmentId == filter.DepartmentId);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
DAL/Repositories/EmployeeAttributeRepository.cs
Normal file
12
DAL/Repositories/EmployeeAttributeRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using DAL.Models.Entities;
|
||||
using HRD.WebApi.Repositories;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class EmployeeAttributeRepository : BaseRepository<EmployeeAttribute>
|
||||
{
|
||||
public EmployeeAttributeRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
96
DAL/Repositories/EmployeeRepository.cs
Normal file
96
DAL/Repositories/EmployeeRepository.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class EmployeeRepository : BaseRepository<Employee>
|
||||
{
|
||||
public EmployeeRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<Employee>> GetListByFilterAsync(EmployeeFullFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<Employee>().AsQueryable();
|
||||
|
||||
if (filter.EmployeeId != null && filter.EmployeeId != 0)
|
||||
{
|
||||
items = items.Where(x => x.EmployeeId == filter.EmployeeId);
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(filter.Name))
|
||||
{
|
||||
items = items.Where(x => EF.Functions.Like(x.FirstName.ToLower() + ' ' + x.LastName.ToLower(), $"%{filter.Name.ToLower()}%"));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(filter.Email))
|
||||
{
|
||||
items = items.Where(x => EF.Functions.Like(x.Email.ToLower(), $"%{filter.Email.ToLower()}%"));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(filter.ShortName))
|
||||
{
|
||||
items = items.Where(x => EF.Functions.Like(x.ShortName.ToLower(), $"%{filter.ShortName.ToLower()}%"));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(filter.LoginName))
|
||||
{
|
||||
items = items.Where(x => EF.Functions.Like(x.LoginName.ToLower(), $"%{filter.LoginName.ToLower()}%"));
|
||||
}
|
||||
|
||||
if (filter.DepartmentIds != null && filter.DepartmentIds.Length > 0)
|
||||
{
|
||||
IQueryable<Employee> itemsTmp = null;
|
||||
for (int i = 0; i < filter.DepartmentIds.Length; i++)
|
||||
{
|
||||
var inx = filter.DepartmentIds[i];
|
||||
var items_ = items.Where(x => EF.Functions.Like("," + x.DepartmentIdList.Replace(" ", "") + ",", $"%,{inx},%"));
|
||||
itemsTmp = itemsTmp != null ? itemsTmp.Union(items_) : items_;
|
||||
}
|
||||
items = itemsTmp;
|
||||
}
|
||||
|
||||
if (filter.WebappIds != null && filter.WebappIds.Length > 0)
|
||||
{
|
||||
IQueryable<Employee> itemsTmp = null;
|
||||
for (int i = 0; i < filter.WebappIds.Length; i++)
|
||||
{
|
||||
var inx = filter.WebappIds[i];
|
||||
var items_ = items.Where(x => EF.Functions.Like("," + x.WebappIdList.Replace(" ", "") + ",", $"%,{inx},%"));
|
||||
itemsTmp = (itemsTmp != null) ? itemsTmp.Union(items_) : items_;
|
||||
}
|
||||
items = itemsTmp;
|
||||
}
|
||||
|
||||
if (filter.AttributeIds != null && filter.AttributeIds.Length > 0)
|
||||
{
|
||||
IQueryable<Employee> itemsTmp = null;
|
||||
for (int i = 0; i < filter.AttributeIds.Length; i++)
|
||||
{
|
||||
var inx = filter.AttributeIds[i];
|
||||
var items_ = items.Where(x => EF.Functions.Like("," + x.AttributeIdList.Replace(" ", "") + ",", $"%,{inx},%"));
|
||||
itemsTmp = (itemsTmp != null) ? itemsTmp.Concat(items_) : items_;
|
||||
}
|
||||
items = itemsTmp;
|
||||
}
|
||||
|
||||
if (filter.ClientId != null && filter.ClientId != 0)
|
||||
{
|
||||
items = items.Where(x => x.ClientId == filter.ClientId);
|
||||
}
|
||||
|
||||
if (filter.IsActive != null)
|
||||
{
|
||||
items = items.Where(x => x.IsActive == filter.IsActive);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
DAL/Repositories/EmployeeStatusRepository.cs
Normal file
12
DAL/Repositories/EmployeeStatusRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using DAL.Models.Entities;
|
||||
using HRD.WebApi.Repositories;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class EmployeeStatusRepository : BaseRepository<EmployeeStatus>
|
||||
{
|
||||
public EmployeeStatusRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
29
DAL/Repositories/EmployeeToAttributeRepository.cs
Normal file
29
DAL/Repositories/EmployeeToAttributeRepository.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class EmployeeToAttributeRepository : BaseRepository<EmployeeToAttribute>
|
||||
{
|
||||
public EmployeeToAttributeRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeToAttribute>> GetListByFilterAsync(EmployeeFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<EmployeeToAttribute>().AsQueryable();
|
||||
|
||||
if (filter.EmployeeId != null && filter.EmployeeId != 0)
|
||||
{
|
||||
items = items.Where(x => x.EmployeeId == filter.EmployeeId);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
29
DAL/Repositories/EmployeeToDepartmentRepository.cs
Normal file
29
DAL/Repositories/EmployeeToDepartmentRepository.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class EmployeeToDepartmentRepository : BaseRepository<EmployeeToDepartment>
|
||||
{
|
||||
public EmployeeToDepartmentRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeToDepartment>> GetListByFilterAsync(EmployeeFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<EmployeeToDepartment>().AsQueryable();
|
||||
|
||||
if (filter.EmployeeId != null && filter.EmployeeId != 0)
|
||||
{
|
||||
items = items.Where(x => x.EmployeeId == filter.EmployeeId);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
253
DAL/Repositories/EmployeeToWebAppRepository.cs
Normal file
253
DAL/Repositories/EmployeeToWebAppRepository.cs
Normal file
@@ -0,0 +1,253 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.LDAPService;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class EmployeeToWebAppRepository : BaseRepository<EmployeeToWebApp>
|
||||
{
|
||||
public EmployeeToWebAppRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<bool> DeleteEmloyeeToWebAppAsync(int webAppId)
|
||||
{
|
||||
var list = await GetListByAsync(x => x.WebAppId == webAppId);
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (!await DeleteByIdAsync(item.EmployeeId))
|
||||
{
|
||||
throw new Exception($"Couldn't delete the Employee-Id: {item.EmployeeId}");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeToWebApp>> GetListByFilterAsync(EmployeeFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<EmployeeToWebApp>().AsQueryable();
|
||||
|
||||
if (filter.EmployeeId != null && filter.EmployeeId != 0)
|
||||
{
|
||||
items = items.Where(x => x.EmployeeId == filter.EmployeeId);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
|
||||
private async Task<bool> AddUserToAdGroup(EmployeeToWebApp entity, int webRoleId, int? departementId)
|
||||
{
|
||||
return await ProcessGroup(entity, "adding", webRoleId, departementId);
|
||||
}
|
||||
|
||||
private async Task<bool> RemoveUserFromAdGroup(EmployeeToWebApp entity, int webRoleId, int? departementId)
|
||||
{
|
||||
return await ProcessGroup(entity, "deleting", webRoleId, departementId);
|
||||
}
|
||||
|
||||
private async Task<bool> ProcessGroup(EmployeeToWebApp entity, string action, int webRoleId, int? departementId)
|
||||
{
|
||||
string groupSuffix = null;
|
||||
if (entity == default) throw new ArgumentNullException(nameof(entity));
|
||||
if (entity == default) throw new ArgumentNullException(nameof(entity));
|
||||
|
||||
var department = await GetDepartmentById(departementId);
|
||||
|
||||
var employee = await GetEmployeeById(entity.EmployeeId);
|
||||
if (employee == default) throw new ArgumentNullException(nameof(employee));
|
||||
|
||||
var webapp = await GetWebAppById(entity.WebAppId);
|
||||
if (webapp == default) throw new ArgumentNullException(nameof(webapp));
|
||||
|
||||
bool result = true;
|
||||
var isAdding = action == "adding";
|
||||
|
||||
var webappRole = await GetWebAppRoleById(webRoleId);
|
||||
|
||||
try
|
||||
{
|
||||
if (department != default && !string.IsNullOrEmpty(department.AdGroupDepartmentName))
|
||||
{
|
||||
groupSuffix = $"{webapp.AdWebAppName}_{department.AdGroupDepartmentName}";
|
||||
if (LdapManager.IsWindreamSuffixGroup(groupSuffix))
|
||||
{
|
||||
if (isAdding) result = LdapManager.AD_AddUserloginToGroup(employee.LoginName, groupSuffix);
|
||||
else result = LdapManager.AD_RemoveUserFromGroup(employee.LoginName, groupSuffix);
|
||||
}
|
||||
}
|
||||
|
||||
if (webappRole != default)
|
||||
{
|
||||
groupSuffix = $"{webapp.AdWebAppName}_{webappRole.WebAppRoleName}";
|
||||
if (isAdding) result = LdapManager.AD_AddUserloginToGroup(employee.LoginName, groupSuffix);
|
||||
else result = LdapManager.AD_RemoveUserFromGroup(employee.LoginName, groupSuffix);
|
||||
|
||||
if (LdapManager.IsWindreamAdminGroup(groupSuffix))
|
||||
{
|
||||
groupSuffix = $"{webapp.AdWebAppName}_User";
|
||||
if (isAdding) result = LdapManager.AD_AddUserloginToGroup(employee.LoginName, groupSuffix);
|
||||
else result = LdapManager.AD_RemoveUserFromGroup(employee.LoginName, groupSuffix);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"An error occurred while '{action}' the '{employee.LoginName}' into '{groupSuffix}'.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!result)
|
||||
{
|
||||
WriteLogError($"An error occurred while '{action}' the '{employee.LoginName}' into '{groupSuffix}'.");
|
||||
return false;
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async Task<bool> UpdateAsync(EmployeeToWebApp entity, bool saveEntity = true)
|
||||
{
|
||||
if (entity == default)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(entity));
|
||||
}
|
||||
|
||||
var orgEntity = await base.GetByIdAsync(entity.EmployeeToWebAppId, true);
|
||||
var oldWebAppRoleId = 0;
|
||||
var newWebAppRoleId = 0;
|
||||
if (orgEntity.WebAppRoleId != entity.WebAppRoleId)
|
||||
{
|
||||
oldWebAppRoleId = orgEntity.WebAppRoleId;
|
||||
newWebAppRoleId = entity.WebAppRoleId;
|
||||
}
|
||||
int? oldDepartmentId = 0;
|
||||
int? newDepartmentId = 0;
|
||||
if (orgEntity.DepartmentId != entity.DepartmentId)
|
||||
{
|
||||
oldDepartmentId = orgEntity.DepartmentId;
|
||||
newDepartmentId = entity.DepartmentId;
|
||||
}
|
||||
orgEntity = null;
|
||||
|
||||
if ((oldDepartmentId == 0 && oldWebAppRoleId == 0) ||
|
||||
await RemoveUserFromAdGroup(entity, oldWebAppRoleId, oldDepartmentId)
|
||||
&& await AddUserToAdGroup(entity, newWebAppRoleId, newDepartmentId))
|
||||
{
|
||||
var result = await base.UpdateAsync(entity, saveEntity);
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override async Task<bool> UpdateListAsync(List<EmployeeToWebApp> entities, bool saveEntity = true)
|
||||
{
|
||||
var result = true;
|
||||
for (int i = 0; i < entities.Count; i++)
|
||||
{
|
||||
if (!await UpdateAsync(entities[i], saveEntity)) result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public override async Task<bool> AddAsync(EmployeeToWebApp entity, bool saveEntity = true)
|
||||
{
|
||||
if (await AddUserToAdGroup(entity, entity.WebAppRoleId, entity.DepartmentId))
|
||||
{
|
||||
var result = await base.AddAsync(entity, saveEntity);
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override async Task<bool> AddListAsync(List<EmployeeToWebApp> entities, bool saveEntity = true)
|
||||
{
|
||||
var result = true;
|
||||
for (int i = 0; i < entities.Count; i++)
|
||||
{
|
||||
if (!await AddAsync(entities[i], saveEntity)) result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public override async Task<bool> DeleteByIdAsync(int id, bool saveEntity = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
var entity = await base.GetByIdAsync(id);
|
||||
if (entity == default)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(entity));
|
||||
}
|
||||
|
||||
if (await RemoveUserFromAdGroup(entity, entity.WebAppRoleId, entity.DepartmentId))
|
||||
{
|
||||
var result = await base.DeleteByIdAsync(id, saveEntity);
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"An error occurred while deleting the Id {id}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<WebApp> GetWebAppById(int entityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await this.RepositoryContext.Set<WebApp>().FindAsync(entityId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
base.WriteLogException(ex, $"{typeof(WebApp).Name} id:{entityId}");
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
public async Task<Department> GetDepartmentById(int? entityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await this.RepositoryContext.Set<Department>().FindAsync(entityId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"{typeof(Department).Name} id:{entityId}");
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
public async Task<Employee> GetEmployeeById(int entityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await this.RepositoryContext.Set<Employee>().FindAsync(entityId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"{typeof(Employee).Name} id:{entityId}");
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
public async Task<WebAppRole> GetWebAppRoleById(int entityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await this.RepositoryContext.Set<WebAppRole>().FindAsync(entityId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"{typeof(WebAppRole).Name} id:{entityId}");
|
||||
}
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
DAL/Repositories/ProjectRepository.cs
Normal file
12
DAL/Repositories/ProjectRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using DAL.Models.Entities;
|
||||
using HRD.WebApi.Repositories;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class ProjectRepository : BaseRepository<Project>
|
||||
{
|
||||
public ProjectRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
12
DAL/Repositories/RangRepository.cs
Normal file
12
DAL/Repositories/RangRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using DAL.Models.Entities;
|
||||
using HRD.WebApi.Repositories;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class RangRepository : BaseRepository<Rang>
|
||||
{
|
||||
public RangRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
12
DAL/Repositories/SubsidiaryRepository.cs
Normal file
12
DAL/Repositories/SubsidiaryRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using DAL.Models.Entities;
|
||||
using HRD.WebApi.Repositories;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class SubsidiaryRepository : BaseRepository<Subsidiary>
|
||||
{
|
||||
public SubsidiaryRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
29
DAL/Repositories/WebAppAdditionalRoleRepository.cs
Normal file
29
DAL/Repositories/WebAppAdditionalRoleRepository.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WebAppAdditionalRoleRepository : BaseRepository<WebAppAdditionalRole>
|
||||
{
|
||||
public WebAppAdditionalRoleRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<WebAppAdditionalRole>> GetListByFilterAsync(WebAppFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<WebAppAdditionalRole>().AsQueryable();
|
||||
|
||||
if (filter.WebAppId != null && filter.WebAppId != 0)
|
||||
{
|
||||
items = items.Where(x => x.WebAppId == filter.WebAppId);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
DAL/Repositories/WebAppRepository.cs
Normal file
12
DAL/Repositories/WebAppRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using DAL.Models.Entities;
|
||||
using HRD.WebApi.Repositories;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WebAppRepository : BaseRepository<WebApp>
|
||||
{
|
||||
public WebAppRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
12
DAL/Repositories/WebAppRoleRepository.cs
Normal file
12
DAL/Repositories/WebAppRoleRepository.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using DAL.Models.Entities;
|
||||
using HRD.WebApi.Repositories;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WebAppRoleRepository : BaseRepository<WebAppRole>
|
||||
{
|
||||
public WebAppRoleRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
178
DAL/Repositories/WebAppToDepartmentRepository.cs
Normal file
178
DAL/Repositories/WebAppToDepartmentRepository.cs
Normal file
@@ -0,0 +1,178 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.LDAPService;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WebAppToDepartmentRepository : BaseRepository<WebAppToDepartment>
|
||||
{
|
||||
public WebAppToDepartmentRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<WebAppToDepartment>> GetListByFilterAsync(EmployeeToWebAppFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<WebAppToDepartment>().AsQueryable();
|
||||
|
||||
if (filter.EmployeeToWebAppId != null && filter.EmployeeToWebAppId != 0)
|
||||
{
|
||||
items = items.Where(x => x.EmployeeToWebAppId == filter.EmployeeToWebAppId);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
|
||||
private async Task<bool> AddUserToAdGroup(WebAppToDepartment entity)
|
||||
{
|
||||
return await ProcessGroup(entity, "adding");
|
||||
}
|
||||
|
||||
private async Task<bool> RemoveUserFromAdGroup(WebAppToDepartment entity)
|
||||
{
|
||||
return await ProcessGroup(entity, "deleting");
|
||||
}
|
||||
|
||||
private async Task<bool> ProcessGroup(WebAppToDepartment entity, string action)
|
||||
{
|
||||
if (entity == default) throw new ArgumentNullException(nameof(entity));
|
||||
|
||||
var employee2Web = await GetEmployeeToWebAppById(entity.EmployeeToWebAppId);
|
||||
if (employee2Web == default) throw new ArgumentNullException(nameof(employee2Web));
|
||||
|
||||
var department = await GetDepartmentById(entity.DepartmentId);
|
||||
if (department == default) throw new ArgumentNullException(nameof(department));
|
||||
if (string.IsNullOrEmpty(department.AdGroupDepartmentName)) return true;
|
||||
|
||||
var employee = await GetEmployeeById(employee2Web.EmployeeId);
|
||||
if (employee == default) throw new ArgumentNullException(nameof(employee));
|
||||
|
||||
var webapp = await GetWebAppById(employee2Web.WebAppId);
|
||||
if (webapp == default) throw new ArgumentNullException(nameof(webapp));
|
||||
|
||||
bool result;
|
||||
var isAdding = action == "adding";
|
||||
|
||||
var groupSuffix = $"{webapp.AdWebAppName}_{department.AdGroupDepartmentName}";
|
||||
if (!LdapManager.IsWindreamSuffixGroup(groupSuffix)) return true;
|
||||
try
|
||||
{
|
||||
if (isAdding) result = LdapManager.AD_AddUserloginToGroup(employee.LoginName, groupSuffix);
|
||||
else result = LdapManager.AD_RemoveUserFromGroup(employee.LoginName, groupSuffix);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"An error occurred while '{action}' the '{employee.LoginName}' into '{groupSuffix}'.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!result)
|
||||
{
|
||||
WriteLogError($"An error occurred while '{action}' the '{employee.LoginName}' into '{groupSuffix}'.");
|
||||
return false;
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async Task<bool> AddAsync(WebAppToDepartment entity, bool saveEntity = true)
|
||||
{
|
||||
if (await AddUserToAdGroup(entity))
|
||||
{
|
||||
var result = await base.AddAsync(entity, saveEntity);
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override async Task<bool> AddListAsync(List<WebAppToDepartment> entities, bool saveEntity = true)
|
||||
{
|
||||
var result = true;
|
||||
for (int i = 0; i < entities.Count; i++)
|
||||
{
|
||||
if (!await AddAsync(entities[i], saveEntity)) result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public override async Task<bool> DeleteByIdAsync(int id, bool saveEntity = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
var entity = await base.GetByIdAsync(id);
|
||||
if (entity == default)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(entity));
|
||||
}
|
||||
|
||||
if (await RemoveUserFromAdGroup(entity))
|
||||
{
|
||||
var result = await base.DeleteByIdAsync(id, saveEntity);
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"An error occurred while deleting the Id {id}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<EmployeeToWebApp> GetEmployeeToWebAppById(int entityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await this.RepositoryContext.Set<EmployeeToWebApp>().FindAsync(entityId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"{typeof(EmployeeToWebApp).Name} id:{entityId}");
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
public async Task<WebApp> GetWebAppById(int entityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await this.RepositoryContext.Set<WebApp>().FindAsync(entityId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"{typeof(WebApp).Name} id:{entityId}");
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
public async Task<Department> GetDepartmentById(int entityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await this.RepositoryContext.Set<Department>().FindAsync(entityId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"{typeof(Department).Name} id:{entityId}");
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
public async Task<Employee> GetEmployeeById(int entityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await this.RepositoryContext.Set<Employee>().FindAsync(entityId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"{typeof(Employee).Name} id:{entityId}");
|
||||
}
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
176
DAL/Repositories/WebAppToWebAppAdditionalRoleRepository.cs
Normal file
176
DAL/Repositories/WebAppToWebAppAdditionalRoleRepository.cs
Normal file
@@ -0,0 +1,176 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.LDAPService;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WebAppToWebAppAdditionalRoleRepository : BaseRepository<WebAppToWebAppAdditionalRole>
|
||||
{
|
||||
public WebAppToWebAppAdditionalRoleRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<WebAppToWebAppAdditionalRole>> GetListByFilterAsync(EmployeeToWebAppFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<WebAppToWebAppAdditionalRole>().AsQueryable();
|
||||
|
||||
if (filter.EmployeeToWebAppId != null && filter.EmployeeToWebAppId != 0)
|
||||
{
|
||||
items = items.Where(x => x.EmployeeToWebAppId == filter.EmployeeToWebAppId);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
|
||||
private async Task<bool> AddUserToAdGroup(WebAppToWebAppAdditionalRole entity)
|
||||
{
|
||||
return await ProcessGroup(entity, "adding");
|
||||
}
|
||||
|
||||
private async Task<bool> RemoveUserFromAdGroup(WebAppToWebAppAdditionalRole entity)
|
||||
{
|
||||
return await ProcessGroup(entity, "deleting");
|
||||
}
|
||||
|
||||
private async Task<bool> ProcessGroup(WebAppToWebAppAdditionalRole entity, string action)
|
||||
{
|
||||
if (entity == default) throw new ArgumentNullException(nameof(entity));
|
||||
|
||||
var employee2Web = await GetEmployeeToWebAppById(entity.EmployeeToWebAppId);
|
||||
if (employee2Web == default) throw new ArgumentNullException(nameof(employee2Web));
|
||||
|
||||
var webappRole = await GetWebAppAddRoleById(entity.WebAppAdditionalRoleId);
|
||||
if (webappRole == default) throw new ArgumentNullException(nameof(webappRole));
|
||||
if (string.IsNullOrEmpty(webappRole.AdWebAppAdditionalRoleName)) return true;
|
||||
|
||||
var employee = await GetEmployeeById(employee2Web.EmployeeId);
|
||||
if (employee == default) throw new ArgumentNullException(nameof(employee));
|
||||
|
||||
var webapp = await GetWebAppById(employee2Web.WebAppId);
|
||||
if (webapp == default) throw new ArgumentNullException(nameof(webapp));
|
||||
|
||||
bool result;
|
||||
var isAdding = action == "adding";
|
||||
var groupSuffix = $"{webapp.AdWebAppName}_{webappRole.AdWebAppAdditionalRoleName}";
|
||||
try
|
||||
{
|
||||
if (isAdding) result = LdapManager.AD_AddUserloginToGroup(employee.LoginName, groupSuffix);
|
||||
else result = LdapManager.AD_RemoveUserFromGroup(employee.LoginName, groupSuffix);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"An error occurred while '{action}' the '{employee.LoginName}' into '{groupSuffix}'.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!result)
|
||||
{
|
||||
WriteLogError($"An error occurred while '{action}' the '{employee.LoginName}' into '{groupSuffix}'.");
|
||||
return false;
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async Task<bool> AddAsync(WebAppToWebAppAdditionalRole entity, bool saveEntity = true)
|
||||
{
|
||||
if (await AddUserToAdGroup(entity))
|
||||
{
|
||||
var result = await base.AddAsync(entity, saveEntity);
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override async Task<bool> AddListAsync(List<WebAppToWebAppAdditionalRole> entities, bool saveEntity = true)
|
||||
{
|
||||
var result = true;
|
||||
for (int i = 0; i < entities.Count; i++)
|
||||
{
|
||||
if (!await AddAsync(entities[i], saveEntity)) result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public override async Task<bool> DeleteByIdAsync(int id, bool saveEntity = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
var entity = await base.GetByIdAsync(id);
|
||||
if (entity == default)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(entity));
|
||||
}
|
||||
|
||||
if (await RemoveUserFromAdGroup(entity))
|
||||
{
|
||||
var result = await base.DeleteByIdAsync(id, saveEntity);
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"An error occurred while deleting the Id {id}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<EmployeeToWebApp> GetEmployeeToWebAppById(int entityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await this.RepositoryContext.Set<EmployeeToWebApp>().FindAsync(entityId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"{typeof(EmployeeToWebApp).Name} id:{entityId}");
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
public async Task<WebApp> GetWebAppById(int entityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await this.RepositoryContext.Set<WebApp>().FindAsync(entityId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"{typeof(WebApp).Name} id:{entityId}");
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
public async Task<WebAppAdditionalRole> GetWebAppAddRoleById(int entityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await this.RepositoryContext.Set<WebAppAdditionalRole>().FindAsync(entityId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"{typeof(WebAppAdditionalRole).Name} id:{entityId}");
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
public async Task<Employee> GetEmployeeById(int entityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await this.RepositoryContext.Set<Employee>().FindAsync(entityId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteLogException(ex, $"{typeof(Employee).Name} id:{entityId}");
|
||||
}
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
29
DAL/Repositories/WebAppToWebAppRoleRepository.cs
Normal file
29
DAL/Repositories/WebAppToWebAppRoleRepository.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WebAppToWebAppRoleRepository : BaseRepository<WebAppToWebAppRole>
|
||||
{
|
||||
public WebAppToWebAppRoleRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<WebAppToWebAppRole>> GetListByFilterAsync(WebAppFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<WebAppToWebAppRole>().AsQueryable();
|
||||
|
||||
if (filter.WebAppId != null && filter.WebAppId != 0)
|
||||
{
|
||||
items = items.Where(x => x.WebAppId == filter.WebAppId);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
34
DAL/Repositories/WindreamColumnsToDepartmentRepository.cs
Normal file
34
DAL/Repositories/WindreamColumnsToDepartmentRepository.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamColumnsToDepartmentRepository : BaseRepository<WindreamColumnsToDepartment>
|
||||
{
|
||||
public WindreamColumnsToDepartmentRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<WindreamColumnsToDepartment>> GetListByFilterAsync(DepartmentFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<WindreamColumnsToDepartment>().AsQueryable();
|
||||
|
||||
if (filter.DepartmentId != null && filter.DepartmentId != 0)
|
||||
{
|
||||
items = items.Where(x => x.DepartmentId == filter.DepartmentId);
|
||||
}
|
||||
|
||||
if (filter.WindreamSearchId != null && filter.WindreamSearchId != 0)
|
||||
{
|
||||
items = items.Where(x => x.WindreamSearchId == filter.WindreamSearchId);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.OrderBy(x => x.Seq).AsNoTracking().ToListAsync() : await items.OrderBy(x => x.Seq).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
29
DAL/Repositories/WindreamIndexRepository.cs
Normal file
29
DAL/Repositories/WindreamIndexRepository.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamIndexRepository : BaseRepository<WindreamIndex>
|
||||
{
|
||||
public WindreamIndexRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<WindreamIndex>> GetListByFilterAsync(ClientIdFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<WindreamIndex>().AsQueryable();
|
||||
|
||||
if (filter.ClientId != null)
|
||||
{
|
||||
items = items.Where(x => x.ClientId == filter.ClientId);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamIndexToWindreamSearchToDepartmentRepository : BaseRepository<WindreamIndexToWindreamSearchToDepartment>
|
||||
{
|
||||
public WindreamIndexToWindreamSearchToDepartmentRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<WindreamIndexToWindreamSearchToDepartment>> GetListByFilterAsync(WindreamSearchToDepartmentFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<WindreamIndexToWindreamSearchToDepartment>().AsQueryable();
|
||||
|
||||
if (filter.WindreamSearchToDepartmentId != null && filter.WindreamSearchToDepartmentId != 0)
|
||||
{
|
||||
items = items.Where(x => x.WindreamSearchToDepartmentId == filter.WindreamSearchToDepartmentId);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.OrderBy(x => x.Seq).AsNoTracking().ToListAsync() : await items.OrderBy(x => x.Seq).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
34
DAL/Repositories/WindreamInputFolderRepository.cs
Normal file
34
DAL/Repositories/WindreamInputFolderRepository.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamInputFolderRepository : BaseRepository<WindreamInputFolder>
|
||||
{
|
||||
public WindreamInputFolderRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<WindreamInputFolder>> GetListByFilterAsync(WindreamInputFolderFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<WindreamInputFolder>().AsQueryable();
|
||||
|
||||
if (filter.WindreamInputFolderId != null && filter.WindreamInputFolderId != 0)
|
||||
{
|
||||
items = items.Where(x => x.WindreamInputFolderId == filter.WindreamInputFolderId);
|
||||
return asNoTracking ? await items.ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
|
||||
if (filter.ClientId != null)
|
||||
{
|
||||
items = items.Where(x => x.ClientId == filter.ClientId);
|
||||
}
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
29
DAL/Repositories/WindreamSearchItemRepository.cs
Normal file
29
DAL/Repositories/WindreamSearchItemRepository.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamSearchItemRepository : BaseRepository<WindreamSearchItem>
|
||||
{
|
||||
public WindreamSearchItemRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<WindreamSearchItem>> GetListByFilterAsync(ClientIdFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<WindreamSearchItem>().AsQueryable();
|
||||
|
||||
if (filter.ClientId != null)
|
||||
{
|
||||
items = items.Where(x => x.ClientId == filter.ClientId);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamSearchItemToWindreamSearchToDepartmentRepository : BaseRepository<WindreamSearchItemToWindreamSearchToDepartment>
|
||||
{
|
||||
public WindreamSearchItemToWindreamSearchToDepartmentRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<WindreamSearchItemToWindreamSearchToDepartment>> GetListByFilterAsync(WindreamSearchToDepartmentFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<WindreamSearchItemToWindreamSearchToDepartment>().AsQueryable();
|
||||
|
||||
if (filter.WindreamSearchToDepartmentId != null && filter.WindreamSearchToDepartmentId != 0)
|
||||
{
|
||||
items = items.Where(x => x.WindreamSearchToDepartmentId == filter.WindreamSearchToDepartmentId);
|
||||
}
|
||||
|
||||
if (filter.DepartmentId != null && filter.DepartmentId != 0)
|
||||
{
|
||||
items = items.Where(x => x.DepartmentId == filter.DepartmentId);
|
||||
}
|
||||
return asNoTracking ? await items.OrderBy(x => x.Seq).AsNoTracking().ToListAsync() : await items.OrderBy(x => x.Seq).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
29
DAL/Repositories/WindreamSearchRepository.cs
Normal file
29
DAL/Repositories/WindreamSearchRepository.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamSearchRepository : BaseRepository<WindreamSearch>
|
||||
{
|
||||
public WindreamSearchRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<WindreamSearch>> GetListByFilterAsync(ClientIdFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<WindreamSearch>().AsQueryable();
|
||||
|
||||
if (filter.ClientId != null)
|
||||
{
|
||||
items = items.Where(x => x.ClientId == filter.ClientId);
|
||||
}
|
||||
|
||||
return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
DAL/Repositories/WindreamSearchToDepartmentRepository.cs
Normal file
36
DAL/Repositories/WindreamSearchToDepartmentRepository.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using DAL.Models.Entities;
|
||||
using DAL.Models.Filters;
|
||||
using HRD.WebApi.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DAL.Repositories
|
||||
{
|
||||
public class WindreamSearchToDepartmentRepository : BaseRepository<WindreamSearchToDepartment>
|
||||
{
|
||||
public WindreamSearchToDepartmentRepository() : base(new WebApiContext())
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<WindreamSearchToDepartment>> GetListByFilterAsync(DepartmentFilter filter, bool asNoTracking = true)
|
||||
{
|
||||
var items = this.RepositoryContext.Set<WindreamSearchToDepartment>().AsQueryable();
|
||||
|
||||
if (filter.DepartmentId != null && filter.DepartmentId != 0)
|
||||
{
|
||||
items = items.Where(x => x.DepartmentId == filter.DepartmentId);
|
||||
}
|
||||
|
||||
items = items.Where(x => x.IsActive);
|
||||
|
||||
return asNoTracking ? await items.OrderBy(x => x.Seq).AsNoTracking().ToListAsync() : await items.OrderBy(x => x.Seq).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> AddWindreamTile(int srcWindreamSearch2DepartmentId, string trgDepartmentIds)
|
||||
{
|
||||
return await ExecStoredProcedureAsync("webapi.sp_TransferWindreamSettings", $"null, {srcWindreamSearch2DepartmentId}, \"{trgDepartmentIds}\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
213
DAL/WebApiContext.cs
Normal file
213
DAL/WebApiContext.cs
Normal file
@@ -0,0 +1,213 @@
|
||||
using DAL._Shared.SharedModels;
|
||||
using DAL.Models.Entities;
|
||||
using HRD.WebApi.DAL;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DAL
|
||||
{
|
||||
public partial class WebApiContext : WebApiBaseContext
|
||||
{
|
||||
public WebApiContext() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public WebApiContext(DbContextOptions<DbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<WebAppUser> WebAppUserSet { get; set; }
|
||||
public virtual DbSet<WebAppEmployeeInfo> WebAppEmployeeInfo { get; set; }
|
||||
|
||||
public virtual DbSet<AdWebAppToWebAppRole> AdWebAppToWebAppRoleSet { get; set; }
|
||||
public virtual DbSet<CostCentre> CostCentreSet { get; set; }
|
||||
public virtual DbSet<Department> DepartmentSet { get; set; }
|
||||
public virtual DbSet<DocumentArt> DocumentArtSet { get; set; }
|
||||
public virtual DbSet<EmployeeAttribute> EmployeeAttributeSet { get; set; }
|
||||
public virtual DbSet<EmployeeStatus> EmployeeStatusSet { get; set; }
|
||||
public virtual DbSet<Project> ProjectSet { get; set; }
|
||||
public virtual DbSet<Rang> RangSet { get; set; }
|
||||
public virtual DbSet<WebApp> WebAppSet { get; set; }
|
||||
public virtual DbSet<WebAppRole> WebAppRoleSet { get; set; }
|
||||
public virtual DbSet<DepartmentToWebAppToEmployeeForWindream> DepartmentToWebAppToEmployeeForWindreamSet { get; set; }
|
||||
public virtual DbSet<DocumentArtToDepartment> DocumentArtToDepartmentSet { get; set; }
|
||||
public virtual DbSet<Employee> EmployeeSet { get; set; }
|
||||
public virtual DbSet<EmployeeToAttribute> EmployeeToAttributeSet { get; set; }
|
||||
public virtual DbSet<EmployeeToDepartment> EmployeeToDepartmentSet { get; set; }
|
||||
public virtual DbSet<EmployeeToWebApp> EmployeeToWebAppSet { get; set; }
|
||||
public virtual DbSet<WebAppAdditionalRole> WebAppAdditionalRoleSet { get; set; }
|
||||
public virtual DbSet<WebAppToDepartment> WebAppToDepartmentSet { get; set; }
|
||||
public virtual DbSet<WebAppToWebAppAdditionalRole> WebAppToWebAppAdditionalRoleSet { get; set; }
|
||||
public virtual DbSet<WebAppToWebAppRole> WebAppToWebAppRoleSet { get; set; }
|
||||
public virtual DbSet<WindreamColumnsToDepartment> WindreamColumnsToDepartmentSet { get; set; }
|
||||
public virtual DbSet<WindreamIndex> WindreamIndexSet { get; set; }
|
||||
public virtual DbSet<WindreamIndexToWindreamSearchToDepartment> WindreamIndexToWindreamSearchToDepartmentSet { get; set; }
|
||||
public virtual DbSet<WindreamSearch> WindreamSearchSet { get; set; }
|
||||
public virtual DbSet<WindreamSearchItem> WindreamSearchItemSet { get; set; }
|
||||
public virtual DbSet<WindreamSearchItemToWindreamSearchToDepartment> WindreamSearchItemToWindreamSearchToDepartmentSet { get; set; }
|
||||
public virtual DbSet<WindreamSearchToDepartment> WindreamSearchToDepartmentSet { get; set; }
|
||||
public virtual DbSet<WindreamInputFolder> WindreamInputFolderSet { get; set; }
|
||||
public virtual DbSet<Subsidiary> SubsidiarySet { get; set; }
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Subsidiary>(entity =>
|
||||
{
|
||||
entity.ToTable("Subsidiary", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WindreamInputFolder>(entity =>
|
||||
{
|
||||
entity.ToTable("WindreamInputFolder", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WindreamSearchToDepartment>(entity =>
|
||||
{
|
||||
entity.ToTable("WindreamSearchToDepartment", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WindreamSearchItemToWindreamSearchToDepartment>(entity =>
|
||||
{
|
||||
entity.ToTable("WindreamSearchItemToWindreamSearchToDepartment", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WindreamSearchItem>(entity =>
|
||||
{
|
||||
entity.ToTable("WindreamSearchItem", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WindreamSearch>(entity =>
|
||||
{
|
||||
entity.ToTable("WindreamSearch", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WindreamIndexToWindreamSearchToDepartment>(entity =>
|
||||
{
|
||||
entity.ToTable("WindreamIndexToWindreamSearchToDepartment", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WindreamIndex>(entity =>
|
||||
{
|
||||
entity.ToTable("WindreamIndex", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WindreamColumnsToDepartment>(entity =>
|
||||
{
|
||||
entity.ToTable("WindreamColumnsToDepartment", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WebAppToWebAppRole>(entity =>
|
||||
{
|
||||
entity.ToTable("WebAppToWebAppRole", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WebAppToWebAppAdditionalRole>(entity =>
|
||||
{
|
||||
entity.ToTable("WebAppToWebAppAdditionalRole", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WebAppToDepartment>(entity =>
|
||||
{
|
||||
entity.ToTable("WebAppToDepartment", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WebAppAdditionalRole>(entity =>
|
||||
{
|
||||
entity.ToTable("WebAppAdditionalRole", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<EmployeeToWebApp>(entity =>
|
||||
{
|
||||
entity.ToTable("EmployeeToWebApp", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<EmployeeToDepartment>(entity =>
|
||||
{
|
||||
entity.ToTable("EmployeeToDepartment", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<EmployeeToAttribute>(entity =>
|
||||
{
|
||||
entity.ToTable("EmployeeToAttribute", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Employee>(entity =>
|
||||
{
|
||||
entity.ToTable("Employee", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DocumentArtToDepartment>(entity =>
|
||||
{
|
||||
entity.ToTable("DocumentArtToDepartment", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DepartmentToWebAppToEmployeeForWindream>(entity =>
|
||||
{
|
||||
entity.ToTable("DepartmentToWebAppToEmployeeForWindream", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WebAppRole>(entity =>
|
||||
{
|
||||
entity.ToTable("WebAppRole", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WebApp>(entity =>
|
||||
{
|
||||
entity.ToTable("WebApp", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Rang>(entity =>
|
||||
{
|
||||
entity.ToTable("Rang", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Project>(entity =>
|
||||
{
|
||||
entity.ToTable("Project", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<EmployeeStatus>(entity =>
|
||||
{
|
||||
entity.ToTable("EmployeeStatus", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<EmployeeAttribute>(entity =>
|
||||
{
|
||||
entity.ToTable("EmployeeAttribute", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DocumentArt>(entity =>
|
||||
{
|
||||
entity.ToTable("DocumentArt", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Department>(entity =>
|
||||
{
|
||||
entity.ToTable("Department", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<CostCentre>(entity =>
|
||||
{
|
||||
entity.ToTable("CostCentre", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AdWebAppToWebAppRole>(entity =>
|
||||
{
|
||||
entity.ToTable("AdWebAppToWebAppRole", "webapi");
|
||||
});
|
||||
|
||||
|
||||
modelBuilder.Entity<WebAppUser>(entity =>
|
||||
{
|
||||
entity.ToTable("WebAppUser", "webapi");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WebAppEmployeeInfo>(entity =>
|
||||
{
|
||||
entity.ToTable("WebAppEmployeeInfo", "webapi");
|
||||
});
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
37
DAL/_Shared/SharedModels/WebAppEmployeeInfo.cs
Normal file
37
DAL/_Shared/SharedModels/WebAppEmployeeInfo.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
59
DAL/_Shared/SharedModels/WebAppUser.cs
Normal file
59
DAL/_Shared/SharedModels/WebAppUser.cs
Normal 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}";
|
||||
}
|
||||
}
|
||||
}
|
||||
114
DAL/_Shared/SharedRepositories/WebAppEmployeeInfoRepository.cs
Normal file
114
DAL/_Shared/SharedRepositories/WebAppEmployeeInfoRepository.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
DAL/_Shared/SharedRepositories/WebAppUserRepository.cs
Normal file
12
DAL/_Shared/SharedRepositories/WebAppUserRepository.cs
Normal 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())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
2
DAL/_Shared/init_context.bat
Normal file
2
DAL/_Shared/init_context.bat
Normal 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
|
||||
Reference in New Issue
Block a user