1 Commits

Author SHA1 Message Date
Damian Wessels
7db9592dff Schlauchliner erweitert 2023-01-29 13:53:50 +01:00
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 decimal Linerlength { get; set; }
public bool IsAvaible { get; set; }
public DateOnly Date { get; set; }
public DateTime Date { get; set; }
public string LinerNumber { get; set; }
public decimal WallThickness { get; set; }
}

View File

@@ -9,7 +9,7 @@ namespace DaSaSo.Domain.Model
public abstract class SewerRehabilation : DomainObject
{
public string Operator { get; set; }
public DateOnly Date { get; set; }
public DateTime Date { get; set; }
public decimal TemperatureOutdoors { get; set; }
public decimal TemperatureSewer { 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()
{
BuildingSite = aktuellBaustelle,
StreetName = "Bitte aktualisieren!"
StreetName = "Bitte aktualisieren!",
//PipeLiner = new PipeLiner()
};
aktuellBaustelle.SewerObjects.Add(sewerObject);
await _buildingsiteService.Update(aktuellBaustelle.Id, aktuellBaustelle);

View File

@@ -75,7 +75,7 @@ namespace DaSaSo.Wpf
try
{
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);
}
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) =>
{
string connectionString = "";
Action<DbContextOptionsBuilder> configureDbContext = null;
Action<DbContextOptionsBuilder> configureDbContext;
string databaseToUse = context.Configuration.GetConnectionString("databaseToUse");
Trace.WriteLine(databaseToUse);
if(databaseToUse.Equals("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"))
{
connectionString = context.Configuration.GetConnectionString("sqlite");
configureDbContext = o => o.UseSqlite(connectionString);
}
else
{
throw new NotImplementedException("Database Type not implementent" + databaseToUse);
}
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="3" Text="{Binding DN}" />
<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}"/>
<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: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:converters="clr-namespace:DaSaSo.Wpf.Converters"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<converters:StringToDateTimeConverter x:Key="StringToDateTimeConverter" />
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
@@ -22,22 +26,26 @@
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<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="2" Content="Temperatur Aussen" />
<Label Margin="5" Grid.Column="0" Grid.Row="3" Content="Temperatur Kanal" />
<Label Margin="5" Grid.Column="0" Grid.Row="4" Content="Wetter" />
<Label Margin="5" Grid.Column="0" Grid.Row="1" Content="Einbau - Datum" />
<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 Aussen" />
<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}" />
<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="3" Margin="5" Text="{Binding TemperaturSewer}" />
<TextBox Grid.Column="1" Grid.Row="4" Margin="5" Text="{Binding Weather}" />
<TextBox Grid.Column="1" Grid.Row="2" Margin="5" />
<!--Text="{Binding Path=Datum, Converter={StaticResource StringToDateTimeConverter}}"-->
<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>
</Border>
</Grid>

View File

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

View File

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

View File

@@ -58,17 +58,19 @@ namespace DaSaSo.Wpf.ViewModel.Controls
}
}
}
private DateTime _date;
public DateTime Datum
{
get => _date;
get => model.Date;
set
{
if(_date != value)
Trace.WriteLine(value);
if (model.Date != value)
{
_date = value;
model.Date = DateOnly.FromDateTime(_date);
model.Date = value;
OnPropertyChanged();
}
}
}
@@ -81,7 +83,7 @@ namespace DaSaSo.Wpf.ViewModel.Controls
{
this.model = model;
SewerPreperationControllViewModel = new SewerPreperationControllViewModel(model.PreparationType);
_date = model.Date.ToDateTime(new TimeOnly(0));
}
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)
{
_model = actualProject.AktuellImpregnation;
//Imprägnierdatum = DateTime.Now;
SaveImpregnation = new SaveImpregnationCommand(this,dataservice);
}
}