125 lines
4.0 KiB
C#
125 lines
4.0 KiB
C#
using System.Windows;
|
|
using BeWo.ViewModel.ListViewModel;
|
|
using System.Windows.Controls;
|
|
|
|
namespace BeWo.View.Detail
|
|
{
|
|
public partial class EnvironmentRoleView
|
|
{
|
|
private readonly ValueListView _PersonView;
|
|
private readonly ValueListView _OrganisationView;
|
|
private readonly ValueListView _RoleInOrganisation;
|
|
private readonly ValueListView _RoleInFamily;
|
|
|
|
public EnvironmentRoleView(ValueListEntryListVM pViewModelPerson, ValueListEntryListVM pViewModelOrganisation, ValueListEntryListVM pViewModelRoleInOrganisation, ValueListEntryListVM pViewModelRoleInFamily)
|
|
{
|
|
InitializeComponent();
|
|
|
|
_RoleInFamily = new ValueListView(pViewModelRoleInFamily);
|
|
_PersonView = new ValueListView(pViewModelPerson);
|
|
_OrganisationView = new ValueListView(pViewModelOrganisation);
|
|
_RoleInOrganisation = new ValueListView(pViewModelRoleInOrganisation);
|
|
|
|
_RoleInFamily.SetValue(Grid.RowProperty, 0);
|
|
_PersonView.SetValue(Grid.RowProperty, 1);
|
|
_OrganisationView.SetValue(Grid.RowProperty, 2);
|
|
_RoleInOrganisation.SetValue(Grid.RowProperty, 3);
|
|
|
|
_PersonView.Margin = new Thickness(0, 10, 0, 0);
|
|
_OrganisationView.Margin = new Thickness(0, 10, 0, 0);
|
|
_RoleInOrganisation.Margin = new Thickness(0, 10, 0, 0);
|
|
|
|
rootGrid.Children.Add(_RoleInFamily);
|
|
rootGrid.Children.Add(_PersonView);
|
|
rootGrid.Children.Add(_OrganisationView);
|
|
rootGrid.Children.Add(_RoleInOrganisation);
|
|
}
|
|
|
|
public EnvironmentRoleView(ValueListEntryListVM personFunktionList, ValueListEntryListVM orgFunktionList)
|
|
{
|
|
InitializeComponent();
|
|
|
|
_PersonView = new ValueListView(personFunktionList);
|
|
_OrganisationView = new ValueListView(orgFunktionList);
|
|
|
|
|
|
_PersonView.SetValue(Grid.RowProperty, 0);
|
|
_OrganisationView.SetValue(Grid.RowProperty, 1);
|
|
|
|
_OrganisationView.Margin = new Thickness(0, 10, 0, 0);
|
|
|
|
rootGrid.Children.Add(_PersonView);
|
|
rootGrid.Children.Add(_OrganisationView);
|
|
}
|
|
|
|
public override bool IsDirty
|
|
{
|
|
get
|
|
{
|
|
var dirty = false;
|
|
|
|
if (_PersonView != null)
|
|
{
|
|
dirty = _PersonView.IsDirty;
|
|
}
|
|
|
|
if (!dirty && _OrganisationView != null)
|
|
{
|
|
dirty = _OrganisationView.IsDirty;
|
|
}
|
|
|
|
if (!dirty && _RoleInOrganisation != null)
|
|
{
|
|
dirty = _RoleInOrganisation.IsDirty;
|
|
}
|
|
|
|
if (!dirty && _RoleInFamily != null)
|
|
{
|
|
dirty = _RoleInFamily.IsDirty;
|
|
}
|
|
|
|
return dirty;
|
|
}
|
|
}
|
|
|
|
public override string Title => null;
|
|
|
|
protected override void Save()
|
|
{
|
|
var valid = true;
|
|
|
|
if (_PersonView != null){
|
|
if (_PersonView.IsDirty)
|
|
{
|
|
valid = _PersonView.SaveData();
|
|
}
|
|
}
|
|
|
|
if(_OrganisationView != null)
|
|
{
|
|
if(valid && _OrganisationView.IsDirty)
|
|
{
|
|
_OrganisationView.SaveData();
|
|
}
|
|
}
|
|
|
|
if(_RoleInOrganisation != null)
|
|
{
|
|
if(valid && _RoleInOrganisation.IsDirty)
|
|
{
|
|
_RoleInOrganisation.SaveData();
|
|
}
|
|
}
|
|
|
|
if(_RoleInFamily != null)
|
|
{
|
|
if(valid && _RoleInFamily.IsDirty)
|
|
{
|
|
_RoleInFamily.SaveData();
|
|
}
|
|
}
|
|
}
|
|
|
|
internal override DependencyObject ValidationOnSaveRootElement => BorderTemp;
|
|
}
|
|
} |