Files
Kanalsanierungsverwaltung/SchnittstelleImporter/Import.cs

98 lines
3.9 KiB
C#

using KlassenBIB;
using SchnittstelleImporter.XML2006;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchnittstelleImporter
{
/// <summary>
///
/// </summary>
public class Import : IImportedObjekte
{
string xmlFile;
string projektnummer;
/// <summary>
/// Angabe zur XML datei
/// </summary>
public string XMLFile
{
get
{
return xmlFile;
}
set
{
xmlFile = value;
}
}
/// <summary>
/// Angabe zur Projektnummer
/// </summary>
public string Projektnummer
{
get
{
return projektnummer;
}
set
{
projektnummer = value;
}
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public List<Inspektionsobjekt> GetInspektionsobjekte()
{
List<Inspektionsobjekt> result = new List<Inspektionsobjekt>();
List<InspizierteAbwassertechnischeAnlage> anlagen = XMLParser.GetList(XMLFile);
foreach(InspizierteAbwassertechnischeAnlage src in anlagen)
{
Inspektionsobjekt inspektionsobjekt = new Inspektionsobjekt();
InspektionskuerzelnCollection inspektionskuerzelns = new InspektionskuerzelnCollection();
inspektionsobjekt.Projektnummer = projektnummer;
inspektionsobjekt.Objektbezeichnung = src.Objektbezeichnung;
inspektionsobjekt.OrtName = src.Lage.Ortname!= null? src.Lage.Ortname : "";
inspektionsobjekt.StrasseName = src.Lage.Strassename != null ? src.Lage.Strassename : "noname";
inspektionsobjekt.RohrMaterial = src.OptischeInspektion.Rohrleitung.Grunddaten.Material != null ? src.OptischeInspektion.Rohrleitung.Grunddaten.Material : "Unbekannt";
inspektionsobjekt.Kanalrohrweite = src.OptischeInspektion.Rohrleitung.Grunddaten.Profilhoehe != 0 ? (uint)src.OptischeInspektion.Rohrleitung.Grunddaten.Profilhoehe : (uint)src.OptischeInspektion.Rohrleitung.Grunddaten.Profilbreite;
inspektionsobjekt.Haltungslaenge = Convert.ToDouble(src.OptischeInspektion.Rohrleitung.Inspektionslaenge);
inspektionsobjekt.VonPunkt = src.OptischeInspektion.Rohrleitung.Grunddaten.KnotenZulauf;
inspektionsobjekt.BisPunkt = src.OptischeInspektion.Rohrleitung.Grunddaten.KnotenAblauf;
inspektionsobjekt.Bemerkung = src.OptischeInspektion.Rohrleitung.Inspektionsrichtung;
foreach(RZustand zustand in src.OptischeInspektion.Rohrleitung.Zustaende)
{
Inspektionskuerzeln inspektionskuerzeln = new Inspektionskuerzeln();
inspektionskuerzeln.Station = zustand.Station;
inspektionskuerzeln.Hauptkode = zustand.Inspektionskode;
inspektionskuerzeln.Charakterisierung1 = zustand.Charakterisierung1;
inspektionskuerzeln.Charakterisierung2 = zustand.Charakterisierung2;
inspektionskuerzeln.ImVerbindung = zustand.Verbindung;
Quantifizierung quant1 = zustand.Quantifizierung1;
Quantifizierung quant2 = zustand.Quantifizierung2;
inspektionskuerzeln.Quantifizierung1 = Convert.ToUInt32(quant1.Numerisch);
inspektionskuerzeln.Quantifizierung2 = Convert.ToUInt32(quant2.Numerisch);
inspektionskuerzelns.Add(inspektionskuerzeln);
}
inspektionsobjekt.Schadenskuerzeln = inspektionskuerzelns;
result.Add(inspektionsobjekt);
}
return result;
}
}
}