Schlauchliner erweitert

This commit is contained in:
Damian Wessels
2023-01-29 13:53:50 +01:00
parent bbb2c45eff
commit 7db9592dff
14 changed files with 127 additions and 20 deletions

View File

@@ -12,7 +12,7 @@ namespace DaSaSo.Domain.Model
public string Number { get; set; } public string Number { get; set; }
public decimal Linerlength { get; set; } public decimal Linerlength { get; set; }
public bool IsAvaible { get; set; } public bool IsAvaible { get; set; }
public DateOnly Date { get; set; } public DateTime Date { get; set; }
public string LinerNumber { get; set; } public string LinerNumber { get; set; }
public decimal WallThickness { get; set; } public decimal WallThickness { get; set; }
} }

View File

@@ -9,7 +9,7 @@ namespace DaSaSo.Domain.Model
public abstract class SewerRehabilation : DomainObject public abstract class SewerRehabilation : DomainObject
{ {
public string Operator { get; set; } public string Operator { get; set; }
public DateOnly Date { get; set; } public DateTime Date { get; set; }
public decimal TemperatureOutdoors { get; set; } public decimal TemperatureOutdoors { get; set; }
public decimal TemperatureSewer { get; set; } public decimal TemperatureSewer { get; set; }
public string Weather { get; set; } public string Weather { get; set; }

View File

@@ -0,0 +1,14 @@
using DaSaSo.Domain.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DaSaSo.Domain.Services.PipeLinerServices
{
public interface IPipeLinerService
{
Task<PipeLiner> CreatePipeLiner(SewerObject sewerObject);
}
}

View File

@@ -0,0 +1,25 @@
using DaSaSo.Domain.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DaSaSo.Domain.Services.PipeLinerServices
{
public class PipeLinerService : IPipeLinerService
{
private readonly IDataService<SewerObject> _sewerObjectService;
public PipeLinerService(IDataService<SewerObject> sewerObjectService)
{
_sewerObjectService = sewerObjectService;
}
public async Task<PipeLiner> CreatePipeLiner(SewerObject sewerObject)
{
sewerObject.PipeLiner = new PipeLiner();
await _sewerObjectService.Update(sewerObject.Id,sewerObject);
return sewerObject.PipeLiner;
}
}
}

View File

@@ -21,7 +21,8 @@ namespace DaSaSo.Domain.Services.SewerObjectService
SewerObject sewerObject = new SewerObject() SewerObject sewerObject = new SewerObject()
{ {
BuildingSite = aktuellBaustelle, BuildingSite = aktuellBaustelle,
StreetName = "Bitte aktualisieren!" StreetName = "Bitte aktualisieren!",
//PipeLiner = new PipeLiner()
}; };
aktuellBaustelle.SewerObjects.Add(sewerObject); aktuellBaustelle.SewerObjects.Add(sewerObject);
await _buildingsiteService.Update(aktuellBaustelle.Id, aktuellBaustelle); await _buildingsiteService.Update(aktuellBaustelle.Id, aktuellBaustelle);

View File

@@ -75,7 +75,7 @@ namespace DaSaSo.Wpf
try try
{ {
Exception ex = (Exception)e.ExceptionObject; Exception ex = (Exception)e.ExceptionObject;
string text = "An application error occured. Plrease contact the Administrator with the following information:\n\n"; string text = "An application error occured. Please contact the Administrator with the following information:\n\n";
MessageBox.Show(text + " " + ex.Message + "\n\n" + ex.StackTrace); MessageBox.Show(text + " " + ex.Message + "\n\n" + ex.StackTrace);
} }
catch(Exception ex2) catch(Exception ex2)

View File

@@ -0,0 +1,31 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace DaSaSo.Wpf.Converters
{
[ValueConversion(typeof(DateTime), typeof(String))]
public class StringToDateTimeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
DateTime val = (DateTime)value;
return string.Format("{0}.{1}.{2} {3}:{4}",val.Day,val.Month, val.Year, val.Hour, val.Minute);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
DateTime result;
if (DateTime.TryParse((value as string), out result))
{
return result;
}
else
{
throw new Exception();
}
}
}
}

View File

