update headers

This commit is contained in:
Frede Hundewadt 2023-03-21 07:19:55 +01:00
parent d8f5895dbb
commit 477a3a2e2b
13 changed files with 2151 additions and 2096 deletions

View file

@ -1,25 +1,25 @@
// *********************************************************************** // ***********************************************************************
// Assembly : FCS.Lib.Utility // Assembly : FCS.Lib.Utility
// Author : FH // Author : fhdk
// Created : 27-08-2016 // Created : 2022 12 17 13:33
// //
// Last Modified By : Frede H. // Last Modified By: fhdk
// Last Modified On : 02-24-2022 // Last Modified On : 2023 03 14 09:16
// *********************************************************************** // ***********************************************************************
// <copyright file="ExtensionsEx.cs" company="FCS-TECH"> // <copyright file="ExtensionsEx.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // along with this program. If not, see [https://www.gnu.org/licenses]
// </copyright> // </copyright>
// <summary></summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
@ -27,8 +27,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace FCS.Lib.Utility namespace FCS.Lib.Utility;
{
/// <summary> /// <summary>
/// Class ExtensionsEx. /// Class ExtensionsEx.
/// </summary> /// </summary>
@ -46,4 +46,3 @@ namespace FCS.Lib.Utility
action(item); action(item);
} }
} }
}

View file

