temp commit

This commit is contained in:
2024-08-14 15:20:37 +02:00
parent 4960c87f2b
commit 0373a73159
11 changed files with 57 additions and 17 deletions

View File

@@ -32,6 +32,7 @@
<ComboBox Grid.Row="0" Grid.Column="1" Margin="3" IsReadOnly="False"
x:Name="combobox_wohnungsname" IsEditable="True" IsTextSearchEnabled="False"
ItemsSource="{Binding Path=WohneinheitListVM.Wohnungsnamen}"
DropDownClosed="combobox_wohnungsname_DropDownClosed"
Text="{Binding Path=WohneinheitListVM.CurrentVM.Wohnname, UpdateSourceTrigger=PropertyChanged}"
ToolTip="Liste der Wohneinheiten ohne Zimmer Bezeichnung"/>

View File

@@ -1,5 +1,6 @@
using BeWo.ViewModel;
using BeWo.ViewModel.ListViewModel;
using BS.Shared.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -106,5 +107,35 @@ namespace BeWo.View.Controls
}
}
}
private void combobox_wohnungsname_DropDownClosed(object sender, EventArgs e)
{
var vm = ViewModel.WohneinheitListVM.CurrentVM;
if (vm is null)
return;
var selected_item = combobox_wohnungsname.SelectedItem as string;
var selected_vm = ViewModel.WohneinheitListVM.VMList.FirstOrDefault(x => x.Wohnname == selected_item);
SetValuesFromParent(vm, selected_vm);
}
private void SetValuesFromParent(WohneinheitVM vm, WohneinheitVM parent_vm)
{
if (vm is null || parent_vm is null)
return;
if (vm.Stock.IsNullOrEmpty() && parent_vm.Stock.IsNotNullOrEmpty())
{
vm.Stock = parent_vm.Stock;
}
if (!vm.Baujahr.HasValue && parent_vm.Baujahr.HasValue)
{
vm.Baujahr = parent_vm.Baujahr;
}
}
}
}

View File

@@ -512,7 +512,6 @@ namespace BeWo.View.Detail
var vmlist = ViewModel.WohneinheitListVM;
vmlist.CurrentVM = vmlist.NewVM;
vmlist.NewVM.Baujahr = 1900;
popup_newWohneinheit.IsOpen = true;
}

View File

@@ -63,6 +63,7 @@ namespace BeWo.ViewModel.ListViewModel
public List<string> GetWohnungsnamen() => VMList?
.Where(x => !string.IsNullOrEmpty(x.Wohnname))
.Where(x => !string.IsNullOrEmpty(x.Zimmername))
.Select(x => x.Wohnname)?
.Distinct()
.OrderBy(x => x)

View File

@@ -27,7 +27,7 @@ namespace BeWo.ViewModel
private decimal _SonstigeKosten;
private decimal _Kaution;
private decimal _QM;
private int _Baujahr;
private int? _Baujahr;
private string _Mobilierung;
private string _Zusatznotiz;
private string _Stock;
@@ -86,7 +86,7 @@ namespace BeWo.ViewModel
}
}
public string Name => ToString();
public decimal Miete
public decimal? Miete
{
get { return _Miete; }
set
@@ -99,7 +99,7 @@ namespace BeWo.ViewModel
FirePropertyChanged(nameof(Brutto));
}
}
public decimal Heizung
public decimal? Heizung
{
get { return _Heizung; }
set
@@ -113,7 +113,7 @@ namespace BeWo.ViewModel
}
}
}
public decimal Strom
public decimal? Strom
{
get { return _Strom; }
set
@@ -127,7 +127,7 @@ namespace BeWo.ViewModel
}
}
}
public decimal Betriebskosten
public decimal? Betriebskosten
{
get { return _Betriebskosten; }
set
@@ -141,7 +141,7 @@ namespace BeWo.ViewModel
}
}
}
public decimal SonstigeKosten
public decimal? SonstigeKosten
{
get { return _SonstigeKosten; }
set
@@ -155,7 +155,7 @@ namespace BeWo.ViewModel
}
}
}
public decimal Kaution
public decimal? Kaution
{
get { return _Kaution; }
set
@@ -168,14 +168,17 @@ namespace BeWo.ViewModel
}
}
}
public decimal Brutto
public decimal? Brutto
{
get
{
if (!Miete.HasValue & !Heizung.HasValue && !Strom.HasValue && !Betriebskosten.HasValue && !SonstigeKosten.HasValue)
return null;
return Miete + Heizung + Strom + Betriebskosten + SonstigeKosten;
}
}
public decimal QM
public decimal? QM
{
get { return _QM; }
set
@@ -189,8 +192,8 @@ namespace BeWo.ViewModel
}
}
}
public string FlacheString => QM.ToString("########0.00 qm");
public int Baujahr
public string FlacheString => QM?.ToString("########0.00 qm");
public int? Baujahr
{
get { return _Baujahr; }
set

View File

@@ -36,7 +36,7 @@ namespace BeWo.Data.Entities
private decimal _SonstigeKosten;
private decimal _Kaution;
private decimal _QM;
private int _Baujahr;
private int? _Baujahr;
private string _Mobilierung;
private string _Zusatznotiz;
private string _Stock;
@@ -212,7 +212,7 @@ namespace BeWo.Data.Entities
}
}
}
public virtual int Baujahr
public virtual int? Baujahr
{
get
{

View File

@@ -10,6 +10,7 @@ namespace BeWo.Service.DCEntityMapper
public override CompactWohnheimDC MergeWithDC(Wohnheim pEntity, CompactWohnheimDC pDataContract)
{
pDataContract.WohnheimOid = pEntity.Oid.Value;
pDataContract.Version = pEntity.Version.Value;
pDataContract.WohnheimName = pEntity.WohnheimName;
pDataContract.Strasse = pEntity.Strasse;
pDataContract.PLZ = pEntity.PLZ;

View File

@@ -15,8 +15,6 @@ namespace BS.Shared.DataContracts.Compact
public bool SupportsActivationType { get{ return true; } set { } }
public long Version { get; set; }
public SolidColorBrush FilterableBrush { get { return new SolidColorBrush(Colors.Transparent); } }
public string AddressString

View File

@@ -13,6 +13,9 @@ namespace BS.Shared.DataContracts.Compact
[DataMember]
public string WohnheimName { get; set; }
[DataMember]
public long Version { get; set; }
[DataMember]
public ActivationTypeId ActivationType { get; set; }

View File

@@ -18,7 +18,7 @@ namespace BS.Shared.DataContracts
[DataMember] public decimal SonstigeKosten { get; set; }
[DataMember] public decimal Kaution { get; set; }
[DataMember] public decimal QM { get; set; }
[DataMember] public int Baujahr { get; set; }
[DataMember] public int? Baujahr { get; set; }
[DataMember] public string Mobilierung { get; set; }
[DataMember] public string Zusatznotiz { get; set; }
[DataMember] public string Stock { get; set; }

View File

@@ -23,6 +23,9 @@ namespace BS.Shared.Extensions
return true;
}
public static bool IsNotNullOrEmpty(this string pString)
=> !IsNullOrEmpty(pString);
public static bool IsNullOrEmpty(this string pString)
{
return String.IsNullOrEmpty(pString);