refactor - revised license AGPL - added headers

This commit is contained in:
FH 2022-02-24 09:59:42 +01:00
parent ba080b074a
commit c0418b4e7a
18 changed files with 645 additions and 106 deletions

View file

@ -4,10 +4,22 @@
// Created : 01-01-2022 // Created : 01-01-2022
// //
// Last Modified By : FH // Last Modified By : FH
// Last Modified On : 01-31-2022 // Last Modified On : 02-24-2022
// *********************************************************************** // ***********************************************************************
// <copyright file="CvrCompany.cs" company="FCS"> // <copyright file="CvrInfo.cs" company="FCS">
// Copyright © FCS 2015-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/>
// </copyright> // </copyright>
// <summary></summary> // <summary></summary>
// *********************************************************************** // ***********************************************************************
@ -17,7 +29,7 @@ namespace FCS.Virk.CvrModels
/// <summary> /// <summary>
/// Class CvrCompany. /// Class CvrCompany.
/// </summary> /// </summary>
public class CvrCompany public class CvrInfo
{ {
/// <summary> /// <summary>
/// Gets or sets the vat number. /// Gets or sets the vat number.
@ -53,6 +65,6 @@ namespace FCS.Virk.CvrModels
/// Gets or sets the status. /// Gets or sets the status.
/// </summary> /// </summary>
/// <value>The status.</value> /// <value>The status.</value>
public List<CvrStatus> Status { get; set; } = new(); public List<CvrState> States { get; set; } = new();
} }
} }

View file

@ -1,32 +0,0 @@
// ***********************************************************************
// Assembly : Inno.Api
// Author : FH
// Created : 01-01-2022
//
// Last Modified By : FH
// Last Modified On : 01-09-2022
// ***********************************************************************
// <copyright file="CvrPeriod.cs" company="FCS">
// Copyright © FCS 2015-2022
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Virk.CvrModels
{
/// <summary>
/// Class CvrPeriod.
/// </summary>
public class CvrPeriod
{
/// <summary>
/// Gets or sets the start date.
/// </summary>
/// <value>The start date.</value>
public string StartDate { get; set; } = "";
/// <summary>
/// Gets or sets the end date.
/// </summary>
/// <value>The end date.</value>
public string EndDate { get; set; } = "";
}
}

49
CvrModels/CvrState.cs Normal file
View file

@ -0,0 +1,49 @@
// ***********************************************************************
// Assembly : Inno.Api
// Author : FH
// Created : 01-01-2022
//
// Last Modified By : FH
// Last Modified On : 02-22-2022
// ***********************************************************************
// <copyright file="CvrState.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Virk.CvrModels
{
/// <summary>
/// Class CvrStatus.
/// </summary>
public class CvrState
{
/// <summary>
/// Gets or sets the last update.
/// </summary>
/// <value>The last update.</value>
public string LastUpdate { get; set; } = "";
/// <summary>
/// Gets or sets the status.
/// </summary>
/// <value>The status.</value>
public string State { get; set; } = "INAKTIV";
/// <summary>
/// Gets or sets the period.
/// </summary>
/// <value>The period.</value>
public TimeFrame TimeFrame { get; set; } = new();
}
}

View file

@ -1,37 +0,0 @@
// ***********************************************************************
// Assembly : Inno.Api
// Author : FH
// Created : 01-01-2022
//
// Last Modified By : FH
// Last Modified On : 01-31-2022
// ***********************************************************************
// <copyright file="CvrStatus.cs" company="FCS">
// Copyright © FCS 2015-2022
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Virk.CvrModels
{
/// <summary>
/// Class CvrStatus.
/// </summary>
public class CvrStatus
{
/// <summary>
/// Gets or sets the last update.
/// </summary>
/// <value>The last update.</value>
public string LastUpdate { get; set; } = "";
/// <summary>
/// Gets or sets the status.
/// </summary>
/// <value>The status.</value>
public string Status { get; set; } = "LUKKET";
/// <summary>
/// Gets or sets the period.
/// </summary>
/// <value>The period.</value>
public CvrPeriod Period { get; set; } = new();
}
}

44
CvrModels/TimeFrame.cs Normal file
View file