@ -1,25 +1,25 @@
// *********************************************************************** // ***********************************************************************
// Assembly : FCS.Lib.Utility // Assembly : FCS.Lib.Utility
// Author : FH // Author : fhdk
// Created : 2020-07-01 // Created : 2023 02 02 06:59
// //
// Last Modified By : FH // Last Modified By: fhdk
// Last Modified On : 02-24-2022 // Last Modified On : 2023 03 14 09:16
// *********************************************************************** // ***********************************************************************
// <copyright file="Generators.cs" company="FCS-TECH"> // <copyright file="Generators.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2023-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // along with this program. If not, see [https://www.gnu.org/licenses]
// </copyright> // </copyright>
// <summary></summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
@ -29,8 +29,8 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
namespace FCS.Lib.Utility namespace FCS.Lib.Utility;
{
/// <summary> /// <summary>
/// Generators /// Generators
/// </summary> /// </summary>
@ -81,7 +81,7 @@ namespace FCS.Lib.Utility
for (var i = 0; i < leftGroupsOrder.Length; i++) for (var i = 0; i < leftGroupsOrder.Length; i++)
leftGroupsOrder[i] = i; leftGroupsOrder[i] = i;
// Using our private randomizer // Using our private random number generator
var random = RandomSeed(); var random = RandomSeed();
// This array will hold short-url characters. // This array will hold short-url characters.
@ -133,9 +133,8 @@ namespace FCS.Lib.Utility
// so that we don't pick it until we process all characters in // so that we don't pick it until we process all characters in
// this group. // this group.
if (lastCharIdx != nextCharIdx) if (lastCharIdx != nextCharIdx)
{ (charGroups[nextGroupIdx][lastCharIdx], charGroups[nextGroupIdx][nextCharIdx]) = (
(charGroups[nextGroupIdx][lastCharIdx], charGroups[nextGroupIdx][nextCharIdx]) = (charGroups[nextGroupIdx][nextCharIdx], charGroups[nextGroupIdx][lastCharIdx]); charGroups[nextGroupIdx][nextCharIdx], charGroups[nextGroupIdx][lastCharIdx]);
}
// Decrement the number of unprocessed characters in // Decrement the number of unprocessed characters in
// this group. // this group.
@ -153,9 +152,8 @@ namespace FCS.Lib.Utility
// Swap processed group with the last unprocessed group // Swap processed group with the last unprocessed group
// so that we don't pick it until we process all groups. // so that we don't pick it until we process all groups.
if (lastLeftGroupsOrderIdx != nextLeftGroupsOrderIdx) if (lastLeftGroupsOrderIdx != nextLeftGroupsOrderIdx)
{ (leftGroupsOrder[lastLeftGroupsOrderIdx], leftGroupsOrder[nextLeftGroupsOrderIdx]) = (
(leftGroupsOrder[lastLeftGroupsOrderIdx], leftGroupsOrder[nextLeftGroupsOrderIdx]) = (leftGroupsOrder[nextLeftGroupsOrderIdx], leftGroupsOrder[lastLeftGroupsOrderIdx]); leftGroupsOrder[nextLeftGroupsOrderIdx], leftGroupsOrder[lastLeftGroupsOrderIdx]);
}
// Decrement the number of unprocessed groups. // Decrement the number of unprocessed groups.
lastLeftGroupsOrderIdx--; lastLeftGroupsOrderIdx--;
@ -176,7 +174,7 @@ namespace FCS.Lib.Utility
{ {
options ??= new StringOptions options ??= new StringOptions
{ {
RequiredLength = 10, RequiredLength = 16,
RequireDigit = true, RequireDigit = true,
RequireLowercase = true, RequireLowercase = true,
RequireUppercase = true, RequireUppercase = true,
@ -197,13 +195,13 @@ namespace FCS.Lib.Utility
{ {
options ??= new StringOptions options ??= new StringOptions
{ {
RequiredLength = 10, RequiredLength = 16,
RequireDigit = true, RequireDigit = true,
RequireLowercase = true, RequireLowercase = true,
RequireUppercase = true, RequireUppercase = true,
RequiredUniqueChars = 4, RequiredUniqueChars = 8,
RequireNonLetterOrDigit = true, RequireNonLetterOrDigit = false,
RequireNonAlphanumeric = true RequireNonAlphanumeric = false
}; };
return GenerateRandomString(options); return GenerateRandomString(options);
} }
@ -240,7 +238,7 @@ namespace FCS.Lib.Utility
{ {
options ??= new StringOptions options ??= new StringOptions
{ {
RequiredLength = 10, RequiredLength = 16,
RequireDigit = true, RequireDigit = true,
RequireLowercase = true, RequireLowercase = true,
RequireUppercase = true, RequireUppercase = true,
@ -257,7 +255,7 @@ namespace FCS.Lib.Utility
"!@$?_-" // non-alphanumeric "!@$?_-" // non-alphanumeric
}; };
// Using our private randomizer // Using our private random number generator
var rand = RandomSeed(); var rand = RandomSeed();
var chars = new List<char>(); var chars = new List<char>();
@ -320,4 +318,3 @@ namespace FCS.Lib.Utility
return new Random(seed); return new Random(seed);
} }
} }
}

View file

@ -1,15 +1,40 @@
using System; // ***********************************************************************
// Assembly : FCS.Lib.Utility
// Author : fhdk
// Created : 2022 12 17 13:33
//
// Last Modified By: fhdk
// Last Modified On : 2023 03 14 09:16
// ***********************************************************************
// <copyright file="GuidGenerator.cs" company="FCS">
// Copyright (C) 2022-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses]
// </copyright>
// <summary></summary>
// ***********************************************************************
using System;
using System.Text; using System.Text;
namespace FCS.Lib.Utility namespace FCS.Lib.Utility;
{
/// <summary> /// <summary>
/// Used for generating UUID based on RFC 4122. /// Used for generating UUID based on RFC 4122.
/// </summary> /// </summary>
/// <seealso href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122 - A Universally Unique IDentifier (UUID) URN Namespace</seealso> /// <seealso href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122 - A Universally Unique IDentifier (UUID) URN Namespace</seealso>
public static class GuidGenerator public static class GuidGenerator
{ {
/// <summary> /// <summary>
/// number of bytes in guid /// number of bytes in guid
/// </summary> /// </summary>
@ -53,16 +78,6 @@ namespace FCS.Lib.Utility
// offset to move from 1/1/0001, which is 0-time for .NET, to gregorian 0-time of 10/15/1582 // offset to move from 1/1/0001, which is 0-time for .NET, to gregorian 0-time of 10/15/1582
private static readonly DateTimeOffset GregorianCalendarStart = new(1582, 10, 15, 0, 0, 0, TimeSpan.Zero); private static readonly DateTimeOffset GregorianCalendarStart = new(1582, 10, 15, 0, 0, 0, TimeSpan.Zero);
/// <summary>
/// Default clock sequence
/// </summary>
public static byte[] DefaultClockSequence { get; set; }
/// <summary>
/// Default node
/// </summary>
public static byte[] DefaultNode { get; set; }
static GuidGenerator() static GuidGenerator()
{ {
DefaultClockSequence = new byte[2]; DefaultClockSequence = new byte[2];
@ -73,6 +88,17 @@ namespace FCS.Lib.Utility
random.NextBytes(DefaultNode); random.NextBytes(DefaultNode);
} }
/// <summary>
/// Default clock sequence
/// </summary>
public static byte[] DefaultClockSequence { get; set; }
/// <summary>
/// Default node
/// </summary>
public static byte[] DefaultNode { get; set; }
/// <summary> /// <summary>
/// Set default node /// Set default node
/// </summary> /// </summary>
@ -248,4 +274,3 @@ namespace FCS.Lib.Utility
return new Guid(guid); return new Guid(guid);
} }
} }
}

