Ft.Datafangst.Utils
1.6.7
See the version list below for details.
dotnet add package Ft.Datafangst.Utils --version 1.6.7
NuGet\Install-Package Ft.Datafangst.Utils -Version 1.6.7
<PackageReference Include="Ft.Datafangst.Utils" Version="1.6.7" />
paket add Ft.Datafangst.Utils --version 1.6.7
#r "nuget: Ft.Datafangst.Utils, 1.6.7"
// Install Ft.Datafangst.Utils as a Cake Addin #addin nuget:?package=Ft.Datafangst.Utils&version=1.6.7 // Install Ft.Datafangst.Utils as a Cake Tool #tool nuget:?package=Ft.Datafangst.Utils&version=1.6.7
Utilities
Contains various utilities related to development of Ft.Datafangst logic.
Add to project
dotnet add package Ft.Datafangst.Utils
NB! Must be in the project folder that it is to be added to!
Installation
To install do the following commands
dotnet tool install --global Ft.Datafangst.Utils
Update
To update do the following commands
dotnet tool update --global Ft.Datafangst.Utils
ModelStateDictionaryExtension
IsConditionInError
Modifies the ModelStateEntry.Errors for the given key by either adding or removing the provided error message based on the evaluation of a condition.
- Param:
- modelStateDic: Represents the outcome of binding values from an HTTP request to an action method. This includes associated validation details.
- state: Condition to evaluate for determining the error state.
- key: Identifier for the ModelStateEntry where potential errors should be added.
- errorMsg: Message to add if the state evaluates to true.
- Return:
- A numeric representation of the Language. Basic Example in C#
ModelStateDictionary validationResults = new ModelStateDictionary();
var key = "organisasjonsnummer";
var errorMsg = "testError";
bool conditionIsError = 2 + 1 == 4; // Evaluates to false.
validationResults.IsConditionInError(conditionIsError, key, errorMsg);
StringExtensions
IsOrganizationNumberValid
Checks if a given string is a valid Organization (Business Registration) Number.
- Param:
- organizationNumber: The organization (Business Registration) number to validate. This should be a 9-digit numeric string.
- Returns:
- true if the organizationNumber is valid, otherwise false. Basic Example in C#
bool isValid = "123456789".IsOrganizationNumberValid(); // Returns true
bool isNotValid = "123".IsOrganizationNumberValid(); // Returns false
IsIsinValid
Validates whether a given string adheres to the ISIN code format.
- Param:
- isinCode: The string representation of the ISIN code for validation.
- Returns:
- true if the string is a valid ISIN code; otherwise, false. Basic Example in C#
bool isValid1 = ValidateIsin("No1234567890"); // Returns true
bool isValid2 = ValidateIsin("No123"); // Returns false
IsLeiValid
Validates whether the given string conforms to the Legal Entity Identifier (LEI) standard.
- Param: -lei: An LEI is a 20-character alphanumeric code that follows a specific format. (ISO 17442: The Global Standard) It consists of four parts: - Characters 1-4: Prefix used to ensure the uniqueness among codes from LEI issuers (Local Operating Units or LOUs). - Characters 5-18: Entity-specific part of the code generated and assigned by LOUs according to transparent, sound and robust allocation policies. As required by ISO 17442, it contains no embedded intelligence. - Characters 19-20: Two check digits as described in the ISO 17442 standard.
- Returns:
- true if the LEI is valid, false otherwise. Basic Example in C#
bool isValid = "123400ABCDE7810FGH07".IsLeiValid(); // Returns true
bool isValid2 = "7ZW8QJWVPR4P1J".IsLeiValid(); // Returns false
ConvertLanguageStringToNumeric
Transforms a two-letter language code (e.g., "nb") into its corresponding numeric value. If no valid code is provided or found, it defaults to English (1033).
- Param:
- language: Two-character language code (e.g., "nb" for Norwegian).
- "nb": Returns 1044
- "nn": Returns 2068
- Any other value or null: Defaults to 1033
- language: Two-character language code (e.g., "nb" for Norwegian).
- Return:
- Numeric representation of the provided language code.
Basic Example in C#
1044 = "nb".ConvertLanguageStringToNumeric();
1033 = null.ConvertLanguageStringToNumeric();
GetLanguageAsNumeric
Gets the language that is set up with the user profile and converts
- Param:
- userProfile: User profile to get language form
- Return:
- A representative numerical value for the Language.
SetPeriode
Configures the period based on the period type and optionally, the year.
- Param:
- periodeType: A code representing specific times within a year.
- H1: 1. Halvår
- H2: 2. Halvår
- Q1: 1. Kvartal
- Q2: 2. Kvartal
- Q3: 3. Kvartal
- Q4: 4. Kvartal
- M1: Januar
- M2: Februar
- M3: Mars
- M4: April
- M5: Mai
- M6: Juni
- M7: Juli
- M8: August
- M9: September
- M10: Oktober
- M11: November
- M12: Desember
- Y: År
- O: Løpende rapportering
- year (Optional): The specific year for the period.
- periodeType: A code representing specific times within a year.
- Return:
- A string combined from the userProfile code and the year.
Basic Example in C#
"1. halvår 2023" = "H1".SetPeriode(2023);
"1. halvår" = "H1".SetPeriode();
"År 2023" = null.SetPeriode("2023");
"" = null.SetPeriode("");
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Altinn.App.Core (>= 7.15.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.10 | 128 | 10/21/2024 |
2.0.9 | 243 | 7/25/2024 |
2.0.8 | 92 | 7/25/2024 |
2.0.7 | 101 | 7/25/2024 |
2.0.6 | 96 | 7/25/2024 |
2.0.5 | 82 | 7/24/2024 |
2.0.4 | 99 | 7/24/2024 |
2.0.3 | 96 | 7/24/2024 |
2.0.2 | 163 | 7/10/2024 |
2.0.1 | 111 | 7/9/2024 |
2.0.0 | 94 | 7/9/2024 |
1.6.18 | 272 | 6/11/2024 |
1.6.17 | 105 | 6/11/2024 |
1.6.16 | 454 | 3/11/2024 |
1.6.14 | 202 | 2/5/2024 |
1.6.13 | 134 | 2/1/2024 |
1.6.12 | 321 | 1/4/2024 |
1.6.11 | 176 | 12/19/2023 |
1.6.10 | 319 | 11/21/2023 |
1.6.9 | 203 | 11/14/2023 |
1.6.8 | 214 | 10/30/2023 |
1.6.7 | 192 | 10/26/2023 |
1.6.6 | 148 | 10/25/2023 |
1.6.4 | 180 | 10/19/2023 |
1.6.3 | 186 | 10/18/2023 |
1.6.2 | 189 | 10/12/2023 |
1.6.1 | 204 | 9/21/2023 |
1.6.0 | 216 | 8/31/2023 |
1.5.3 | 449 | 5/25/2023 |
1.5.2 | 380 | 4/4/2023 |
1.5.0 | 372 | 3/16/2023 |
1.4.0 | 340 | 3/8/2023 |
1.3.0 | 295 | 3/2/2023 |
1.2.1 | 273 | 3/2/2023 |
1.2.0 | 280 | 3/2/2023 |
1.1.2 | 249 | 3/2/2023 |
1.1.1 | 262 | 3/2/2023 |
1.0.5 | 289 | 2/14/2023 |
1.0.4 | 289 | 2/14/2023 |