Add helper methods for color conversion and string checksum generation

- Implemented ToColor extension method to convert predefined ColorType enums to HTML hex colors.
- Added GetChecksum extension method to generate a SHA-256 checksum from a string.
- Included conditional directive for .NET Framework compatibility.
This commit is contained in:
Developer 02
2025-05-21 19:52:58 +02:00
parent 39cc30f48b
commit 39c1d3e624
3 changed files with 50 additions and 4 deletions

View File

@@ -1,7 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Drawing;
using DigitalData.Modules.Base;
#if NETFRAMEWORK
using System;
using System.Collections.Generic;
@@ -80,11 +79,11 @@ namespace EnvelopeGenerator.Domain.Entities
SignedDate == DateTime.MinValue ? "-" : SignedDate.ToString("G");
[NotMapped]
public Color Color => Helpers.ColorTypeToColor(ColorType);
public Color Color => ColorType.ToColor();
public string GetSignature()
{
return StringEx.GetChecksum(EmailAddress?.ToUpperInvariant() ?? string.Empty);
return EmailAddress.ToUpperInvariant().GetChecksum();
}
}
}