View file

@ -1,5 +1,31 @@
namespace FCS.Lib.Utility // ***********************************************************************
{ // Assembly : FCS.Lib.Utility
// Author : fhdk
// Created : 2022 12 17 13:33
//
// Last Modified By: fhdk
// Last Modified On : 2023 03 14 09:16
// ***********************************************************************
// <copyright file="GuidVersion.cs" company="FCS">
// Copyright (C) 2022-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses]
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Lib.Utility;
/// <summary> /// <summary>
/// Guid Version Enum /// Guid Version Enum
/// </summary> /// </summary>
@ -9,17 +35,19 @@
/// Time /// Time
/// </summary> /// </summary>
TimeBased = 0x01, TimeBased = 0x01,
/// <summary> /// <summary>
/// Reserved /// Reserved
/// </summary> /// </summary>
Reserved = 0x02, Reserved = 0x02,
/// <summary> /// <summary>
/// Name /// Name
/// </summary> /// </summary>
NameBased = 0x03, NameBased = 0x03,
/// <summary> /// <summary>
/// Random /// Random
/// </summary> /// </summary>
Random = 0x04 Random = 0x04
} }
}

View file

@ -1,25 +1,25 @@
// *********************************************************************** // ***********************************************************************
// Assembly : FCS.Lib.Utility // Assembly : FCS.Lib.Utility
// Author : FH // Author : fhdk
// Created : 03-10-2015 // Created : 2023 01 23 07:31
// //
// Last Modified By : FH // Last Modified By: fhdk
// Last Modified On : 02-24-2022 // Last Modified On : 2023 03 14 09:16
// *********************************************************************** // ***********************************************************************
// <copyright file="IAsyncReadonlyRepo.cs" company="FCS-TECH"> // <copyright file="IAsyncReadonlyRepo.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2023-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // along with this program. If not, see [https://www.gnu.org/licenses]
// </copyright> // </copyright>
// <summary></summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
@ -30,8 +30,8 @@ using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace FCS.Lib.Utility namespace FCS.Lib.Utility;
{
/// <summary> /// <summary>
/// Interface IRepositoryAsync /// Interface IRepositoryAsync
/// </summary> /// </summary>
@ -93,4 +93,3 @@ namespace FCS.Lib.Utility
/// <returns>TEntity.</returns> /// <returns>TEntity.</returns>
TEntity GetById(string id); TEntity GetById(string id);
} }
}

View file

@ -1,31 +1,31 @@
// *********************************************************************** // ***********************************************************************
// Assembly : FCS.Lib.Utility // Assembly : FCS.Lib.Utility
// Author : FH // Author : fhdk
// Created : 05-13-2020 // Created : 2022 12 17 13:33
// //
// Last Modified By : FH // Last Modified By: fhdk
// Last Modified On : 02-24-2022 // Last Modified On : 2023 03 14 09:16
// *********************************************************************** // ***********************************************************************
// <copyright file="IRepository.cs" company="FCS-TECH"> // <copyright file="IRepository.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // along with this program. If not, see [https://www.gnu.org/licenses]
// </copyright> // </copyright>
// <summary></summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
namespace FCS.Lib.Utility namespace FCS.Lib.Utility;
{
/// <summary> /// <summary>
/// Interface IRepository /// Interface IRepository
/// </summary> /// </summary>
@ -58,4 +58,3 @@ namespace FCS.Lib.Utility
/// <param name="id">The identifier.</param> /// <param name="id">The identifier.</param>
void Delete(TKey id); void Delete(TKey id);
} }
}

View file

@ -1,25 +1,25 @@
// *********************************************************************** // ***********************************************************************
// Assembly : FCS.Lib.Utility // Assembly : FCS.Lib.Utility
// Author : FH // Author : fhdk
// Created : 03-10-2015 // Created : 2022 12 17 13:33
// //
// Last Modified By : FH // Last Modified By: fhdk
// Last Modified On : 02-24-2022 // Last Modified On : 2023 03 14 09:16
// *********************************************************************** // ***********************************************************************
// <copyright file="IRepositoryEx.cs" company="FCS-TECH"> // <copyright file="IRepositoryEx.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // along with this program. If not, see [https://www.gnu.org/licenses]
// </copyright> // </copyright>
// <summary></summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
@ -29,8 +29,8 @@ using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace FCS.Lib.Utility namespace FCS.Lib.Utility;
{
/// <summary> /// <summary>
/// Interface IRepositoryEx /// Interface IRepositoryEx
/// </summary> /// </summary>
@ -124,4 +124,3 @@ namespace FCS.Lib.Utility
/// <returns>IQueryable&lt;TEntity&gt;</returns> /// <returns>IQueryable&lt;TEntity&gt;</returns>
IQueryable<TEntity> All(); IQueryable<TEntity> All();
} }
}

View file

@ -1,25 +1,25 @@
// *********************************************************************** // ***********************************************************************
// Assembly : FCS.Lib.Utility // Assembly : FCS.Lib.Utility
// Author : FH // Author : fhdk
// Created : 27-08-2016 // Created : 2023 03 02 09:52
// //
// Last Modified By : Frede H. // Last Modified By: fhdk
// Last Modified On : 02-24-2022 // Last Modified On : 2023 03 14 09:16
// *********************************************************************** // ***********************************************************************
// <copyright file="Mogrify.cs" company="FCS-TECH"> // <copyright file="Mogrify.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2023-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // along with this program. If not, see [https://www.gnu.org/licenses]
// </copyright> // </copyright>
// <summary></summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
@ -33,13 +33,27 @@ using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace FCS.Lib.Utility namespace FCS.Lib.Utility;
{
/// <summary> /// <summary>
/// Mogrify between units /// Mogrify between units
/// </summary> /// </summary>
public static class Mogrify public static class Mogrify
{ {
/// <summary>
/// Remove everything but digits and country code
/// </summary>
/// <param name="phone"></param>
/// <returns></returns>
public static string SanitizePhone(string phone)
{
if (string.IsNullOrWhiteSpace(phone))
return "";
phone = phone.Replace("+45", "").Replace("+46", "").Replace("+47", "");
var regexObj = new Regex(@"[^\d]");
return regexObj.Replace(phone, "");
}
/// <summary> /// <summary>
/// Get month from timestamp /// Get month from timestamp
/// </summary> /// </summary>
@ -70,6 +84,7 @@ namespace FCS.Lib.Utility
{ {
return DateTimeIso8601(TimeStampToDateTime(timestamp)); return DateTimeIso8601(TimeStampToDateTime(timestamp));
} }
/// <summary> /// <summary>
/// return date as ISO /// return date as ISO
/// </summary> /// </summary>
@ -89,7 +104,8 @@ namespace FCS.Lib.Utility
{ {
var dt1 = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0); var dt1 = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0);
var dt2 = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, 23, 59, 59); var dt2 = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, 23, 59, 59);
return new Dictionary<string, long>{ return new Dictionary<string, long>
{
{ "lower", DateTimeToTimeStamp(dt1) }, { "lower", DateTimeToTimeStamp(dt1) },
{ "upper", DateTimeToTimeStamp(dt2) } { "upper", DateTimeToTimeStamp(dt2) }
}; };
@ -334,6 +350,7 @@ namespace FCS.Lib.Utility
return flag; return flag;
} }
/// <summary> /// <summary>
/// get decimal from string /// get decimal from string
/// </summary> /// </summary>
@ -345,7 +362,7 @@ namespace FCS.Lib.Utility
return return
!decimal.TryParse(inString.Replace(",", "").Replace(".", ""), NumberStyles.Number, !decimal.TryParse(inString.Replace(",", "").Replace(".", ""), NumberStyles.Number,
CultureInfo.InvariantCulture, out var num) CultureInfo.InvariantCulture, out var num)
? (decimal?) null ? null
: decimal.Divide(num, new decimal((long)100)); : decimal.Divide(num, new decimal((long)100));
} }
@ -475,4 +492,3 @@ namespace FCS.Lib.Utility
// return empty; // return empty;
//} //}
} }
}

