Replace User class with EGUser across the codebase

This commit introduces the new `EGUser` class, which replaces the existing `User` class in multiple files, including `EnvelopeModel.vb`, `State.vb`, and `UserModel.vb`. The `EGUser` class extends `User`, adding new properties while maintaining existing functionality.

Key changes include:
- Updated property types from `User` to `EGUser` in relevant models.
- Method signatures in `UserModel.vb` modified to accept and return `EGUser`.
- Domain entities in `Envelope.cs` and `EnvelopeHistory.cs` now reference `EGUser`.
- Complete removal of the `User.cs` file.
- Added a new package reference for `UserManager.Domain` in the project file.
- Updated `MYUSER` variable in `ModuleSettings.vb` to use `EGUser`.

These changes enhance the user model to better meet application requirements.
This commit is contained in:
tekh 2025-06-26 14:26:21 +02:00
parent db05183137
commit ff1e9f27af
9 changed files with 61 additions and 123 deletions

View File

@ -37,7 +37,7 @@ Public Class EnvelopeModel
.AddedWhen = pRow.Item("ADDED_WHEN"), .AddedWhen = pRow.Item("ADDED_WHEN"),
.ChangedWhen = pRow.ItemEx(Of Date)("CHANGED_WHEN", Nothing), .ChangedWhen = pRow.ItemEx(Of Date)("CHANGED_WHEN", Nothing),
.CertificationType = ObjectEx.ToEnum(Of CertificationType)(pRow.ItemEx("CERTIFICATION_TYPE", CertificationType.AdvancedElectronicSignature.ToString())), .CertificationType = ObjectEx.ToEnum(Of CertificationType)(pRow.ItemEx("CERTIFICATION_TYPE", CertificationType.AdvancedElectronicSignature.ToString())),
.User = New User(), .User = New EGUser(),
.ExpiresWhen = pRow.ItemEx(Of Date)("EXPIRES_WHEN", Nothing), .ExpiresWhen = pRow.ItemEx(Of Date)("EXPIRES_WHEN", Nothing),
.ExpiresWarningWhen = pRow.ItemEx(Of Date)("EXPIRES_WARNING_WHEN", Nothing), .ExpiresWarningWhen = pRow.ItemEx(Of Date)("EXPIRES_WARNING_WHEN", Nothing),
.ExpiresWhenDays = pRow.ItemEx("EXPIRES_WHEN_DAYS", 0), .ExpiresWhenDays = pRow.ItemEx("EXPIRES_WHEN_DAYS", 0),

View File

@ -4,7 +4,7 @@ Imports EnvelopeGenerator.Domain.Entities
Public Class State Public Class State
Public Property UserId As Integer Public Property UserId As Integer
Public Property User As User Public Property User As EGUser
Public Property Config As Config Public Property Config As Config
Public Property DbConfig As DbConfig Public Property DbConfig As DbConfig
Public Property LogConfig As LogConfig Public Property LogConfig As LogConfig

View File

