Compare commits
1 Commits
main
...
dev-mkoebi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3deb79cc6 |
23
Hochbaustatistik.Testing/DatabaseOperationsTests.cs
Normal file
23
Hochbaustatistik.Testing/DatabaseOperationsTests.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using Xunit;
|
||||||
|
using Hochbaustatistik.Business;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Hochbaustatistik.Database;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Hochbaustatistik.Testing
|
||||||
|
{
|
||||||
|
public class DatabaseOperationsTests
|
||||||
|
{
|
||||||
|
|
||||||
|
[Fact (Skip ="Keine Datenbank-Verbindung m<>glich")]
|
||||||
|
public void ConnectAndExecuteHochbauTest()
|
||||||
|
{
|
||||||
|
DatabaseOperations.conString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dborap04.stadtdo.de)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=bgvp.stadtdo.de)));user id=leser;password=leser;";
|
||||||
|
var result = DatabaseOperations.ConnectAndExecuteHochbau(new Vorgang() { Aktenzeichen = "63/2-1-020989" });
|
||||||
|
Assert.NotNull(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
57
Hochbaustatistik.Testing/EmailTests.cs
Normal file
57
Hochbaustatistik.Testing/EmailTests.cs
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Mail;
|
||||||
|
using Domino;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Hochbaustatistik.Testing
|
||||||
|
{
|
||||||
|
public class EmailTests
|
||||||
|
{
|
||||||
|
[Theory(Skip = "Kein Lotus Notes installiert")]
|
||||||
|
[InlineData(@"C:\TEMP\test.txt")]
|
||||||
|
public void SenMailTest(string attachment)
|
||||||
|
{
|
||||||
|
Assert.True(SendEmail(attachment));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool SendEmail(string attachment)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NotesSession nSession = new NotesSession();
|
||||||
|
nSession.Initialize("Mk130881");
|
||||||
|
|
||||||
|
NotesDatabase nDatabase = nSession.GetDatabase("DOMMAIL4/SRV/Stadt Dortmund/DE", "MAIL\\mkoebis-riedel");
|
||||||
|
|
||||||
|
NotesDocument nDocument = nDatabase.CreateDocument();
|
||||||
|
|
||||||
|
//Attachment
|
||||||
|
var richTextItem = nDocument.CreateRichTextItem("files");
|
||||||
|
richTextItem.EmbedObject(EMBED_TYPE.EMBED_ATTACHMENT, "", attachment, "attachment");
|
||||||
|
|
||||||
|
|
||||||
|
string[] recipients = { "mkoebis-riedel@stadtdo.de, katyes@gmx.li" };
|
||||||
|
|
||||||
|
string txtMessage = "Sehr geehrte Damen und Herren,\r\n\r\nanbei erhalten Sie die Auswertung zur Hochbaustatistik für das Jahr " + DateTime.Today.Year + ".\r\n\r\nBitte senden Sie jene ausgefüllt zurück an: mkoebis-riedel@stadtdo.de\r\n\r\nDanke und freundliche Grüße";
|
||||||
|
nDocument.ReplaceItemValue("Form", "Memo");
|
||||||
|
nDocument.ReplaceItemValue("SentTo", recipients);
|
||||||
|
nDocument.ReplaceItemValue("Subject", "Hochbaustatistik Auswertung IT.NRW");
|
||||||
|
nDocument.ReplaceItemValue("Body", txtMessage); //set body text
|
||||||
|
|
||||||
|
nDocument.SaveMessageOnSend = true;
|
||||||
|
nDocument.Send(false, recipients);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(ex.Message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,19 +4,45 @@
|
|||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
|
||||||
|
<Platforms>AnyCPU;x86</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
<PackageReference Include="coverlet.collector" Version="3.2.0">
|
||||||
<PackageReference Include="xunit" Version="2.4.1" />
|
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="coverlet.collector" Version="3.1.2">
|
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
||||||
|
<PackageReference Include="Selenium.WebDriver" Version="4.8.2" />
|
||||||
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Hochbaustatistik\Hochbaustatistik.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="TestData\Testdata.csv">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Interop.Domino">
|
||||||
|
<HintPath>Utilities\Interop.Domino.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Interop.Microsoft.Office.Interop.Excel">
|
||||||
|
<HintPath>Utilities\Interop.Microsoft.Office.Interop.Excel.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
33
Hochbaustatistik.Testing/SQL_Tiefensuche.txt
Normal file
33
Hochbaustatistik.Testing/SQL_Tiefensuche.txt
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
SELECT
|
||||||
|
INPROP.PMGTVVORGANG.VORGANGID,
|
||||||
|
INPROP.PMGTVVORGANG.VORGANGDEFID,
|
||||||
|
INPROP.PMGTVVORGANG.STRASSE1ID,
|
||||||
|
INPROP.PMGTVVORGANG.STRASSE1,
|
||||||
|
INPROP.PMGTVVORGANG.HAUSNUMMER1,
|
||||||
|
INPROP.PMGTVSACHBEARB.NAME,
|
||||||
|
INPROP.PMGTVVORGANG.VORGANGABGESCHL,
|
||||||
|
INPROP.PMGTVVORGANG.DATUMEINGANG,
|
||||||
|
INPROP.PMGTVVORGANGVAR.FLD_D_3 as Genehmigung,
|
||||||
|
INPROP.PMGTVVORGANGVAR.FLD_D_5 as Freigabe,
|
||||||
|
INPROP.PMGTVVORGANG.FLD_B_2 as Statistik_Relevant,
|
||||||
|
INPROP.PMGTVVORGANG.FLD_A_2 as Statistik1,
|
||||||
|
INPROP.PMGTVVORGANG.FLD_A_3 as Statistik2,
|
||||||
|
INPROP.PMGTVVORGANGVAR.FLD_D_10 as Genehmigung_gemeldet,
|
||||||
|
INPROP.PMGTVVORGANGVAR.FLD_D_11 as Fertigstellung_gemeldet,
|
||||||
|
INPROP.PMGTVVORGANGVAR.FLD_D_15 as Baubeginn,
|
||||||
|
INPROP.PMGTVVORGANGVAR.FLD_D_16 as Teilrohbauabnahme,
|
||||||
|
INPROP.PMGTVVORGANGVAR.FLD_D_17 as Rohbauabnahme,
|
||||||
|
INPROP.PMGTVVORGANGVAR.FLD_D_20 as Schlussabnahme,
|
||||||
|
INPROP.PMGTVVORGANG.FLD_A_20 as Vorjahr,
|
||||||
|
INPROP.PMGTVVORGANGVAR.FLD_C_2 as Bauüberhang_Vorjahr,
|
||||||
|
INPROP.PMGTVVORGANG.AKTENSTANDORT
|
||||||
|
FROM INPROP.PMGTVVORGANG
|
||||||
|
INNER JOIN INPROP.PMGTVVORGANGVAR ON INPROP.PMGTVVORGANG.VORGANGID = INPROP.PMGTVVORGANGVAR.VORGANGID
|
||||||
|
AND INPROP.PMGTVVORGANG.VORGANGID = INPROP.PMGTVVORGANGVAR.VORGANGID
|
||||||
|
INNER JOIN INPROP.PMVBCHECKLIST ON INPROP.PMGTVVORGANG.CHECKID = INPROP.PMVBCHECKLIST.CHECKLISTID
|
||||||
|
INNER JOIN INPROP.PMGTVSACHBEARB ON INPROP.PMGTVVORGANG.ANWENDER = INPROP.PMGTVSACHBEARB.USERID
|
||||||
|
WHERE INPROP.PMGTVVORGANG.STRASSE1='Dachsweg' AND INPROP.PMGTVVORGANG.HAUSNUMMER1='4'
|
||||||
|
AND INPROP.PMGTVVORGANG.VORGANGID
|
||||||
|
IN (SELECT INPROP.PMGTVVORGANG.VORGANGID FROM INPROP.PMGTVVORGANG
|
||||||
|
WHERE INPROP.PMGTVVORGANG.FLD_A_2 LIKE '576637%'
|
||||||
|
OR INPROP.PMGTVVORGANG.FLD_A_3 LIKE '576637%')
|
||||||
1854
Hochbaustatistik.Testing/TestData/Testdata.csv
Normal file
1854
Hochbaustatistik.Testing/TestData/Testdata.csv
Normal file
File diff suppressed because it is too large
Load Diff
198
Hochbaustatistik.Testing/Utilities/DataOpsTest.cs
Normal file
198
Hochbaustatistik.Testing/Utilities/DataOpsTest.cs
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
using Hochbaustatistik.Business;
|
||||||
|
using Hochbaustatistik.Database;
|
||||||
|
using Hochbaustatistik.Utilities;
|
||||||
|
using OpenQA.Selenium.DevTools.V109.Target;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Hochbaustatistik.Testing.Utilities
|
||||||
|
{
|
||||||
|
public class DataOpsTest
|
||||||
|
{
|
||||||
|
public readonly VorgangInpro vorgang = new VorgangInpro() { Schlussabnahme = "2022" };
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("61/5-2-052875", "615-2-052875")]
|
||||||
|
public void IsValidTest(string trueAz, string falseAZ)
|
||||||
|
{
|
||||||
|
var instance = DataOpsSingleton.Instance;
|
||||||
|
|
||||||
|
Assert.True(instance.IsValid(trueAz));
|
||||||
|
Assert.False(instance.IsValid(falseAZ));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("615-2-052875", "61/5-2-052870255", "61/5-4-050497/1", "6175-4-052875", "61/5-3-49044", "61/52052702", "Tiefe-Mark 20")]
|
||||||
|
public void CorrectAZTest(string az1, string az2, string az3, string az4, string az5, string az6, string az7)
|
||||||
|
{
|
||||||
|
var instance = DataOpsSingleton.Instance;
|
||||||
|
|
||||||
|
var expected1 = "61/5-2-052875";
|
||||||
|
var expected2 = "NOT_CORRECTED";
|
||||||
|
var expected3 = "61/5-4-050497";
|
||||||
|
var expected4 = "61/5-4-052875";
|
||||||
|
var expected5 = "61/5-3-049044";
|
||||||
|
var expected6 = "61/5-2-052702";
|
||||||
|
var expected7 = "NOT_CORRECTED";
|
||||||
|
|
||||||
|
Assert.Equal(expected1, instance.CorrectAZ(az1));
|
||||||
|
Assert.Equal(expected2, instance.CorrectAZ(az2));
|
||||||
|
Assert.Equal(expected3, instance.CorrectAZ(az3));
|
||||||
|
Assert.Equal(expected4, instance.CorrectAZ(az4));
|
||||||
|
Assert.Equal(expected5, instance.CorrectAZ(az5));
|
||||||
|
Assert.Equal(expected6, instance.CorrectAZ(az6));
|
||||||
|
Assert.Equal(expected7, instance.CorrectAZ(az7));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("50001234567")]
|
||||||
|
public void ReshapeIdentifikatorTest(string ident)
|
||||||
|
{
|
||||||
|
var instance = DataOpsSingleton.Instance;
|
||||||
|
var expected = "1234567";
|
||||||
|
var actual = instance.ReshapeIdentifikator(ident);
|
||||||
|
Assert.Equal(expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CreateItnrwRecordTest()
|
||||||
|
{
|
||||||
|
var instance = DataOpsSingleton.Instance;
|
||||||
|
List<VorgangItnrw> hochbauliste = new List<VorgangItnrw>();
|
||||||
|
hochbauliste.Add(new VorgangItnrw()
|
||||||
|
{
|
||||||
|
AGS = "913000",
|
||||||
|
Identifikator = "50005733064",
|
||||||
|
BauscheinNr = "61/5-2-43665",
|
||||||
|
MonatGenehmigung = "5",
|
||||||
|
JahrGenehmigung = "2017",
|
||||||
|
NameBauherr = " ",
|
||||||
|
Strasse = "Rüschenstr. 29",
|
||||||
|
PLZ = "44328",
|
||||||
|
Gemeinde = "Dortmund",
|
||||||
|
Gemeindeteil = " ",
|
||||||
|
Bauzustand = " ",
|
||||||
|
Bemerkungen = " "
|
||||||
|
});
|
||||||
|
|
||||||
|
var correctedAZ = "61/5-2-043665";
|
||||||
|
var origAZ = "61/5-2-43665";
|
||||||
|
var row = 57;
|
||||||
|
|
||||||
|
var hochbauListe = FileOperations.GenerateHochbauVorgangFromCSV(@"..\..\..\TestData\Testdata.csv");
|
||||||
|
|
||||||
|
var actual = instance.CreateItnrwRecord(row, correctedAZ, origAZ,hochbauListe);
|
||||||
|
var expected = String.Concat("913000;", "50005733064;", "61/5-2-043665;", "5;", "2017;", " ;", "Rüschenstr. 29;", "44328;", "Dortmund;", " ;");
|
||||||
|
|
||||||
|
Assert.Equal(expected, actual);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CreateStatusBauzustandTest()
|
||||||
|
{
|
||||||
|
var instance = DataOpsSingleton.Instance;
|
||||||
|
List<string> actuals = new List<string>();
|
||||||
|
|
||||||
|
List<VorgangInpro> inproVorgänge = new List<VorgangInpro>()
|
||||||
|
{
|
||||||
|
new VorgangInpro{ Schlussabnahme = "2022" },
|
||||||
|
new VorgangInpro { BaugenehmigungAusgeführt ="2022"}
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var item in inproVorgänge)
|
||||||
|
{
|
||||||
|
actuals.Add(instance.CreateStatusBauzustand(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
var expected1 = "F Fertigstellung erfolgte bis 31.12. des Vorjahres";
|
||||||
|
var expected2 = "4 Baugenehmigung erloschen";
|
||||||
|
|
||||||
|
Assert.Equal(expected1, actuals.ElementAt(0));
|
||||||
|
Assert.Equal(expected2, actuals.ElementAt(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact(Skip = "Keine Datenbank-Verbindung möglich")]
|
||||||
|
public void MergeInproWithITNRWTest()
|
||||||
|
{
|
||||||
|
var resultFile = @"C:\TEMP\hochbaustatistik.csv";
|
||||||
|
DatabaseOperations.conString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dborap04.stadtdo.de)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=bgvp.stadtdo.de)));user id=leser;password=leser;";
|
||||||
|
var instance = DataOpsSingleton.Instance;
|
||||||
|
|
||||||
|
List<VorgangItnrw> hochbauliste = new List<VorgangItnrw>();
|
||||||
|
hochbauliste.Add(new VorgangItnrw()
|
||||||
|
{
|
||||||
|
AGS = "913000",
|
||||||
|
Identifikator = "50005733064",
|
||||||
|
BauscheinNr = "61/5-2-43665",
|
||||||
|
MonatGenehmigung = "5",
|
||||||
|
JahrGenehmigung = "2017",
|
||||||
|
NameBauherr = " ",
|
||||||
|
Strasse = "Rüschenstr. 29",
|
||||||
|
PLZ = "44328",
|
||||||
|
Gemeinde = "Dortmund",
|
||||||
|
Gemeindeteil = " ",
|
||||||
|
Bauzustand = " ",
|
||||||
|
Bemerkungen = " "
|
||||||
|
});
|
||||||
|
|
||||||
|
instance.MergeInproWithITNRW(resultFile, hochbauliste);
|
||||||
|
Assert.True(File.Exists(resultFile));
|
||||||
|
var result = SearchEntry(resultFile, hochbauliste[0].PLZ);
|
||||||
|
Assert.True(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool SearchEntry(string file, string text)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
using (StreamReader sr = new StreamReader(file))
|
||||||
|
{
|
||||||
|
var fullText = sr.ReadToEnd();
|
||||||
|
found = fullText.Contains(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<object[]> Vorgänge()
|
||||||
|
{
|
||||||
|
var vorgänge = new List<VorgangInpro>
|
||||||
|
{
|
||||||
|
new VorgangInpro { Schlussabnahme = "2022" },
|
||||||
|
new VorgangInpro { Fertigstellung_Gemeldet = "2022" },
|
||||||
|
new VorgangInpro { BaugenehmigungAusgeführt = "2022"}
|
||||||
|
};
|
||||||
|
|
||||||
|
yield return new object[] { vorgänge };
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<object[]> Hochbauliste()
|
||||||
|
{
|
||||||
|
var hochbauliste = new List<VorgangItnrw>
|
||||||
|
{
|
||||||
|
new VorgangItnrw {
|
||||||
|
AGS = "913000",
|
||||||
|
Identifikator = "50005733064",
|
||||||
|
BauscheinNr = "61/5-2-43665",
|
||||||
|
MonatGenehmigung = "5",
|
||||||
|
JahrGenehmigung = "2017",
|
||||||
|
NameBauherr = " ",
|
||||||
|
Strasse = "Rüschenstr. 29",
|
||||||
|
PLZ = "44328",
|
||||||
|
Gemeinde = "Dortmund",
|
||||||
|
Gemeindeteil = " ",
|
||||||
|
Bauzustand = " ",
|
||||||
|
Bemerkungen = " "}
|
||||||
|
};
|
||||||
|
|
||||||
|
yield return new object[] { hochbauliste };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
27
Hochbaustatistik.Testing/Utilities/FileOperationsTests.cs
Normal file
27
Hochbaustatistik.Testing/Utilities/FileOperationsTests.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Xunit;
|
||||||
|
using Hochbaustatistik.Business;
|
||||||
|
using Hochbaustatistik.Database;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Hochbaustatistik.Utilities;
|
||||||
|
|
||||||
|
namespace Hochbaustatistik.Testing.Utilities
|
||||||
|
{
|
||||||
|
public class FileOperationsTests
|
||||||
|
{
|
||||||
|
List<VorgangItnrw> hochbauListe = new List<VorgangItnrw>();
|
||||||
|
readonly string filePath = @"..\..\..\TestData\Testdata.csv";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void GenerateHochbauVorgangFromCSVTest()
|
||||||
|
{
|
||||||
|
hochbauListe = FileOperations.GenerateHochbauVorgangFromCSV(filePath);
|
||||||
|
Assert.True(hochbauListe.Count != 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Hochbaustatistik.Testing/Utilities/Interop.Domino.dll
Normal file
BIN
Hochbaustatistik.Testing/Utilities/Interop.Domino.dll
Normal file
Binary file not shown.
Binary file not shown.
64
Hochbaustatistik.Testing/WebTesting.cs
Normal file
64
Hochbaustatistik.Testing/WebTesting.cs
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Xunit;
|
||||||
|
using Hochbaustatistik.Business;
|
||||||
|
using Hochbaustatistik.Database;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Threading;
|
||||||
|
using OpenQA.Selenium;
|
||||||
|
using OpenQA.Selenium.Support.UI;
|
||||||
|
using OpenQA.Selenium.Edge;
|
||||||
|
using System.Net;
|
||||||
|
using System.Data;
|
||||||
|
|
||||||
|
namespace Hochbaustatistik.Testing
|
||||||
|
{
|
||||||
|
public class WebTesting
|
||||||
|
{
|
||||||
|
|
||||||
|
[Fact (Skip ="Derzeit keine Daten zum Download vorhanden")]
|
||||||
|
public void DownloadList()
|
||||||
|
{
|
||||||
|
//DownloadFolder
|
||||||
|
string pathUser = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||||
|
string pathDownloadedList = Path.Combine(pathUser, "Downloads", "BU-Liste_913000.csv");
|
||||||
|
|
||||||
|
//User: 0521442179
|
||||||
|
//Passwort: #Dortmund2022
|
||||||
|
IWebDriver driver = new EdgeDriver();
|
||||||
|
|
||||||
|
string loginUrl = "https://www.idev.nrw.de/";
|
||||||
|
|
||||||
|
driver.Navigate().GoToUrl(loginUrl);
|
||||||
|
|
||||||
|
IWebElement site = driver.FindElement(By.Id("05"));
|
||||||
|
site.Click();
|
||||||
|
|
||||||
|
site = driver.FindElement(By.Id("loginid"));
|
||||||
|
site.SendKeys("0521442179");
|
||||||
|
|
||||||
|
site = driver.FindElement(By.Id("password"));
|
||||||
|
site.SendKeys("#Dortmund2022");
|
||||||
|
|
||||||
|
site = driver.FindElement(By.Id("login"));
|
||||||
|
site.Click();
|
||||||
|
|
||||||
|
site = driver.FindElement(By.Id("menu100"));
|
||||||
|
site.Click();
|
||||||
|
|
||||||
|
site = driver.FindElement(By.LinkText("Bauüberhangsliste"));
|
||||||
|
|
||||||
|
site.Click();
|
||||||
|
|
||||||
|
Thread.Sleep(1500);
|
||||||
|
driver.Quit();
|
||||||
|
|
||||||
|
Assert.True(File.Exists(pathDownloadedList));
|
||||||
|
File.Delete(pathDownloadedList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,18 +3,34 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.3.32819.101
|
VisualStudioVersion = 17.3.32819.101
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hochbaustatistik", "Hochbaustatistik\Hochbaustatistik.csproj", "{76A60AF1-41A8-4E94-8FCF-598D447ABD67}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hochbaustatistik", "Hochbaustatistik\Hochbaustatistik.csproj", "{76A60AF1-41A8-4E94-8FCF-598D447ABD67}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hochbaustatistik.Testing", "Hochbaustatistik.Testing\Hochbaustatistik.Testing.csproj", "{227ED660-8995-4FB0-BD49-27A3FECE3CAE}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Release|Any CPU.Build.0 = Release|Any CPU
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Debug|x86.Build.0 = Debug|x86
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Release|x86.ActiveCfg = Release|x86
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Release|x86.Build.0 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
21
Hochbaustatistik/AssemblyInfo.cs
Normal file
21
Hochbaustatistik/AssemblyInfo.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// In Projekten im SDK-Stil wie dem vorliegenden, bei dem verschiedene Assemblyattribute
|
||||||
|
// üblicherweise in dieser Datei definiert wurden, werden diese Attribute jetzt während
|
||||||
|
// der Builderstellung automatisch hinzugefügt und mit Werten aufgefüllt, die in den
|
||||||
|
// Projekteigenschaften definiert sind. Informationen dazu, welche Attribute einbezogen
|
||||||
|
// werden und wie dieser Prozess angepasst werden kann, finden Sie unter https://aka.ms/assembly-info-properties.
|
||||||
|
|
||||||
|
|
||||||
|
// Wenn "ComVisible" auf FALSE festgelegt wird, sind die Typen in dieser Assembly
|
||||||
|
// für COM-Komponenten nicht sichtbar. Wenn Sie von COM aus auf einen Typ in dieser
|
||||||
|
// Assembly zugreifen müssen, legen Sie das ComVisible-Attribut für den betreffenden
|
||||||
|
// Typ auf TRUE fest.
|
||||||
|
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
[assembly: InternalsVisibleTo("Hochbaustatistik.Testing")]
|
||||||
|
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM
|
||||||
|
// bereitgestellt wird.
|
||||||
|
|
||||||
|
[assembly: Guid("30a9bd76-c085-48d8-afe7-ee269a998ace")]
|
||||||
91
Hochbaustatistik/Business/ConvertCSVToExcel.cs
Normal file
91
Hochbaustatistik/Business/ConvertCSVToExcel.cs
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using Excel = Microsoft.Office.Interop.Excel;
|
||||||
|
using Microsoft.Office.Interop.Excel;
|
||||||
|
using System.Data.OleDb;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Hochbaustatistik.Business
|
||||||
|
{
|
||||||
|
public static class CSVToExcel
|
||||||
|
{
|
||||||
|
public static string ReadExcel(string filename, string vorgangId)
|
||||||
|
{
|
||||||
|
Excel.Application excel = null;
|
||||||
|
excel = new Excel.Application();
|
||||||
|
excel.Visible = true;
|
||||||
|
Excel.Workbook wkb = null;
|
||||||
|
|
||||||
|
wkb = Open(excel, filename);
|
||||||
|
Excel.Range searchedRange = excel.get_Range("A1", "XFD1048576");
|
||||||
|
Excel.Range currentFind = searchedRange.Find(vorgangId);
|
||||||
|
Excel.Sheets excelSheets = wkb.Worksheets;
|
||||||
|
Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelSheets.get_Item(1);
|
||||||
|
string res = string.Empty;
|
||||||
|
|
||||||
|
if (currentFind != null)
|
||||||
|
{
|
||||||
|
var cellValue = Convert.ToString((excelWorksheet.Cells[currentFind.Row, currentFind.Column + 10] as Excel.Range).Value);
|
||||||
|
DateTime dt = DateTime.Parse(cellValue);
|
||||||
|
res = dt.ToShortDateString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
res = "01.01.1900";
|
||||||
|
//TODO: Logger, falls nicht gefunden. Und sonst wird 01.01.1900 als default gesetzt
|
||||||
|
}
|
||||||
|
|
||||||
|
wkb.Close(true);
|
||||||
|
excel.Quit();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Excel.Workbook Open(Excel.Application excelInstance,
|
||||||
|
string fileName, bool readOnly = false, bool editable = true,
|
||||||
|
bool updateLinks = true)
|
||||||
|
{
|
||||||
|
Excel.Workbook book = excelInstance.Workbooks.Open(
|
||||||
|
fileName, updateLinks, readOnly,
|
||||||
|
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
|
||||||
|
Type.Missing, editable, Type.Missing, Type.Missing, Type.Missing,
|
||||||
|
Type.Missing, Type.Missing);
|
||||||
|
return book;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReleaseComObjects(ref List<object> comObjects)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < comObjects.Count; i++)
|
||||||
|
{
|
||||||
|
object obj = comObjects[i];
|
||||||
|
if (Marshal.IsComObject(obj))
|
||||||
|
{
|
||||||
|
while (obj != null && Marshal.ReleaseComObject(obj) != 0) ;
|
||||||
|
while (obj != null && Marshal.FinalReleaseComObject(obj) != 0) ;
|
||||||
|
}
|
||||||
|
obj = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
GC.Collect();
|
||||||
|
GC.WaitForPendingFinalizers();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int GetColumnNumber(string column)//A --> 1 B --> 2 CI --> 87
|
||||||
|
{
|
||||||
|
int col = 0;
|
||||||
|
char[] temp = column.ToUpper().ToCharArray();
|
||||||
|
for (int i = temp.Length - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
int num = Convert.ToInt32(temp[i]) - 64;
|
||||||
|
col += num * Convert.ToInt32(Math.Pow(26, temp.Length - 1 - i));
|
||||||
|
}
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
74
Hochbaustatistik/Business/Vorgang.cs
Normal file
74
Hochbaustatistik/Business/Vorgang.cs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
|
namespace Hochbaustatistik.Business
|
||||||
|
{
|
||||||
|
public class Vorgang
|
||||||
|
{
|
||||||
|
#region Fields
|
||||||
|
private string aktenzeichen;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Aktenzeichen
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return aktenzeichen;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
aktenzeichen = value;
|
||||||
|
if (!aktenzeichen.Contains("/"))
|
||||||
|
{
|
||||||
|
aktenzeichen = ReplaceHiphenWithSlash(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Strasse1 { get; set; }
|
||||||
|
|
||||||
|
public string Hausnummer1 { get; set; }
|
||||||
|
|
||||||
|
public string Strasse2 { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Hausnummer2 { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string VorgangsDefinition { get; set; }
|
||||||
|
#endregion Properties
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
public Vorgang(string id, string aktenzeichen)
|
||||||
|
{
|
||||||
|
this.Aktenzeichen = aktenzeichen;
|
||||||
|
this.Id = Convert.ToInt32(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vorgang()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
string ReplaceHiphenWithSlash(string aktenzeichen)
|
||||||
|
{
|
||||||
|
var regex = new Regex(Regex.Escape("-"),RegexOptions.None,TimeSpan.FromMilliseconds(5));
|
||||||
|
string res = regex.Replace(aktenzeichen, "/", 1);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual string GenerateVorgang(Vorgang v)
|
||||||
|
{
|
||||||
|
return String.Empty;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
38
Hochbaustatistik/Business/VorgangITNRW.cs
Normal file
38
Hochbaustatistik/Business/VorgangITNRW.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Hochbaustatistik.Business
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Klasse der IT-NRW Daten
|
||||||
|
/// </summary>
|
||||||
|
public class VorgangItnrw : Vorgang
|
||||||
|
{
|
||||||
|
public string AGS { get; set; }
|
||||||
|
|
||||||
|
public string Identifikator { get; set; }
|
||||||
|
|
||||||
|
public string BauscheinNr { get; set; }
|
||||||
|
|
||||||
|
public string MonatGenehmigung { get; set; }
|
||||||
|
|
||||||
|
public string JahrGenehmigung { get; set; }
|
||||||
|
|
||||||
|
public string NameBauherr { get; set; }
|
||||||
|
|
||||||
|
public string Strasse { get; set; }
|
||||||
|
|
||||||
|
public string PLZ { get; set; }
|
||||||
|
|
||||||
|
public string Gemeinde { get; set; }
|
||||||
|
|
||||||
|
public string Gemeindeteil { get; set; }
|
||||||
|
|
||||||
|
public string Bauzustand { get; set; }
|
||||||
|
|
||||||
|
public string Bemerkungen { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
97
Hochbaustatistik/Business/VorgangInpro.cs
Normal file
97
Hochbaustatistik/Business/VorgangInpro.cs
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Hochbaustatistik.Business
|
||||||
|
{
|
||||||
|
public class VorgangInpro : Vorgang
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
//ggf Datetime
|
||||||
|
public string Eingangsdatum { get; set; }
|
||||||
|
|
||||||
|
public string IdStrasse { get; set; }
|
||||||
|
|
||||||
|
public string Sachbearbeiter { get; set; }
|
||||||
|
|
||||||
|
//ggf. Boolean
|
||||||
|
public string ZdA { get; set; }
|
||||||
|
|
||||||
|
//ggf Datetime
|
||||||
|
public string Genehmigung { get; set; }
|
||||||
|
|
||||||
|
//ggf Datetime
|
||||||
|
public string Freigabe { get; set; }
|
||||||
|
|
||||||
|
public string Bezirk { get; set; }
|
||||||
|
|
||||||
|
public string Nummer { get; set; }
|
||||||
|
|
||||||
|
public string Statistik_Relevant { get; set; }
|
||||||
|
|
||||||
|
public string Statistik1 { get; set; }
|
||||||
|
|
||||||
|
public string Statistik2 { get; set; }
|
||||||
|
|
||||||
|
//ggf Datetime
|
||||||
|
public string Genehmigung_Gemeldet { get; set; }
|
||||||
|
|
||||||
|
//ggf Datetime
|
||||||
|
public string Fertigstellung_Gemeldet { get; set; }
|
||||||
|
|
||||||
|
//ggf Datetime
|
||||||
|
public string Baubeginn { get; set; }
|
||||||
|
|
||||||
|
//ggf Datetime
|
||||||
|
public string Teilrohbauabnahme { get; set; }
|
||||||
|
|
||||||
|
//ggf Datetime
|
||||||
|
public string Rohbauabnahme { get; set; }
|
||||||
|
|
||||||
|
//ggf Datetime
|
||||||
|
public string Schlussabnahme { get; set; }
|
||||||
|
|
||||||
|
public string BaugenehmigungAusgeführt { get; set; }
|
||||||
|
|
||||||
|
//ggf Datetime
|
||||||
|
public string Vorjahr { get; set; }
|
||||||
|
|
||||||
|
//ggf Datetime
|
||||||
|
public string Bauüberhang_Vorjahr { get; set; }
|
||||||
|
|
||||||
|
public string Aktenstandort { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
public override string GenerateVorgang(Vorgang v)
|
||||||
|
{
|
||||||
|
StringBuilder sbInpro = new StringBuilder();
|
||||||
|
|
||||||
|
sbInpro.Append(string.Concat(this.Bezirk, ";"));//Bezirk
|
||||||
|
sbInpro.Append(string.Concat(v.Aktenzeichen, ";"));//Vorgangsnummer
|
||||||
|
sbInpro.Append(string.Concat(this.Nummer, ";"));//letzten 6 Ziffern des AZ
|
||||||
|
sbInpro.Append(string.Concat(v.VorgangsDefinition, ";"));//Vorgangdefinition
|
||||||
|
sbInpro.Append(string.Concat(this.IdStrasse, ";"));//Strasse1ID
|
||||||
|
sbInpro.Append(string.Concat(v.Strasse1," ", v.Hausnummer1, ";").Trim());//Strasse1+Hausnummer
|
||||||
|
sbInpro.Append(string.Concat(this.Sachbearbeiter, ";"));//Sachbearbeiter
|
||||||
|
sbInpro.Append(string.Concat(this.ZdA, ";"));//zdA
|
||||||
|
sbInpro.Append(string.Concat(this.Genehmigung, ";"));//Genehmigung
|
||||||
|
sbInpro.Append(string.Concat(this.Statistik_Relevant, ";"));//Statistik_Relevant
|
||||||
|
sbInpro.Append(string.Concat(this.Statistik1, ";"));//Statistik1
|
||||||
|
sbInpro.Append(string.Concat(this.Statistik2, ";"));//Statistik2
|
||||||
|
sbInpro.Append(string.Concat(this.Genehmigung_Gemeldet, ";"));//Genehmigung_Gemeldet
|
||||||
|
sbInpro.Append(string.Concat(this.Fertigstellung_Gemeldet, ";"));//Fertigstellung
|
||||||
|
sbInpro.Append(string.Concat(this.Baubeginn, ";"));//Baubeginn
|
||||||
|
sbInpro.Append(string.Concat(this.Rohbauabnahme, ";"));//Rohbauabnahme
|
||||||
|
sbInpro.Append(string.Concat(this.Schlussabnahme, ";"));//Schlussabnahme
|
||||||
|
sbInpro.Append(string.Concat(this.Vorjahr, ";"));//Vorjahr
|
||||||
|
sbInpro.Append(string.Concat(this.Bauüberhang_Vorjahr, ";"));//Bauüberhang_Vorjahr
|
||||||
|
sbInpro.Append(string.Concat(this.Aktenstandort, ";"));//Aktenstandort
|
||||||
|
return sbInpro.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
183
Hochbaustatistik/Database/DatabaseOperations.cs
Normal file
183
Hochbaustatistik/Database/DatabaseOperations.cs
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
using Hochbaustatistik.Business;
|
||||||
|
using Hochbaustatistik.Utilities;
|
||||||
|
using NLog;
|
||||||
|
using OpenQA.Selenium.DevTools.V110.WebAuthn;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace Hochbaustatistik.Database
|
||||||
|
{
|
||||||
|
public static class DatabaseOperations
|
||||||
|
{
|
||||||
|
private static readonly Logger _logger = NLog.LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
public static string conString;
|
||||||
|
public static string csvPath;
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private static string GenerateQueryHochbau(string az, int identifikator = 0)
|
||||||
|
{
|
||||||
|
string sqlQuery = "SELECT "
|
||||||
|
+ "INPROP.PMGTVVORGANG.VORGANGID, "
|
||||||
|
+ "INPROP.PMGTVVORGANG.VORGANGDEFID, "
|
||||||
|
+ "INPROP.PMGTVVORGANG.STRASSE1ID, "
|
||||||
|
+ "INPROP.PMGTVVORGANG.STRASSE1, "
|
||||||
|
+ "INPROP.PMGTVVORGANG.HAUSNUMMER1, "
|
||||||
|
+ "INPROP.PMGTVSACHBEARB.NAME, "
|
||||||
|
+ "INPROP.PMGTVVORGANG.VORGANGABGESCHL, " //zdA
|
||||||
|
+ "INPROP.PMGTVVORGANG.DATUMEINGANG, "
|
||||||
|
+ "INPROP.PMGTVVORGANGVAR.FLD_D_3, " //Genehmigung
|
||||||
|
+ "INPROP.PMGTVVORGANGVAR.FLD_D_5, " //Freigabe
|
||||||
|
+ "INPROP.PMGTVVORGANG.FLD_B_2, " //Statistik relevant
|
||||||
|
+ "INPROP.PMGTVVORGANG.FLD_A_2, " //Statistik1
|
||||||
|
+ "INPROP.PMGTVVORGANG.FLD_A_3, " //Statistik2
|
||||||
|
+ "INPROP.PMGTVVORGANGVAR.FLD_D_10, " //Genehmigung gemeldet
|
||||||
|
+ "INPROP.PMGTVVORGANGVAR.FLD_D_11, " //Fertigstellung gemeldet
|
||||||
|
+ "INPROP.PMGTVVORGANGVAR.FLD_D_15, " //Baubeginn
|
||||||
|
+ "INPROP.PMGTVVORGANGVAR.FLD_D_16, " //Teilrohbauabnahme
|
||||||
|
+ "INPROP.PMGTVVORGANGVAR.FLD_D_17, " //Rohbauabnahme
|
||||||
|
+ "INPROP.PMGTVVORGANGVAR.FLD_D_20, " //Schlussabnahme
|
||||||
|
+ "INPROP.PMGTVVORGANG.FLD_A_20, " //Vorjahr
|
||||||
|
+ "INPROP.PMGTVVORGANGVAR.FLD_C_2, " //Bauüberhang Vorjahr
|
||||||
|
+ "INPROP.PMGTVVORGANG.AKTENSTANDORT, "
|
||||||
|
+ "INPROP.PMGTVVORGANGVAR.FLD_D_12 " //Baugenehmigung ausgeführt
|
||||||
|
+ "FROM INPROP.PMGTVVORGANG "
|
||||||
|
+ "INNER JOIN INPROP.PMGTVVORGANGVAR ON INPROP.PMGTVVORGANG.VORGANGID = INPROP.PMGTVVORGANGVAR.VORGANGID "
|
||||||
|
+ "AND INPROP.PMGTVVORGANG.VORGANGID = INPROP.PMGTVVORGANGVAR.VORGANGID "
|
||||||
|
+ "INNER JOIN INPROP.PMVBCHECKLIST ON INPROP.PMGTVVORGANG.CHECKID = INPROP.PMVBCHECKLIST.CHECKLISTID "
|
||||||
|
+ "INNER JOIN INPROP.PMGTVSACHBEARB ON INPROP.PMGTVVORGANG.ANWENDER = INPROP.PMGTVSACHBEARB.USERID ";
|
||||||
|
if (identifikator > 0)
|
||||||
|
{
|
||||||
|
sqlQuery += "WHERE INPROP.PMGTVVORGANG.FLD_A_2 LIKE '%" + identifikator.ToString() + "%' OR INPROP.PMGTVVORGANG.FLD_A_3 LIKE '%" + identifikator.ToString() + "%'";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sqlQuery += "WHERE INPROP.PMGTVVORGANG.VORGANGID='" + az + "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
return sqlQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private static VorgangInpro FillVorgangInproHochbau(Oracle.ManagedDataAccess.Client.OracleConnection con, Oracle.ManagedDataAccess.Client.OracleCommand cmd, Vorgang v)
|
||||||
|
{
|
||||||
|
con.Open();
|
||||||
|
using (Oracle.ManagedDataAccess.Client.OracleDataReader reader = cmd.ExecuteReader())
|
||||||
|
{
|
||||||
|
VorgangInpro vorgangInproHochbau = new VorgangInpro();
|
||||||
|
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
v.Aktenzeichen = reader.GetString(0);
|
||||||
|
if (v.Aktenzeichen == string.Empty)
|
||||||
|
{
|
||||||
|
//Kandidat für Tiefensuche
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
vorgangInproHochbau.Nummer = v.Aktenzeichen.Substring(8);
|
||||||
|
v.VorgangsDefinition = reader.GetString(1);
|
||||||
|
vorgangInproHochbau.IdStrasse = reader.GetValue(2).ToString();
|
||||||
|
vorgangInproHochbau.Bezirk = v.Aktenzeichen.Split("-").ElementAt(1).ToString();
|
||||||
|
v.Strasse1 = reader.GetValue(3).ToString().Trim();
|
||||||
|
v.Hausnummer1 = reader.GetValue(4).ToString().Trim();
|
||||||
|
vorgangInproHochbau.Sachbearbeiter = reader.GetValue(5).ToString();
|
||||||
|
vorgangInproHochbau.ZdA = reader.GetValue(6).ToString();
|
||||||
|
|
||||||
|
vorgangInproHochbau.Eingangsdatum = reader.GetValue(7).ToString().Split(' ').FirstOrDefault();
|
||||||
|
|
||||||
|
vorgangInproHochbau.Genehmigung = reader.GetValue(8).ToString() == null ? "" : reader.GetValue(8).ToString().Split(' ').FirstOrDefault();
|
||||||
|
|
||||||
|
vorgangInproHochbau.Freigabe = reader.GetValue(9).ToString();
|
||||||
|
vorgangInproHochbau.Statistik_Relevant = reader.GetValue(10).ToString();
|
||||||
|
vorgangInproHochbau.Statistik1 = reader.GetValue(11).ToString();
|
||||||
|
vorgangInproHochbau.Statistik2 = reader.GetValue(12).ToString();
|
||||||
|
|
||||||
|
vorgangInproHochbau.Genehmigung_Gemeldet = reader.GetValue(13).ToString() == null ? "" : reader.GetValue(13).ToString().Split(' ').FirstOrDefault();
|
||||||
|
|
||||||
|
vorgangInproHochbau.Fertigstellung_Gemeldet = reader.GetValue(14).ToString() == null ? "" : reader.GetValue(14).ToString().Split(' ').FirstOrDefault();
|
||||||
|
vorgangInproHochbau.Baubeginn = reader.GetValue(15).ToString() == null ? "" : reader.GetValue(15).ToString().Split(' ').FirstOrDefault();
|
||||||
|
|
||||||
|
vorgangInproHochbau.Teilrohbauabnahme = reader.GetValue(16).ToString() == null ? "" : reader.GetValue(16).ToString().Split(' ').FirstOrDefault();
|
||||||
|
|
||||||
|
vorgangInproHochbau.Rohbauabnahme = reader.GetValue(17).ToString() == null ? "" : reader.GetValue(17).ToString().Split(' ').FirstOrDefault();
|
||||||
|
|
||||||
|
vorgangInproHochbau.Schlussabnahme = reader.GetValue(18).ToString() == null ? "" : reader.GetValue(18).ToString().Split(' ').FirstOrDefault();
|
||||||
|
|
||||||
|
|
||||||
|
string tempDate = string.Empty;
|
||||||
|
if (tempDate == null)
|
||||||
|
{
|
||||||
|
vorgangInproHochbau.Vorjahr = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var splitted = tempDate.Split('.').LastOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(splitted))
|
||||||
|
{
|
||||||
|
vorgangInproHochbau.Vorjahr = splitted.Split(' ').FirstOrDefault();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vorgangInproHochbau.Vorjahr = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vorgangInproHochbau.Bauüberhang_Vorjahr = reader.GetValue(20).ToString();
|
||||||
|
vorgangInproHochbau.Aktenstandort = reader.GetValue(21).ToString();
|
||||||
|
vorgangInproHochbau.BaugenehmigungAusgeführt = reader.GetValue(22).ToString();
|
||||||
|
}
|
||||||
|
return vorgangInproHochbau;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Verbindet zur Datenbank, führt Query aus und füllt Inpro-Objekt, identifikator optional -> nur falls Tiefensuche nötig
|
||||||
|
public static VorgangInpro ConnectAndExecuteHochbau(Vorgang v, int identifikator = 0)
|
||||||
|
{
|
||||||
|
VorgangInpro vorgangInproHochbau;
|
||||||
|
|
||||||
|
string sqlQuery;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (Oracle.ManagedDataAccess.Client.OracleConnection oracle = new Oracle.ManagedDataAccess.Client.OracleConnection())
|
||||||
|
{
|
||||||
|
oracle.ConnectionString = conString;
|
||||||
|
|
||||||
|
if (identifikator != 0)
|
||||||
|
{
|
||||||
|
sqlQuery = GenerateQueryHochbau(v.Aktenzeichen, identifikator);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sqlQuery = GenerateQueryHochbau(v.Aktenzeichen);
|
||||||
|
}
|
||||||
|
|
||||||
|
using (Oracle.ManagedDataAccess.Client.OracleCommand com = new Oracle.ManagedDataAccess.Client.OracleCommand(sqlQuery, oracle))
|
||||||
|
{
|
||||||
|
vorgangInproHochbau = FillVorgangInproHochbau(oracle, com, v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return vorgangInproHochbau;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//Fehler wird Benutzer angezeigt
|
||||||
|
Console.WriteLine("Error {0}:{1}", v.Aktenzeichen, ex.Message);
|
||||||
|
_logger.Error(ex.Message + " " + v.Aktenzeichen);
|
||||||
|
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -5,4 +5,36 @@
|
|||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="Business\ConvertCSVToExcel.cs" />
|
||||||
|
<Compile Remove="Utilities\DataOperations.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="C:\Users\Mario\.nuget\packages\nlog.config\4.7.15\contentFiles\any\any\NLog.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="NLog" Version="5.1.2" />
|
||||||
|
<PackageReference Include="OpenCover" Version="4.7.1221" />
|
||||||
|
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.90" />
|
||||||
|
<PackageReference Include="ReportGenerator" Version="5.1.21" />
|
||||||
|
<PackageReference Include="Selenium.WebDriver" Version="4.8.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Interop.Domino">
|
||||||
|
<HintPath>Utilities\Interop.Domino.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Interop.Microsoft.Office.Interop.Excel">
|
||||||
|
<HintPath>Utilities\Interop.Microsoft.Office.Interop.Excel.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="config\config.txt">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
41
Hochbaustatistik/Hochbaustatistik.sln
Normal file
41
Hochbaustatistik/Hochbaustatistik.sln
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.3.32819.101
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hochbaustatistik", "Hochbaustatistik\Hochbaustatistik.csproj", "{76A60AF1-41A8-4E94-8FCF-598D447ABD67}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hochbaustatistik.Testing", "Hochbaustatistik.Testing\Hochbaustatistik.Testing.csproj", "{227ED660-8995-4FB0-BD49-27A3FECE3CAE}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{76A60AF1-41A8-4E94-8FCF-598D447ABD67}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Debug|x86.Build.0 = Debug|x86
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Release|x86.ActiveCfg = Release|x86
|
||||||
|
{227ED660-8995-4FB0-BD49-27A3FECE3CAE}.Release|x86.Build.0 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {0F1AC96B-EB42-4896-A738-93CA0F1EAA55}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -1,12 +1,49 @@
|
|||||||
using System;
|
using Hochbaustatistik.Business;
|
||||||
|
using Hochbaustatistik.Database;
|
||||||
|
using Hochbaustatistik.Utilities;
|
||||||
|
using NLog;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Hochbaustatistik
|
namespace Hochbaustatistik
|
||||||
{
|
{
|
||||||
internal class Program
|
static class Program
|
||||||
{
|
{
|
||||||
|
private static readonly Logger _logger = NLog.LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
static string pathUser = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Hello World!");
|
string[] config = File.ReadLines(@".\config\config.txt").ToArray();
|
||||||
|
string pathDownloadedList = Path.Combine(pathUser, "Downloads", config[3]);
|
||||||
|
|
||||||
|
//Download Liste, falls nicht vorhanden
|
||||||
|
if (!File.Exists(pathDownloadedList))
|
||||||
|
VariousHelper.DownloadList(config[2]);
|
||||||
|
|
||||||
|
string resultFile = Path.Combine(pathUser, "Downloads", "result.csv");
|
||||||
|
|
||||||
|
DatabaseOperations.conString = config[0];
|
||||||
|
|
||||||
|
Console.WriteLine("Erstelle Hochbaustatistik... Bitte warten.");
|
||||||
|
_logger.Info("Beginne Hochbaustatistik");
|
||||||
|
|
||||||
|
List<VorgangItnrw> hochbauListe = FileOperations.GenerateHochbauVorgangFromCSV(pathDownloadedList);
|
||||||
|
|
||||||
|
DataOpsSingleton instance = DataOpsSingleton.Instance;
|
||||||
|
instance.MergeInproWithITNRW(resultFile, hochbauListe);
|
||||||
|
|
||||||
|
Console.WriteLine("{0} erstellt.", resultFile);
|
||||||
|
|
||||||
|
Console.WriteLine("Fehler: {0}", instance.CountErrors);
|
||||||
|
Console.WriteLine("Fehler NICHT korrigiert: {0}", instance.CountErrorsNotCorrected);
|
||||||
|
|
||||||
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
Console.WriteLine("Fertig. Das Fenster kann geschlossen werden.");
|
||||||
|
Console.ReadLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
341
Hochbaustatistik/Utilities/DataOperations.cs
Normal file
341
Hochbaustatistik/Utilities/DataOperations.cs
Normal file
@@ -0,0 +1,341 @@
|
|||||||
|
using Hochbaustatistik.Business;
|
||||||
|
using Hochbaustatistik.Database;
|
||||||
|
using NLog;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
|
||||||
|
//Singleton Klasse draus machen
|
||||||
|
namespace Hochbaustatistik.Utilities
|
||||||
|
{
|
||||||
|
public static class DataOperations
|
||||||
|
{
|
||||||
|
private static readonly Logger _logger = NLog.LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
public static int countErrors;
|
||||||
|
public static int countErrorsCorrected;
|
||||||
|
|
||||||
|
private static string lastValidAz;
|
||||||
|
|
||||||
|
public static bool IsValid(string az)
|
||||||
|
{
|
||||||
|
string pattern = @"\b(61[/][0-9]{1}[-][0-9]{1}[-][0-9]{6})";
|
||||||
|
Regex r = new Regex(pattern);
|
||||||
|
bool matched = r.IsMatch(az);
|
||||||
|
bool len = az.Length == 13;
|
||||||
|
if (matched && len)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Korrigiert Bauscheinnummer anhand Ersetzungsmethoden
|
||||||
|
public static string CorrectAZ(string az, string name = "", string strasse = "")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CheckForSlashAndCorrect(ref az);
|
||||||
|
CheckForDoubleSlashAndCorrect(ref az);
|
||||||
|
CheckFor7AndCorrect(ref az);
|
||||||
|
AddZero(ref az);
|
||||||
|
SplitUpSpaces(ref az);
|
||||||
|
CheckForHyphenAndCorrect(ref az);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(strasse))
|
||||||
|
{
|
||||||
|
ApplyLastAzToNewAz(ref az, name, strasse);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (IsValid(az))
|
||||||
|
{
|
||||||
|
lastValidAz = az;
|
||||||
|
return az;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
//wenn nicht korrigiert werden konnte...
|
||||||
|
return "NOT_CORRECTED";
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
_logger.Error("Korrektur für {0} nicht möglich.", az);
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Ersetzungen
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private static void CheckForDoubleSlashAndCorrect(ref string az)
|
||||||
|
{
|
||||||
|
string result = string.Empty;
|
||||||
|
|
||||||
|
if (az.Length > 13 && az.LastIndexOf('/') > 2)
|
||||||
|
{
|
||||||
|
int idx = az.LastIndexOf('/');
|
||||||
|
result = az.Substring(0, idx);
|
||||||
|
az = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
public static void ApplyLastAzToNewAz(ref string az, string name, string strasse)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private static void SplitUpSpaces(ref string az)
|
||||||
|
{
|
||||||
|
if (az.All(char.IsWhiteSpace))
|
||||||
|
az = az.Split(' ').FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private static void CheckForSlashAndCorrect(ref string az)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
if (az.Length == 12 && az.ElementAt(2) == '5')
|
||||||
|
{
|
||||||
|
char[] chars = az.ToCharArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < chars.Length; i++)
|
||||||
|
{
|
||||||
|
if (i == 2)
|
||||||
|
{
|
||||||
|
sb.Append('/');
|
||||||
|
}
|
||||||
|
sb.Append(chars[i]);
|
||||||
|
az = sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private static void CheckFor7AndCorrect(ref string az)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
if (az.Length == 13 && az.ElementAt(2) == '7')
|
||||||
|
{
|
||||||
|
char[] chars = az.ToCharArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < chars.Length; i++)
|
||||||
|
{
|
||||||
|
if (chars[2] == '7')
|
||||||
|
{
|
||||||
|
chars[2] = '/';
|
||||||
|
}
|
||||||
|
sb.Append(chars[i]);
|
||||||
|
az = sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private static void AddZero(ref string az)
|
||||||
|
{
|
||||||
|
if (IsValid(az))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (az == "" || az.Length < 10 || !az.Any(char.IsDigit))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (az.Contains('-'))
|
||||||
|
{
|
||||||
|
string splitted = az.Substring(az.LastIndexOf('-'));
|
||||||
|
|
||||||
|
if (!splitted[1].Equals('0'))
|
||||||
|
{
|
||||||
|
var temp = splitted.Insert(1, "0");
|
||||||
|
az = az.Replace(az.Substring(az.LastIndexOf('-')), temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private static void CheckForHyphenAndCorrect(ref string az)
|
||||||
|
{
|
||||||
|
if (!az.ElementAt(4).Equals('-'))
|
||||||
|
az = az.Insert(4, "-");
|
||||||
|
if (!az.ElementAt(6).Equals('-'))
|
||||||
|
az = az.Insert(6, "-");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//TODO: Redundanzen und Komplexität abbauen
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
internal static void MergeInproWithITNRW(string resultFile, List<VorgangItnrw> hochbauListe)
|
||||||
|
{
|
||||||
|
Vorgang v;
|
||||||
|
|
||||||
|
//FileOperations.ReadCSVGenHochbauVorgang(csvPath); //legt Hochbauliste an
|
||||||
|
using (StreamWriter sw = new StreamWriter(resultFile))
|
||||||
|
{
|
||||||
|
_logger.Info("{0} Datensätze werden verarbeitet.");
|
||||||
|
|
||||||
|
for (int i = 0; i < hochbauListe.Count; i++)
|
||||||
|
{
|
||||||
|
v = new Vorgang();
|
||||||
|
|
||||||
|
//header
|
||||||
|
if (i == 0)
|
||||||
|
sw.WriteLine("AGS;Identifikator;Bauscheinnummer;MonatGenehmigung;JahrGenehmigung;NameBauherr;Strasse;PLZ;Gemeinde;Gemeindeteil;Bezirk;Aktenzeichen;AZNummer;VorgangDef;Strasse1ID;Strasse1;Name;zdA;Genehmigung;Statistik_Relevant;Statistik1;Statistik2;Genehmigung_Gemeldet;Fertigstellung_Gemeldet;Baubeginn;Rohbauabnahme;Schlussabnahme;Vorjahr;Bauüberhang_Vorjahr;Aktenstandort;Bauzustand;Bemerkungen;");
|
||||||
|
|
||||||
|
v.Aktenzeichen = hochbauListe[i].BauscheinNr;
|
||||||
|
|
||||||
|
if (DataOperations.IsValid(v.Aktenzeichen))
|
||||||
|
{
|
||||||
|
VorgangInpro vorgangHochbauInpro = DatabaseOperations.ConnectAndExecuteHochbau(v);
|
||||||
|
|
||||||
|
if (vorgangHochbauInpro.IdStrasse == null)
|
||||||
|
{
|
||||||
|
vorgangHochbauInpro = DatabaseOperations.ConnectAndExecuteHochbau(v, Convert.ToInt32(ReshapeIdentifikator(hochbauListe.ElementAt(i).Identifikator)));
|
||||||
|
}
|
||||||
|
|
||||||
|
string strVorgangHochbauInpro = vorgangHochbauInpro.GenerateVorgang(v);
|
||||||
|
string strVorgangHochbau = DataOperations.CreateItnrwRecord(i, v.Aktenzeichen, string.Empty, hochbauListe);
|
||||||
|
|
||||||
|
//Bauzustand anfügen
|
||||||
|
string bauzustand = CreateStatusBauzustand(vorgangHochbauInpro);
|
||||||
|
|
||||||
|
sw.WriteLine(string.Concat(strVorgangHochbau, strVorgangHochbauInpro, bauzustand, ";", hochbauListe.ElementAt(i).Bemerkungen, ";"));
|
||||||
|
_logger.Info("{0} Datensatz wird verarbeitet.", i);
|
||||||
|
Console.Write("\r{0}/{1}", i + 1, hochbauListe.Count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
countErrors++;
|
||||||
|
string origAZ = v.Aktenzeichen;
|
||||||
|
v.Aktenzeichen = DataOperations.CorrectAZ(v.Aktenzeichen);
|
||||||
|
|
||||||
|
//korrigierte Aktenzeichen
|
||||||
|
if (!v.Aktenzeichen.Equals("NOT_CORRECTED"))
|
||||||
|
{
|
||||||
|
VorgangInpro vorgangHochbauInpro = DatabaseOperations.ConnectAndExecuteHochbau(v);
|
||||||
|
|
||||||
|
//Wenn Strasse null, dann anhand Identifikator suchen
|
||||||
|
if (vorgangHochbauInpro.IdStrasse == null)
|
||||||
|
{
|
||||||
|
vorgangHochbauInpro = DatabaseOperations.ConnectAndExecuteHochbau(v, Convert.ToInt32(ReshapeIdentifikator(hochbauListe.ElementAt(i).Identifikator)));
|
||||||
|
}
|
||||||
|
|
||||||
|
string strVorgangHochbauInpro = vorgangHochbauInpro.GenerateVorgang(v);
|
||||||
|
|
||||||
|
//Bauzustand anfügen
|
||||||
|
string bauzustand = CreateStatusBauzustand(vorgangHochbauInpro);
|
||||||
|
|
||||||
|
countErrorsCorrected++;
|
||||||
|
_logger.Error("{0} Datensatz fehlerhaft, aber korrigiert {1}", i, origAZ);
|
||||||
|
string strVorgangHochbau = CreateItnrwRecord(i, v.Aktenzeichen, string.Empty, hochbauListe);
|
||||||
|
sw.WriteLine(string.Concat(strVorgangHochbau, strVorgangHochbauInpro, bauzustand, ";", hochbauListe.ElementAt(i).Bemerkungen, ";"));
|
||||||
|
}
|
||||||
|
//nicht korrigierte Aktenzeichen, werden anhand "Identifikator" gesucht oder Daten anhand vorigen AZ übernommen
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string ident = ReshapeIdentifikator(hochbauListe.ElementAt(i).Identifikator);
|
||||||
|
|
||||||
|
VorgangInpro vorgangHochbauInpro = DatabaseOperations.ConnectAndExecuteHochbau(v, Convert.ToInt32(ident));
|
||||||
|
string strVorgangHochbauInpro = vorgangHochbauInpro.GenerateVorgang(v);
|
||||||
|
|
||||||
|
string strVorgangHochbau = CreateItnrwRecord(i, v.Aktenzeichen, origAZ, hochbauListe);
|
||||||
|
|
||||||
|
//Bauzustand anfügen
|
||||||
|
string bauzustand = CreateStatusBauzustand(vorgangHochbauInpro);
|
||||||
|
|
||||||
|
_logger.Error("{0} Datensatz fehlerhaft. {1}", i, origAZ);
|
||||||
|
sw.WriteLine(string.Concat(strVorgangHochbau, strVorgangHochbauInpro, bauzustand, ";", hochbauListe.ElementAt(i).Bemerkungen, ";"));
|
||||||
|
if (DataOperations.IsValid(v.Aktenzeichen))
|
||||||
|
{
|
||||||
|
_logger.Info("{0} Datensatz korrigiert anhand Identifikator: {1}, originales AZ: {2}", i, ident, origAZ);
|
||||||
|
countErrorsCorrected++;
|
||||||
|
}
|
||||||
|
//Versuche anhand letztem AZ, letzem Namen und letzter Strasse zu vergleichen
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LastData ld = new LastData() { az = v.Aktenzeichen, name = hochbauListe[i - 1].NameBauherr, strasse = hochbauListe[i - 1].Strasse };
|
||||||
|
|
||||||
|
ApplyLastAzToNewAz(ref v.Aktenzeichen, hochbauListe[i].NameBauherr, hochbauListe[i].Strasse);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Trenne Präfix "500" ab
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
internal static string ReshapeIdentifikator(string ident)
|
||||||
|
{
|
||||||
|
ident = ident.Substring(3);
|
||||||
|
if (ident.StartsWith("0"))
|
||||||
|
ident = ident.Substring(1);
|
||||||
|
return ident;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Erstelle IT.NRW Hochbau-Objekt
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
internal static string CreateItnrwRecord(int i, string correctedAZ, string origAZ, List<VorgangItnrw> hochbauListe)
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrEmpty(correctedAZ) && !correctedAZ.Equals("NOT_CORRECTED"))
|
||||||
|
{
|
||||||
|
hochbauListe.ElementAt(i).BauscheinNr = correctedAZ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Wenn NOT_CORRECTED, dann das originale AZ aus der IT-NRW-Liste aufnehmen
|
||||||
|
hochbauListe.ElementAt(i).BauscheinNr = origAZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
string strVorgangHochbau = string.Concat(hochbauListe.ElementAt(i).AGS, ";",
|
||||||
|
hochbauListe.ElementAt(i).Identifikator, ";",
|
||||||
|
hochbauListe.ElementAt(i).BauscheinNr, ";",
|
||||||
|
hochbauListe.ElementAt(i).MonatGenehmigung, ";",
|
||||||
|
hochbauListe.ElementAt(i).JahrGenehmigung, ";",
|
||||||
|
hochbauListe.ElementAt(i).NameBauherr, ";",
|
||||||
|
hochbauListe.ElementAt(i).Strasse, ";",
|
||||||
|
hochbauListe.ElementAt(i).PLZ, ";",
|
||||||
|
hochbauListe.ElementAt(i).Gemeinde, ";",
|
||||||
|
hochbauListe.ElementAt(i).Gemeindeteil, ";");
|
||||||
|
return strVorgangHochbau;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
internal static string CreateStatusBauzustand(VorgangInpro v)
|
||||||
|
{
|
||||||
|
string bauzustand = string.Empty;
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(v.Schlussabnahme) || !String.IsNullOrEmpty(v.Fertigstellung_Gemeldet))
|
||||||
|
{
|
||||||
|
bauzustand = "F Fertigstellung erfolgte bis 31.12. des Vorjahres";
|
||||||
|
return bauzustand;
|
||||||
|
}
|
||||||
|
if (!String.IsNullOrEmpty(v.BaugenehmigungAusgeführt))
|
||||||
|
{
|
||||||
|
bauzustand = "4 Baugenehmigung erloschen";
|
||||||
|
return bauzustand;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bauzustand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct LastData
|
||||||
|
{
|
||||||
|
public string az;
|
||||||
|
public string name;
|
||||||
|
public string strasse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
321
Hochbaustatistik/Utilities/DataOpsSingleton.cs
Normal file
321
Hochbaustatistik/Utilities/DataOpsSingleton.cs
Normal file
@@ -0,0 +1,321 @@
|
|||||||
|
using Hochbaustatistik.Business;
|
||||||
|
using Hochbaustatistik.Database;
|
||||||
|
using NLog;
|
||||||
|
using NLog.Fluent;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace Hochbaustatistik.Utilities
|
||||||
|
{
|
||||||
|
//Thread safe implementierung, sodass Konstruktor nur 1x aufgerufen wird
|
||||||
|
internal sealed class DataOpsSingleton
|
||||||
|
{
|
||||||
|
private static readonly Logger _logger = NLog.LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
public int CountErrors { get; set; }
|
||||||
|
|
||||||
|
public int CountErrorsNotCorrected { get; set; }
|
||||||
|
|
||||||
|
public string LastValidAz { get; set; }
|
||||||
|
|
||||||
|
public List<string> Hochbauliste { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
static DataOpsSingleton()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DataOpsSingleton Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
_logger.Info("Singleton-Instance erzeugt.");
|
||||||
|
return Nested.instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
#region Korrekturen
|
||||||
|
public string CorrectAZ(string az, string name = "", string strasse = "")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (String.IsNullOrEmpty(az))
|
||||||
|
{
|
||||||
|
return az = "NOT_CORRECTED";
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckForSlashAndCorrect(ref az);
|
||||||
|
CheckForDoubleSlashAndCorrect(ref az);
|
||||||
|
CheckFor7AndCorrect(ref az);
|
||||||
|
AddZero(ref az);
|
||||||
|
SplitUpSpaces(ref az);
|
||||||
|
CheckForHyphenAndCorrect(ref az);
|
||||||
|
|
||||||
|
if (!IsValid(az))
|
||||||
|
{
|
||||||
|
az = "NOT_CORRECTED";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
_logger.Error("Korrektur für {0} nicht möglich.", az);
|
||||||
|
az = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
return az;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private void CheckForDoubleSlashAndCorrect(ref string az)
|
||||||
|
{
|
||||||
|
string result = string.Empty;
|
||||||
|
|
||||||
|
if (az.Length > 13 && az.LastIndexOf('/') > 2)
|
||||||
|
{
|
||||||
|
int idx = az.LastIndexOf('/');
|
||||||
|
result = az.Substring(0, idx);
|
||||||
|
az = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private void SplitUpSpaces(ref string az)
|
||||||
|
{
|
||||||
|
if (az.All(char.IsWhiteSpace))
|
||||||
|
az = az.Split(' ').FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private void CheckForSlashAndCorrect(ref string az)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
if (az.Length == 12 && az.ElementAt(2) == '5')
|
||||||
|
{
|
||||||
|
char[] chars = az.ToCharArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < chars.Length; i++)
|
||||||
|
{
|
||||||
|
if (i == 2)
|
||||||
|
{
|
||||||
|
sb.Append('/');
|
||||||
|
}
|
||||||
|
sb.Append(chars[i]);
|
||||||
|
az = sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private void CheckFor7AndCorrect(ref string az)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
if (az.Length == 13 && az.ElementAt(2) == '7')
|
||||||
|
{
|
||||||
|
char[] chars = az.ToCharArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < chars.Length; i++)
|
||||||
|
{
|
||||||
|
if (chars[2] == '7')
|
||||||
|
{
|
||||||
|
chars[2] = '/';
|
||||||
|
}
|
||||||
|
sb.Append(chars[i]);
|
||||||
|
az = sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private void AddZero(ref string az)
|
||||||
|
{
|
||||||
|
if (IsValid(az))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (az == "" || az.Length < 10 || !az.Any(char.IsDigit))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (az.Contains('-'))
|
||||||
|
{
|
||||||
|
string splitted = az.Substring(az.LastIndexOf('-'));
|
||||||
|
|
||||||
|
if (!splitted[1].Equals('0'))
|
||||||
|
{
|
||||||
|
var temp = splitted.Insert(1, "0");
|
||||||
|
az = az.Replace(az.Substring(az.LastIndexOf('-')), temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private void CheckForHyphenAndCorrect(ref string az)
|
||||||
|
{
|
||||||
|
if (!az.ElementAt(4).Equals('-'))
|
||||||
|
az = az.Insert(4, "-");
|
||||||
|
if (!az.ElementAt(6).Equals('-'))
|
||||||
|
az = az.Insert(6, "-");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public bool IsValid(string az)
|
||||||
|
{
|
||||||
|
string pattern = @"\b(61[/][0-9]{1}[-][0-9]{1}[-][0-9]{6})";
|
||||||
|
Regex r = new Regex(pattern,RegexOptions.None, TimeSpan.FromMilliseconds(5));
|
||||||
|
bool matched = r.IsMatch(az);
|
||||||
|
bool len = az.Length == 13;
|
||||||
|
if (matched && len)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Ersten 3 Ziffern von Identifikator verwerfen
|
||||||
|
internal string ReshapeIdentifikator(string ident)
|
||||||
|
{
|
||||||
|
ident = ident.Substring(3);
|
||||||
|
if (ident.StartsWith("0"))
|
||||||
|
ident = ident.Substring(1);
|
||||||
|
return ident;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Erstellt aus IT-NRW Zeile ein Objekt
|
||||||
|
internal string CreateItnrwRecord(int i, string correctedAZ, string origAZ, List<VorgangItnrw> hochbauListe)
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrEmpty(correctedAZ) && !correctedAZ.Equals("NOT_CORRECTED"))
|
||||||
|
{
|
||||||
|
hochbauListe.ElementAt(i).BauscheinNr = correctedAZ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Wenn NOT_CORRECTED, dann das originale AZ aus der IT-NRW-Liste aufnehmen
|
||||||
|
hochbauListe.ElementAt(i).BauscheinNr = origAZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
string strVorgangHochbau = string.Concat(hochbauListe.ElementAt(i).AGS, ";",
|
||||||
|
hochbauListe.ElementAt(i).Identifikator, ";",
|
||||||
|
hochbauListe.ElementAt(i).BauscheinNr, ";",
|
||||||
|
hochbauListe.ElementAt(i).MonatGenehmigung, ";",
|
||||||
|
hochbauListe.ElementAt(i).JahrGenehmigung, ";",
|
||||||
|
hochbauListe.ElementAt(i).NameBauherr, ";",
|
||||||
|
hochbauListe.ElementAt(i).Strasse, ";",
|
||||||
|
hochbauListe.ElementAt(i).PLZ, ";",
|
||||||
|
hochbauListe.ElementAt(i).Gemeinde, ";",
|
||||||
|
hochbauListe.ElementAt(i).Gemeindeteil, ";");
|
||||||
|
return strVorgangHochbau;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Erstellt Status zum Bauzustand als Hilfestellung für Bauaufsicht
|
||||||
|
internal string CreateStatusBauzustand(VorgangInpro v)
|
||||||
|
{
|
||||||
|
string bauzustand = string.Empty;
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(v.Schlussabnahme) || !String.IsNullOrEmpty(v.Fertigstellung_Gemeldet))
|
||||||
|
{
|
||||||
|
bauzustand = "F Fertigstellung erfolgte bis 31.12. des Vorjahres";
|
||||||
|
return bauzustand;
|
||||||
|
}
|
||||||
|
if (!String.IsNullOrEmpty(v.BaugenehmigungAusgeführt))
|
||||||
|
{
|
||||||
|
bauzustand = "4 Baugenehmigung erloschen";
|
||||||
|
return bauzustand;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bauzustand;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void MergeInproWithITNRW(string resultFile, List<VorgangItnrw> hochbauListe)
|
||||||
|
{
|
||||||
|
Vorgang vorgang;
|
||||||
|
|
||||||
|
_logger.Info("{0} Datensätze werden verarbeitet.", hochbauListe.Count);
|
||||||
|
string strVorgangHochbauInpro = string.Empty;
|
||||||
|
string bauzustand = string.Empty;
|
||||||
|
string strVorgangHochbau = string.Empty;
|
||||||
|
string ident = string.Empty;
|
||||||
|
|
||||||
|
using (StreamWriter sw = new StreamWriter(resultFile))
|
||||||
|
{
|
||||||
|
//header
|
||||||
|
_logger.Info("Schreibe Header-Zeile");
|
||||||
|
sw.WriteLine("AGS;Identifikator;Bauscheinnummer;MonatGenehmigung;JahrGenehmigung;NameBauherr;Strasse;PLZ;Gemeinde;Gemeindeteil;Bezirk;Aktenzeichen;AZNummer;VorgangDef;Strasse1ID;Strasse1;Name;zdA;Genehmigung;Statistik_Relevant;Statistik1;Statistik2;Genehmigung_Gemeldet;Fertigstellung_Gemeldet;Baubeginn;Rohbauabnahme;Schlussabnahme;Vorjahr;Bauüberhang_Vorjahr;Aktenstandort;Bauzustand;Bemerkungen;");
|
||||||
|
|
||||||
|
for (int row = 0; row < hochbauListe.Count; row++)
|
||||||
|
{
|
||||||
|
vorgang = new Vorgang();
|
||||||
|
|
||||||
|
vorgang.Aktenzeichen = hochbauListe[row].BauscheinNr;
|
||||||
|
string origAZ = vorgang.Aktenzeichen;
|
||||||
|
ident = ReshapeIdentifikator(hochbauListe.ElementAt(row).Identifikator);
|
||||||
|
|
||||||
|
//Aktenzeichen nicht korrekt
|
||||||
|
if (!IsValid(vorgang.Aktenzeichen))
|
||||||
|
{
|
||||||
|
_logger.Warn("{0} nicht korrekt.", vorgang.Aktenzeichen);
|
||||||
|
this.CountErrors++;
|
||||||
|
//Korrigiere Aktenzeichen (z.B. zweiten Slash entfernen oder 7 statt Slash oder keine Bindestriche etc.
|
||||||
|
vorgang.Aktenzeichen = CorrectAZ(vorgang.Aktenzeichen);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.Write("\r{0}/{1}", row + 1, hochbauListe.Count);
|
||||||
|
CreateMergedRecord(vorgang, row, ref strVorgangHochbauInpro, ref strVorgangHochbau, ref bauzustand, hochbauListe, ident, origAZ);
|
||||||
|
|
||||||
|
//Schreibe IT-NRW und Inpro in Datei
|
||||||
|
sw.WriteLine(string.Concat(strVorgangHochbau, strVorgangHochbauInpro, bauzustand, ";", hochbauListe.ElementAt(row).Bemerkungen, ";"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private void CreateMergedRecord(Vorgang vorgang, int record, ref string strVorgangHochbauInpro, ref string strVorgangHochbau, ref string bauzustand, List<VorgangItnrw> hochbauListe, string identifikator, string origAZ = "")
|
||||||
|
{
|
||||||
|
VorgangInpro vorgangHochbauInpro = DatabaseOperations.ConnectAndExecuteHochbau(vorgang);
|
||||||
|
if (vorgangHochbauInpro.IdStrasse == null)
|
||||||
|
{
|
||||||
|
vorgangHochbauInpro = DatabaseOperations.ConnectAndExecuteHochbau(vorgang, Convert.ToInt32(identifikator));
|
||||||
|
}
|
||||||
|
if (vorgang.Aktenzeichen.Equals("NOT_CORRECTED"))
|
||||||
|
{
|
||||||
|
CountErrorsNotCorrected++;
|
||||||
|
_logger.Error("{0} konnte nicht korrigiert werden.", origAZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
strVorgangHochbauInpro = vorgangHochbauInpro.GenerateVorgang(vorgang);
|
||||||
|
strVorgangHochbau = CreateItnrwRecord(record, vorgang.Aktenzeichen, origAZ, hochbauListe);
|
||||||
|
|
||||||
|
//Bauzustand anfügen
|
||||||
|
bauzustand = CreateStatusBauzustand(vorgangHochbauInpro);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private static class Nested
|
||||||
|
{
|
||||||
|
// Tell C# compiler not to mark type as beforefieldinit (https://csharpindepth.com/articles/BeforeFieldInit)
|
||||||
|
static Nested()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static readonly DataOpsSingleton instance = new DataOpsSingleton();
|
||||||
|
}
|
||||||
|
|
||||||
|
private DataOpsSingleton()
|
||||||
|
{
|
||||||
|
_logger.Info("Singleton erzeugt.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
63
Hochbaustatistik/Utilities/FileOperations.cs
Normal file
63
Hochbaustatistik/Utilities/FileOperations.cs
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
using Hochbaustatistik.Business;
|
||||||
|
using Hochbaustatistik.Database;
|
||||||
|
using OpenQA.Selenium;
|
||||||
|
using OpenQA.Selenium.Edge;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace Hochbaustatistik.Utilities
|
||||||
|
{
|
||||||
|
public static class FileOperations
|
||||||
|
{
|
||||||
|
public static List<VorgangItnrw> GenerateHochbauVorgangFromCSV(string path)
|
||||||
|
{
|
||||||
|
List<VorgangItnrw> hochbauListe = new List<VorgangItnrw>();
|
||||||
|
|
||||||
|
using (StreamReader sr = new StreamReader(path, Encoding.GetEncoding("ISO-8859-1")))
|
||||||
|
{
|
||||||
|
while (!sr.EndOfStream)
|
||||||
|
{
|
||||||
|
VorgangItnrw hochbau = new VorgangItnrw();
|
||||||
|
|
||||||
|
//Splitte Textzeile
|
||||||
|
string[] row = sr.ReadLine().Split(";");
|
||||||
|
|
||||||
|
//Falls header, mache mit nächster Iteration weiter
|
||||||
|
if (row[0] == "AGS")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
hochbau.AGS = row[0];
|
||||||
|
hochbau.Identifikator = row[1];
|
||||||
|
var tempVal = row[2];
|
||||||
|
|
||||||
|
//Refactored analog SonarQube
|
||||||
|
var splitted = tempVal.Split(' ').FirstOrDefault();
|
||||||
|
if(splitted == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException($"Fehler");
|
||||||
|
}
|
||||||
|
|
||||||
|
hochbau.BauscheinNr = splitted.Trim('_');
|
||||||
|
hochbau.MonatGenehmigung = row[3];
|
||||||
|
hochbau.JahrGenehmigung = row[4];
|
||||||
|
hochbau.NameBauherr = row[5];
|
||||||
|
hochbau.Strasse = row[6];
|
||||||
|
hochbau.PLZ = row[7];
|
||||||
|
hochbau.Gemeinde = row[8];
|
||||||
|
hochbau.Gemeindeteil = row[9];
|
||||||
|
|
||||||
|
hochbau.Bemerkungen = row[11];
|
||||||
|
hochbauListe.Add(hochbau);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hochbauListe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Hochbaustatistik/Utilities/Interop.Domino.dll
Normal file
BIN
Hochbaustatistik/Utilities/Interop.Domino.dll
Normal file
Binary file not shown.
Binary file not shown.
86
Hochbaustatistik/Utilities/VariousHelper.cs
Normal file
86
Hochbaustatistik/Utilities/VariousHelper.cs
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
using OpenQA.Selenium.Edge;
|
||||||
|
using OpenQA.Selenium;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using Domino;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
namespace Hochbaustatistik.Utilities
|
||||||
|
{
|
||||||
|
internal static class VariousHelper
|
||||||
|
{
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
private static bool SendEmail(string attachment)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NotesSession nSession = new NotesSession();
|
||||||
|
nSession.Initialize("Mk130881");
|
||||||
|
|
||||||
|
NotesDatabase nDatabase = nSession.GetDatabase("DOMMAIL4/SRV/Stadt Dortmund/DE", "MAIL\\mkoebis-riedel");
|
||||||
|
|
||||||
|
NotesDocument nDocument = nDatabase.CreateDocument();
|
||||||
|
|
||||||
|
//Attachment
|
||||||
|
var richTextItem = nDocument.CreateRichTextItem("files");
|
||||||
|
richTextItem.EmbedObject(EMBED_TYPE.EMBED_ATTACHMENT, "", attachment, "attachment");
|
||||||
|
|
||||||
|
|
||||||
|
string[] recipients = { "mkoebis-riedel@stadtdo.de, katyes@gmx.li" };
|
||||||
|
|
||||||
|
string txtMessage = "Sehr geehrte Damen und Herren,\r\n\r\nanbei erhalten Sie die Auswertung zur Hochbaustatistik für das Jahr " + DateTime.Today.Year + ".\r\n\r\nBitte senden Sie jene ausgefüllt zurück an: mkoebis-riedel@stadtdo.de\r\n\r\nDanke und freundliche Grüße";
|
||||||
|
nDocument.ReplaceItemValue("Form", "Memo");
|
||||||
|
nDocument.ReplaceItemValue("SentTo", recipients);
|
||||||
|
nDocument.ReplaceItemValue("Subject", "Hochbaustatistik Auswertung IT.NRW");
|
||||||
|
nDocument.ReplaceItemValue("Body", txtMessage); //set body text
|
||||||
|
|
||||||
|
nDocument.SaveMessageOnSend = true;
|
||||||
|
nDocument.Send(false, recipients);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(ex.Message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcludeFromCodeCoverage]
|
||||||
|
internal static void DownloadList(string idevUrl)
|
||||||
|
{
|
||||||
|
//User: 0521442179
|
||||||
|
//Passwort: #Dortmund2022
|
||||||
|
IWebDriver driver = new EdgeDriver();
|
||||||
|
|
||||||
|
string loginUrl = idevUrl;
|
||||||
|
|
||||||
|
driver.Navigate().GoToUrl(loginUrl);
|
||||||
|
|
||||||
|
IWebElement site = driver.FindElement(By.Id("05"));
|
||||||
|
site.Click();
|
||||||
|
|
||||||
|
site = driver.FindElement(By.Id("loginid"));
|
||||||
|
site.SendKeys("0521442179");
|
||||||
|
|
||||||
|
site = driver.FindElement(By.Id("password"));
|
||||||
|
site.SendKeys("#Dortmund2022");
|
||||||
|
|
||||||
|
site = driver.FindElement(By.Id("login"));
|
||||||
|
site.Click();
|
||||||
|
|
||||||
|
site = driver.FindElement(By.Id("menu100"));
|
||||||
|
site.Click();
|
||||||
|
|
||||||
|
site = driver.FindElement(By.LinkText("Bauüberhangsliste"));
|
||||||
|
|
||||||
|
site.Click();
|
||||||
|
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
driver.Quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
201
Hochbaustatistik/config/.gitignore
vendored
Normal file
201
Hochbaustatistik/config/.gitignore
vendored
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
###############
|
||||||
|
# folder #
|
||||||
|
###############
|
||||||
|
/**/DROP/
|
||||||
|
/**/TEMP/
|
||||||
|
/**/packages/
|
||||||
|
/**/bin/
|
||||||
|
/**/obj/
|
||||||
|
_site
|
||||||
|
|
||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.sln.docstates
|
||||||
|
*.cache
|
||||||
|
*.v2
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
x64/
|
||||||
|
build/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
|
||||||
|
# Roslyn cache directories
|
||||||
|
*.ide/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
#NUNIT
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_i.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# JustCode is a .NET coding addin-in
|
||||||
|
.JustCode
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
## TODO: Comment the next line if you want to checkin your
|
||||||
|
## web deploy settings but do note that will include unencrypted
|
||||||
|
## passwords
|
||||||
|
#*.pubxml
|
||||||
|
|
||||||
|
# NuGet Packages Directory
|
||||||
|
packages/*
|
||||||
|
## TODO: If the tool you use requires repositories.config
|
||||||
|
## uncomment the next line
|
||||||
|
#!packages/repositories.config
|
||||||
|
|
||||||
|
# Enable "build/" folder in the NuGet Packages folder since
|
||||||
|
# NuGet packages use it for MSBuild targets.
|
||||||
|
# This line needs to be after the ignore of the build folder
|
||||||
|
# (and the packages folder if the line above has been uncommented)
|
||||||
|
!packages/build/
|
||||||
|
|
||||||
|
# Windows Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Windows Store app package directory
|
||||||
|
AppPackages/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
sql/
|
||||||
|
*.Cache
|
||||||
|
ClientBin/
|
||||||
|
[Ss]tyle[Cc]op.*
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# LightSwitch generated files
|
||||||
|
GeneratedArtifacts/
|
||||||
|
_Pvt_Extensions/
|
||||||
|
ModelManifest.xml
|
||||||
75
Hochbaustatistik/config/Jenkinsfile
vendored
Normal file
75
Hochbaustatistik/config/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
pipeline
|
||||||
|
{
|
||||||
|
agent
|
||||||
|
{
|
||||||
|
node
|
||||||
|
{
|
||||||
|
label 'Jenkins_Homer'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stages
|
||||||
|
{
|
||||||
|
stage('Build')
|
||||||
|
{
|
||||||
|
environment
|
||||||
|
{
|
||||||
|
dotnet ="C:\\Program Files\\dotnet\\"
|
||||||
|
scannerHome = "C:\\home\\jenkins\\tools\\hudson.plugins.sonar.MsBuildSQRunnerInstallation\\C_sonar-runner"
|
||||||
|
token = 'sqa_71202f188aacbe40492ba767cf3e841179d3f41a'
|
||||||
|
project = 'hochbaustatistik'
|
||||||
|
}
|
||||||
|
steps
|
||||||
|
{
|
||||||
|
cleanWs()
|
||||||
|
checkout scm
|
||||||
|
bat "dotnet restore Hochbaustatistik\\Hochbaustatistik.sln"
|
||||||
|
bat "${scannerHome}\\SonarScanner.MSBuild.exe begin /k:${project} /d:sonar.login=${token} /d:sonar.verbose=true /d:sonar.cs.opencover.reportsPaths=${WORKSPACE}\\coverage.xml"
|
||||||
|
bat "\"${tool 'MSBuild17'}\" ${WORKSPACE}\\Hochbaustatistik\\Hochbaustatistik.sln /t:Restore /t:Rebuild /p:Configuration=Debug"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Test')
|
||||||
|
{
|
||||||
|
environment
|
||||||
|
{
|
||||||
|
dotnet ="C:\\Program Files\\dotnet\\"
|
||||||
|
}
|
||||||
|
steps
|
||||||
|
{
|
||||||
|
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE')
|
||||||
|
{
|
||||||
|
bat "dotnet test ${WORKSPACE}\\Hochbaustatistik\\Hochbaustatistik.Testing\\Hochbaustatistik.Testing.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=..\\..\\coverage.xml /p:Exclude=[Scan2Compress.GUI]*%2c[Scan2Compress.Properties]* --no-build"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('SonarQube')
|
||||||
|
{
|
||||||
|
environment
|
||||||
|
{
|
||||||
|
scannerHome = "C:\\home\\jenkins\\tools\\hudson.plugins.sonar.MsBuildSQRunnerInstallation\\C_sonar-runner"
|
||||||
|
token = 'sqa_a11eb81bb62f3777b11679484aee7e65ed739ef2'
|
||||||
|
project = 'hochbaustatistik'
|
||||||
|
}
|
||||||
|
steps
|
||||||
|
{
|
||||||
|
bat "${scannerHome}\\SonarScanner.MSBuild.exe end /d:sonar.login=${token}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Coverage')
|
||||||
|
{
|
||||||
|
environment
|
||||||
|
{
|
||||||
|
reportGen = "C:\\Nuget-Packages\\reportgenerator\\5.1.6\\tools\\net6.0\\ReportGenerator.exe"
|
||||||
|
}
|
||||||
|
steps
|
||||||
|
{
|
||||||
|
bat "${reportGen} -verbosity:Info -reports:${WORKSPACE}\\coverage.xml -targetdir:${WORKSPACE} -reporttypes:SonarQube;Cobertura;Html"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
|
||||||
|
step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/Cobertura.xml', failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
Hochbaustatistik/config/NLog.config
Normal file
24
Hochbaustatistik/config/NLog.config
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||||
|
autoReload="true"
|
||||||
|
throwExceptions="false"
|
||||||
|
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||||
|
|
||||||
|
<variable name="myvar" value="myvalue"/>
|
||||||
|
|
||||||
|
<targets>
|
||||||
|
<target name="file" xsi:type="File" createDirs="true" fileName="${basedir}/hochbaustatistik.log" />
|
||||||
|
|
||||||
|
</targets>
|
||||||
|
|
||||||
|
<rules>
|
||||||
|
|
||||||
|
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||||
|
<!--
|
||||||
|
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||||
|
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||||
|
-->
|
||||||
|
</rules>
|
||||||
|
</nlog>
|
||||||
4
Hochbaustatistik/config/config.txt
Normal file
4
Hochbaustatistik/config/config.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dborap04.stadtdo.de)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=bgvp.stadtdo.de)));user id=leser;password=leser;
|
||||||
|
\\asbgvp02\Archivtransfer\
|
||||||
|
https://www.idev.nrw.de/
|
||||||
|
BU-Liste_913000.csv
|
||||||
Reference in New Issue
Block a user