View file

@ -17,5 +17,5 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
[assembly: Guid("8D850197-78DB-4D16-A91F-E5BB6E8880A7")] [assembly: Guid("8D850197-78DB-4D16-A91F-E5BB6E8880A7")]
[assembly: AssemblyVersion("1.0.23023.0820")] [assembly: AssemblyVersion("1.0.23077.1334")]
[assembly: AssemblyFileVersion("1.0.23023.0820")] [assembly: AssemblyFileVersion("1.0.23077.1334")]

View file

@ -1,25 +1,25 @@
// *********************************************************************** // ***********************************************************************
// Assembly : FCS.Lib.Utility // Assembly : FCS.Lib.Utility
// Author : FH // Author : fhdk
// Created : 01-01-2022 // Created : 2022 12 17 13:33
// //
// Last Modified By : FH // Last Modified By: fhdk
// Last Modified On : 02-24-2022 // Last Modified On : 2023 03 14 09:16
// *********************************************************************** // ***********************************************************************
// <copyright file="QueryHelper.cs" company="Frede Hundewadt"> // <copyright file="QueryHelper.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // along with this program. If not, see [https://www.gnu.org/licenses]
// </copyright> // </copyright>
// <summary></summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
@ -29,8 +29,8 @@ using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Reflection; using System.Reflection;
namespace FCS.Lib.Utility namespace FCS.Lib.Utility;
{
/// <summary> /// <summary>
/// Class QueryHelper. /// Class QueryHelper.
/// </summary> /// </summary>
@ -94,5 +94,4 @@ namespace FCS.Lib.Utility
return desc ? q.OrderByDescending(exp) : q.OrderBy(exp); return desc ? q.OrderByDescending(exp) : q.OrderBy(exp);
} }
}
}}

View file