@@ -19,19 +19,27 @@ namespace DaSaSo.Wpf.HostBuilders
host.ConfigureServices((context,services) => host.ConfigureServices((context,services) =>
{ {
string connectionString = ""; string connectionString = "";
Action<DbContextOptionsBuilder> configureDbContext = null; Action<DbContextOptionsBuilder> configureDbContext;
string databaseToUse = context.Configuration.GetConnectionString("databaseToUse"); string databaseToUse = context.Configuration.GetConnectionString("databaseToUse");
Trace.WriteLine(databaseToUse); Trace.WriteLine(databaseToUse);
if(databaseToUse.Equals("default")) if(databaseToUse.Equals("default"))
{ {
connectionString = context.Configuration.GetConnectionString("default"); connectionString = context.Configuration.GetConnectionString("default");
configureDbContext = o => o.UseNpgsql(connectionString); configureDbContext = o =>
{
o.UseNpgsql(connectionString);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
};
} }
else if(databaseToUse.Equals("sqlite")) else if(databaseToUse.Equals("sqlite"))
{ {
connectionString = context.Configuration.GetConnectionString("sqlite"); connectionString = context.Configuration.GetConnectionString("sqlite");
configureDbContext = o => o.UseSqlite(connectionString); configureDbContext = o => o.UseSqlite(connectionString);
} }
else
{
throw new NotImplementedException("Database Type not implementent" + databaseToUse);
}
services.AddDbContext<DaSaSoDbContext>(configureDbContext); services.AddDbContext<DaSaSoDbContext>(configureDbContext);

View File

@@ -34,7 +34,7 @@
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding LinerLänge}" /> <TextBox Grid.Column="1" Grid.Row="2" Text="{Binding LinerLänge}" />
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding DN}" /> <TextBox Grid.Column="1" Grid.Row="3" Text="{Binding DN}" />
<TextBox Grid.Column="1" Grid.Row="4" Text="{Binding Wandstärke}" /> <TextBox Grid.Column="1" Grid.Row="4" Text="{Binding Wandstärke}" />
<TextBox Grid.Column="1" Grid.Row="5" Text="" /> <DatePicker Grid.Column="1" Grid.Row="5" SelectedDate="{Binding Imprägnierdatum}" />
<CheckBox Grid.Column="1" Grid.Row="6" Content="Ja" Style="{StaticResource checkBoxCircleSmall}"/> <CheckBox Grid.Column="1" Grid.Row="6" Content="Ja" Style="{StaticResource checkBoxCircleSmall}"/>
<Button Grid.Row="7" Grid.ColumnSpan="2" Content="Speichern" Command="{Binding SaveImpregnation}" /> <Button Grid.Row="7" Grid.ColumnSpan="2" Content="Speichern" Command="{Binding SaveImpregnation}" />

View File

@@ -4,8 +4,12 @@
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:local="clr-namespace:DaSaSo.Wpf.View.SewerObject.Controls" xmlns:viewmodel="clr-namespace:DaSaSo.Wpf.ViewModel" xmlns:controls="clr-namespace:DaSaSo.Wpf.ViewModel.Controls" d:DataContext="{d:DesignInstance Type=controls:SewerRhebalationControllViewModel}" xmlns:local="clr-namespace:DaSaSo.Wpf.View.SewerObject.Controls" xmlns:viewmodel="clr-namespace:DaSaSo.Wpf.ViewModel" xmlns:controls="clr-namespace:DaSaSo.Wpf.ViewModel.Controls" d:DataContext="{d:DesignInstance Type=controls:SewerRhebalationControllViewModel}"
xmlns:converters="clr-namespace:DaSaSo.Wpf.Converters"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<converters:StringToDateTimeConverter x:Key="StringToDateTimeConverter" />
</UserControl.Resources>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition /> <ColumnDefinition />
@@ -22,22 +26,26 @@
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Margin="5" Grid.Column="0" Grid.Row="0" Content="Operator" /> <Label Margin="5" Grid.Column="0" Grid.Row="0" Content="Operator" />
<Label Margin="5" Grid.Column="0" Grid.Row="1" Content="Datum" /> <Label Margin="5" Grid.Column="0" Grid.Row="1" Content="Einbau - Datum" />
<Label Margin="5" Grid.Column="0" Grid.Row="2" Content="Temperatur Aussen" /> <Label Margin="5" Grid.Column="0" Grid.Row="2" Content="TV Inspektion durchgeführt am" />
<Label Margin="5" Grid.Column="0" Grid.Row="3" Content="Temperatur Kanal" /> <Label Margin="5" Grid.Column="0" Grid.Row="3" Content="Temperatur Aussen" />
<Label Margin="5" Grid.Column="0" Grid.Row="4" Content="Wetter" /> <Label Margin="5" Grid.Column="0" Grid.Row="4" Content="Temperatur Kanal" />
<Label Margin="5" Grid.Column="0" Grid.Row="5" Content="Wetter" />
<TextBox Grid.Column="1" Grid.Row="0" Margin="5" Text="{Binding Bediener}" /> <TextBox Grid.Column="1" Grid.Row="0" Margin="5" Text="{Binding Bediener}" />
<DatePicker Grid.Column="1" Grid.Row="1" Margin="5" SelectedDate="{Binding Datum}" /> <DatePicker Grid.Column="1" Grid.Row="1" Margin="5" SelectedDate="{Binding Datum}" />
<TextBox Grid.Column="1" Grid.Row="2" Margin="5" Text="{Binding TemperaturAussen}" /> <TextBox Grid.Column="1" Grid.Row="2" Margin="5" />
<TextBox Grid.Column="1" Grid.Row="3" Margin="5" Text="{Binding TemperaturSewer}" /> <!--Text="{Binding Path=Datum, Converter={StaticResource StringToDateTimeConverter}}"-->
<TextBox Grid.Column="1" Grid.Row="4" Margin="5" Text="{Binding Weather}" /> <TextBox Grid.Column="1" Grid.Row="3" Margin="5" Text="{Binding TemperaturAussen}" />
<TextBox Grid.Column="1" Grid.Row="4" Margin="5" Text="{Binding TemperaturSewer}" />
<TextBox Grid.Column="1" Grid.Row="5" Margin="5" Text="{Binding Weather}" />
</Grid> </Grid>
</Border> </Border>
</Grid> </Grid>

View File

@@ -24,5 +24,10 @@ namespace DaSaSo.Wpf.View.SewerObject
{ {
InitializeComponent(); InitializeComponent();
} }
private void SewerRehabilation_Loaded(object sender, RoutedEventArgs e)
{
}
} }
} }

