diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..1110d08
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,4 @@
+[*.cs]
+
+# CA1707: Identifiers should not contain underscores
+dotnet_diagnostic.CA1707.severity = silent
diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj
new file mode 100644
index 0000000..014b2d7
--- /dev/null
+++ b/DAL/DAL.csproj
@@ -0,0 +1,14 @@
+
+
+
+ net7.0
+ 2.3.7
+ 2.3.7.0
+ 2.3.7.0
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DAL/Models/Entities/AdWebAppToWebAppRole.cs b/DAL/Models/Entities/AdWebAppToWebAppRole.cs
new file mode 100644
index 0000000..dbc9a5a
--- /dev/null
+++ b/DAL/Models/Entities/AdWebAppToWebAppRole.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/CostCentre.cs b/DAL/Models/Entities/CostCentre.cs
new file mode 100644
index 0000000..1519da9
--- /dev/null
+++ b/DAL/Models/Entities/CostCentre.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/Department.cs b/DAL/Models/Entities/Department.cs
new file mode 100644
index 0000000..8ea4f30
--- /dev/null
+++ b/DAL/Models/Entities/Department.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/DepartmentToWebAppToEmployeeForWindream.cs b/DAL/Models/Entities/DepartmentToWebAppToEmployeeForWindream.cs
new file mode 100644
index 0000000..a38c113
--- /dev/null
+++ b/DAL/Models/Entities/DepartmentToWebAppToEmployeeForWindream.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/DocumentArt.cs b/DAL/Models/Entities/DocumentArt.cs
new file mode 100644
index 0000000..5e6ad00
--- /dev/null
+++ b/DAL/Models/Entities/DocumentArt.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/DocumentArtToDepartment.cs b/DAL/Models/Entities/DocumentArtToDepartment.cs
new file mode 100644
index 0000000..7ecd341
--- /dev/null
+++ b/DAL/Models/Entities/DocumentArtToDepartment.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/Employee.cs b/DAL/Models/Entities/Employee.cs
new file mode 100644
index 0000000..459ec74
--- /dev/null
+++ b/DAL/Models/Entities/Employee.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/EmployeeAttribute.cs b/DAL/Models/Entities/EmployeeAttribute.cs
new file mode 100644
index 0000000..7ed42d0
--- /dev/null
+++ b/DAL/Models/Entities/EmployeeAttribute.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/EmployeeStatus.cs b/DAL/Models/Entities/EmployeeStatus.cs
new file mode 100644
index 0000000..f246cbc
--- /dev/null
+++ b/DAL/Models/Entities/EmployeeStatus.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/EmployeeToAttribute.cs b/DAL/Models/Entities/EmployeeToAttribute.cs
new file mode 100644
index 0000000..77593d2
--- /dev/null
+++ b/DAL/Models/Entities/EmployeeToAttribute.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/EmployeeToDepartment.cs b/DAL/Models/Entities/EmployeeToDepartment.cs
new file mode 100644
index 0000000..8ddc572
--- /dev/null
+++ b/DAL/Models/Entities/EmployeeToDepartment.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/EmployeeToWebApp.cs b/DAL/Models/Entities/EmployeeToWebApp.cs
new file mode 100644
index 0000000..4048fd4
--- /dev/null
+++ b/DAL/Models/Entities/EmployeeToWebApp.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/Project.cs b/DAL/Models/Entities/Project.cs
new file mode 100644
index 0000000..2239068
--- /dev/null
+++ b/DAL/Models/Entities/Project.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/Rang.cs b/DAL/Models/Entities/Rang.cs
new file mode 100644
index 0000000..220d1e3
--- /dev/null
+++ b/DAL/Models/Entities/Rang.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/Subsidiary.cs b/DAL/Models/Entities/Subsidiary.cs
new file mode 100644
index 0000000..6233633
--- /dev/null
+++ b/DAL/Models/Entities/Subsidiary.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WebApp.cs b/DAL/Models/Entities/WebApp.cs
new file mode 100644
index 0000000..213bd18
--- /dev/null
+++ b/DAL/Models/Entities/WebApp.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WebAppAdditionalRole.cs b/DAL/Models/Entities/WebAppAdditionalRole.cs
new file mode 100644
index 0000000..744e1af
--- /dev/null
+++ b/DAL/Models/Entities/WebAppAdditionalRole.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WebAppRole.cs b/DAL/Models/Entities/WebAppRole.cs
new file mode 100644
index 0000000..ddb6466
--- /dev/null
+++ b/DAL/Models/Entities/WebAppRole.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WebAppToDepartment.cs b/DAL/Models/Entities/WebAppToDepartment.cs
new file mode 100644
index 0000000..6a93fec
--- /dev/null
+++ b/DAL/Models/Entities/WebAppToDepartment.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WebAppToWebAppAdditionalRole.cs b/DAL/Models/Entities/WebAppToWebAppAdditionalRole.cs
new file mode 100644
index 0000000..aadd7fe
--- /dev/null
+++ b/DAL/Models/Entities/WebAppToWebAppAdditionalRole.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WebAppToWebAppRole.cs b/DAL/Models/Entities/WebAppToWebAppRole.cs
new file mode 100644
index 0000000..672fddb
--- /dev/null
+++ b/DAL/Models/Entities/WebAppToWebAppRole.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WindreamColumnsToDepartment.cs b/DAL/Models/Entities/WindreamColumnsToDepartment.cs
new file mode 100644
index 0000000..a32c377
--- /dev/null
+++ b/DAL/Models/Entities/WindreamColumnsToDepartment.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WindreamIndex.cs b/DAL/Models/Entities/WindreamIndex.cs
new file mode 100644
index 0000000..f2ffd7a
--- /dev/null
+++ b/DAL/Models/Entities/WindreamIndex.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WindreamIndexToWindreamSearchToDepartment.cs b/DAL/Models/Entities/WindreamIndexToWindreamSearchToDepartment.cs
new file mode 100644
index 0000000..c2f2ca7
--- /dev/null
+++ b/DAL/Models/Entities/WindreamIndexToWindreamSearchToDepartment.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WindreamInputFolder.cs b/DAL/Models/Entities/WindreamInputFolder.cs
new file mode 100644
index 0000000..9762bd2
--- /dev/null
+++ b/DAL/Models/Entities/WindreamInputFolder.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WindreamSearch.cs b/DAL/Models/Entities/WindreamSearch.cs
new file mode 100644
index 0000000..4ccd30f
--- /dev/null
+++ b/DAL/Models/Entities/WindreamSearch.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WindreamSearchItem.cs b/DAL/Models/Entities/WindreamSearchItem.cs
new file mode 100644
index 0000000..d5ccb2d
--- /dev/null
+++ b/DAL/Models/Entities/WindreamSearchItem.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WindreamSearchItemToWindreamSearchToDepartment.cs b/DAL/Models/Entities/WindreamSearchItemToWindreamSearchToDepartment.cs
new file mode 100644
index 0000000..537d229
--- /dev/null
+++ b/DAL/Models/Entities/WindreamSearchItemToWindreamSearchToDepartment.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Entities/WindreamSearchToDepartment.cs b/DAL/Models/Entities/WindreamSearchToDepartment.cs
new file mode 100644
index 0000000..cdf8687
--- /dev/null
+++ b/DAL/Models/Entities/WindreamSearchToDepartment.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Filters/ClientIdFilter.cs b/DAL/Models/Filters/ClientIdFilter.cs
new file mode 100644
index 0000000..ff6b981
--- /dev/null
+++ b/DAL/Models/Filters/ClientIdFilter.cs
@@ -0,0 +1,9 @@
+using HRD.WebApi.DAL;
+
+namespace DAL.Models.Filters
+{
+ public partial class ClientIdFilter : BaseFilter
+ {
+ public int? ClientId { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Filters/DepartmentFilter.cs b/DAL/Models/Filters/DepartmentFilter.cs
new file mode 100644
index 0000000..4fe2aac
--- /dev/null
+++ b/DAL/Models/Filters/DepartmentFilter.cs
@@ -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; }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Filters/DepartmentFullFilter.cs b/DAL/Models/Filters/DepartmentFullFilter.cs
new file mode 100644
index 0000000..8899eba
--- /dev/null
+++ b/DAL/Models/Filters/DepartmentFullFilter.cs
@@ -0,0 +1,9 @@
+using HRD.WebApi.DAL;
+
+namespace DAL.Models.Filters
+{
+ public partial class DepartmentFullFilter : BaseFilter
+ {
+ public string DepartmentName { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Filters/EmployeeFilter.cs b/DAL/Models/Filters/EmployeeFilter.cs
new file mode 100644
index 0000000..00c57d5
--- /dev/null
+++ b/DAL/Models/Filters/EmployeeFilter.cs
@@ -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; }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Filters/EmployeeFullFilter.cs b/DAL/Models/Filters/EmployeeFullFilter.cs
new file mode 100644
index 0000000..d4bb6dc
--- /dev/null
+++ b/DAL/Models/Filters/EmployeeFullFilter.cs
@@ -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; }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Filters/EmployeeToWebAppFilter.cs b/DAL/Models/Filters/EmployeeToWebAppFilter.cs
new file mode 100644
index 0000000..bd4b591
--- /dev/null
+++ b/DAL/Models/Filters/EmployeeToWebAppFilter.cs
@@ -0,0 +1,9 @@
+using HRD.WebApi.DAL;
+
+namespace DAL.Models.Filters
+{
+ public partial class EmployeeToWebAppFilter : BaseFilter
+ {
+ public int? EmployeeToWebAppId { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Filters/WebAppFilter.cs b/DAL/Models/Filters/WebAppFilter.cs
new file mode 100644
index 0000000..4d991a8
--- /dev/null
+++ b/DAL/Models/Filters/WebAppFilter.cs
@@ -0,0 +1,9 @@
+using HRD.WebApi.DAL;
+
+namespace DAL.Models.Filters
+{
+ public partial class WebAppFilter : BaseFilter
+ {
+ public int? WebAppId { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Filters/WindreamInputFolderFilter.cs b/DAL/Models/Filters/WindreamInputFolderFilter.cs
new file mode 100644
index 0000000..e4f838e
--- /dev/null
+++ b/DAL/Models/Filters/WindreamInputFolderFilter.cs
@@ -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; }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Models/Filters/WindreamSearchToDepartmentFilter.cs b/DAL/Models/Filters/WindreamSearchToDepartmentFilter.cs
new file mode 100644
index 0000000..1054241
--- /dev/null
+++ b/DAL/Models/Filters/WindreamSearchToDepartmentFilter.cs
@@ -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; }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/AdWebAppToWebAppRoleRepository.cs b/DAL/Repositories/AdWebAppToWebAppRoleRepository.cs
new file mode 100644
index 0000000..3797d02
--- /dev/null
+++ b/DAL/Repositories/AdWebAppToWebAppRoleRepository.cs
@@ -0,0 +1,12 @@
+using DAL.Models.Entities;
+using HRD.WebApi.Repositories;
+
+namespace DAL.Repositories
+{
+ public class AdWebAppToWebAppRoleRepository : BaseRepository
+ {
+ public AdWebAppToWebAppRoleRepository() : base(new WebApiContext())
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/CostCentreRepository.cs b/DAL/Repositories/CostCentreRepository.cs
new file mode 100644
index 0000000..329856f
--- /dev/null
+++ b/DAL/Repositories/CostCentreRepository.cs
@@ -0,0 +1,12 @@
+using DAL.Models.Entities;
+using HRD.WebApi.Repositories;
+
+namespace DAL.Repositories
+{
+ public class CostCentreRepository : BaseRepository
+ {
+ public CostCentreRepository() : base(new WebApiContext())
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/DepartmentRepository.cs b/DAL/Repositories/DepartmentRepository.cs
new file mode 100644
index 0000000..2db3a34
--- /dev/null
+++ b/DAL/Repositories/DepartmentRepository.cs
@@ -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
+ {
+ public DepartmentRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetDepartmentListAsync(DepartmentFullFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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 ReplaceWindreamTiles(int srcDepartmentId, string trgDepartmentIds)
+ {
+ return await ExecStoredProcedureAsync("webapi.sp_TransferWindreamSettings", $"{srcDepartmentId}, null, \"{trgDepartmentIds}\"");
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/DepartmentToWebAppToEmployeeForWindreamRepository.cs b/DAL/Repositories/DepartmentToWebAppToEmployeeForWindreamRepository.cs
new file mode 100644
index 0000000..dca4313
--- /dev/null
+++ b/DAL/Repositories/DepartmentToWebAppToEmployeeForWindreamRepository.cs
@@ -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
+ {
+ public DepartmentToWebAppToEmployeeForWindreamRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(EmployeeFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/DocumentArtRepository.cs b/DAL/Repositories/DocumentArtRepository.cs
new file mode 100644
index 0000000..7f4d27f
--- /dev/null
+++ b/DAL/Repositories/DocumentArtRepository.cs
@@ -0,0 +1,12 @@
+using DAL.Models.Entities;
+using HRD.WebApi.Repositories;
+
+namespace DAL.Repositories
+{
+ public class DocumentArtRepository : BaseRepository
+ {
+ public DocumentArtRepository() : base(new WebApiContext())
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/DocumentArtToDepartmentRepository.cs b/DAL/Repositories/DocumentArtToDepartmentRepository.cs
new file mode 100644
index 0000000..0e4edcd
--- /dev/null
+++ b/DAL/Repositories/DocumentArtToDepartmentRepository.cs
@@ -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
+ {
+ public DocumentArtToDepartmentRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(DepartmentFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/EmployeeAttributeRepository.cs b/DAL/Repositories/EmployeeAttributeRepository.cs
new file mode 100644
index 0000000..9df3f78
--- /dev/null
+++ b/DAL/Repositories/EmployeeAttributeRepository.cs
@@ -0,0 +1,12 @@
+using DAL.Models.Entities;
+using HRD.WebApi.Repositories;
+
+namespace DAL.Repositories
+{
+ public class EmployeeAttributeRepository : BaseRepository
+ {
+ public EmployeeAttributeRepository() : base(new WebApiContext())
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/EmployeeRepository.cs b/DAL/Repositories/EmployeeRepository.cs
new file mode 100644
index 0000000..0065e26
--- /dev/null
+++ b/DAL/Repositories/EmployeeRepository.cs
@@ -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
+ {
+ public EmployeeRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(EmployeeFullFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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 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 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 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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/EmployeeStatusRepository.cs b/DAL/Repositories/EmployeeStatusRepository.cs
new file mode 100644
index 0000000..8711a80
--- /dev/null
+++ b/DAL/Repositories/EmployeeStatusRepository.cs
@@ -0,0 +1,12 @@
+using DAL.Models.Entities;
+using HRD.WebApi.Repositories;
+
+namespace DAL.Repositories
+{
+ public class EmployeeStatusRepository : BaseRepository
+ {
+ public EmployeeStatusRepository() : base(new WebApiContext())
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/EmployeeToAttributeRepository.cs b/DAL/Repositories/EmployeeToAttributeRepository.cs
new file mode 100644
index 0000000..7edf87c
--- /dev/null
+++ b/DAL/Repositories/EmployeeToAttributeRepository.cs
@@ -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
+ {
+ public EmployeeToAttributeRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(EmployeeFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/EmployeeToDepartmentRepository.cs b/DAL/Repositories/EmployeeToDepartmentRepository.cs
new file mode 100644
index 0000000..dab874a
--- /dev/null
+++ b/DAL/Repositories/EmployeeToDepartmentRepository.cs
@@ -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
+ {
+ public EmployeeToDepartmentRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(EmployeeFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/EmployeeToWebAppRepository.cs b/DAL/Repositories/EmployeeToWebAppRepository.cs
new file mode 100644
index 0000000..9ad32f3
--- /dev/null
+++ b/DAL/Repositories/EmployeeToWebAppRepository.cs
@@ -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
+ {
+ public EmployeeToWebAppRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task 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> GetListByFilterAsync(EmployeeFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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 AddUserToAdGroup(EmployeeToWebApp entity, int webRoleId, int? departementId)
+ {
+ return await ProcessGroup(entity, "adding", webRoleId, departementId);
+ }
+
+ private async Task RemoveUserFromAdGroup(EmployeeToWebApp entity, int webRoleId, int? departementId)
+ {
+ return await ProcessGroup(entity, "deleting", webRoleId, departementId);
+ }
+
+ private async Task 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 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 UpdateListAsync(List 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 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 AddListAsync(List 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 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 GetWebAppById(int entityId)
+ {
+ try
+ {
+ return await this.RepositoryContext.Set().FindAsync(entityId);
+ }
+ catch (Exception ex)
+ {
+ base.WriteLogException(ex, $"{typeof(WebApp).Name} id:{entityId}");
+ }
+ return default;
+ }
+
+ public async Task GetDepartmentById(int? entityId)
+ {
+ try
+ {
+ return await this.RepositoryContext.Set().FindAsync(entityId);
+ }
+ catch (Exception ex)
+ {
+ WriteLogException(ex, $"{typeof(Department).Name} id:{entityId}");
+ }
+ return default;
+ }
+
+ public async Task GetEmployeeById(int entityId)
+ {
+ try
+ {
+ return await this.RepositoryContext.Set().FindAsync(entityId);
+ }
+ catch (Exception ex)
+ {
+ WriteLogException(ex, $"{typeof(Employee).Name} id:{entityId}");
+ }
+ return default;
+ }
+
+ public async Task GetWebAppRoleById(int entityId)
+ {
+ try
+ {
+ return await this.RepositoryContext.Set().FindAsync(entityId);
+ }
+ catch (Exception ex)
+ {
+ WriteLogException(ex, $"{typeof(WebAppRole).Name} id:{entityId}");
+ }
+ return default;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/ProjectRepository.cs b/DAL/Repositories/ProjectRepository.cs
new file mode 100644
index 0000000..9db6c2a
--- /dev/null
+++ b/DAL/Repositories/ProjectRepository.cs
@@ -0,0 +1,12 @@
+using DAL.Models.Entities;
+using HRD.WebApi.Repositories;
+
+namespace DAL.Repositories
+{
+ public class ProjectRepository : BaseRepository
+ {
+ public ProjectRepository() : base(new WebApiContext())
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/RangRepository.cs b/DAL/Repositories/RangRepository.cs
new file mode 100644
index 0000000..17fba1b
--- /dev/null
+++ b/DAL/Repositories/RangRepository.cs
@@ -0,0 +1,12 @@
+using DAL.Models.Entities;
+using HRD.WebApi.Repositories;
+
+namespace DAL.Repositories
+{
+ public class RangRepository : BaseRepository
+ {
+ public RangRepository() : base(new WebApiContext())
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/SubsidiaryRepository.cs b/DAL/Repositories/SubsidiaryRepository.cs
new file mode 100644
index 0000000..d9ede89
--- /dev/null
+++ b/DAL/Repositories/SubsidiaryRepository.cs
@@ -0,0 +1,12 @@
+using DAL.Models.Entities;
+using HRD.WebApi.Repositories;
+
+namespace DAL.Repositories
+{
+ public class SubsidiaryRepository : BaseRepository
+ {
+ public SubsidiaryRepository() : base(new WebApiContext())
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WebAppAdditionalRoleRepository.cs b/DAL/Repositories/WebAppAdditionalRoleRepository.cs
new file mode 100644
index 0000000..67d31c0
--- /dev/null
+++ b/DAL/Repositories/WebAppAdditionalRoleRepository.cs
@@ -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
+ {
+ public WebAppAdditionalRoleRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(WebAppFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WebAppRepository.cs b/DAL/Repositories/WebAppRepository.cs
new file mode 100644
index 0000000..4b6483f
--- /dev/null
+++ b/DAL/Repositories/WebAppRepository.cs
@@ -0,0 +1,12 @@
+using DAL.Models.Entities;
+using HRD.WebApi.Repositories;
+
+namespace DAL.Repositories
+{
+ public class WebAppRepository : BaseRepository
+ {
+ public WebAppRepository() : base(new WebApiContext())
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WebAppRoleRepository.cs b/DAL/Repositories/WebAppRoleRepository.cs
new file mode 100644
index 0000000..6c82c4a
--- /dev/null
+++ b/DAL/Repositories/WebAppRoleRepository.cs
@@ -0,0 +1,12 @@
+using DAL.Models.Entities;
+using HRD.WebApi.Repositories;
+
+namespace DAL.Repositories
+{
+ public class WebAppRoleRepository : BaseRepository
+ {
+ public WebAppRoleRepository() : base(new WebApiContext())
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WebAppToDepartmentRepository.cs b/DAL/Repositories/WebAppToDepartmentRepository.cs
new file mode 100644
index 0000000..e43c27e
--- /dev/null
+++ b/DAL/Repositories/WebAppToDepartmentRepository.cs
@@ -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
+ {
+ public WebAppToDepartmentRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(EmployeeToWebAppFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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 AddUserToAdGroup(WebAppToDepartment entity)
+ {
+ return await ProcessGroup(entity, "adding");
+ }
+
+ private async Task RemoveUserFromAdGroup(WebAppToDepartment entity)
+ {
+ return await ProcessGroup(entity, "deleting");
+ }
+
+ private async Task 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 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 AddListAsync(List 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 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 GetEmployeeToWebAppById(int entityId)
+ {
+ try
+ {
+ return await this.RepositoryContext.Set().FindAsync(entityId);
+ }
+ catch (Exception ex)
+ {
+ WriteLogException(ex, $"{typeof(EmployeeToWebApp).Name} id:{entityId}");
+ }
+ return default;
+ }
+
+ public async Task GetWebAppById(int entityId)
+ {
+ try
+ {
+ return await this.RepositoryContext.Set().FindAsync(entityId);
+ }
+ catch (Exception ex)
+ {
+ WriteLogException(ex, $"{typeof(WebApp).Name} id:{entityId}");
+ }
+ return default;
+ }
+
+ public async Task GetDepartmentById(int entityId)
+ {
+ try
+ {
+ return await this.RepositoryContext.Set().FindAsync(entityId);
+ }
+ catch (Exception ex)
+ {
+ WriteLogException(ex, $"{typeof(Department).Name} id:{entityId}");
+ }
+ return default;
+ }
+
+ public async Task GetEmployeeById(int entityId)
+ {
+ try
+ {
+ return await this.RepositoryContext.Set().FindAsync(entityId);
+ }
+ catch (Exception ex)
+ {
+ WriteLogException(ex, $"{typeof(Employee).Name} id:{entityId}");
+ }
+ return default;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WebAppToWebAppAdditionalRoleRepository.cs b/DAL/Repositories/WebAppToWebAppAdditionalRoleRepository.cs
new file mode 100644
index 0000000..17d7444
--- /dev/null
+++ b/DAL/Repositories/WebAppToWebAppAdditionalRoleRepository.cs
@@ -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
+ {
+ public WebAppToWebAppAdditionalRoleRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(EmployeeToWebAppFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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 AddUserToAdGroup(WebAppToWebAppAdditionalRole entity)
+ {
+ return await ProcessGroup(entity, "adding");
+ }
+
+ private async Task RemoveUserFromAdGroup(WebAppToWebAppAdditionalRole entity)
+ {
+ return await ProcessGroup(entity, "deleting");
+ }
+
+ private async Task 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 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 AddListAsync(List 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 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 GetEmployeeToWebAppById(int entityId)
+ {
+ try
+ {
+ return await this.RepositoryContext.Set().FindAsync(entityId);
+ }
+ catch (Exception ex)
+ {
+ WriteLogException(ex, $"{typeof(EmployeeToWebApp).Name} id:{entityId}");
+ }
+ return default;
+ }
+
+ public async Task GetWebAppById(int entityId)
+ {
+ try
+ {
+ return await this.RepositoryContext.Set().FindAsync(entityId);
+ }
+ catch (Exception ex)
+ {
+ WriteLogException(ex, $"{typeof(WebApp).Name} id:{entityId}");
+ }
+ return default;
+ }
+
+ public async Task GetWebAppAddRoleById(int entityId)
+ {
+ try
+ {
+ return await this.RepositoryContext.Set().FindAsync(entityId);
+ }
+ catch (Exception ex)
+ {
+ WriteLogException(ex, $"{typeof(WebAppAdditionalRole).Name} id:{entityId}");
+ }
+ return default;
+ }
+
+ public async Task GetEmployeeById(int entityId)
+ {
+ try
+ {
+ return await this.RepositoryContext.Set().FindAsync(entityId);
+ }
+ catch (Exception ex)
+ {
+ WriteLogException(ex, $"{typeof(Employee).Name} id:{entityId}");
+ }
+ return default;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WebAppToWebAppRoleRepository.cs b/DAL/Repositories/WebAppToWebAppRoleRepository.cs
new file mode 100644
index 0000000..ca1fd3c
--- /dev/null
+++ b/DAL/Repositories/WebAppToWebAppRoleRepository.cs
@@ -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
+ {
+ public WebAppToWebAppRoleRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(WebAppFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WindreamColumnsToDepartmentRepository.cs b/DAL/Repositories/WindreamColumnsToDepartmentRepository.cs
new file mode 100644
index 0000000..d3acd5a
--- /dev/null
+++ b/DAL/Repositories/WindreamColumnsToDepartmentRepository.cs
@@ -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
+ {
+ public WindreamColumnsToDepartmentRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(DepartmentFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WindreamIndexRepository.cs b/DAL/Repositories/WindreamIndexRepository.cs
new file mode 100644
index 0000000..48d8d95
--- /dev/null
+++ b/DAL/Repositories/WindreamIndexRepository.cs
@@ -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
+ {
+ public WindreamIndexRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(ClientIdFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().AsQueryable();
+
+ if (filter.ClientId != null)
+ {
+ items = items.Where(x => x.ClientId == filter.ClientId);
+ }
+
+ return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WindreamIndexToWindreamSearchToDepartmentRepository.cs b/DAL/Repositories/WindreamIndexToWindreamSearchToDepartmentRepository.cs
new file mode 100644
index 0000000..810151c
--- /dev/null
+++ b/DAL/Repositories/WindreamIndexToWindreamSearchToDepartmentRepository.cs
@@ -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
+ {
+ public WindreamIndexToWindreamSearchToDepartmentRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(WindreamSearchToDepartmentFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WindreamInputFolderRepository.cs b/DAL/Repositories/WindreamInputFolderRepository.cs
new file mode 100644
index 0000000..732049a
--- /dev/null
+++ b/DAL/Repositories/WindreamInputFolderRepository.cs
@@ -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
+ {
+ public WindreamInputFolderRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(WindreamInputFolderFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WindreamSearchItemRepository.cs b/DAL/Repositories/WindreamSearchItemRepository.cs
new file mode 100644
index 0000000..83391fa
--- /dev/null
+++ b/DAL/Repositories/WindreamSearchItemRepository.cs
@@ -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
+ {
+ public WindreamSearchItemRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(ClientIdFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().AsQueryable();
+
+ if (filter.ClientId != null)
+ {
+ items = items.Where(x => x.ClientId == filter.ClientId);
+ }
+
+ return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WindreamSearchItemToWindreamSearchToDepartmentRepository.cs b/DAL/Repositories/WindreamSearchItemToWindreamSearchToDepartmentRepository.cs
new file mode 100644
index 0000000..ba925dc
--- /dev/null
+++ b/DAL/Repositories/WindreamSearchItemToWindreamSearchToDepartmentRepository.cs
@@ -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
+ {
+ public WindreamSearchItemToWindreamSearchToDepartmentRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(WindreamSearchToDepartmentFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WindreamSearchRepository.cs b/DAL/Repositories/WindreamSearchRepository.cs
new file mode 100644
index 0000000..ebc17ea
--- /dev/null
+++ b/DAL/Repositories/WindreamSearchRepository.cs
@@ -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
+ {
+ public WindreamSearchRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(ClientIdFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().AsQueryable();
+
+ if (filter.ClientId != null)
+ {
+ items = items.Where(x => x.ClientId == filter.ClientId);
+ }
+
+ return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/Repositories/WindreamSearchToDepartmentRepository.cs b/DAL/Repositories/WindreamSearchToDepartmentRepository.cs
new file mode 100644
index 0000000..591e610
--- /dev/null
+++ b/DAL/Repositories/WindreamSearchToDepartmentRepository.cs
@@ -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
+ {
+ public WindreamSearchToDepartmentRepository() : base(new WebApiContext())
+ {
+ }
+
+ public async Task> GetListByFilterAsync(DepartmentFilter filter, bool asNoTracking = true)
+ {
+ var items = this.RepositoryContext.Set().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 AddWindreamTile(int srcWindreamSearch2DepartmentId, string trgDepartmentIds)
+ {
+ return await ExecStoredProcedureAsync("webapi.sp_TransferWindreamSettings", $"null, {srcWindreamSearch2DepartmentId}, \"{trgDepartmentIds}\"");
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/WebApiContext.cs b/DAL/WebApiContext.cs
new file mode 100644
index 0000000..8621862
--- /dev/null
+++ b/DAL/WebApiContext.cs
@@ -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 options) : base(options)
+ {
+ }
+
+ public virtual DbSet WebAppUserSet { get; set; }
+ public virtual DbSet WebAppEmployeeInfo { get; set; }
+
+ public virtual DbSet AdWebAppToWebAppRoleSet { get; set; }
+ public virtual DbSet CostCentreSet { get; set; }
+ public virtual DbSet DepartmentSet { get; set; }
+ public virtual DbSet DocumentArtSet { get; set; }
+ public virtual DbSet EmployeeAttributeSet { get; set; }
+ public virtual DbSet EmployeeStatusSet { get; set; }
+ public virtual DbSet ProjectSet { get; set; }
+ public virtual DbSet RangSet { get; set; }
+ public virtual DbSet WebAppSet { get; set; }
+ public virtual DbSet WebAppRoleSet { get; set; }
+ public virtual DbSet DepartmentToWebAppToEmployeeForWindreamSet { get; set; }
+ public virtual DbSet DocumentArtToDepartmentSet { get; set; }
+ public virtual DbSet EmployeeSet { get; set; }
+ public virtual DbSet EmployeeToAttributeSet { get; set; }
+ public virtual DbSet EmployeeToDepartmentSet { get; set; }
+ public virtual DbSet EmployeeToWebAppSet { get; set; }
+ public virtual DbSet WebAppAdditionalRoleSet { get; set; }
+ public virtual DbSet WebAppToDepartmentSet { get; set; }
+ public virtual DbSet WebAppToWebAppAdditionalRoleSet { get; set; }
+ public virtual DbSet WebAppToWebAppRoleSet { get; set; }
+ public virtual DbSet WindreamColumnsToDepartmentSet { get; set; }
+ public virtual DbSet WindreamIndexSet { get; set; }
+ public virtual DbSet WindreamIndexToWindreamSearchToDepartmentSet { get; set; }
+ public virtual DbSet WindreamSearchSet { get; set; }
+ public virtual DbSet WindreamSearchItemSet { get; set; }
+ public virtual DbSet WindreamSearchItemToWindreamSearchToDepartmentSet { get; set; }
+ public virtual DbSet WindreamSearchToDepartmentSet { get; set; }
+ public virtual DbSet WindreamInputFolderSet { get; set; }
+ public virtual DbSet SubsidiarySet { get; set; }
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("Subsidiary", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WindreamInputFolder", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WindreamSearchToDepartment", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WindreamSearchItemToWindreamSearchToDepartment", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WindreamSearchItem", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WindreamSearch", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WindreamIndexToWindreamSearchToDepartment", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WindreamIndex", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WindreamColumnsToDepartment", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WebAppToWebAppRole", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WebAppToWebAppAdditionalRole", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WebAppToDepartment", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WebAppAdditionalRole", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("EmployeeToWebApp", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("EmployeeToDepartment", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("EmployeeToAttribute", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("Employee", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("DocumentArtToDepartment", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("DepartmentToWebAppToEmployeeForWindream", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WebAppRole", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WebApp", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("Rang", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("Project", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("EmployeeStatus", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("EmployeeAttribute", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("DocumentArt", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("Department", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("CostCentre", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("AdWebAppToWebAppRole", "webapi");
+ });
+
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WebAppUser", "webapi");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToTable("WebAppEmployeeInfo", "webapi");
+ });
+
+ base.OnModelCreating(modelBuilder);
+ }
+
+ }
+}
diff --git a/DAL/_Shared/SharedModels/WebAppEmployeeInfo.cs b/DAL/_Shared/SharedModels/WebAppEmployeeInfo.cs
new file mode 100644
index 0000000..3740618
--- /dev/null
+++ b/DAL/_Shared/SharedModels/WebAppEmployeeInfo.cs
@@ -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();
+ }
+}
\ No newline at end of file
diff --git a/DAL/_Shared/SharedModels/WebAppUser.cs b/DAL/_Shared/SharedModels/WebAppUser.cs
new file mode 100644
index 0000000..924dd78
--- /dev/null
+++ b/DAL/_Shared/SharedModels/WebAppUser.cs
@@ -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}";
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/_Shared/SharedRepositories/WebAppEmployeeInfoRepository.cs b/DAL/_Shared/SharedRepositories/WebAppEmployeeInfoRepository.cs
new file mode 100644
index 0000000..fac6207
--- /dev/null
+++ b/DAL/_Shared/SharedRepositories/WebAppEmployeeInfoRepository.cs
@@ -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
+
+ {
+ public WebAppEmployeeInfoRepository() : base(new WebApiContext())
+ {
+ }
+
+ private IQueryable PrepareList(List departmentIds)
+ {
+ IQueryable items = RepositoryContext.Set().AsNoTracking();
+ return items.Where(x => departmentIds.Contains(x.DepartmentId));
+ }
+
+ public async Task> GetEmailListForDepartmentsAsync(List departmentIds)
+ {
+ return await PrepareList(departmentIds).Select(x => x.Email).ToListAsync();
+ }
+
+ public async Task> GetLoginnameListForDepartmentsAsync(List departmentIds)
+ {
+ return await PrepareList(departmentIds).Select(x => x.LoginName).ToListAsync();
+ }
+
+ public async Task> GetShortnameListForDepartmentsAsync(List departmentIds)
+ {
+ return await PrepareList(departmentIds).Select(x => x.ShortName).ToListAsync();
+ }
+
+ public async Task GetShortnameForLoginAsync(string loginname)
+ {
+ return (await RepositoryContext.Set().FirstAsync(x => x.LoginName == loginname)).ShortName;
+ }
+
+ //----------------
+ public List GetEmailListForDepartments(List departmentIds)
+ {
+ return PrepareList(departmentIds).Select(x => x.Email).ToList();
+ }
+
+ public List GetLoginnameListForDepartments(List departmentIds)
+ {
+ return PrepareList(departmentIds).Select(x => x.LoginName).ToList();
+ }
+
+ public List GetShortnameListForDepartments(List departmentIds)
+ {
+ return PrepareList(departmentIds).Select(x => x.ShortName).ToList();
+ }
+
+ public string GetShortnameForLogin(string loginname)
+ {
+ return RepositoryContext.Set().First(x => x.LoginName == loginname).ShortName;
+ }
+
+ //----------------
+ public bool PrepareForUserLoginnameOrLoginnameListFilter(LdapUser ldapUser, ref string loginName, ref List 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 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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/_Shared/SharedRepositories/WebAppUserRepository.cs b/DAL/_Shared/SharedRepositories/WebAppUserRepository.cs
new file mode 100644
index 0000000..191ff67
--- /dev/null
+++ b/DAL/_Shared/SharedRepositories/WebAppUserRepository.cs
@@ -0,0 +1,12 @@
+using DAL._Shared.SharedModels;
+using HRD.WebApi.Repositories;
+
+namespace DAL._Shared.SharedRepositories
+{
+ public class WebAppUserRepository : BaseRepository
+ {
+ public WebAppUserRepository() : base(new WebApiContext())
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/DAL/_Shared/init_context.bat b/DAL/_Shared/init_context.bat
new file mode 100644
index 0000000..191a34b
--- /dev/null
+++ b/DAL/_Shared/init_context.bat
@@ -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
\ No newline at end of file
diff --git a/HRD.AppLogger/AppLoggerConfig.cs b/HRD.AppLogger/AppLoggerConfig.cs
new file mode 100644
index 0000000..e414180
--- /dev/null
+++ b/HRD.AppLogger/AppLoggerConfig.cs
@@ -0,0 +1,255 @@
+using HRD.AppLogger;
+using NLog;
+using NLog.Config;
+using NLog.Targets;
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace HRD.AppLogger
+{
+ public enum EN_LoggingLevel
+ {
+ Trace = 1,
+ Debug = 2,
+ Info = 3,
+ Warn = 4,
+ Error = 5,
+ Fatal = 6,
+ Off = 7
+ }
+}
+
+public static class AppLoggerConfig
+{
+ private static readonly string DBLOG_CommandText =
+ @"
+ INSERT INTO dbo.DBLog
+ ( MachineName,
+ Application,
+ Logged,
+ Level,
+ Message,
+ Logger,
+ CallSite,
+ Webrequest,
+ Stacktrace,
+ InnerException,
+ Exception,
+ Version,
+ Entity
+ )
+ VALUES
+ ( @machineName,
+ @application,
+ @logged,
+ @level,
+ @message,
+ @logger,
+ @callsite,
+ iif(@webrequestaction='',@webrequest, concat(@webrequest,' | action:',@webrequestaction)),
+ @stacktrace,
+ @innerException,
+ @exception,
+ @Version,
+ @Entity
+ );";
+
+ private static readonly Dictionary DBLOG_Parameters = new Dictionary() {
+ //Globals
+ {"@version", "${gdc:item=Version}"},
+ {"@application", "${gdc:item=Application}"},
+
+ //Local
+ //{"@webrequest", "${mdlc:item=Webrequest}"},
+ {"@entity", "${mdlc:item=Entity}"},
+
+ //WebApi
+ {"@webrequest", "${aspnet-request-url}"},
+ {"@webrequestaction", "${aspnet-mvc-action}"},
+
+ //Nlog
+ {"@machineName", "${machinename}" },
+ {"@logged", "${date}"},
+ {"@level", "${level:upperCase=true}"},
+ {"@message", "${message}"},
+ {"@logger", "${logger}"},
+ {"@callSite", "${callsite:fileName=true:includeSourcePath=false:skipFrames=1}"}, //{"@callSite", "${callsite:filename=false:className=true:methodName=true}"},
+ {"@stacktrace", "${stacktrace:topFrames=10}"},
+ {"@InnerException", "${exception:format=Message,StackTrace,Data:maxInnerExceptionLevel=10}"},
+ {"@Exception", "${exception:format=ToString}"},
+ };
+
+ public static string AssemblyName { get; set; }
+ public static string AssemblyVersion { get; set; }
+ public static EN_LoggingLevel DBLogLevel { get; set; } = EN_LoggingLevel.Warn;
+ public static EN_LoggingLevel FileLogLevel { get; set; } = EN_LoggingLevel.Error;
+ public static string LogDirectory { get; set; } = String.Empty;
+ public static string NlogConnectionstring { get; set; }
+ public static LogLevel NlogDBLogLevel { get; set; }
+ public static LogLevel NlogFileLogLevel { get; set; }
+ public static NlogSentryConfig NlogSentryConfig { get; set; } = new NlogSentryConfig();
+
+ public static LoggingConfiguration CreateConfig()
+ {
+ NlogDBLogLevel = MapLogLevel(DBLogLevel);
+ NlogFileLogLevel = MapLogLevel(FileLogLevel);
+
+ var config = new LoggingConfiguration();
+
+ DatabaseTarget dbTarget = CreateDatabaseTarget(config);
+ var dbRule = new LoggingRule("*", NlogDBLogLevel, dbTarget);
+ config.LoggingRules.Add(dbRule);
+
+ //Rules
+ FileTarget targetFile = CreateFileTarget(config);
+ var rule = new LoggingRule("*", NlogFileLogLevel, targetFile);
+ config.LoggingRules.Add(rule);
+ if (NlogSentryConfig.NlogSentryIsEnable)
+ {
+ AddSentry(config);
+ }
+
+ return config;
+ }
+
+ public static void Init(
+ string assemblyName,
+ string assemblyVersion,
+ EN_LoggingLevel dbLogLevel = EN_LoggingLevel.Warn
+ , EN_LoggingLevel fileLoogLevel = EN_LoggingLevel.Off
+ , string logDirectory = "")
+ {
+ AssemblyVersion = assemblyVersion;
+ AssemblyName = assemblyName;
+ DBLogLevel = dbLogLevel;
+ FileLogLevel = fileLoogLevel;
+ LogDirectory = logDirectory;
+ }
+
+ private static void AddSentry(LoggingConfiguration config)
+ {
+ config.AddSentry(o =>
+ {
+ o.Dsn = NlogSentryConfig.Dsn;
+
+ o.Layout = "${message}";
+
+ o.BreadcrumbLayout = "${logger}: ${message} #url: ${aspnet-request-url} | #action: ${aspnet-mvc-action}";
+ // Optionally specify a separate format for breadcrumbs
+
+ o.MinimumBreadcrumbLevel = NlogSentryConfig.MinimumBreadcrumbLevel; // Debug and higher are stored as breadcrumbs (default is Info)
+ o.MinimumEventLevel = NlogSentryConfig.MinimumEventLevel; // Error and higher is sent as event (default is Error)
+
+ // If DSN is not set, the SDK will look for an environment variable called SENTRY_DSN. If
+ // nothing is found, SDK is disabled.
+
+ o.AttachStacktrace = NlogSentryConfig.AttachStacktrace;
+ o.SendDefaultPii = NlogSentryConfig.SendDefaultPii; // Send Personal Identifiable information like the username of the user logged in to the device
+
+ o.IncludeEventDataOnBreadcrumbs = NlogSentryConfig.IncludeEventDataOnBreadcrumbs; // Optionally include event properties with breadcrumbs
+ o.ShutdownTimeoutSeconds = 5;
+ o.TracesSampleRate = 0.3;
+
+ //Optionally specify user properties via NLog (here using MappedDiagnosticsLogicalContext as an example)
+ // o.User = new SentryNLogUser
+ // {
+ // Id = "${mdlc:item=id}",
+ // Username = "${mdlc:item=username}",
+ // Email = "${mdlc:item=email}",
+ // IpAddress = "${mdlc:item=ipAddress}",
+ // Other =
+ //{
+ // new TargetPropertyWithContext("mood", "joyous")
+ //},
+ //};
+
+ o.AddTag("Backend", "${gdc:item=Application}"); // Send the logger name as a tag
+ o.AddTag("BackendVersion", "${gdc:item=Version}"); // Send the logger name as a tag
+ o.AddTag("logger", "${logger}"); // Send the logger name as a tag
+
+ // Other configuration
+ });
+ }
+
+ private static DatabaseTarget CreateDatabaseTarget(LoggingConfiguration config)
+ {
+ var dbTarget = new DatabaseTarget
+ {
+ ConnectionString = NlogConnectionstring,
+
+ CommandText = DBLOG_CommandText
+ };
+
+ foreach (var item in DBLOG_Parameters)
+ {
+ dbTarget.Parameters.Add(new DatabaseParameterInfo(item.Key, item.Value));
+ }
+
+ config.AddTarget("database", dbTarget);
+ return dbTarget;
+ }
+
+ private static FileTarget CreateFileTarget(LoggingConfiguration config)
+ {
+ var targetFile =
+ new FileTarget
+ {
+ FileName = Path.Combine(
+ !string.IsNullOrEmpty(LogDirectory) ? LogDirectory : "${basedir}/_logs/",
+ "${gdc:item=Application}" + "_V." + "${gdc:item=Version}" + $"_{DateTime.Now:yyyyMMdd}.log"),
+ Layout = "${date}|${uppercase:${level}}|${stacktrace}|${message}" +
+ "|${exception:format=Message,StackTrace,Data:maxInnerExceptionLevel=10}" +
+ "${event-properties:item=EventId.Id}"
+ };
+
+ config.AddTarget("logfile", targetFile);
+ return targetFile;
+ }
+
+ private static LogLevel MapLogLevel(EN_LoggingLevel loggingLevel)
+ {
+ LogLevel logLevel = LogLevel.Error;
+ switch (loggingLevel)
+ {
+ case EN_LoggingLevel.Trace:
+ logLevel = LogLevel.Trace;
+ break;
+
+ case EN_LoggingLevel.Debug:
+ logLevel = LogLevel.Debug;
+ break;
+
+ case EN_LoggingLevel.Info:
+ logLevel = LogLevel.Info;
+ break;
+
+ case EN_LoggingLevel.Warn:
+ logLevel = LogLevel.Warn;
+ break;
+
+ case EN_LoggingLevel.Error:
+ logLevel = LogLevel.Error;
+ break;
+
+ case EN_LoggingLevel.Fatal:
+ logLevel = LogLevel.Fatal;
+ break;
+
+ case EN_LoggingLevel.Off:
+ logLevel = LogLevel.Off;
+ break;
+
+ default:
+ break;
+ }
+ return logLevel;
+ }
+
+ public static void SetSentryUser(int id, string login, string email, IDictionary others = null)
+ {
+ NlogSentryConfig.SentryUser = new Sentry.User { Id = id.ToString(), Username = login, Email = email };
+ if (others != null) NlogSentryConfig.SentryUser.Other = others;
+ Sentry.SentrySdk.ConfigureScope(scope => { scope.User = NlogSentryConfig.SentryUser; });
+ }
+}
\ No newline at end of file
diff --git a/HRD.AppLogger/HRD.AppLogger.csproj b/HRD.AppLogger/HRD.AppLogger.csproj
new file mode 100644
index 0000000..5e132c4
--- /dev/null
+++ b/HRD.AppLogger/HRD.AppLogger.csproj
@@ -0,0 +1,15 @@
+
+
+
+ netcoreapp7.0
+ Hensel Recycling GmbH
+ IT Entwicklung
+ 1.5.0
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HRD.AppLogger/ILoggerManager.cs b/HRD.AppLogger/ILoggerManager.cs
new file mode 100644
index 0000000..de1df6c
--- /dev/null
+++ b/HRD.AppLogger/ILoggerManager.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace HRD.AppLogger
+{
+ public interface ILoggerManager
+ {
+ void LogDebug(string message, string entityMessage = null, string webrequest = null, string userLogin = null);
+
+ void LogError(string message, string entityMessage = null, string webrequest = null, string userLogin = null);
+
+ void LogInfo(string message, string entityMessage = null, string webrequest = null, string userLogin = null);
+
+ void LogWarn(string message, string entityMessage = null, string webrequest = null, string userLogin = null);
+
+ void LogException(Exception exception, string entityMessage = null, string webrequest = null, string userLogin = null);
+ }
+}
\ No newline at end of file
diff --git a/HRD.AppLogger/LoggerManager.cs b/HRD.AppLogger/LoggerManager.cs
new file mode 100644
index 0000000..c39f96f
--- /dev/null
+++ b/HRD.AppLogger/LoggerManager.cs
@@ -0,0 +1,214 @@
+using NLog;
+using Sentry;
+using System;
+
+namespace HRD.AppLogger
+{
+ public class LoggerManager : ILoggerManager
+ {
+ private static readonly ILogger logger = LogManager.GetCurrentClassLogger();
+
+ public LoggerManager(bool throwExceptions = true) : this()
+ {
+ LogManager.ThrowExceptions = throwExceptions;
+ }
+
+ public LoggerManager()
+ {
+ GlobalDiagnosticsContext.Set("Version", AppLoggerConfig.AssemblyVersion);
+ GlobalDiagnosticsContext.Set("Application", AppLoggerConfig.AssemblyName);
+
+ LogManager.ThrowConfigExceptions = true;
+ LogManager.ThrowExceptions = false;
+ LogManager.Configuration = AppLoggerConfig.CreateConfig();
+ }
+
+ public void WriteLog(Action