@ -1,34 +1,34 @@
// *********************************************************************** // ***********************************************************************
// Assembly : FCS.Lib.Utility // Assembly : FCS.Lib.Utility
// Author : FH // Author : fhdk
// Created : 2020-07-01 // Created : 2022 12 17 13:33
// //
// Last Modified By : FH // Last Modified By: fhdk
// Last Modified On : 02-24-2022 // Last Modified On : 2023 03 14 09:16
// *********************************************************************** // ***********************************************************************
// <copyright file="Squid.cs" company="FCS-TECH"> // <copyright file="Squid.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the Affero GNU General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// Affero GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the Affero GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // along with this program. If not, see [https://www.gnu.org/licenses]
// </copyright> // </copyright>
// <summary>Derived from https:github.com/csharpvitamins/CSharpVitamins.ShortGuid</summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
using System; using System;
using System.Diagnostics; using System.Diagnostics;
namespace FCS.Lib.Utility namespace FCS.Lib.Utility;
{
/// <summary> /// <summary>
/// A wrapper for handling URL-safe Base64 encoded globally unique identifiers (GUID). /// A wrapper for handling URL-safe Base64 encoded globally unique identifiers (GUID).
/// </summary> /// </summary>
@ -127,7 +127,7 @@ namespace FCS.Lib.Utility
/// <returns>New Squid object</returns> /// <returns>New Squid object</returns>
public static Squid NewGuid() public static Squid NewGuid()
{ {
return new(Guid.NewGuid()); return new Squid(Guid.NewGuid());
} }
/// <summary> /// <summary>
@ -392,4 +392,3 @@ namespace FCS.Lib.Utility
#endregion #endregion
} }
}

View file

@ -1,13 +1,13 @@
// *********************************************************************** // ***********************************************************************
// Assembly : FCS.Lib.Utility // Assembly : FCS.Lib.Utility
// Author : FH // Author : fhdk
// Created : 2020-09-09 // Created : 2022 12 17 13:33
// //
// Last Modified By : FH // Last Modified By: fhdk
// Last Modified On : 03-14-2022 // Last Modified On : 2023 03 14 09:16
// *********************************************************************** // ***********************************************************************
// <copyright file="StringOptions.cs" company="FCS-TECH"> // <copyright file="StringOptions.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2022-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
@ -24,8 +24,8 @@
// <summary></summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
namespace FCS.Lib.Utility namespace FCS.Lib.Utility;
{
/// <summary> /// <summary>
/// Class StringOptions. /// Class StringOptions.
/// </summary> /// </summary>
@ -73,4 +73,3 @@ namespace FCS.Lib.Utility
/// <value><c>true</c> if [require non alphanumeric]; otherwise, <c>false</c>.</value> /// <value><c>true</c> if [require non alphanumeric]; otherwise, <c>false</c>.</value>
public bool RequireNonAlphanumeric { get; set; } public bool RequireNonAlphanumeric { get; set; }
} }
}

View file

@ -1,13 +1,13 @@
// *********************************************************************** // ***********************************************************************
// Assembly : FCS.Lib.Utility // Assembly : FCS.Lib.Utility
// Author : FH // Author : fhdk
// Created : 03-30-2022 // Created : 2023 03 09 17:42
// //
// Last Modified By : FH // Last Modified By: fhdk
// Last Modified On : 04-19-2022 // Last Modified On : 2023 03 14 09:16
// *********************************************************************** // ***********************************************************************
// <copyright file="VatFormatValidator.cs" company="FCS-TECH"> // <copyright file="VatFormatValidator.cs" company="FCS">
// Copyright (C) 2022 FCS Frede's Computer Services. // Copyright (C) 2023-2023 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
@ -24,12 +24,11 @@
// <summary></summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace FCS.Lib.Utility namespace FCS.Lib.Utility;
{
/// <summary> /// <summary>
/// Vat format validator /// Vat format validator
/// </summary> /// </summary>
@ -123,7 +122,7 @@ namespace FCS.Lib.Utility
// C10 is check digit // C10 is check digit
var orgToCheck = orgNumber; var orgToCheck = orgNumber;
if (long.Parse(orgToCheck) == 0) if (!long.TryParse(orgToCheck, out _))
return false; return false;
switch (orgToCheck.Length) switch (orgToCheck.Length)
@ -217,7 +216,6 @@ namespace FCS.Lib.Utility
{ {
return false; return false;
} }
} }
@ -357,6 +355,4 @@ namespace FCS.Lib.Utility
// return nSum % 10 == 0; // return nSum % 10 == 0;
//} //}
}
} }