Testdateien hinzugefügt.
Schächte werden Importiert
This commit is contained in:
BIN
Beispieldaten/211213-Bezeichnungen für Neubestand.pdf
Normal file
BIN
Beispieldaten/211213-Bezeichnungen für Neubestand.pdf
Normal file
Binary file not shown.
4
Beispieldaten/Haltungen.hal
Normal file
4
Beispieldaten/Haltungen.hal
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
KANHAL6.0
|
||||||
|
S0269900 76992006 S0269900 K S IB PP 1 200 200 16.553 1 -0.013 1 -0.03 1 Luebbert 21.10.2022
|
||||||
|
S0269900 76992006 S0269900 K S IB PP 1 200 200 16.553 1 -0.013 1 -0.03 1
|
||||||
|
Luebbert 21.10.2022
|
||||||
15
Beispieldaten/Koordinatendatei.csv
Normal file
15
Beispieldaten/Koordinatendatei.csv
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
Schachtnummer;Rechtswert;Hochwert;H<>he
|
||||||
|
11204001;444932.93;5883935.519;5.155
|
||||||
|
11204002;444932.906;5883935.689;3.462
|
||||||
|
11203001;444899.818;5883939.262;5.056
|
||||||
|
11203002;444899.787;5883939.131;3.478
|
||||||
|
11267001;444884.352;5883892.304;4.828
|
||||||
|
11267002;444884.447;5883892.28;3.575
|
||||||
|
11266001;444871.604;5883853.74;4.777
|
||||||
|
11266002;444871.658;5883853.724;3.63
|
||||||
|
2111101;444869.48;5883851.658;4.802
|
||||||
|
2111102;444869.415;5883851.701;3.109
|
||||||
|
21112001;444882.238;5883890.294;4.781
|
||||||
|
21112002;444882.18;5883890.313;2.841
|
||||||
|
21113001;444896.159;5883933.946;4.969
|
||||||
|
21113002;444896.024;5883933.817;2.449
|
||||||
|
3
Beispieldaten/Schächte.sch
Normal file
3
Beispieldaten/Schächte.sch
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
KANSCH6.0
|
||||||
|
S0269900 S IB RESC B 1.690 1 -0.013 1 479665.481 5966015.976 1 479665.490 5966015.912 1 Luebbert 22.10.2022
|
||||||
|
S0269900 S IB RESC B 1.690 1 -0.013 1 479665.481 5966015.976 1 479665.490 5966015.912 1
|
||||||
BIN
Beispieldaten/novaKANDIS10_Schnittstellen-Formatbeschreibung.pdf
Normal file
BIN
Beispieldaten/novaKANDIS10_Schnittstellen-Formatbeschreibung.pdf
Normal file
Binary file not shown.
@@ -104,5 +104,14 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
|
|||||||
return entity;
|
return entity;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> InsertSchachtBulk(List<Schacht> schacht)
|
||||||
|
{
|
||||||
|
foreach(var item in schacht)
|
||||||
|
{
|
||||||
|
await Create(item);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using SewerStammGen.Shared.Domain;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -6,8 +7,8 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Shared.Contracts
|
namespace Shared.Contracts
|
||||||
{
|
{
|
||||||
internal interface IImport
|
public interface IImport
|
||||||
{
|
{
|
||||||
|
List<Schacht> LoadSchaechte(string filename, EEntwaeserung entwaeserung);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,5 +13,6 @@ namespace SewerStammGen.Shared.Contracts
|
|||||||
{
|
{
|
||||||
Task<IEnumerable<Schacht>> GetAllByProjekt(int projektID);
|
Task<IEnumerable<Schacht>> GetAllByProjekt(int projektID);
|
||||||
Task<IEnumerable<Schacht>> GetAllByProjekt(Projekt projekt);
|
Task<IEnumerable<Schacht>> GetAllByProjekt(Projekt projekt);
|
||||||
|
Task<bool> InsertSchachtBulk(List<Schacht> schacht);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace SewerStammGen.HostBuilders
|
|||||||
|
|
||||||
services.AddSingleton<ViewModelDelegateRenavigator<ManholeListViewModel>>();
|
services.AddSingleton<ViewModelDelegateRenavigator<ManholeListViewModel>>();
|
||||||
services.AddSingleton<ViewModelDelegateRenavigator<ManholeEditViewModel>>();
|
services.AddSingleton<ViewModelDelegateRenavigator<ManholeEditViewModel>>();
|
||||||
|
services.AddSingleton<ViewModelDelegateRenavigator<ManholeImportViewModel>>();
|
||||||
|
|
||||||
services.AddSingleton<ViewModelDelegateRenavigator<HaltungListViewModel>>();
|
services.AddSingleton<ViewModelDelegateRenavigator<HaltungListViewModel>>();
|
||||||
services.AddSingleton<ViewModelDelegateRenavigator<HaltungEditViewModel>>();
|
services.AddSingleton<ViewModelDelegateRenavigator<HaltungEditViewModel>>();
|
||||||
@@ -47,8 +48,8 @@ namespace SewerStammGen.HostBuilders
|
|||||||
return () => new ManholeListViewModel(
|
return () => new ManholeListViewModel(
|
||||||
services.GetRequiredService<ISchachtDataService>(),
|
services.GetRequiredService<ISchachtDataService>(),
|
||||||
services.GetRequiredService<ViewModelDelegateRenavigator<ManholeEditViewModel>>(),
|
services.GetRequiredService<ViewModelDelegateRenavigator<ManholeEditViewModel>>(),
|
||||||
services.GetRequiredService<IActualState>()
|
services.GetRequiredService<IActualState>(),
|
||||||
|
services.GetRequiredService<ViewModelDelegateRenavigator<ManholeImportViewModel>>()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -60,6 +61,15 @@ namespace SewerStammGen.HostBuilders
|
|||||||
services.GetRequiredService<ViewModelDelegateRenavigator<ManholeListViewModel>>()
|
services.GetRequiredService<ViewModelDelegateRenavigator<ManholeListViewModel>>()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
services.AddSingleton<CreateViewModel<ManholeImportViewModel>>(services =>
|
||||||
|
{
|
||||||
|
return () => new ManholeImportViewModel(
|
||||||
|
services.GetRequiredService<ISchachtDataService>(),
|
||||||
|
services.GetRequiredService<ViewModelDelegateRenavigator<ManholeListViewModel>>(),
|
||||||
|
services.GetRequiredService<IActualState>()
|
||||||
|
);
|
||||||
|
});
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Haltungen
|
#region Haltungen
|
||||||
|
|||||||
@@ -22,6 +22,9 @@
|
|||||||
<DataTemplate DataType="{x:Type viewmodel:ManholeEditViewModel}">
|
<DataTemplate DataType="{x:Type viewmodel:ManholeEditViewModel}">
|
||||||
<view:SchachtEditView />
|
<view:SchachtEditView />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type viewmodel:ManholeImportViewModel}">
|
||||||
|
<view:SchachtImportView />
|
||||||
|
</DataTemplate>
|
||||||
<DataTemplate DataType="{x:Type viewmodel:HaltungListViewModel}">
|
<DataTemplate DataType="{x:Type viewmodel:HaltungListViewModel}">
|
||||||
<view:HaltungListView />
|
<view:HaltungListView />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|||||||
26
SewerStammGen.WPF/Services/OpenFileDialogService.cs
Normal file
26
SewerStammGen.WPF/Services/OpenFileDialogService.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SewerStammGen.WPF.Services
|
||||||
|
{
|
||||||
|
internal class OpenFileDialogService
|
||||||
|
{
|
||||||
|
public string OpenFileDialog()
|
||||||
|
{
|
||||||
|
OpenFileDialog dialog = new OpenFileDialog();
|
||||||
|
dialog.Filter = "CSV Files(.csv)|.csv";
|
||||||
|
dialog.FilterIndex = 1;
|
||||||
|
dialog.Multiselect = false;
|
||||||
|
if(dialog.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
return dialog.FileName;
|
||||||
|
}
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SewerStammGen.DAL\SewerStammGen.DAL.csproj" />
|
<ProjectReference Include="..\SewerStammGen.DAL\SewerStammGen.DAL.csproj" />
|
||||||
<ProjectReference Include="..\SewerStammGen.Shared\SewerStammGen.Shared.csproj" />
|
<ProjectReference Include="..\SewerStammGen.Shared\SewerStammGen.Shared.csproj" />
|
||||||
|
<ProjectReference Include="..\WWTech_KanalSchnittstelle\WWTech_KanalSchnittstelle.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -25,6 +25,9 @@
|
|||||||
<Compile Update="Views\Projekt\ProjektListView.xaml.cs">
|
<Compile Update="Views\Projekt\ProjektListView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Views\Schacht\SchachtImportView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Views\Schacht\SchachtListView.xaml.cs">
|
<Compile Update="Views\Schacht\SchachtListView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -57,6 +60,9 @@
|
|||||||
<Page Update="Views\Projekt\ProjektListView.xaml">
|
<Page Update="Views\Projekt\ProjektListView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="Views\Schacht\SchachtImportView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="Views\Schacht\SchachtListView.xaml">
|
<Page Update="Views\Schacht\SchachtListView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
using SewerStammGen.Shared.Contracts;
|
||||||
|
using SewerStammGen.Shared.Domain;
|
||||||
|
using SewerStammGen.WPF.Interface.Navigator;
|
||||||
|
using SewerStammGen.WPF.Services;
|
||||||
|
using SewerStammGen.WPF.ViewModel.State;
|
||||||
|
using Shared.Contracts;
|
||||||
|
using System;
|
||||||
|
using System.CodeDom;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using WWTech_KanalSchnittstelle.Importer;
|
||||||
|
|
||||||
|
namespace SewerStammGen.WPF.ViewModel
|
||||||
|
{
|
||||||
|
public class ManholeImportViewModel : BaseViewModel
|
||||||
|
{
|
||||||
|
private readonly ISchachtDataService schachtDataService;
|
||||||
|
private readonly IRenavigator renavigator;
|
||||||
|
private OpenFileDialogService fileDialogService;
|
||||||
|
|
||||||
|
private string filename = string.Empty;
|
||||||
|
public string FileName
|
||||||
|
{
|
||||||
|
get => filename;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (filename == value) return;
|
||||||
|
filename = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICommand LoadFile { get; set; }
|
||||||
|
public ICommand OpenFileDialogCommand { get; set; }
|
||||||
|
|
||||||
|
private readonly IImport importer;
|
||||||
|
|
||||||
|
public ManholeImportViewModel(ISchachtDataService schachtDataService, IRenavigator renavigator, IActualState actualState)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
FileName = @"C:\Users\damia\source\repos\Stammdatengenerator\Beispieldaten\Koordinatendatei.csv";
|
||||||
|
#endif
|
||||||
|
LoadFile = new RelayCommand((x) => importFile());
|
||||||
|
this.schachtDataService = schachtDataService;
|
||||||
|
|
||||||
|
importer = new CSVImporter(actualState.ProjektID);
|
||||||
|
this.renavigator = renavigator;
|
||||||
|
this.fileDialogService = new OpenFileDialogService();
|
||||||
|
this.OpenFileDialogCommand = new RelayCommand((x) =>
|
||||||
|
{
|
||||||
|
FileName = fileDialogService.OpenFileDialog();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void importFile()
|
||||||
|
{
|
||||||
|
var schaechte = importer.LoadSchaechte(FileName, EEntwaeserung.Mischwasser);
|
||||||
|
if (schaechte != null)
|
||||||
|
{
|
||||||
|
await schachtDataService.InsertSchachtBulk(schaechte);
|
||||||
|
}
|
||||||
|
renavigator.Renavigate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ namespace SewerStammGen.WPF.ViewModel
|
|||||||
private readonly ISchachtDataService _schachtDataService;
|
private readonly ISchachtDataService _schachtDataService;
|
||||||
private readonly ObservableCollection<Schacht> _schaechte;
|
private readonly ObservableCollection<Schacht> _schaechte;
|
||||||
private readonly IActualState _actualState;
|
private readonly IActualState _actualState;
|
||||||
|
private readonly IRenavigator renavigateToImport;
|
||||||
|
|
||||||
public ObservableCollection<Schacht> Schaechte { get => _schaechte; }
|
public ObservableCollection<Schacht> Schaechte { get => _schaechte; }
|
||||||
|
|
||||||
@@ -27,19 +28,26 @@ namespace SewerStammGen.WPF.ViewModel
|
|||||||
public ICommand AddSchachtCommand { get; set; }
|
public ICommand AddSchachtCommand { get; set; }
|
||||||
public ICommand EditSchachtCommand { get; set; }
|
public ICommand EditSchachtCommand { get; set; }
|
||||||
public ICommand DeleteSchachtCommand { get; set; }
|
public ICommand DeleteSchachtCommand { get; set; }
|
||||||
|
public ICommand ImportSchachtCommand { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public ManholeListViewModel(ISchachtDataService schachtDataService, IRenavigator renavigator ,IActualState actualState)
|
|
||||||
|
public ManholeListViewModel(ISchachtDataService schachtDataService, IRenavigator renavigator ,IActualState actualState, IRenavigator navigatetoImport)
|
||||||
{
|
{
|
||||||
_schachtDataService = schachtDataService;
|
_schachtDataService = schachtDataService;
|
||||||
_actualState = actualState;
|
_actualState = actualState;
|
||||||
|
|
||||||
_schaechte = new ObservableCollection<Schacht>();
|
_schaechte = new ObservableCollection<Schacht>();
|
||||||
|
renavigateToImport = navigatetoImport;
|
||||||
|
|
||||||
AddSchachtCommand = new SchachtAddCommand(actualState,renavigator);
|
AddSchachtCommand = new SchachtAddCommand(actualState,renavigator);
|
||||||
EditSchachtCommand = new SchachtEditCommand(actualState, renavigator,this);
|
EditSchachtCommand = new SchachtEditCommand(actualState, renavigator,this);
|
||||||
DeleteSchachtCommand = new SchachtDeleteCommand(schachtDataService, actualState, renavigator, this);
|
DeleteSchachtCommand = new SchachtDeleteCommand(schachtDataService, actualState, renavigator, this);
|
||||||
|
ImportSchachtCommand = new RelayCommand((x) =>
|
||||||
|
{
|
||||||
|
navigatetoImport.Renavigate();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
LoadSchaechte();
|
LoadSchaechte();
|
||||||
}
|
}
|
||||||
|
|||||||
24
SewerStammGen.WPF/Views/Schacht/SchachtImportView.xaml
Normal file
24
SewerStammGen.WPF/Views/Schacht/SchachtImportView.xaml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<UserControl x:Class="SewerStammGen.WPF.Views.SchachtImportView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:SewerStammGen.WPF.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label Grid.Row="0" Grid.Column="0" Content="Dateiname" />
|
||||||
|
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding FileName}" Margin="20,20,20,132" />
|
||||||
|
<Button Grid.Row="0" Grid.Column="1" Content="Datei wählen" Margin="120,170,200,4" Command="{Binding OpenFileDialogCommand}" />
|
||||||
|
|
||||||
|
<Button Grid.Row="1" Grid.ColumnSpan="2" Content="Laden" Command="{Binding LoadFile}" />
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
SewerStammGen.WPF/Views/Schacht/SchachtImportView.xaml.cs
Normal file
28
SewerStammGen.WPF/Views/Schacht/SchachtImportView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace SewerStammGen.WPF.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für SchachtImportView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class SchachtImportView : UserControl
|
||||||
|
{
|
||||||
|
public SchachtImportView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,8 +7,12 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel>
|
<Grid.RowDefinitions>
|
||||||
<DataGrid ItemsSource="{Binding Schaechte}" AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Single" SelectedItem="{Binding SelectedSchacht}">
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<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}" />
|
||||||
@@ -18,9 +22,11 @@
|
|||||||
<DataGridTextColumn Header="Entwässerung" Binding="{Binding Entwaesserung}" />
|
<DataGridTextColumn Header="Entwässerung" Binding="{Binding Entwaesserung}" />
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
<StackPanel Grid.Row="1">
|
||||||
<Button Content="Schacht hinzufügen" Command="{Binding AddSchachtCommand}" />
|
<Button Content="Schacht hinzufügen" Command="{Binding AddSchachtCommand}" />
|
||||||
<Button Content="Schacht Editieren" Command="{Binding EditSchachtCommand}" />
|
<Button Content="Schacht Editieren" Command="{Binding EditSchachtCommand}" />
|
||||||
<Button Content="Schacht Löschen" Command="{Binding DeleteSchachtCommand}" />
|
<Button Content="Schacht Löschen" Command="{Binding DeleteSchachtCommand}" />
|
||||||
|
<Button Content="Schächte aus CSV Laden" Command="{Binding ImportSchachtCommand}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -7,9 +7,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SewerStammGen.WPF", "SewerS
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SewerStammGen.Shared", "SewerStammGen.Shared\SewerStammGen.Shared.csproj", "{3A47BD31-36C2-45C4-9609-D0D9D92A993B}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SewerStammGen.Shared", "SewerStammGen.Shared\SewerStammGen.Shared.csproj", "{3A47BD31-36C2-45C4-9609-D0D9D92A993B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SewerStammGen.DAL", "SewerStammGen.DAL\SewerStammGen.DAL.csproj", "{7D983D7C-84C2-4FD8-B2CE-B13529036CB5}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SewerStammGen.DAL", "SewerStammGen.DAL\SewerStammGen.DAL.csproj", "{7D983D7C-84C2-4FD8-B2CE-B13529036CB5}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SewerStammGen.ConsoleApp", "SewerStammGen.ConsoleApp\SewerStammGen.ConsoleApp.csproj", "{774EB800-0C5B-4047-A02D-DB4F1BA58167}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SewerStammGen.ConsoleApp", "SewerStammGen.ConsoleApp\SewerStammGen.ConsoleApp.csproj", "{774EB800-0C5B-4047-A02D-DB4F1BA58167}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WWTech_KanalSchnittstelle", "WWTech_KanalSchnittstelle\WWTech_KanalSchnittstelle.csproj", "{DB503A96-8B9F-4AF0-826E-17FB69C94AA0}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WWTech_KanalSchnittstelleTests", "WWTech_KanalSchnittstelleTests\WWTech_KanalSchnittstelleTests.csproj", "{83F2D043-AB23-4B8C-8751-ABE1F32BF5C1}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -33,6 +37,14 @@ Global
|
|||||||
{774EB800-0C5B-4047-A02D-DB4F1BA58167}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{774EB800-0C5B-4047-A02D-DB4F1BA58167}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{774EB800-0C5B-4047-A02D-DB4F1BA58167}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{774EB800-0C5B-4047-A02D-DB4F1BA58167}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{774EB800-0C5B-4047-A02D-DB4F1BA58167}.Release|Any CPU.Build.0 = Release|Any CPU
|
{774EB800-0C5B-4047-A02D-DB4F1BA58167}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{DB503A96-8B9F-4AF0-826E-17FB69C94AA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{DB503A96-8B9F-4AF0-826E-17FB69C94AA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{DB503A96-8B9F-4AF0-826E-17FB69C94AA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{DB503A96-8B9F-4AF0-826E-17FB69C94AA0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{83F2D043-AB23-4B8C-8751-ABE1F32BF5C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{83F2D043-AB23-4B8C-8751-ABE1F32BF5C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{83F2D043-AB23-4B8C-8751-ABE1F32BF5C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{83F2D043-AB23-4B8C-8751-ABE1F32BF5C1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
52
WWTech_KanalSchnittstelle/Importer/CSVImporter.cs
Normal file
52
WWTech_KanalSchnittstelle/Importer/CSVImporter.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using SewerStammGen.Shared.Domain;
|
||||||
|
using Shared.Contracts;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WWTech_KanalSchnittstelle.Importer
|
||||||
|
{
|
||||||
|
public class CSVImporter : IImport
|
||||||
|
{
|
||||||
|
private string[] input;
|
||||||
|
private readonly Projekt projekt;
|
||||||
|
|
||||||
|
#pragma warning disable CS8618 // Ein Non-Nullable-Feld muss beim Beenden des Konstruktors einen Wert ungleich NULL enthalten. Erwägen Sie die Deklaration als Nullable.
|
||||||
|
public CSVImporter(int projektID)
|
||||||
|
#pragma warning restore CS8618 // Ein Non-Nullable-Feld muss beim Beenden des Konstruktors einen Wert ungleich NULL enthalten. Erwägen Sie die Deklaration als Nullable.
|
||||||
|
{
|
||||||
|
projekt = new Projekt() { Id = projektID };
|
||||||
|
}
|
||||||
|
public List<Schacht> LoadSchaechte(string filename, EEntwaeserung entwaeserung)
|
||||||
|
{
|
||||||
|
List<Schacht> result = new List<Schacht>();
|
||||||
|
|
||||||
|
if(!File.Exists(filename))
|
||||||
|
{
|
||||||
|
throw new FileNotFoundException(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
input = File.ReadAllLines(filename);
|
||||||
|
int zeile = -1;
|
||||||
|
|
||||||
|
foreach (string line in input)
|
||||||
|
{
|
||||||
|
zeile++;
|
||||||
|
if (zeile == 0) continue;
|
||||||
|
string[] parsed = line.Split(new char[] { ';' });
|
||||||
|
result.Add(new Schacht()
|
||||||
|
{
|
||||||
|
Objektbezeichnung = parsed[0],
|
||||||
|
RechtsWert = decimal.Parse(parsed[1].Replace('.',',')),
|
||||||
|
HochWert = decimal.Parse(parsed[2].Replace('.', ',')),
|
||||||
|
DeckelHoehe = decimal.Parse(parsed[3].Replace('.', ',')),
|
||||||
|
Projekt = projekt,
|
||||||
|
Entwaesserung = entwaeserung
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
WWTech_KanalSchnittstelle/WWTech_KanalSchnittstelle.csproj
Normal file
13
WWTech_KanalSchnittstelle/WWTech_KanalSchnittstelle.csproj
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SewerStammGen.Shared\SewerStammGen.Shared.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
21
WWTech_KanalSchnittstelleTests/Importer/CSVImporterTests.cs
Normal file
21
WWTech_KanalSchnittstelleTests/Importer/CSVImporterTests.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using WWTech_KanalSchnittstelle.Importer;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WWTech_KanalSchnittstelle.Importer.Tests
|
||||||
|
{
|
||||||
|
[TestClass()]
|
||||||
|
public class CSVImporterTests
|
||||||
|
{
|
||||||
|
[TestMethod()]
|
||||||
|
public void LoadSchaechteTest()
|
||||||
|
{
|
||||||
|
CSVImporter importer = new CSVImporter(1);
|
||||||
|
var s = importer.LoadSchaechte(@"C:\Users\damia\source\repos\Stammdatengenerator\Beispieldaten\Koordinatendatei.csv");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
<IsTestProject>true</IsTestProject>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
|
||||||
|
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
|
||||||
|
<PackageReference Include="coverlet.collector" Version="3.1.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\WWTech_KanalSchnittstelle\WWTech_KanalSchnittstelle.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user