103 lines
2.1 KiB
C#
103 lines
2.1 KiB
C#
using BS.Shared.Extensions;
|
|
using BS.Shared.Interface;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BS.Shared.Core.Rule
|
|
{
|
|
public static class GkvRules
|
|
{
|
|
public static bool IsBezDatenannahmestelleValid(string bez_datenannahmestelle)
|
|
{
|
|
return !string.IsNullOrWhiteSpace(bez_datenannahmestelle);
|
|
}
|
|
|
|
public static bool IsIKNumberValid(params string[] iks)
|
|
=> iks?.All(IsIKNumberValid) ?? false;
|
|
public static bool IsIKNumberValid(string iknummer)
|
|
{
|
|
if (iknummer == null)
|
|
return false;
|
|
|
|
iknummer = iknummer.Trim();
|
|
|
|
if (iknummer.Length != 9)
|
|
return false;
|
|
|
|
return int.TryParse(iknummer, out int x);
|
|
}
|
|
|
|
public static bool IsVersichertennummerValid(string nummer)
|
|
{
|
|
if (nummer == null)
|
|
return false;
|
|
|
|
nummer = nummer.Trim();
|
|
|
|
if (nummer.Length < 6)
|
|
return false;
|
|
|
|
if (nummer.Length > 12)
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
public static bool IsVersichertenstatusValid(string status)
|
|
{
|
|
if (status == null)
|
|
return false;
|
|
|
|
status = status.Trim();
|
|
|
|
if (status.Length == 0)
|
|
return false;
|
|
|
|
if (status.Length == 6)
|
|
return false;
|
|
|
|
if (status.Length >= 8)
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
public static bool IsLeistungserbringergruppeValid(string code)
|
|
{
|
|
if (code == null)
|
|
return false;
|
|
|
|
code = code.Trim();
|
|
|
|
if (code.Length != 5 && code.Length != 7)
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
public static bool IsInvoiceNumberGkvValid(string invoiceNumber)
|
|
{
|
|
var pattern = @"^(?!.*[-/]{2})(?![-/])(?!.*[-/]$)[A-Za-z0-9]+(?:[/-][A-Za-z0-9]+)*$";
|
|
|
|
return Regex.IsMatch(invoiceNumber, pattern);
|
|
}
|
|
|
|
// Neu
|
|
public static bool AreAllAddressSame(IEnumerable<IInvoiceBase> invoiceBases)
|
|
=> invoiceBases.Select(x => x.SenderAddressToString()).AreAllTheSame();
|
|
|
|
public static bool IsUnitDescriptionValid(IInvoiceItem invoiceItem)
|
|
{
|
|
if(invoiceItem == null || invoiceItem.UnitDescription == null)
|
|
return false;
|
|
|
|
// GPos. 123456
|
|
// 0123456
|
|
return invoiceItem.UnitDescription.Length >= 8;
|
|
}
|
|
}
|
|
}
|