Gegeninspektionen werden nun zusammengeführt
This commit is contained in:
37
Schnittstelle/Export/Excel.cs
Normal file
37
Schnittstelle/Export/Excel.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Schnittstelle.Import.XML.v2013.Model;
|
||||
using Syncfusion.XlsIO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Schnittstelle.Export
|
||||
{
|
||||
public static class Excel
|
||||
{
|
||||
const string LizenceKey = "Ngo9BigBOggjHTQxAR8/V1NCaF5cXmZCf1FpRmJGdld5fUVHYVZUTXxaS00DNHVRdkdnWXdccXRQQ2NZWEBxWUM=";
|
||||
public static void MakeWorkbook(List<KanalObjekt> KanalObjekte)
|
||||
{
|
||||
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(LizenceKey);
|
||||
ExcelEngine excelEngine = new ExcelEngine();
|
||||
IApplication application = excelEngine.Excel;
|
||||
|
||||
application.DefaultVersion = ExcelVersion.Xlsx;
|
||||
IWorkbook workbook = application.Workbooks.Create(KanalObjekte.Count);
|
||||
for (int i = 0; i < KanalObjekte.Count; i++)
|
||||
{
|
||||
IWorksheet worksheet = workbook.Worksheets[i];
|
||||
KanalObjekt k = KanalObjekte[i];
|
||||
CalculateHaltung(k, worksheet);
|
||||
}
|
||||
FileStream stream = new FileStream("beurteilung.xlsx", FileMode.Create, FileAccess.ReadWrite);
|
||||
workbook.SaveAs(stream);
|
||||
stream.Dispose();
|
||||
}
|
||||
|
||||
private static void CalculateHaltung(KanalObjekt haltung, IWorksheet worksheet)
|
||||
{
|
||||
worksheet.Name = string.Format("{0}", haltung.Stammdaten.Objektbezeichnung);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public sealed class InspizierteAbwassertechnischeAnlage
|
||||
@@ -5,7 +7,7 @@ namespace Schnittstelle.Import.XML.v2013.Model
|
||||
string objektbezeichnung;
|
||||
Lage lage;
|
||||
EAnlagetyp anlagentyp;
|
||||
OptischeInspektion optischeInspektion;
|
||||
List<OptischeInspektion> optischeInspektion = new List<OptischeInspektion>();
|
||||
|
||||
public string Objektbezeichnung
|
||||
{
|
||||
@@ -29,7 +31,7 @@ namespace Schnittstelle.Import.XML.v2013.Model
|
||||
anlagentyp = value;
|
||||
}
|
||||
}
|
||||
public OptischeInspektion OptischeInspektion
|
||||
public List<OptischeInspektion> OptischeInspektion
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -53,7 +55,7 @@ namespace Schnittstelle.Import.XML.v2013.Model
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return objektbezeichnung + " " + optischeInspektion.Rohrleitung.Grunddaten.Profilbreite;
|
||||
return objektbezeichnung + " " + optischeInspektion[0].Rohrleitung.Grunddaten.Profilbreite;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Schnittstelle.Import.XML.v2013.Model
|
||||
public InspizierteAbwassertechnischeAnlage Inspektionsdaten { get; set; }
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} ({1})",Stammdaten.Objektbezeichnung, Inspektionsdaten.OptischeInspektion.Rohrleitung != null ? Inspektionsdaten.OptischeInspektion.Rohrleitung.Grunddaten.Profilbreite: 0);
|
||||
return string.Format("{0} ({1})",Stammdaten.Objektbezeichnung, Inspektionsdaten.OptischeInspektion[0].Rohrleitung != null ? Inspektionsdaten.OptischeInspektion[0].Rohrleitung.Grunddaten.Profilbreite: 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Schnittstelle.DWA149_2_2013;
|
||||
using Schnittstelle.Import.XML.v2013.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -101,7 +102,17 @@ namespace Schnittstelle.Import.XML.v2013
|
||||
|
||||
foreach (XmlNode node in Inspektionsdaten)
|
||||
{
|
||||
result.Add(ParseInspektion(node));
|
||||
var parsedInspektion = ParseInspektion(node);
|
||||
var src = result.Find(x => x.Objektbezeichnung == parsedInspektion.Objektbezeichnung);
|
||||
|
||||
if (src != null)
|
||||
{
|
||||
src.OptischeInspektion.Add(parsedInspektion.OptischeInspektion[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(parsedInspektion);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -134,7 +145,7 @@ namespace Schnittstelle.Import.XML.v2013
|
||||
}
|
||||
result.Lage = new Lage(strassename, ortname);
|
||||
break;
|
||||
case "OptischeInspektion": result.OptischeInspektion = parseOptischeInspektion(d); break;
|
||||
case "OptischeInspektion": result.OptischeInspektion.Add(parseOptischeInspektion(d)); break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -5,4 +5,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="26.2.10" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user