refactor - revised license AGPL - added headers
This commit is contained in:
parent
ba080b074a
commit
c0418b4e7a
18 changed files with 645 additions and 106 deletions
|
@ -4,10 +4,22 @@
|
|||
// Created : 01-01-2022
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 01-31-2022
|
||||
// Last Modified On : 02-24-2022
|
||||
// ***********************************************************************
|
||||
// <copyright file="CvrCompany.cs" company="FCS">
|
||||
// Copyright © FCS 2015-2022
|
||||
// <copyright file="CvrInfo.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>
|
||||
// ***********************************************************************
|
||||
|
@ -17,7 +29,7 @@ namespace FCS.Virk.CvrModels
|
|||
/// <summary>
|
||||
/// Class CvrCompany.
|
||||
/// </summary>
|
||||
public class CvrCompany
|
||||
public class CvrInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the vat number.
|
||||
|
@ -53,6 +65,6 @@ namespace FCS.Virk.CvrModels
|
|||
/// Gets or sets the status.
|
||||
/// </summary>
|
||||
/// <value>The status.</value>
|
||||
public List<CvrStatus> Status { get; set; } = new();
|
||||
public List<CvrState> States { get; set; } = new();
|
||||
}
|
||||
}
|
|
@ -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
49
CvrModels/CvrState.cs
Normal 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();
|
||||
}
|
||||
}
|
|
@ -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
44
CvrModels/TimeFrame.cs
Normal 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; } = "";
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
namespace FCS.Virk
|
||||
{
|
||||
/// <summary>
|
||||
/// Class VrCvrMapper.
|
||||
/// </summary>
|
||||
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,
|
||||
Address =
|
||||
|
@ -18,19 +51,27 @@ namespace FCS.Virk
|
|||
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,
|
||||
Period = new CvrPeriod
|
||||
TimeFrame = new TimeFrame
|
||||
{
|
||||
StartDate = vrStatus.Periode.GyldigFra,
|
||||
EndDate = vrStatus.Periode.GyldigTil
|
||||
}
|
||||
}))
|
||||
{
|
||||
c.Status.Add(cs);
|
||||
c.States.Add(cs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
c.States.Add(new CvrState());
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
namespace FCS.Virk
|
||||
{
|
||||
/// <summary>
|
||||
/// Class VrHttpRequest.
|
||||
/// </summary>
|
||||
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<VrResponseView> representing the asynchronous operation.</returns>
|
||||
public async Task<VrResponseView> GetResponseAsync(string endpoint, string jsonData, string auth)
|
||||
{
|
||||
using var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the husnummer fra.
|
||||
/// </summary>
|
||||
/// <value>The husnummer fra.</value>
|
||||
public int? HusnummerFra { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the husnummer til.
|
||||
/// </summary>
|
||||
/// <value>The husnummer til.</value>
|
||||
public int? HusnummerTil { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the postnummer.
|
||||
/// </summary>
|
||||
/// <value>The postnummer.</value>
|
||||
public int? Postnummer { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the vejnavn.
|
||||
/// </summary>
|
||||
/// <value>The vejnavn.</value>
|
||||
public string Vejnavn { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Gets or sets the co navn.
|
||||
/// </summary>
|
||||
/// <value>The co navn.</value>
|
||||
public string CoNavn { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Gets or sets the post distrikt.
|
||||
/// </summary>
|
||||
/// <value>The post distrikt.</value>
|
||||
public string PostDistrikt { get; set; } = "";
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the navn.
|
||||
/// </summary>
|
||||
/// <value>The navn.</value>
|
||||
public string Navn { get; set; } = "";
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the gyldig fra.
|
||||
/// </summary>
|
||||
/// <value>The gyldig fra.</value>
|
||||
public string GyldigFra { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Gets or sets the gyldig til.
|
||||
/// </summary>
|
||||
/// <value>The gyldig til.</value>
|
||||
public string GyldigTil { get; set; } = "";
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the nyeste navn.
|
||||
/// </summary>
|
||||
/// <value>The nyeste navn.</value>
|
||||
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();
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the sidst opdateret.
|
||||
/// </summary>
|
||||
/// <value>The sidst opdateret.</value>
|
||||
public string SidstOpdateret { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Gets or sets the status.
|
||||
/// </summary>
|
||||
/// <value>The status.</value>
|
||||
public string Status { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Gets or sets the periode.
|
||||
/// </summary>
|
||||
/// <value>The periode.</value>
|
||||
public Periode Periode { get; set; } = new();
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the CVR nummer.
|
||||
/// </summary>
|
||||
/// <value>The CVR nummer.</value>
|
||||
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 ();
|
||||
/// <summary>
|
||||
/// Gets or sets the virksomhed metadata.
|
||||
/// </summary>
|
||||
/// <value>The virksomhed metadata.</value>
|
||||
public VirksomhedMetadata VirksomhedMetadata { get; set; } = new();
|
||||
|
||||
}
|
||||
|
|
46
VrQuery.cs
46
VrQuery.cs
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the vat number.
|
||||
/// </summary>
|
||||
/// <value>The vat number.</value>
|
||||
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; } = "";
|
||||
/// <summary>
|
||||
/// Gets or sets the house number.
|
||||
/// </summary>
|
||||
/// <value>The house number.</value>
|
||||
public string HouseNumber { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Gets or sets the zip code.
|
||||
/// </summary>
|
||||
/// <value>The zip code.</value>
|
||||
public string ZipCode { get; set; } = "";
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Class VrQueryMapper.
|
||||
/// </summary>
|
||||
public class VrQueryMapper
|
||||
{
|
||||
/// <summary>
|
||||
/// Vrs the map query.
|
||||
/// </summary>
|
||||
/// <param name="query">The query.</param>
|
||||
/// <returns>JObject.</returns>
|
||||
public JObject VrMapQuery(VrQuery query)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(query.VatNumber))
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <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)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Precise lookup
|
||||
if (!string.IsNullOrEmpty(query.VatNumber)) return true;
|
||||
if (!string.IsNullOrWhiteSpace(query.VatNumber)) return true;
|
||||
// Search lookup
|
||||
return !string.IsNullOrWhiteSpace(query.StreetName)
|
||||
&& !string.IsNullOrWhiteSpace(query.HouseNumber)
|
||||
&& !string.IsNullOrEmpty(query.ZipCode);
|
||||
&& !string.IsNullOrWhiteSpace(query.ZipCode);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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.Linq;
|
||||
|
||||
namespace FCS.Virk
|
||||
{
|
||||
/// <summary>
|
||||
/// Class VrResponseParser.
|
||||
/// </summary>
|
||||
public class VrResponseParser
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses the vr response.
|
||||
/// </summary>
|
||||
/// <param name="jsonData">The json data.</param>
|
||||
/// <returns>List<System.Nullable<VrVirksomhed>>.</returns>
|
||||
public List<VrVirksomhed?> ParseVrResponse(string jsonData)
|
||||
{
|
||||
var result = new List<VrVirksomhed?>();
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Class VrResponseView.
|
||||
/// </summary>
|
||||
public class VrResponseView
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the code.
|
||||
/// </summary>
|
||||
/// <value>The code.</value>
|
||||
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; }
|
||||
/// <summary>
|
||||
/// Gets or sets the message.
|
||||
/// </summary>
|
||||
/// <value>The message.</value>
|
||||
public string Message { get; set; } = "";
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue