diff --git a/CvrModels/CvrInfo.cs b/CvrModels/CvrInfo.cs
index 4951965..2ed9a5a 100644
--- a/CvrModels/CvrInfo.cs
+++ b/CvrModels/CvrInfo.cs
@@ -26,45 +26,15 @@
namespace FCS.Lib.Virk.CvrModels
{
- ///
- /// Class CvrCompany.
- ///
public class CvrInfo
{
- ///
- /// Gets or sets the vat number.
- ///
- /// The vat number.
public string VatNumber { get; set; } = "";
- ///
- /// Gets or sets the name.
- ///
- /// The name.
public string Name { get; set; } = "";
- ///
- /// Gets or sets the name of the co.
- ///
- /// The name of the co.
public string CoName { get; set; } = "";
- ///
- /// Gets or sets the address.
- ///
- /// The address.
public string Address { get; set; } = "";
- ///
- /// Gets or sets the city.
- ///
- /// The city.
public string City { get; set; } = "";
- ///
- /// Gets or sets the zip code.
- ///
- /// The zip code.
public string ZipCode { get; set; } = "";
- ///
- /// Gets or sets the status.
- ///
- /// The status.
public List States { get; set; } = new();
+ public List LifeCycles { get; set; } = new();
}
}
\ No newline at end of file
diff --git a/CvrModels/CvrState.cs b/CvrModels/CvrState.cs
index 7376536..cfe3dd3 100644
--- a/CvrModels/CvrState.cs
+++ b/CvrModels/CvrState.cs
@@ -25,25 +25,10 @@
// ***********************************************************************
namespace FCS.Lib.Virk.CvrModels
{
- ///
- /// Class CvrStatus.
- ///
public class CvrState
{
- ///
- /// Gets or sets the last update.
- ///
- /// The last update.
public string LastUpdate { get; set; } = "";
- ///
- /// Gets or sets the status.
- ///
- /// The status.
- public string State { get; set; } = "INAKTIV";
- ///
- /// Gets or sets the period.
- ///
- /// The period.
+ public string State { get; set; } = "";
public TimeFrame TimeFrame { get; set; } = new();
}
}
\ No newline at end of file
diff --git a/CvrModels/LifeCycle.cs b/CvrModels/LifeCycle.cs
new file mode 100644
index 0000000..c40c325
--- /dev/null
+++ b/CvrModels/LifeCycle.cs
@@ -0,0 +1,34 @@
+// ***********************************************************************
+// Assembly : FCS.Lib.Virk
+// Author : FH
+// Created : 03-31-2022
+//
+// Last Modified By : FH
+// Last Modified On : 03-31-2022
+// ***********************************************************************
+//
+// Copyright (C) 2022 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]
+//
+//
+// ***********************************************************************
+namespace FCS.Lib.Virk.CvrModels
+{
+ public class LifeCycle
+ {
+ public string LastUpdate { get; set; } = "";
+ public TimeFrame TimeFrame { get; set; } = new ();
+
+ }
+}
\ No newline at end of file
diff --git a/CvrModels/TimeFrame.cs b/CvrModels/TimeFrame.cs
index 3770839..3ae7c78 100644
--- a/CvrModels/TimeFrame.cs
+++ b/CvrModels/TimeFrame.cs
@@ -25,20 +25,9 @@
// ***********************************************************************
namespace FCS.Lib.Virk.CvrModels
{
- ///
- /// Class CvrPeriod.
- ///
public class TimeFrame
{
- ///
- /// Gets or sets the start date.
- ///
- /// The start date.
public string StartDate { get; set; } = "";
- ///
- /// Gets or sets the end date.
- ///
- /// The end date.
public string EndDate { get; set; } = "";
}
}
\ No newline at end of file
diff --git a/VrCvrMapper.cs b/VrCvrMapper.cs
index 1647233..ee25248 100644
--- a/VrCvrMapper.cs
+++ b/VrCvrMapper.cs
@@ -29,16 +29,8 @@ using FCS.Lib.Virk.VrModels;
namespace FCS.Lib.Virk
{
- ///
- /// Class VrCvrMapper.
- ///
public class VrCvrMapper
{
- ///
- /// Maps the vr to CVR.
- ///
- /// The vr virk.
- /// CvrInfo.
public CvrInfo MapVrToCvr(VrVirksomhed vrVirk)
{
var c = new CvrInfo
@@ -61,7 +53,7 @@ namespace FCS.Lib.Virk
TimeFrame = new TimeFrame
{
StartDate = vrStatus.Periode.GyldigFra,
- EndDate = vrStatus.Periode.GyldigTil
+ EndDate = !string.IsNullOrWhiteSpace(vrStatus.Periode.GyldigTil) ? vrStatus.Periode.GyldigTil : ""
}
}))
{
@@ -73,6 +65,37 @@ namespace FCS.Lib.Virk
c.States.Add(new CvrState());
}
+ if (vrVirk.Livsforloeb.Any())
+ {
+ foreach (var lc in vrVirk.Livsforloeb.Select(
+ vrCourse => new LifeCycle
+ {
+ LastUpdate = vrCourse.SidstOpdateret,
+ TimeFrame = new TimeFrame
+ {
+ StartDate = vrCourse.Periode.GyldigFra,
+ EndDate = !string.IsNullOrWhiteSpace(vrCourse.Periode.GyldigTil) ? vrCourse.Periode.GyldigTil : ""
+ }
+ }
+ ))
+ {
+ c.LifeCycles.Add(lc);
+ }
+ }
+ else
+ {
+ c.LifeCycles.Add(new LifeCycle());
+ }
+
+ if (!string.IsNullOrWhiteSpace(c.States[c.States.Count - 1].State)) return c;
+
+ var sc = c.States.Count - 1;
+ var lcc = c.LifeCycles.Count - 1;
+ c.States[sc].LastUpdate = c.LifeCycles[lcc].LastUpdate;
+ c.States[sc].TimeFrame.StartDate = c.LifeCycles[lcc].TimeFrame.StartDate;
+ c.States[sc].TimeFrame.EndDate = c.LifeCycles[lcc].TimeFrame.EndDate;
+
+ c.States[sc].State = string.IsNullOrWhiteSpace(c.LifeCycles[c.LifeCycles.Count - 1].TimeFrame.EndDate) ? "NORMAL" : "LUKKET";
return c;
}
}
diff --git a/VrHttpRequest.cs b/VrHttpRequest.cs
index c873204..39a73ba 100644
--- a/VrHttpRequest.cs
+++ b/VrHttpRequest.cs
@@ -29,18 +29,8 @@ using System.Text;
namespace FCS.Lib.Virk
{
- ///
- /// Class VrHttpRequest.
- ///
public class VrHttpRequest
{
- ///
- /// Get response as an asynchronous operation.
- ///
- /// The endpoint.
- /// The json data.
- /// The authentication.
- /// A Task<VrResponseView> representing the asynchronous operation.
public async Task GetResponseAsync(string endpoint, string jsonData, string auth)
{
using var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
diff --git a/VrModels/LivsforloebModel.cs b/VrModels/LivsforloebModel.cs
new file mode 100644
index 0000000..95d322c
--- /dev/null
+++ b/VrModels/LivsforloebModel.cs
@@ -0,0 +1,33 @@
+// ***********************************************************************
+// Assembly : FCS.Lib.Virk
+// Author : FH
+// Created : 03-31-2022
+//
+// Last Modified By : FH
+// Last Modified On : 03-31-2022
+// ***********************************************************************
+//
+// Copyright (C) 2022 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]
+//
+//
+// ***********************************************************************
+namespace FCS.Lib.Virk.VrModels
+{
+ public class LivsforloebModel
+ {
+ public string SidstOpdateret { get; set; } = "";
+ public Periode Periode { get; set; } = new ();
+ }
+}
\ No newline at end of file
diff --git a/VrModels/NyesteBeliggenhedsadresse.cs b/VrModels/NyesteBeliggenhedsadresse.cs
index 1943d7e..f7c61b1 100644
--- a/VrModels/NyesteBeliggenhedsadresse.cs
+++ b/VrModels/NyesteBeliggenhedsadresse.cs
@@ -25,40 +25,13 @@
// ***********************************************************************
namespace FCS.Lib.Virk.VrModels
{
- ///
- /// Class NyesteBeliggenhedsadresse.
- ///
public class NyesteBeliggenhedsadresse
{
- ///
- /// Gets or sets the husnummer fra.
- ///
- /// The husnummer fra.
public int? HusnummerFra { get; set; }
- ///
- /// Gets or sets the husnummer til.
- ///
- /// The husnummer til.
public int? HusnummerTil { get; set; }
- ///
- /// Gets or sets the postnummer.
- ///
- /// The postnummer.
public int? Postnummer { get; set; }
- ///
- /// Gets or sets the vejnavn.
- ///
- /// The vejnavn.
public string Vejnavn { get; set; } = "";
- ///
- /// Gets or sets the co navn.
- ///
- /// The co navn.
public string CoNavn { get; set; } = "";
- ///
- /// Gets or sets the post distrikt.
- ///
- /// The post distrikt.
public string PostDistrikt { get; set; } = "";
}
}
\ No newline at end of file
diff --git a/VrModels/NyesteNavn.cs b/VrModels/NyesteNavn.cs
index 2dc6ffb..daaf6d5 100644
--- a/VrModels/NyesteNavn.cs
+++ b/VrModels/NyesteNavn.cs
@@ -26,15 +26,8 @@
namespace FCS.Lib.Virk.VrModels
{
- ///
- /// Class NyesteNavn.
- ///
public class NyesteNavn
{
- ///
- /// Gets or sets the navn.
- ///
- /// The navn.
public string Navn { get; set; } = "";
}
}
\ No newline at end of file
diff --git a/VrModels/Periode.cs b/VrModels/Periode.cs
index 2ab4f2b..1ad4266 100644
--- a/VrModels/Periode.cs
+++ b/VrModels/Periode.cs
@@ -25,20 +25,9 @@
// ***********************************************************************
namespace FCS.Lib.Virk.VrModels
{
- ///
- /// Class Periode.
- ///
public class Periode
{
- ///
- /// Gets or sets the gyldig fra.
- ///
- /// The gyldig fra.
public string GyldigFra { get; set; } = "";
- ///
- /// Gets or sets the gyldig til.
- ///
- /// The gyldig til.
public string GyldigTil { get; set; } = "";
}
}
\ No newline at end of file
diff --git a/VrModels/VirksomhedMetadata.cs b/VrModels/VirksomhedMetadata.cs
index f0289b1..7825660 100644
--- a/VrModels/VirksomhedMetadata.cs
+++ b/VrModels/VirksomhedMetadata.cs
@@ -25,20 +25,9 @@
// ***********************************************************************
namespace FCS.Lib.Virk.VrModels
{
- ///
- /// Class VirksomhedMetadata.
- ///
public class VirksomhedMetadata
{
- ///
- /// Gets or sets the nyeste navn.
- ///
- /// The nyeste navn.
public NyesteNavn NyesteNavn { get; set; } = new();
- ///
- /// Gets or sets the nyeste beliggenhedsadresse.
- ///
- /// The nyeste beliggenhedsadresse.
public NyesteBeliggenhedsadresse NyesteBeliggenhedsadresse { get; set; } = new();
}
}
\ No newline at end of file
diff --git a/VrModels/VirksomhedsStatus.cs b/VrModels/VirksomhedsStatus.cs
index fee6265..d76fb1b 100644
--- a/VrModels/VirksomhedsStatus.cs
+++ b/VrModels/VirksomhedsStatus.cs
@@ -25,25 +25,10 @@
// ***********************************************************************
namespace FCS.Lib.Virk.VrModels
{
- ///
- /// Class VirksomhedsStatus.
- ///
public class VirksomhedsStatus
{
- ///
- /// Gets or sets the sidst opdateret.
- ///
- /// The sidst opdateret.
public string SidstOpdateret { get; set; } = "";
- ///
- /// Gets or sets the status.
- ///
- /// The status.
public string Status { get; set; } = "";
- ///
- /// Gets or sets the periode.
- ///
- /// The periode.
public Periode Periode { get; set; } = new();
}
}
\ No newline at end of file
diff --git a/VrModels/VrVirksomhed.cs b/VrModels/VrVirksomhed.cs
index c365ac0..6527f2c 100644
--- a/VrModels/VrVirksomhed.cs
+++ b/VrModels/VrVirksomhed.cs
@@ -25,26 +25,11 @@
// ***********************************************************************
namespace FCS.Lib.Virk.VrModels
{
- ///
- /// Class VrVirksomhed.
- ///
public class VrVirksomhed
{
- ///
- /// Gets or sets the CVR nummer.
- ///
- /// The CVR nummer.
public string CvrNummer { get; set; } = "";
- ///
- /// Gets or sets the virksomheds status.
- ///
- /// The virksomheds status.
public List VirksomhedsStatus { get; set; } = new ();
- ///
- /// Gets or sets the virksomhed metadata.
- ///
- /// The virksomhed metadata.
public VirksomhedMetadata VirksomhedMetadata { get; set; } = new();
-
+ public List Livsforloeb { get; set; } = new();
}
}
\ No newline at end of file
diff --git a/VrQuery.cs b/VrQuery.cs
index c243dbb..043004e 100644
--- a/VrQuery.cs
+++ b/VrQuery.cs
@@ -25,30 +25,11 @@
// ***********************************************************************
namespace FCS.Lib.Virk
{
- ///
- /// Class VrQuery.
- ///
public class VrQuery
{
- ///
- /// Gets or sets the vat number.
- ///
- /// The vat number.
public string VatNumber { get; set; } = "";
- ///
- /// Gets or sets the name of the street.
- ///
- /// The name of the street.
public string StreetName { get; set; } = "";
- ///
- /// Gets or sets the house number.
- ///
- /// The house number.
public string HouseNumber { get; set; } = "";
- ///
- /// Gets or sets the zip code.
- ///
- /// The zip code.
public string ZipCode { get; set; } = "";
}
}
\ No newline at end of file
diff --git a/VrQueryMapper.cs b/VrQueryMapper.cs
index 9b48099..35052a2 100644
--- a/VrQueryMapper.cs
+++ b/VrQueryMapper.cs
@@ -28,16 +28,8 @@ using Newtonsoft.Json.Linq;
namespace FCS.Lib.Virk
{
- ///
- /// Class VrQueryMapper.
- ///
public class VrQueryMapper
{
- ///
- /// Vrs the map query.
- ///
- /// The query.
- /// JObject.
public JObject VrMapQuery(VrQuery query)
{
if (string.IsNullOrWhiteSpace(query.VatNumber))
@@ -53,7 +45,8 @@ namespace FCS.Lib.Virk
"Vrvirksomhed.virksomhedMetadata.nyesteBeliggenhedsadresse.husnummerTil",
"Vrvirksomhed.virksomhedMetadata.nyesteBeliggenhedsadresse.postnummer",
"Vrvirksomhed.virksomhedMetadata.nyesteBeliggenhedsadresse.postdistrikt",
- "Vrvirksomhed.virksomhedsstatus")
+ "Vrvirksomhed.virksomhedsstatus",
+ "Vrvirksomhed.livsforloeb")
),
new JProperty("query",
new JObject(new JProperty("bool",
@@ -89,7 +82,8 @@ namespace FCS.Lib.Virk
"Vrvirksomhed.virksomhedMetadata.nyesteBeliggenhedsadresse.husnummerTil",
"Vrvirksomhed.virksomhedMetadata.nyesteBeliggenhedsadresse.postnummer",
"Vrvirksomhed.virksomhedMetadata.nyesteBeliggenhedsadresse.postdistrikt",
- "Vrvirksomhed.virksomhedsstatus")
+ "Vrvirksomhed.virksomhedsstatus",
+ "Vrvirksomhed.livsforloeb")
),
new JProperty("query",
new JObject(new JProperty("term",
diff --git a/VrQueryValidator.cs b/VrQueryValidator.cs
index 72d3703..6a9c804 100644
--- a/VrQueryValidator.cs
+++ b/VrQueryValidator.cs
@@ -25,16 +25,8 @@
// ***********************************************************************
namespace FCS.Lib.Virk
{
- ///
- /// Class VrQueryValidator.
- ///
public static class VrQueryValidator
{
- ///
- /// Validates the vr query.
- ///
- /// The query.
- /// true if XXXX, false otherwise.
public static bool ValidateVrQuery(VrQuery query)
{
try
diff --git a/VrResponseParser.cs b/VrResponseParser.cs
index 1b05095..8f9566e 100644
--- a/VrResponseParser.cs
+++ b/VrResponseParser.cs
@@ -30,16 +30,8 @@ using Newtonsoft.Json.Linq;
namespace FCS.Lib.Virk
{
- ///
- /// Class VrResponseParser.
- ///
public class VrResponseParser
{
- ///
- /// Parses the vr response.
- ///
- /// The json data.
- /// List<System.Nullable<VrVirksomhed>>.
public List ParseVrResponse(string jsonData)
{
var result = new List();
diff --git a/VrResponseView.cs b/VrResponseView.cs
index 94bf9ad..9b4689d 100644
--- a/VrResponseView.cs
+++ b/VrResponseView.cs
@@ -28,25 +28,10 @@ using System.Net;
namespace FCS.Lib.Virk
{
- ///
- /// Class VrResponseView.
- ///
public class VrResponseView
{
- ///
- /// Gets or sets the code.
- ///
- /// The code.
public HttpStatusCode Code { get; set; }
- ///
- /// Gets or sets a value indicating whether this instance is success status code.
- ///
- /// true if this instance is success status code; otherwise, false.
public bool IsSuccessStatusCode { get; set; }
- ///
- /// Gets or sets the message.
- ///
- /// The message.
public string Message { get; set; } = "";
}
}
\ No newline at end of file