@ -0,0 +1,44 @@
// ***********************************************************************
// Assembly : Inno.Api
// Author : FH
// Created : 01-01-2022
//
// Last Modified By : FH
// Last Modified On : 02-22-2022
// ***********************************************************************
// <copyright file="TimeFrame.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Virk.CvrModels
{
/// <summary>
/// Class CvrPeriod.
/// </summary>
public class TimeFrame
{
/// <summary>
/// Gets or sets the start date.
/// </summary>
/// <value>The start date.</value>
public string StartDate { get; set; } = "";
/// <summary>
/// Gets or sets the end date.
/// </summary>
/// <value>The end date.</value>
public string EndDate { get; set; } = "";
}
}

View file

@ -1,13 +1,46 @@
using FCS.Virk.CvrModels; // ***********************************************************************
// Assembly : FCS.Virk
// Author : FH
// Created : 02-21-2022
//
// Last Modified By : FH
// Last Modified On : 02-24-2022
// ***********************************************************************
// <copyright file="VrCvrMapper.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
using FCS.Virk.CvrModels;
using FCS.Virk.VrModels; using FCS.Virk.VrModels;
namespace FCS.Virk namespace FCS.Virk
{ {
/// <summary>
/// Class VrCvrMapper.
/// </summary>
public class VrCvrMapper public class VrCvrMapper
{ {
public CvrCompany MapVrToCvr(VrVirksomhed vrVirk) /// <summary>
/// Maps the vr to CVR.
/// </summary>
/// <param name="vrVirk">The vr virk.</param>
/// <returns>CvrInfo.</returns>
public CvrInfo MapVrToCvr(VrVirksomhed vrVirk)
{ {
var c = new CvrCompany var c = new CvrInfo
{ {
Name = vrVirk.VirksomhedMetadata.NyesteNavn.Navn, Name = vrVirk.VirksomhedMetadata.NyesteNavn.Navn,
Address = Address =
@ -18,19 +51,27 @@ namespace FCS.Virk
VatNumber = vrVirk.CvrNummer VatNumber = vrVirk.CvrNummer
}; };
foreach (var cs in vrVirk.VirksomhedsStatus.Select(vrStatus => new CvrStatus if (vrVirk.VirksomhedsStatus.Any())
{ {
Status = vrStatus.Status, foreach (var cs in vrVirk.VirksomhedsStatus.Select(vrStatus => new CvrState
{
State = vrStatus.Status,
LastUpdate = vrStatus.SidstOpdateret, LastUpdate = vrStatus.SidstOpdateret,
Period = new CvrPeriod TimeFrame = new TimeFrame
{ {
StartDate = vrStatus.Periode.GyldigFra, StartDate = vrStatus.Periode.GyldigFra,
EndDate = vrStatus.Periode.GyldigTil EndDate = vrStatus.Periode.GyldigTil
} }
})) }))
{ {
c.Status.Add(cs); c.States.Add(cs);
} }
}
else
{
c.States.Add(new CvrState());
}
return c; return c;
} }
} }

View file

@ -1,10 +1,45 @@
using System.Net.Http.Headers; // ***********************************************************************
// Assembly : FCS.Virk
// Author : FH
// Created : 02-21-2022
//
// Last Modified By : FH
// Last Modified On : 02-24-2022
// ***********************************************************************
// <copyright file="VrHttpRequest.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
using System.Net.Http.Headers;
using System.Text; using System.Text;
namespace FCS.Virk namespace FCS.Virk
{ {
/// <summary>
/// Class VrHttpRequest.
/// </summary>
public class VrHttpRequest public class VrHttpRequest
{ {
/// <summary>
/// Get response as an asynchronous operation.
/// </summary>
/// <param name="endpoint">The endpoint.</param>
/// <param name="jsonData">The json data.</param>
/// <param name="auth">The authentication.</param>
/// <returns>A Task&lt;VrResponseView&gt; representing the asynchronous operation.</returns>
public async Task<VrResponseView> GetResponseAsync(string endpoint, string jsonData, string auth) public async Task<VrResponseView> GetResponseAsync(string endpoint, string jsonData, string auth)
{ {
using var content = new StringContent(jsonData, Encoding.UTF8, "application/json"); using var content = new StringContent(jsonData, Encoding.UTF8, "application/json");

View file

@ -1,12 +1,64 @@
namespace FCS.Virk.VrModels // ***********************************************************************
// Assembly : FCS.Virk
// Author : FH
// Created : 02-21-2022
//
// Last Modified By : FH
// Last Modified On : 02-24-2022
// ***********************************************************************
// <copyright file="NyesteBeliggenhedsadresse.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Virk.VrModels
{ {
/// <summary>
/// Class NyesteBeliggenhedsadresse.
/// </summary>
public class NyesteBeliggenhedsadresse public class NyesteBeliggenhedsadresse
{ {
/// <summary>
/// Gets or sets the husnummer fra.
/// </summary>
/// <value>The husnummer fra.</value>
public int? HusnummerFra { get; set; } public int? HusnummerFra { get; set; }
/// <summary>
/// Gets or sets the husnummer til.
/// </summary>
/// <value>The husnummer til.</value>
public int? HusnummerTil { get; set; } public int? HusnummerTil { get; set; }
/// <summary>
/// Gets or sets the postnummer.
/// </summary>
/// <value>The postnummer.</value>
public int? Postnummer { get; set; } public int? Postnummer { get; set; }
/// <summary>
/// Gets or sets the vejnavn.
/// </summary>
/// <value>The vejnavn.</value>
public string Vejnavn { get; set; } = ""; public string Vejnavn { get; set; } = "";
/// <summary>
/// Gets or sets the co navn.
/// </summary>
/// <value>The co navn.</value>
public string CoNavn { get; set; } = ""; public string CoNavn { get; set; } = "";
/// <summary>
/// Gets or sets the post distrikt.
/// </summary>
/// <value>The post distrikt.</value>
public string PostDistrikt { get; set; } = ""; public string PostDistrikt { get; set; } = "";
} }
} }

View file

@ -1,7 +1,40 @@
namespace FCS.Virk.VrModels // ***********************************************************************
// Assembly : FCS.Virk
// Author : FH
// Created : 02-21-2022
//
// Last Modified By : FH
// Last Modified On : 02-24-2022
// ***********************************************************************
// <copyright file="NyesteNavn.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Virk.VrModels
{ {
/// <summary>
/// Class NyesteNavn.
/// </summary>
public class NyesteNavn public class NyesteNavn
{ {
/// <summary>
/// Gets or sets the navn.
/// </summary>
/// <value>The navn.</value>
public string Navn { get; set; } = ""; public string Navn { get; set; } = "";
} }
} }

View file

@ -1,8 +1,44 @@
namespace FCS.Virk.VrModels // ***********************************************************************
// Assembly : FCS.Virk
// Author : FH
// Created : 02-21-2022
//
// Last Modified By : FH
// Last Modified On : 02-24-2022
// ***********************************************************************
// <copyright file="Periode.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Virk.VrModels
{ {
/// <summary>
/// Class Periode.
/// </summary>
public class Periode public class Periode
{ {
/// <summary>
/// Gets or sets the gyldig fra.
/// </summary>
/// <value>The gyldig fra.</value>
public string GyldigFra { get; set; } = ""; public string GyldigFra { get; set; } = "";
/// <summary>
/// Gets or sets the gyldig til.
/// </summary>
/// <value>The gyldig til.</value>
public string GyldigTil { get; set; } = ""; public string GyldigTil { get; set; } = "";
} }
} }

View file

@ -1,8 +1,44 @@
namespace FCS.Virk.VrModels // ***********************************************************************
// Assembly : FCS.Virk
// Author : FH
// Created : 02-21-2022
//
// Last Modified By : FH
// Last Modified On : 02-24-2022
// ***********************************************************************
// <copyright file="VirksomhedMetadata.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Virk.VrModels
{ {
/// <summary>
/// Class VirksomhedMetadata.
/// </summary>
public class VirksomhedMetadata public class VirksomhedMetadata
{ {
/// <summary>
/// Gets or sets the nyeste navn.
/// </summary>
/// <value>The nyeste navn.</value>
public NyesteNavn NyesteNavn { get; set; } = new(); public NyesteNavn NyesteNavn { get; set; } = new();
/// <summary>
/// Gets or sets the nyeste beliggenhedsadresse.
/// </summary>
/// <value>The nyeste beliggenhedsadresse.</value>
public NyesteBeliggenhedsadresse NyesteBeliggenhedsadresse { get; set; } = new(); public NyesteBeliggenhedsadresse NyesteBeliggenhedsadresse { get; set; } = new();
} }
} }

View file

@ -1,9 +1,49 @@
namespace FCS.Virk.VrModels // ***********************************************************************
// Assembly : FCS.Virk
// Author : FH
// Created : 02-21-2022
//
// Last Modified By : FH
// Last Modified On : 02-24-2022
// ***********************************************************************
// <copyright file="VirksomhedsStatus.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Virk.VrModels
{ {
/// <summary>
/// Class VirksomhedsStatus.
/// </summary>
public class VirksomhedsStatus public class VirksomhedsStatus
{ {
/// <summary>
/// Gets or sets the sidst opdateret.
/// </summary>
/// <value>The sidst opdateret.</value>
public string SidstOpdateret { get; set; } = ""; public string SidstOpdateret { get; set; } = "";
/// <summary>
/// Gets or sets the status.
/// </summary>
/// <value>The status.</value>
public string Status { get; set; } = ""; public string Status { get; set; } = "";
/// <summary>
/// Gets or sets the periode.
/// </summary>
/// <value>The periode.</value>
public Periode Periode { get; set; } = new(); public Periode Periode { get; set; } = new();
} }
} }

View file

@ -1,9 +1,49 @@
namespace FCS.Virk.VrModels // ***********************************************************************
// Assembly : FCS.Virk
// Author : FH
// Created : 02-21-2022
//
// Last Modified By : FH
// Last Modified On : 02-21-2022
// ***********************************************************************
// <copyright file="VrVirksomhed.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Virk.VrModels
{ {
/// <summary>
/// Class VrVirksomhed.
/// </summary>
public class VrVirksomhed public class VrVirksomhed
{ {
/// <summary>
/// Gets or sets the CVR nummer.
/// </summary>
/// <value>The CVR nummer.</value>
public string CvrNummer { get; set; } = ""; public string CvrNummer { get; set; } = "";
/// <summary>
/// Gets or sets the virksomheds status.
/// </summary>
/// <value>The virksomheds status.</value>
public List<VirksomhedsStatus> VirksomhedsStatus { get; set; } = new (); public List<VirksomhedsStatus> VirksomhedsStatus { get; set; } = new ();
/// <summary>
/// Gets or sets the virksomhed metadata.
/// </summary>
/// <value>The virksomhed metadata.</value>
public VirksomhedMetadata VirksomhedMetadata { get; set; } = new(); public VirksomhedMetadata VirksomhedMetadata { get; set; } = new();
} }

View file

@ -1,10 +1,54 @@
namespace FCS.Virk // ***********************************************************************
// Assembly : FCS.Virk
// Author : FH
// Created : 02-21-2022
//
// Last Modified By : FH
// Last Modified On : 02-24-2022
// ***********************************************************************
// <copyright file="VrQuery.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Virk
{ {
/// <summary>
/// Class VrQuery.
/// </summary>
public class VrQuery public class VrQuery
{ {
/// <summary>
/// Gets or sets the vat number.
/// </summary>
/// <value>The vat number.</value>
public string VatNumber { get; set; } = ""; public string VatNumber { get; set; } = "";
/// <summary>
/// Gets or sets the name of the street.
/// </summary>
/// <value>The name of the street.</value>
public string StreetName { get; set; } = ""; public string StreetName { get; set; } = "";
/// <summary>
/// Gets or sets the house number.
/// </summary>
/// <value>The house number.</value>
public string HouseNumber { get; set; } = ""; public string HouseNumber { get; set; } = "";
/// <summary>
/// Gets or sets the zip code.
/// </summary>
/// <value>The zip code.</value>
public string ZipCode { get; set; } = ""; public string ZipCode { get; set; } = "";
} }
} }

View file

@ -1,9 +1,42 @@
using Newtonsoft.Json.Linq; // ***********************************************************************
// Assembly : FCS.Virk
// Author : FH
// Created : 02-21-2022
//
// Last Modified By : FH
// Last Modified On : 02-24-2022
// ***********************************************************************
// <copyright file="VrQueryMapper.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
using Newtonsoft.Json.Linq;
namespace FCS.Virk namespace FCS.Virk
{ {
/// <summary>
/// Class VrQueryMapper.
/// </summary>
public class VrQueryMapper public class VrQueryMapper
{ {
/// <summary>
/// Vrs the map query.
/// </summary>
/// <param name="query">The query.</param>
/// <returns>JObject.</returns>
public JObject VrMapQuery(VrQuery query) public JObject VrMapQuery(VrQuery query)
{ {
if (string.IsNullOrWhiteSpace(query.VatNumber)) if (string.IsNullOrWhiteSpace(query.VatNumber))

View file

@ -1,15 +1,55 @@
namespace FCS.Virk // ***********************************************************************
// Assembly : FCS.Virk
// Author : FH
// Created : 02-21-2022
//
// Last Modified By : FH
// Last Modified On : 02-24-2022
// ***********************************************************************
// <copyright file="VrQueryValidator.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
namespace FCS.Virk
{ {
/// <summary>
/// Class VrQueryValidator.
/// </summary>
public static class VrQueryValidator public static class VrQueryValidator
{ {
/// <summary>
/// Validates the vr query.
/// </summary>
/// <param name="query">The query.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public static bool ValidateVrQuery(VrQuery query) public static bool ValidateVrQuery(VrQuery query)
{
try
{ {
// Precise lookup // Precise lookup
if (!string.IsNullOrEmpty(query.VatNumber)) return true; if (!string.IsNullOrWhiteSpace(query.VatNumber)) return true;
// Search lookup // Search lookup
return !string.IsNullOrWhiteSpace(query.StreetName) return !string.IsNullOrWhiteSpace(query.StreetName)
&& !string.IsNullOrWhiteSpace(query.HouseNumber) && !string.IsNullOrWhiteSpace(query.HouseNumber)
&& !string.IsNullOrEmpty(query.ZipCode); && !string.IsNullOrWhiteSpace(query.ZipCode);
}
catch
{
return false;
}
} }
} }
} }

View file

@ -1,11 +1,44 @@
using FCS.Virk.VrModels; // ***********************************************************************
// Assembly : FCS.Virk
// Author : FH
// Created : 02-21-2022
//
// Last Modified By : FH
// Last Modified On : 02-24-2022
// ***********************************************************************
// <copyright file="VrResponseParser.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
using FCS.Virk.VrModels;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
namespace FCS.Virk namespace FCS.Virk
{ {
/// <summary>
/// Class VrResponseParser.
/// </summary>
public class VrResponseParser public class VrResponseParser
{ {
/// <summary>
/// Parses the vr response.
/// </summary>
/// <param name="jsonData">The json data.</param>
/// <returns>List&lt;System.Nullable&lt;VrVirksomhed&gt;&gt;.</returns>
public List<VrVirksomhed?> ParseVrResponse(string jsonData) public List<VrVirksomhed?> ParseVrResponse(string jsonData)
{ {
var result = new List<VrVirksomhed?>(); var result = new List<VrVirksomhed?>();

View file

@ -1,11 +1,51 @@
using System.Net; // ***********************************************************************
// Assembly : FCS.Virk
// Author : FH
// Created : 02-21-2022
//
// Last Modified By : FH
// Last Modified On : 02-24-2022
// ***********************************************************************
// <copyright file="VrResponseView.cs" company="FCS">
// 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/>
// </copyright>
// <summary></summary>
// ***********************************************************************
using System.Net;
namespace FCS.Virk namespace FCS.Virk
{ {
/// <summary>
/// Class VrResponseView.
/// </summary>
public class VrResponseView public class VrResponseView
{ {
/// <summary>
/// Gets or sets the code.
/// </summary>
/// <value>The code.</value>
public HttpStatusCode Code { get; set; } public HttpStatusCode Code { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is success status code.
/// </summary>
/// <value><c>true</c> if this instance is success status code; otherwise, <c>false</c>.</value>
public bool IsSuccessStatusCode { get; set; } public bool IsSuccessStatusCode { get; set; }
/// <summary>
/// Gets or sets the message.
/// </summary>
/// <value>The message.</value>
public string Message { get; set; } = ""; public string Message { get; set; } = "";
} }
} }