76 lines
2.2 KiB
C#
76 lines
2.2 KiB
C#
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Wohnhilfe;
|
|
using DevExpress.Mvvm;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BeWo.ViewModel.ListViewModel
|
|
{
|
|
public class CustomerWohnhilfeListVM : AbstractDCListMapperVM<CustomerWohnhilfeDC, CustomerWohnhilfeVM>
|
|
{
|
|
private bool _IsLarge;
|
|
|
|
public DelegateCommand AddWohnhilfeCommand { get; set; }
|
|
public DelegateCommand DeleteWohnhilfeCommand { get; set; }
|
|
public DelegateCommand CopySelectedWohnhilfeCommand { get; set; }
|
|
public DelegateCommand InsertDetailsCommand { get; set; }
|
|
|
|
public CustomerVM Customer { get; set; }
|
|
|
|
public CustomerWohnhilfeListVM() { }
|
|
|
|
public CustomerWohnhilfeListVM(CustomerVM vm, IEnumerable<CustomerWohnhilfeDC> wohnhilfe) : base(wohnhilfe)
|
|
{
|
|
Customer = vm;
|
|
|
|
AddWohnhilfeCommand = new DelegateCommand(() => AddNewVMToListAndSelect(true), CanAddWohnhilfe);
|
|
|
|
DeleteWohnhilfeCommand = new DelegateCommand(() => DeleteSelectedVM($"Wohnhilfe '{SelectedVM.Displayname}'"));
|
|
|
|
CopySelectedWohnhilfeCommand = new DelegateCommand(CopySelectedWohnhilfe);
|
|
|
|
InsertDetailsCommand = new DelegateCommand(InsertDetails);
|
|
|
|
_IsLarge = true;
|
|
}
|
|
|
|
public bool IsLarge
|
|
{
|
|
get { return _IsLarge; }
|
|
set
|
|
{
|
|
if (!AreDifferent(IsLarge, value))
|
|
return;
|
|
|
|
_IsLarge = value;
|
|
FirePropertyChanged(nameof(IsLarge));
|
|
}
|
|
}
|
|
|
|
public void CopySelectedWohnhilfe()
|
|
{
|
|
var old_vm = SelectedVM;
|
|
|
|
var new_vm = AddNewVMToListAndSelect(true);
|
|
|
|
new_vm.CopyFrom(old_vm);
|
|
}
|
|
|
|
public void InsertDetails()
|
|
{
|
|
var selected_vm = SelectedVM;
|
|
|
|
selected_vm.BereichSozialstrukturVM.Geburtsdatum = Customer.DateOfBirth;
|
|
}
|
|
|
|
public bool CanAddWohnhilfe()
|
|
{
|
|
return BeWoApp.HasLoggedOnUserRight(UserRightType.Customer_Wohnhilfe_Create);
|
|
}
|
|
}
|
|
}
|