@ -9,8 +9,8 @@ Public Class UserModel
MyBase.New(pState) MyBase.New(pState)
End Sub End Sub
Private Function ToUser(pRow As DataRow) As User Private Function ToUser(pRow As DataRow) As EGUser
Dim oUser = New User() With { Dim oUser = New EGUser() With {
.Id = pRow.ItemEx("GUID", 0), .Id = pRow.ItemEx("GUID", 0),
.Prename = pRow.ItemEx("PRENAME", ""), .Prename = pRow.ItemEx("PRENAME", ""),
.Name = pRow.ItemEx("NAME", ""), .Name = pRow.ItemEx("NAME", ""),
@ -22,7 +22,7 @@ Public Class UserModel
Return oUser Return oUser
End Function End Function
Public Function CheckUserLogin(pUser As User) As User Public Function CheckUserLogin(pUser As EGUser) As EGUser
Try Try
Dim oSql = $"SELECT * FROM [dbo].[FNDD_LOGIN_USER_MODULE] ('{pUser.Username}', 'SIG_ENV_CR', 1)" Dim oSql = $"SELECT * FROM [dbo].[FNDD_LOGIN_USER_MODULE] ('{pUser.Username}', 'SIG_ENV_CR', 1)"
Dim oTable As DataTable = Database.GetDatatable(oSql) Dim oTable As DataTable = Database.GetDatatable(oSql)
@ -45,7 +45,7 @@ Public Class UserModel
End Try End Try
End Function End Function
Public Function SelectUser() As User Public Function SelectUser() As EGUser
Try Try
Dim oSql = $"SELECT * FROM [dbo].[TBDD_USER] WHERE GUID = {State.UserId}" Dim oSql = $"SELECT * FROM [dbo].[TBDD_USER] WHERE GUID = {State.UserId}"
Dim oTable = Database.GetDatatable(oSql) Dim oTable = Database.GetDatatable(oSql)
@ -58,7 +58,7 @@ Public Class UserModel
End Try End Try
End Function End Function
Public Function SelectUser(pUserID As Integer) As User Public Function SelectUser(pUserID As Integer) As EGUser
Try Try
Dim oSql = $"SELECT * FROM [dbo].[TBDD_USER] WHERE GUID = {pUserID}" Dim oSql = $"SELECT * FROM [dbo].[TBDD_USER] WHERE GUID = {pUserID}"
Dim oTable = Database.GetDatatable(oSql) Dim oTable = Database.GetDatatable(oSql)

View File

@ -0,0 +1,50 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using DigitalData.UserManager.Domain.Entities;
#if NETFRAMEWORK
using System;
#endif
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBDD_USER", Schema = "dbo")]
public class EGUser : User
{
[Required]
[Column("GENERAL_VIEWER")]
[StringLength(30)]
[DefaultValue("NONE")]
public string GeneralViewer { get; set; }
[Required]
[Column("WAN_ENVIRONMENT")]
public bool WanEnvironment { get; set; }
[Required]
[Column("USERID_FK_INT_ECM")]
public int UseridFkIntEcm { get; set; }
[Column("DELETED_WHEN")]
public DateTime DeletedWhen { get; set; }
[Column("DELETED_WHO")]
[StringLength(50)]
public string DeletedWho { get; set; }
#region FORM_APP
[NotMapped]
public bool HasAccess { get; set; }
[NotMapped]
public bool IsAdmin { get; set; }
[NotMapped]
public bool GhostModeActive { get; set; }
[NotMapped]
public string FullName => $"{Prename} {Name}";
#endregion
}
}

View File

@ -113,7 +113,7 @@ namespace EnvelopeGenerator.Domain.Entities
// TODO: * Check the Form App and remove the default value // TODO: * Check the Form App and remove the default value
[ForeignKey("UserId")] [ForeignKey("UserId")]
public User User { get; set; } = new User(); public EGUser User { get; set; } = new EGUser();
[ForeignKey("EnvelopeTypeId")] [ForeignKey("EnvelopeTypeId")]
public EnvelopeType EnvelopeType { get; set; } public EnvelopeType EnvelopeType { get; set; }

View File

@ -38,7 +38,7 @@ namespace EnvelopeGenerator.Domain.Entities
public string Comment { get; set; } public string Comment { get; set; }
[ForeignKey("UserReference")] [ForeignKey("UserReference")]
public virtual User Sender { get; set; } public virtual EGUser Sender { get; set; }
[ForeignKey("UserReference")] [ForeignKey("UserReference")]
public virtual Receiver Receiver { get; set; } public virtual Receiver Receiver { get; set; }

View File

@ -1,113 +0,0 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
#if NETFRAMEWORK
using System;
#endif
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBDD_USER", Schema = "dbo")]
public class User
{
[Column("GUID")]
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; } = 0;
[StringLength(50)]
[Column("ADDED_WHO")]
public string AddedWho { get; set; }
[StringLength(50)]
[Column("CHANGED_WHO")]
public string ChangedWho { get; set; }
//TODO: assign it to default value in create dto, not here!
[Column("ADDED_WHEN", TypeName = "datetime")]
[DefaultValue("GETDATE()")]
public DateTime AddedWhen { get; set; } = DateTime.Now;
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime ChangedWhen { get; set; }
[Column("PRENAME")]
[StringLength(50)]
public string Prename { get; set; }
[Column("NAME")]
[StringLength(50)]
public string Name { get; set; }
[Required]
[Column("USERNAME")]
[StringLength(50)]
public string Username { get; set; }
[Column("SHORTNAME")]
[StringLength(30)]
public string Shortname { get; set; }
[Column("EMAIL")]
[StringLength(100)]
public string Email { get; set; }
[Required]
[Column("LANGUAGE")]
[StringLength(5)]
[DefaultValue("de-DE")]
public string Language { get; set; }
[Column("COMMENT")]
[StringLength(500)]
public string Comment { get; set; }
[Column("DELETED")]
public bool Deleted { get; set; }
[Required]
[Column("DATE_FORMAT")]
[StringLength(10)]
[DefaultValue("dd.MM.yyyy")]
public string DateFormat { get; set; }
[Required]
[Column("ACTIVE")]
public bool Active { get; set; }
[Required]
[Column("GENERAL_VIEWER")]
[StringLength(30)]
[DefaultValue("NONE")]
public string GeneralViewer { get; set; }
[Required]
[Column("WAN_ENVIRONMENT")]
public bool WanEnvironment { get; set; }
[Required]
[Column("USERID_FK_INT_ECM")]
public int UseridFkIntEcm { get; set; }
[Column("DELETED_WHEN")]
public DateTime DeletedWhen { get; set; }
[Column("DELETED_WHO")]
[StringLength(50)]
public string DeletedWho { get; set; }
#region FORM_APP
[NotMapped]
public bool HasAccess { get; set; }
[NotMapped]
public bool IsAdmin { get; set; }
[NotMapped]
public bool GhostModeActive { get; set; }
[NotMapped]
public string FullName => $"{Prename} {Name}";
#endregion
}
}

View File

@ -33,6 +33,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="DigitalData.EmailProfilerDispatcher.Abstraction.Attributes" Version="1.0.0" /> <PackageReference Include="DigitalData.EmailProfilerDispatcher.Abstraction.Attributes" Version="1.0.0" />
<PackageReference Include="UserManager.Domain" Version="3.2.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -11,7 +11,7 @@ Module ModuleSettings
Public DB_DD_ECM As MSSQLServer = Nothing Public DB_DD_ECM As MSSQLServer = Nothing
Public DEF_TF_ENABLED As Boolean = False Public DEF_TF_ENABLED As Boolean = False
Public DEF_TF_ENABLED_WITH_PHONE As Boolean = False Public DEF_TF_ENABLED_WITH_PHONE As Boolean = False
Public MYUSER As User Public MYUSER As EGUser
Public MyTempFiles As TempFiles Public MyTempFiles As TempFiles
Public SQL_REP_ENV_USER_LM As String = "" Public SQL_REP_ENV_USER_LM As String = ""
Public SQL_REP_ENV_USER_TM As String = "" Public SQL_REP_ENV_USER_TM As String = ""