View File

@@ -16,6 +16,7 @@ namespace DaSaSo.Wpf.ViewModel.Commands
private IDataService<SewerObject> _dataService; private IDataService<SewerObject> _dataService;
private readonly ISewerpointService _sewerPointService; private readonly ISewerpointService _sewerPointService;
public SaveSewerStammdatenCommand(SewerStammdatenViewModel stammdatenViewModel, IDataService<SewerObject> dataService, ISewerpointService sewerpointService) public SaveSewerStammdatenCommand(SewerStammdatenViewModel stammdatenViewModel, IDataService<SewerObject> dataService, ISewerpointService sewerpointService)
{ {
_stammdatenViewModel = stammdatenViewModel; _stammdatenViewModel = stammdatenViewModel;

View File

@@ -58,17 +58,19 @@ namespace DaSaSo.Wpf.ViewModel.Controls
} }
} }
} }
private DateTime _date;
public DateTime Datum public DateTime Datum
{ {
get => _date; get => model.Date;
set set
{ {
if(_date != value) Trace.WriteLine(value);
if (model.Date != value)
{ {
_date = value; model.Date = value;
model.Date = DateOnly.FromDateTime(_date);
OnPropertyChanged(); OnPropertyChanged();
} }
} }
} }
@@ -81,7 +83,7 @@ namespace DaSaSo.Wpf.ViewModel.Controls
{ {
this.model = model; this.model = model;
SewerPreperationControllViewModel = new SewerPreperationControllViewModel(model.PreparationType); SewerPreperationControllViewModel = new SewerPreperationControllViewModel(model.PreparationType);
_date = model.Date.ToDateTime(new TimeOnly(0));
} }
public override void Dispose() public override void Dispose()
{ {

View File

@@ -58,9 +58,21 @@ namespace DaSaSo.Wpf.ViewModel
} }
} }
public DateTime Imprägnierdatum
{
get => _model.Date;
set
{
_model.Date = value;
}
}
public ImpregnierungEditViewModel(IActualProject actualProject, IDataService<Impregnation> dataservice) public ImpregnierungEditViewModel(IActualProject actualProject, IDataService<Impregnation> dataservice)
{ {
_model = actualProject.AktuellImpregnation; _model = actualProject.AktuellImpregnation;
//Imprägnierdatum = DateTime.Now;
SaveImpregnation = new SaveImpregnationCommand(this,dataservice); SaveImpregnation = new SaveImpregnationCommand(this,dataservice);
} }
} }