Files
BeWoPlaner/BeWo/View/Detail/EnvironmentRoleView.xaml.cs

91 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using BeWo.Core;
using BeWo.Core.Service;
using BeWo.ServiceProxy;
using BeWo.ViewModel;
using BeWo.ViewModel.ListViewModel;
using BS.Shared;
using BS.Shared.Extensions;
using System.Windows.Controls;
namespace BeWo.View.Detail
{
/// <summary>
/// Interaction logic for EmploymentTypeView.xaml
/// </summary>
public partial class EnvironmentRoleView : BeWoView
{
private ValueListView personView = null;
private ValueListView organisationView = null;
private ValueListView roleInOrganisation = null;
public EnvironmentRoleView(ValueListEntryListVM pViewModelPerson, ValueListEntryListVM pViewModelOrganisation, ValueListEntryListVM pViewModelRoleInOrganisation)
{
this.InitializeComponent();
personView = new ValueListView(pViewModelPerson);
organisationView = new ValueListView(pViewModelOrganisation);
roleInOrganisation = new ValueListView(pViewModelRoleInOrganisation);
personView.SetValue(Grid.RowProperty, 0);
organisationView.SetValue(Grid.RowProperty, 1);
roleInOrganisation.SetValue(Grid.RowProperty, 2);
organisationView.Margin = new Thickness(0, 10, 0, 0);
roleInOrganisation.Margin = new Thickness(0, 10, 0, 0);
rootGrid.Children.Add(personView);
rootGrid.Children.Add(organisationView);
rootGrid.Children.Add(roleInOrganisation);
}
public override bool IsDirty
{
get
{
bool dirty = this.personView.IsDirty;
if (!dirty)
dirty = this.organisationView.IsDirty;
if (!dirty)
dirty = this.roleInOrganisation.IsDirty;
return dirty;
}
}
public override string Title
{
get
{
return null;
}
}
protected override void Save()
{
bool valid = true;
if (this.personView.IsDirty)
valid = this.personView.SaveData();
if (valid && this.organisationView.IsDirty)
this.organisationView.SaveData();
if (valid && roleInOrganisation.IsDirty)
this.roleInOrganisation.SaveData();
}
internal override DependencyObject ValidationOnSaveRootElement
{
get { return this.borderTemp; }
}
}
}