Kandis exporter geschrieben
Deckel und Sohlhöhe werden gespeichert
This commit is contained in:
@@ -6,14 +6,16 @@ CREATE TABLE IF NOT EXISTS public.schacht
|
|||||||
(
|
(
|
||||||
schacht_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
schacht_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
|
||||||
objektbezeichnung text COLLATE pg_catalog."default",
|
objektbezeichnung text COLLATE pg_catalog."default",
|
||||||
rechtswert numeric(18,4) NOT NULL,
|
deckelrechtswert numeric(18,4) NOT NULL,
|
||||||
hochwert numeric(18,4) NOT NULL,
|
deckelhochwert numeric(18,4) NOT NULL,
|
||||||
sohlhoehe numeric(18,4) NOT NULL,
|
|
||||||
deckelhoehe numeric(18,4) NOT NULL,
|
deckelhoehe numeric(18,4) NOT NULL,
|
||||||
|
sohlrechtswert numeric(18,4),
|
||||||
|
sohlhochwert numeric(18,4),
|
||||||
|
sohlhoehe numeric(18,4) NOT NULL,
|
||||||
entwaesserung integer NOT NULL,
|
entwaesserung integer NOT NULL,
|
||||||
ref_projekt_id integer,
|
ref_projekt_id integer,
|
||||||
CONSTRAINT "PK_Schaechte" PRIMARY KEY (schacht_id),
|
CONSTRAINT "PK_schacht" PRIMARY KEY (schacht_id),
|
||||||
CONSTRAINT "FK_Schaechte_Projekte_ProjektId" FOREIGN KEY (ref_projekt_id)
|
CONSTRAINT "FK_schacht_Projekte_ProjektId" FOREIGN KEY (ref_projekt_id)
|
||||||
REFERENCES public.projekt (projekt_id) MATCH SIMPLE
|
REFERENCES public.projekt (projekt_id) MATCH SIMPLE
|
||||||
ON UPDATE NO ACTION
|
ON UPDATE NO ACTION
|
||||||
ON DELETE NO ACTION
|
ON DELETE NO ACTION
|
||||||
|
|||||||
@@ -11,33 +11,42 @@ namespace SewerStammGen.ConsoleApp
|
|||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
IProjektDataService projektService = new ProjektDataService("");
|
Test t = new();
|
||||||
|
|
||||||
Projekt neuesProjekt = new Projekt()
|
|
||||||
{
|
|
||||||
Erstelldatum = "test",
|
|
||||||
Projektname = "test",
|
|
||||||
Kodierungssystem = EKodierungssystem.EN13508_2_2011,
|
|
||||||
ExportType = EExportType.XML2006,
|
|
||||||
Ort = "test",
|
|
||||||
Strasse = "test",
|
|
||||||
};
|
|
||||||
|
|
||||||
//test(neuesProjekt, projektService);
|
|
||||||
readtest(projektService);
|
|
||||||
Console.WriteLine("Hello, World!");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async void readtest(IProjektDataService projektService)
|
|
||||||
{
|
|
||||||
var m = await projektService.GetAll();
|
|
||||||
Debugger.Break();
|
Debugger.Break();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static async void test(Projekt neuesProjekt, IProjektDataService projektService)
|
class Test
|
||||||
|
{
|
||||||
|
char[] zeile = new char[1476];
|
||||||
|
public Test()
|
||||||
{
|
{
|
||||||
var m = await projektService.Create(neuesProjekt);
|
zeile = new char[1476];
|
||||||
Console.WriteLine(m.Id);
|
for(int i = 0; i < zeile.Length; i++)
|
||||||
|
{
|
||||||
|
zeile[i] = ' ';
|
||||||
|
}
|
||||||
|
WriteContent(new Tuple<uint, uint>(3, 17), "29283829");
|
||||||
|
WriteContent(new Tuple<uint, uint>(56, 65), "S");
|
||||||
|
WriteContent(new Tuple<uint, uint>(67, 76), "IB");
|
||||||
|
WriteContent(new Tuple<uint, uint>(78, 87), "RESC");
|
||||||
|
string result = new string(zeile);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WriteContent(Tuple<uint, uint> spalten, string content)
|
||||||
|
{
|
||||||
|
uint start = spalten.Item1-1;
|
||||||
|
uint ende = spalten.Item2-1;
|
||||||
|
|
||||||
|
int counter = 0;
|
||||||
|
|
||||||
|
for(uint i = start; i < (content.Length+start); i++)
|
||||||
|
{
|
||||||
|
zeile[i] = content[counter];
|
||||||
|
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,17 +17,21 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
|||||||
|
|
||||||
public async Task<Schacht> Create(Schacht entity)
|
public async Task<Schacht> Create(Schacht entity)
|
||||||
{
|
{
|
||||||
string command = "INSERT INTO " + tableName + " (objektbezeichnung,rechtswert,hochwert,sohlhoehe,deckelhoehe,entwaesserung,ref_projekt_id) VALUES " +
|
string command = "INSERT INTO " + tableName + " (" +
|
||||||
"(@1,@2,@3,@4,@5,@6,@7) RETURNING schacht_id";
|
"objektbezeichnung,deckelrechtswert,deckelhochwert," +
|
||||||
|
"sohlrechtswert,sohlhochwert,sohlhoehe,deckelhoehe,entwaesserung,ref_projekt_id) VALUES " +
|
||||||
|
"(@1,@2,@3,@4,@5,@6,@7,@8,@9) RETURNING schacht_id";
|
||||||
using(var cmd = new NpgsqlCommand(command,conn))
|
using(var cmd = new NpgsqlCommand(command,conn))
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("1", entity.Objektbezeichnung);
|
cmd.Parameters.AddWithValue("1", entity.Objektbezeichnung);
|
||||||
cmd.Parameters.AddWithValue("2", entity.RechtsWert);
|
cmd.Parameters.AddWithValue("2", entity.DeckelRechtsWert);
|
||||||
cmd.Parameters.AddWithValue("3", entity.HochWert);
|
cmd.Parameters.AddWithValue("3", entity.DeckelHochWert);
|
||||||
cmd.Parameters.AddWithValue("4", entity.SohlHoehe);
|
cmd.Parameters.AddWithValue("4", entity.SohlRechtsWert);
|
||||||
cmd.Parameters.AddWithValue("5", entity.DeckelHoehe);
|
cmd.Parameters.AddWithValue("5", entity.SohlHochWert);
|
||||||
cmd.Parameters.AddWithValue("6", (int)entity.Entwaesserung);
|
cmd.Parameters.AddWithValue("6", entity.SohlHoehe);
|
||||||
cmd.Parameters.AddWithValue("7", entity.Projekt.Id);
|
cmd.Parameters.AddWithValue("7", entity.DeckelHoehe);
|
||||||
|
cmd.Parameters.AddWithValue("8", (int)entity.Entwaesserung);
|
||||||
|
cmd.Parameters.AddWithValue("9", entity.Projekt.Id);
|
||||||
using var reader = await cmd.ExecuteReaderAsync();
|
using var reader = await cmd.ExecuteReaderAsync();
|
||||||
reader.Read();
|
reader.Read();
|
||||||
entity.Id = reader.GetInt32(0);
|
entity.Id = reader.GetInt32(0);
|
||||||
@@ -51,12 +55,14 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
|||||||
{
|
{
|
||||||
Id = reader.GetInt32(0),
|
Id = reader.GetInt32(0),
|
||||||
Objektbezeichnung = reader.IsDBNull(1) ? "": reader.GetString(1),
|
Objektbezeichnung = reader.IsDBNull(1) ? "": reader.GetString(1),
|
||||||
RechtsWert = reader.GetDecimal(2),
|
DeckelRechtsWert = reader.GetDecimal(2),
|
||||||
HochWert = reader.GetDecimal(3),
|
DeckelHochWert = reader.GetDecimal(3),
|
||||||
SohlHoehe = reader.GetDecimal(4),
|
DeckelHoehe = reader.GetDecimal(4),
|
||||||
DeckelHoehe = reader.GetDecimal(5),
|
SohlRechtsWert = reader.GetDecimal(5),
|
||||||
Entwaesserung = (EEntwaeserung)reader.GetInt32(6),
|
SohlHochWert = reader.GetDecimal(6),
|
||||||
Projekt = new Projekt() { Id = reader.GetInt32(7) },
|
SohlHoehe = reader.GetDecimal(7),
|
||||||
|
Entwaesserung = (EEntwaeserung)reader.GetInt32(8),
|
||||||
|
Projekt = new Projekt() { Id = reader.GetInt32(9) },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,17 +93,20 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
|||||||
public async Task<Schacht> Update(Schacht entity)
|
public async Task<Schacht> Update(Schacht entity)
|
||||||
{
|
{
|
||||||
string command = @"UPDATE " + tableName + " SET " +
|
string command = @"UPDATE " + tableName + " SET " +
|
||||||
"objektbezeichnung=@1, rechtswert=@2, hochwert=@3, sohlhoehe=@4, deckelhoehe=@5, entwaesserung=@6, ref_projekt_id=@7 WHERE schacht_id=@8";
|
"objektbezeichnung=@1, deckelrechtswert=@2, deckelhochwert=@3, deckelhoehe=@4, " +
|
||||||
|
"sohlrechtswert=@5, sohlhochwert=@6, sohlhoehe=@7, entwaesserung=@8, ref_projekt_id=@9 WHERE schacht_id=@10";
|
||||||
using(var cmd = new NpgsqlCommand(command,conn))
|
using(var cmd = new NpgsqlCommand(command,conn))
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("1", entity.Objektbezeichnung);
|
cmd.Parameters.AddWithValue("1", entity.Objektbezeichnung);
|
||||||
cmd.Parameters.AddWithValue("2", entity.RechtsWert);
|
cmd.Parameters.AddWithValue("2", entity.DeckelRechtsWert);
|
||||||
cmd.Parameters.AddWithValue("3", entity.HochWert);
|
cmd.Parameters.AddWithValue("3", entity.DeckelHochWert);
|
||||||
cmd.Parameters.AddWithValue("4", entity.SohlHoehe);
|
cmd.Parameters.AddWithValue("4", entity.DeckelHoehe);
|
||||||
cmd.Parameters.AddWithValue("5", entity.DeckelHoehe);
|
cmd.Parameters.AddWithValue("5", entity.SohlRechtsWert);
|
||||||
cmd.Parameters.AddWithValue("6", (int)entity.Entwaesserung);
|
cmd.Parameters.AddWithValue("6", entity.SohlHochWert);
|
||||||
cmd.Parameters.AddWithValue("7", entity.Projekt.Id);
|
cmd.Parameters.AddWithValue("7", entity.SohlHoehe);
|
||||||
cmd.Parameters.AddWithValue("8", entity.Id);
|
cmd.Parameters.AddWithValue("8", (int)entity.Entwaesserung);
|
||||||
|
cmd.Parameters.AddWithValue("9", entity.Projekt.Id);
|
||||||
|
cmd.Parameters.AddWithValue("10", entity.Id);
|
||||||
|
|
||||||
await cmd.ExecuteNonQueryAsync();
|
await cmd.ExecuteNonQueryAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,12 @@ namespace SewerStammGen.Shared.Domain
|
|||||||
public class Schacht : DBObject
|
public class Schacht : DBObject
|
||||||
{
|
{
|
||||||
public string Objektbezeichnung { get; set; } = String.Empty;
|
public string Objektbezeichnung { get; set; } = String.Empty;
|
||||||
public decimal RechtsWert { get; set; }
|
public decimal DeckelRechtsWert { get; set; }
|
||||||
public decimal HochWert { get; set; }
|
public decimal DeckelHochWert { get; set; }
|
||||||
public decimal SohlHoehe { get; set; }
|
|
||||||
public decimal DeckelHoehe { get; set; }
|
public decimal DeckelHoehe { get; set; }
|
||||||
|
public decimal SohlRechtsWert { get; set; }
|
||||||
|
public decimal SohlHochWert { get; set; }
|
||||||
|
public decimal SohlHoehe { get; set; }
|
||||||
public Projekt Projekt { get; set; } = new Projekt();
|
public Projekt Projekt { get; set; } = new Projekt();
|
||||||
public EEntwaeserung Entwaesserung { get; set; }
|
public EEntwaeserung Entwaesserung { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,10 +77,10 @@ namespace SewerStammGen.WPF.ViewModel
|
|||||||
private void RecalculateLength()
|
private void RecalculateLength()
|
||||||
{
|
{
|
||||||
|
|
||||||
double x1 = (double)Model.StartSchacht.RechtsWert;
|
double x1 = (double)Model.StartSchacht.DeckelRechtsWert;
|
||||||
double x2 = (double)Model.EndSchacht.RechtsWert;
|
double x2 = (double)Model.EndSchacht.DeckelRechtsWert;
|
||||||
double y1 = (double)Model.StartSchacht.HochWert;
|
double y1 = (double)Model.StartSchacht.DeckelHochWert;
|
||||||
double y2 = (double)Model.EndSchacht.HochWert;
|
double y2 = (double)Model.EndSchacht.DeckelHochWert;
|
||||||
|
|
||||||
|
|
||||||
double length = Math.Sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
|
double length = Math.Sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
|
||||||
|
|||||||
@@ -36,25 +36,25 @@ namespace SewerStammGen.WPF.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public decimal RechtsWert
|
public decimal DeckelRechtsWert
|
||||||
{
|
{
|
||||||
get => _model.RechtsWert;
|
get => _model.DeckelRechtsWert;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if(_model.RechtsWert != value)
|
if(_model.DeckelRechtsWert != value)
|
||||||
{
|
{
|
||||||
_model.RechtsWert = value;
|
_model.DeckelRechtsWert = value;
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public decimal HochWert
|
public decimal DeckelHochWert
|
||||||
{
|
{
|
||||||
get => _model.HochWert; set
|
get => _model.DeckelHochWert; set
|
||||||
{
|
{
|
||||||
if (_model.HochWert != value)
|
if (_model.DeckelHochWert != value)
|
||||||
{
|
{
|
||||||
_model.HochWert = value;
|
_model.DeckelHochWert = value;
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,6 +71,31 @@ namespace SewerStammGen.WPF.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public decimal SohlHochWert
|
||||||
|
{
|
||||||
|
get => _model.SohlHochWert;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(_model.SohlHochWert != value)
|
||||||
|
{
|
||||||
|
_model.SohlHochWert = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public decimal SohlRechtsWert
|
||||||
|
{
|
||||||
|
get => _model.SohlRechtsWert;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(_model.SohlRechtsWert != value)
|
||||||
|
{
|
||||||
|
_model.SohlRechtsWert = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public decimal SohlHoehe
|
public decimal SohlHoehe
|
||||||
{
|
{
|
||||||
get => _model.SohlHoehe;
|
get => _model.SohlHoehe;
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using SewerStammGen.Shared.Domain;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace SewerStammGen.WPF.Views.Converters
|
||||||
|
{
|
||||||
|
public class EqualValueToEntwaesserungConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return value.ToString() == parameter.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return (EEntwaeserung)parameter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,9 +3,14 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:converter="clr-namespace:SewerStammGen.WPF.Views.Converters"
|
||||||
|
xmlns:stat="clr-namespace:SewerStammGen.Shared.Domain;assembly=SewerStammGen.Shared"
|
||||||
xmlns:local="clr-namespace:SewerStammGen.WPF.Views"
|
xmlns:local="clr-namespace:SewerStammGen.WPF.Views"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<converter:EqualValueToEntwaesserungConverter x:Key="EqualValueToEntwaesserungConverter" />
|
||||||
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="auto" />
|
<ColumnDefinition Width="auto" />
|
||||||
@@ -18,29 +23,37 @@
|
|||||||
<RowDefinition Height="auto" />
|
<RowDefinition Height="auto" />
|
||||||
<RowDefinition Height="auto" />
|
<RowDefinition Height="auto" />
|
||||||
<RowDefinition Height="auto" />
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Label Grid.Column="0" Grid.Row="0" Content="Bezeichnung" />
|
<Label Grid.Column="0" Grid.Row="0" Content="Bezeichnung" />
|
||||||
<Label Grid.Column="0" Grid.Row="1" Content="Rechtswert" />
|
<Label Grid.Column="0" Grid.Row="1" Content="Deckel Rechtswert" />
|
||||||
<Label Grid.Column="0" Grid.Row="2" Content="Hochwert" />
|
<Label Grid.Column="0" Grid.Row="2" Content="Deckel Hochwert" />
|
||||||
<Label Grid.Column="0" Grid.Row="3" Content="Sohlhöhe" />
|
<Label Grid.Column="0" Grid.Row="3" Content="Deckel Höhe" />
|
||||||
<Label Grid.Column="0" Grid.Row="4" Content="Deckelhöhe" />
|
<Label Grid.Column="0" Grid.Row="4" Content="Sohl Rechtswert" />
|
||||||
<Label Grid.Column="0" Grid.Row="5" Content="Entwässerungsart" />
|
<Label Grid.Column="0" Grid.Row="5" Content="Sohl Hochwert" />
|
||||||
|
<Label Grid.Column="0" Grid.Row="6" Content="Sohl Höhe" />
|
||||||
|
<!--<Label Grid.Column="0" Grid.Row="7" Content="Deckelhöhe" />-->
|
||||||
|
<Label Grid.Column="0" Grid.Row="7" Content="Entwässerungsart" />
|
||||||
|
|
||||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="0" Text="{Binding Objektbezeichnung}" />
|
<TextBox Margin="2" Grid.Column="1" Grid.Row="0" Text="{Binding Objektbezeichnung}" />
|
||||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="1" Text="{Binding RechtsWert}" />
|
<TextBox Margin="2" Grid.Column="1" Grid.Row="1" Text="{Binding DeckelRechtsWert}" />
|
||||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="2" Text="{Binding HochWert}" />
|
<TextBox Margin="2" Grid.Column="1" Grid.Row="2" Text="{Binding DeckelHochWert}" />
|
||||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="3" Text="{Binding SohlHoehe}" />
|
<TextBox Margin="2" Grid.Column="1" Grid.Row="3" Text="{Binding DeckelHoehe}" />
|
||||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="4" Text="{Binding DeckelHoehe}" />
|
<TextBox Margin="2" Grid.Column="1" Grid.Row="4" Text="{Binding SohlRechtsWert}" />
|
||||||
<DockPanel Grid.Column="1" Grid.Row="5">
|
<TextBox Margin="2" Grid.Column="1" Grid.Row="5" Text="{Binding SohlHochWert}" />
|
||||||
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Regenwasser" />
|
<TextBox Margin="2" Grid.Column="1" Grid.Row="6" Text="{Binding SohlHoehe}" />
|
||||||
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Schmutzwasser" />
|
|
||||||
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Mischwasser" />
|
<DockPanel Grid.Column="1" Grid.Row="7">
|
||||||
|
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Regenwasser" IsChecked="{Binding Entwaeserung, Converter={StaticResource EqualValueToEntwaesserungConverter},ConverterParameter={x:Static stat:EEntwaeserung.Regenwasser}}" />
|
||||||
|
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Schmutzwasser" IsChecked="{Binding Entwaeserung, Converter={StaticResource EqualValueToEntwaesserungConverter},ConverterParameter={x:Static stat:EEntwaeserung.Schmutzwasser}}" />
|
||||||
|
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Mischwasser" IsChecked="{Binding Entwaeserung, Converter={StaticResource EqualValueToEntwaesserungConverter},ConverterParameter={x:Static stat:EEntwaeserung.Mischwasser}}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
|
|
||||||
<StackPanel Grid.ColumnSpan="2" Grid.Row="6">
|
<StackPanel Grid.ColumnSpan="2" Grid.Row="8">
|
||||||
<Button Content="Speichern" Command="{Binding Speichern}" />
|
<Button Content="Speichern" Command="{Binding Speichern}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,10 @@
|
|||||||
<DataGrid Grid.Row="0" ItemsSource="{Binding Schaechte}" AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Single" SelectedItem="{Binding SelectedSchacht}">
|
<DataGrid Grid.Row="0" ItemsSource="{Binding Schaechte}" AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Single" SelectedItem="{Binding SelectedSchacht}">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="Schachtnummer" Binding="{Binding Objektbezeichnung}" />
|
<DataGridTextColumn Header="Schachtnummer" Binding="{Binding Objektbezeichnung}" />
|
||||||
<DataGridTextColumn Header="Rechtswert" Binding="{Binding RechtsWert}" />
|
<!--<DataGridTextColumn Header="Rechtswert" Binding="{Binding RechtsWert}" />-->
|
||||||
<DataGridTextColumn Header="Hochwert" Binding="{Binding HochWert}" />
|
<!--<DataGridTextColumn Header="Hochwert" Binding="{Binding HochWert}" />-->
|
||||||
<DataGridTextColumn Header="Sohlhöhe" Binding="{Binding SohlHoehe}" />
|
<!--<DataGridTextColumn Header="Sohlhöhe" Binding="{Binding SohlHoehe}" />-->
|
||||||
<DataGridTextColumn Header="Deckelhöhe" Binding="{Binding DeckelHoehe}" />
|
<!--<DataGridTextColumn Header="Deckelhöhe" Binding="{Binding DeckelHoehe}" />-->
|
||||||
<DataGridTextColumn Header="Entwässerung" Binding="{Binding Entwaesserung}" />
|
<DataGridTextColumn Header="Entwässerung" Binding="{Binding Entwaesserung}" />
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|||||||
79
WWTech_KanalSchnittstelle/Exporter/Kandis/KANDIS_Exporter.cs
Normal file
79
WWTech_KanalSchnittstelle/Exporter/Kandis/KANDIS_Exporter.cs
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WWTech_KanalSchnittstelle.Exporter.Kandis
|
||||||
|
{
|
||||||
|
public static class ExporterHelper
|
||||||
|
{
|
||||||
|
public static Dictionary<string, int> Exporters = new Dictionary<string, int>()
|
||||||
|
{
|
||||||
|
{ "KANSCH4.0",557 },
|
||||||
|
{ "KANSCH6.0",2041 },
|
||||||
|
{ "KANHAL4.0",530 },
|
||||||
|
{ "KANHAL6.0",2167 }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public abstract class KANDIS_Exporter : IDisposable
|
||||||
|
{
|
||||||
|
private StreamWriter sw;
|
||||||
|
char[] zeile;
|
||||||
|
|
||||||
|
protected string Zeile => new string(zeile);
|
||||||
|
|
||||||
|
public KANDIS_Exporter(string filename, int maxzeilen)
|
||||||
|
{
|
||||||
|
|
||||||
|
sw = new StreamWriter(filename, append: false, Encoding.GetEncoding("ISO-8859-1"));
|
||||||
|
|
||||||
|
zeile = new char[1476];
|
||||||
|
ClearLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClearLine()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < zeile.Length; i++)
|
||||||
|
{
|
||||||
|
zeile[i] = ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void WriteLineInFile()
|
||||||
|
{
|
||||||
|
sw.WriteLine(Zeile);
|
||||||
|
sw.Flush();
|
||||||
|
ClearLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void WriteContent(Tuple<uint, uint> spalten, string content)
|
||||||
|
{
|
||||||
|
uint start = spalten.Item1 - 1;
|
||||||
|
uint ende = spalten.Item2 - 1;
|
||||||
|
|
||||||
|
uint length = ende - start;
|
||||||
|
if(length > content.Length)
|
||||||
|
{
|
||||||
|
throw new Exception("Inhalt des Feldes ist zu lang");
|
||||||
|
}
|
||||||
|
|
||||||
|
int counter = 0;
|
||||||
|
for (uint i = start; i < (content.Length + start); i++)
|
||||||
|
{
|
||||||
|
zeile[i] = content[counter];
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void CloseStream()
|
||||||
|
{
|
||||||
|
sw.Close();
|
||||||
|
}
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
sw.Close();
|
||||||
|
sw.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using SewerStammGen.Shared.Domain;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WWTech_KanalSchnittstelle.Exporter.Kandis
|
||||||
|
{
|
||||||
|
public class KANDIS_HALTUNG60 : KANDIS_Exporter
|
||||||
|
{
|
||||||
|
public KANDIS_HALTUNG60(string filename, List<Kanal> kanaele) : base(filename, ExporterHelper.Exporters["KANHAL6.0"])
|
||||||
|
{
|
||||||
|
foreach(Kanal haltung in kanaele)
|
||||||
|
{
|
||||||
|
WriteContent(new Tuple<uint, uint>(3, 17), haltung.StartSchacht.Objektbezeichnung);
|
||||||
|
WriteContent(new Tuple<uint, uint>(24, 38), haltung.EndSchacht.Objektbezeichnung);
|
||||||
|
WriteContent(new Tuple<uint, uint>(45, 64), haltung.Objektbezeichnung);
|
||||||
|
WriteContent(new Tuple<uint, uint>(66, 75), "K"); // Kanalart
|
||||||
|
WriteContent(new Tuple<uint, uint>(77, 86), "S"); // Entwässerungskennzeichen
|
||||||
|
WriteContent(new Tuple<uint, uint>(88, 97), "B"); // Betriebzustand
|
||||||
|
WriteContent(new Tuple<uint, uint>(173, 182), haltung.Material);
|
||||||
|
WriteContent(new Tuple<uint, uint>(184, 193), "1"); // Profil
|
||||||
|
WriteContent(new Tuple<uint, uint>(195, 198), haltung.DN.ToString()); // Profilhöhe
|
||||||
|
WriteContent(new Tuple<uint, uint>(195, 198), haltung.DN.ToString()); // Profilbreite
|
||||||
|
WriteContent(new Tuple<uint, uint>(227,234), haltung.Haltungslaenge.ToString());
|
||||||
|
WriteContent(new Tuple<uint, uint>(236, 245), "1"); // Status haltungslänge
|
||||||
|
WriteContent(new Tuple<uint, uint>(307, 314), ""); // Sohlhöhe AS
|
||||||
|
WriteContent(new Tuple<uint, uint>(316, 325), "1"); // Status Sohlhöhe AS
|
||||||
|
WriteContent(new Tuple<uint, uint>(327, 334), ""); // Sohlhöhe ES
|
||||||
|
WriteContent(new Tuple<uint, uint>(336, 345), "1"); // Status Sohlhöhe ES
|
||||||
|
WriteContent(new Tuple<uint, uint>(1152, 1161), "Marwede"); // Vermesser
|
||||||
|
WriteContent(new Tuple<uint, uint>(1257, 1266), "19.04.2023"); // Aufnahmedatum
|
||||||
|
}
|
||||||
|
CloseStream();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using SewerStammGen.Shared.Domain;
|
||||||
|
|
||||||
|
namespace WWTech_KanalSchnittstelle.Exporter.Kandis
|
||||||
|
{
|
||||||
|
public class KANDIS_SCHACHT60 : KANDIS_Exporter
|
||||||
|
{
|
||||||
|
public KANDIS_SCHACHT60(string filename,List<Schacht> schaechte) : base(filename, ExporterHelper.Exporters["KANSCH6.0"])
|
||||||
|
{
|
||||||
|
|
||||||
|
foreach(Schacht schacht in schaechte)
|
||||||
|
{
|
||||||
|
WriteContent(new Tuple<uint, uint>(3, 17), schacht.Objektbezeichnung);
|
||||||
|
WriteContent(new Tuple<uint, uint>(56, 65), "S");
|
||||||
|
WriteContent(new Tuple<uint, uint>(67, 76), "IB");
|
||||||
|
WriteContent(new Tuple<uint, uint>(78, 87), "RESC");
|
||||||
|
WriteContent(new Tuple<uint, uint>(190, 197), schacht.DeckelHoehe.ToString());
|
||||||
|
WriteContent(new Tuple<uint, uint>(199, 208), "1"); // Status Deckelhöhe
|
||||||
|
WriteContent(new Tuple<uint, uint>(210, 217), schacht.SohlHoehe.ToString());
|
||||||
|
WriteContent(new Tuple<uint, uint>(219, 228), "1"); // Status Sohlhöhe
|
||||||
|
// Schachtmittelpunktkoordinaten
|
||||||
|
WriteContent(new Tuple<uint, uint>(284, 298), schacht.DeckelRechtsWert.ToString());
|
||||||
|
WriteContent(new Tuple<uint, uint>(300, 314), schacht.DeckelHochWert.ToString());
|
||||||
|
WriteContent(new Tuple<uint, uint>(316, 325), "1"); // Status der Schachtmittelpunktkoordinaten
|
||||||
|
// Deckelkoordinaten
|
||||||
|
WriteContent(new Tuple<uint, uint>(370, 384), schacht.DeckelRechtsWert.ToString());
|
||||||
|
WriteContent(new Tuple<uint, uint>(386, 400), schacht.DeckelHochWert.ToString());
|
||||||
|
WriteContent(new Tuple<uint, uint>(402, 411), "1"); // Status der Deckelkoordinaten
|
||||||
|
|
||||||
|
WriteContent(new Tuple<uint, uint>(1222, 1231), "Marwede"); // Vermesser
|
||||||
|
WriteContent(new Tuple<uint, uint>(1319, 1328), "19.04.2023"); // Aufnahmedatum
|
||||||
|
WriteLineInFile();
|
||||||
|
}
|
||||||
|
CloseStream();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WWTech_KanalSchnittstelle.Exporter.Kandis
|
|
||||||
{
|
|
||||||
public class KANDIS_Stammdaten
|
|
||||||
{
|
|
||||||
private string _line;
|
|
||||||
internal string ToString(int startSpalte, int endSpalte)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string text = _line.Substring(startSpalte - 1, endSpalte - startSpalte + 1);
|
|
||||||
return text.Trim();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,6 +8,11 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace WWTech_KanalSchnittstelle.Importer
|
namespace WWTech_KanalSchnittstelle.Importer
|
||||||
{
|
{
|
||||||
|
internal enum EKennung
|
||||||
|
{
|
||||||
|
DECKEL = 1,
|
||||||
|
SOHLE = 2
|
||||||
|
}
|
||||||
public class CSVImporter : IImport
|
public class CSVImporter : IImport
|
||||||
{
|
{
|
||||||
private string[] input;
|
private string[] input;
|
||||||
@@ -36,15 +41,42 @@ namespace WWTech_KanalSchnittstelle.Importer
|
|||||||
zeile++;
|
zeile++;
|
||||||
if (zeile == 0) continue;
|
if (zeile == 0) continue;
|
||||||
string[] parsed = line.Split(new char[] { ';' });
|
string[] parsed = line.Split(new char[] { ';' });
|
||||||
result.Add(new Schacht()
|
|
||||||
|
string objektbezeichnung = parsed[0];
|
||||||
|
|
||||||
|
string objektname = objektbezeichnung.Substring(0, objektbezeichnung.Length - 2);
|
||||||
|
EKennung kennung = (EKennung)Convert.ToInt32(objektbezeichnung.Substring(objektbezeichnung.Length - 2, 2));
|
||||||
|
|
||||||
|
bool neueSchacht = false;
|
||||||
|
Schacht? schacht = result.FindLast(x => x.Objektbezeichnung.Equals(objektname) && x.Projekt.Id.Equals(projekt.Id));
|
||||||
|
if (schacht == null)
|
||||||
{
|
{
|
||||||
Objektbezeichnung = parsed[0],
|
schacht = new Schacht();
|
||||||
RechtsWert = decimal.Parse(parsed[1].Replace('.',',')),
|
neueSchacht = true;
|
||||||
HochWert = decimal.Parse(parsed[2].Replace('.', ',')),
|
}
|
||||||
DeckelHoehe = decimal.Parse(parsed[3].Replace('.', ',')),
|
|
||||||
Projekt = projekt,
|
if(kennung == EKennung.DECKEL)
|
||||||
Entwaesserung = entwaeserung
|
{
|
||||||
});
|
schacht.DeckelRechtsWert = decimal.Parse(parsed[1].Replace('.', ','));
|
||||||
|
schacht.DeckelHochWert = decimal.Parse(parsed[2].Replace('.', ','));
|
||||||
|
schacht.DeckelHoehe = decimal.Parse(parsed[3].Replace('.', ','));
|
||||||
|
}
|
||||||
|
if(kennung == EKennung.SOHLE)
|
||||||
|
{
|
||||||
|
schacht.SohlRechtsWert = decimal.Parse(parsed[1].Replace('.', ','));
|
||||||
|
schacht.SohlHochWert = decimal.Parse(parsed[2].Replace('.', ','));
|
||||||
|
schacht.SohlHoehe = decimal.Parse(parsed[3].Replace('.', ','));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
schacht.Projekt = projekt;
|
||||||
|
schacht.Entwaesserung = entwaeserung;
|
||||||
|
|
||||||
|
if (neueSchacht)
|
||||||
|
{
|
||||||
|
schacht.Objektbezeichnung = objektname;
|
||||||
|
result.Add(schacht);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using WWTech_KanalSchnittstelle.Exporter.Kandis;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using SewerStammGen.Shared.Domain;
|
||||||
|
|
||||||
|
namespace WWTech_KanalSchnittstelle.Exporter.Kandis.Tests
|
||||||
|
{
|
||||||
|
[TestClass()]
|
||||||
|
public class KANDIS_SCHACHT60Tests
|
||||||
|
{
|
||||||
|
[TestMethod()]
|
||||||
|
public void KANDIS_SCHACHT60Test()
|
||||||
|
{
|
||||||
|
List<Schacht> schaechte = new List<Schacht>()
|
||||||
|
{
|
||||||
|
new Schacht()
|
||||||
|
{
|
||||||
|
Objektbezeichnung = "15456498",
|
||||||
|
SohlHoehe = 1457,
|
||||||
|
DeckelHoehe = 1454,
|
||||||
|
DeckelRechtsWert = 14,
|
||||||
|
DeckelHochWert = 14785,
|
||||||
|
},
|
||||||
|
new Schacht()
|
||||||
|
{
|
||||||
|
Objektbezeichnung = "18656498",
|
||||||
|
SohlHoehe = 145,
|
||||||
|
DeckelHoehe = 14,
|
||||||
|
DeckelRechtsWert = 28,
|
||||||
|
DeckelHochWert = 14,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
KANDIS_SCHACHT60 kANDIS_SCHACHT60 = new KANDIS_SCHACHT60("test.txt", schaechte);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ namespace WWTech_KanalSchnittstelle.Importer.Tests
|
|||||||
public void LoadSchaechteTest()
|
public void LoadSchaechteTest()
|
||||||
{
|
{
|
||||||
CSVImporter importer = new CSVImporter(1);
|
CSVImporter importer = new CSVImporter(1);
|
||||||
var s = importer.LoadSchaechte(@"C:\Users\damia\source\repos\Stammdatengenerator\Beispieldaten\Koordinatendatei.csv");
|
var s = importer.LoadSchaechte(@"C:\Users\damia\source\repos\Stammdatengenerator\Beispieldaten\Koordinatendatei.csv", SewerStammGen.Shared.Domain.EEntwaeserung.Regenwasser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user