Schnittstelle um logging erweitert
This commit is contained in:
@@ -28,6 +28,7 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
||||
{
|
||||
IAuftraggeberDataService auftraggeberDataService = new AuftraggeberDataService(connString);
|
||||
var s = await auftraggeberDataService.GetAll();
|
||||
// TODO : Auftraggeber verwaltung
|
||||
entity.Auftraggeber = s.ToList().Last();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,6 +11,6 @@ namespace Shared.Contracts
|
||||
{
|
||||
public interface IExport
|
||||
{
|
||||
Task<bool> Export(string projektname,EKodierungssystem kodierungssystem,List<Kanal> haltungen, List<Schacht> schaechte);
|
||||
Task<bool> Export(string projektname,EKodierungssystem kodierungssystem,List<Kanal> haltungen, List<Schacht> schaechte, IWWLog log);
|
||||
}
|
||||
}
|
||||
|
||||
13
SewerStammGen.Shared/Contracts/IWWLog.cs
Normal file
13
SewerStammGen.Shared/Contracts/IWWLog.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.Shared.Contracts
|
||||
{
|
||||
public interface IWWLog
|
||||
{
|
||||
void Log(string message);
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ namespace StammGenerator.Commands
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
if (_projektListViewModel.SelectedProjekt == null) return;
|
||||
IWWLog wwLog = null ;
|
||||
Projekt _selectedProjekt = _projektListViewModel.SelectedProjekt;
|
||||
try
|
||||
{
|
||||
@@ -39,7 +40,7 @@ namespace StammGenerator.Commands
|
||||
IEnumerable<Kanal> haltungen = await _haltungDataService.GetAllByProjekt(_selectedProjekt);
|
||||
IEnumerable<Schacht> schaechte = await _schachtDataService.GetAllByProjekt(_selectedProjekt);
|
||||
|
||||
await export.Export(_selectedProjekt.Id.ToString(), _selectedProjekt.Kodierungssystem, haltungen.ToList(), schaechte.ToList());
|
||||
await export.Export(_selectedProjekt.Id.ToString(), _selectedProjekt.Kodierungssystem, haltungen.ToList(), schaechte.ToList(), wwLog);
|
||||
}
|
||||
catch(NotImplementedException)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Enum;
|
||||
using Shared.Contracts;
|
||||
using System;
|
||||
@@ -11,10 +12,10 @@ namespace WWTech_KanalSchnittstelle.Exporter.Kandis
|
||||
{
|
||||
public class KANDIS60 : IExport
|
||||
{
|
||||
public async Task<bool> Export(string projektname,EKodierungssystem kodierungssystem, List<Kanal> haltungen, List<Schacht> schaechte)
|
||||
public async Task<bool> Export(string projektname,EKodierungssystem kodierungssystem, List<Kanal> haltungen, List<Schacht> schaechte, IWWLog log)
|
||||
{
|
||||
KANDIS_HALTUNG60 haltung = new KANDIS_HALTUNG60(projektname, haltungen);
|
||||
KANDIS_SCHACHT60 schacht = new KANDIS_SCHACHT60(projektname, schaechte);
|
||||
KANDIS_HALTUNG60 haltung = new KANDIS_HALTUNG60(projektname, haltungen,log);
|
||||
KANDIS_SCHACHT60 schacht = new KANDIS_SCHACHT60(projektname, schaechte,log);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using SewerStammGen.Shared.Enum;
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Enum;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -32,11 +33,13 @@ namespace WWTech_KanalSchnittstelle.Exporter.Kandis
|
||||
|
||||
private StreamWriter sw;
|
||||
char[] zeile;
|
||||
protected IWWLog Logger;
|
||||
|
||||
protected string Zeile => new string(zeile);
|
||||
|
||||
public KANDIS_Exporter(string filename, EExportType exportType, kType kType)
|
||||
public KANDIS_Exporter(string filename, EExportType exportType, kType kType, IWWLog Logger)
|
||||
{
|
||||
this.Logger = Logger;
|
||||
string version = string.Empty;
|
||||
switch (kType)
|
||||
{
|
||||
@@ -104,9 +107,11 @@ namespace WWTech_KanalSchnittstelle.Exporter.Kandis
|
||||
uint length = (ende+1) - start;
|
||||
if(content.Length > length)
|
||||
{
|
||||
content = content.Substring(0, (int)length);
|
||||
//Debugger.Break();
|
||||
//throw new Exception("Inhalt des Feldes ist zu lang");
|
||||
string newcontent = content.Substring(0,(int)length);
|
||||
Logger.Log(string.Format("Inhalt {0} des Feldes war zu lang. Feld wird auf {1} stellen gekürzt." +
|
||||
"Neue Inhalt lautet: {2}",content,length,newcontent));
|
||||
content = newcontent;
|
||||
|
||||
}
|
||||
|
||||
int counter = 0;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,7 +11,7 @@ namespace WWTech_KanalSchnittstelle.Exporter.Kandis
|
||||
{
|
||||
internal class KANDIS_HALTUNG60 : KANDIS_Exporter
|
||||
{
|
||||
public KANDIS_HALTUNG60(string filename, List<Kanal> kanaele) : base(filename+".hal", EExportType.KANDIS6, kType.HALTUNG)
|
||||
public KANDIS_HALTUNG60(string filename, List<Kanal> kanaele, IWWLog log) : base(filename+".hal", EExportType.KANDIS6, kType.HALTUNG,log)
|
||||
{
|
||||
foreach(Kanal haltung in kanaele)
|
||||
{
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Contracts;
|
||||
using SewerStammGen.Shared.Domain;
|
||||
using SewerStammGen.Shared.Enum;
|
||||
|
||||
namespace WWTech_KanalSchnittstelle.Exporter.Kandis
|
||||
{
|
||||
internal class KANDIS_SCHACHT60 : KANDIS_Exporter
|
||||
{
|
||||
public KANDIS_SCHACHT60(string filename,List<Schacht> schaechte) : base(filename+".sch", EExportType.KANDIS6, kType.SCHACHT)
|
||||
public KANDIS_SCHACHT60(string filename,List<Schacht> schaechte, IWWLog log) : base(filename+".sch", EExportType.KANDIS6, kType.SCHACHT,log)
|
||||
{
|
||||
|
||||
foreach(Schacht schacht in schaechte)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace WWTech_KanalSchnittstelle.Exporter.XML
|
||||
private XmlDocument _file;
|
||||
private List<Schacht> _schaechte;
|
||||
private List<Kanal> _haltungen;
|
||||
public async Task<bool> Export(string projektname, EKodierungssystem kodierungssystem, List<Kanal> haltungen, List<Schacht> schaechte)
|
||||
public async Task<bool> Export(string projektname, EKodierungssystem kodierungssystem, List<Kanal> haltungen, List<Schacht> schaechte, IWWLog logger)
|
||||
{
|
||||
_schaechte = schaechte;
|
||||
_haltungen = haltungen;
|
||||
@@ -27,7 +27,7 @@ namespace WWTech_KanalSchnittstelle.Exporter.XML
|
||||
XmlElement xmlElement = CreateElementFor("Identifikation", _file);
|
||||
xmlElement.SetAttribute("xmlns", "http://www.ofd-hannover.la/Identifikation");
|
||||
XmlElement xmlElement2 = CreateElementFor("Version", xmlElement);
|
||||
xmlElement2.InnerText = "2006-2";
|
||||
xmlElement2.InnerText = "2006-2"; // XML Version
|
||||
DoAdmindata(xmlElement);
|
||||
DoCollectives(xmlElement);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace WWTech_KanalSchnittstelle.Importer
|
||||
{
|
||||
decimal result = 0m;
|
||||
input = string.Format("{0:0.000}", input).Replace('.', ',');
|
||||
if(decimal.TryParse(input, out result))
|
||||
if(!decimal.TryParse(input, out result))
|
||||
{
|
||||
throw new Exception("Konnte koordinate nicht parsen");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user