53 lines
2.3 KiB
C#
53 lines
2.3 KiB
C#
using System.Collections.Generic;
|
|
using System.Windows;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
|
|
namespace BeWo.ViewModel.ListViewModel
|
|
{
|
|
public class SupportConceptApprovalPeriodEmployeeRelListVM : AbstractDCListMapperVM<SupportConceptApprovalPeriodEmployeeRelDC, SupportConceptApprovalPeriodEmployeeRelVM>
|
|
{
|
|
public static string PropertyName_GridVisibility = "GridVisibility";
|
|
|
|
public Visibility GridVisibility
|
|
{
|
|
get
|
|
{
|
|
var hasRightToViewAll = BeWoApp.LoggedOnUser.HasRight(UserRightType.ViewAll);
|
|
var hasRightToViewBetreuungsschluessel = BeWoApp.LoggedOnUser.HasRight(UserRightType.Betreuungsschluessel_View);
|
|
var listHasItems = VMList.Count > 0;
|
|
|
|
if (hasRightToViewAll && listHasItems || !hasRightToViewAll && hasRightToViewBetreuungsschluessel && listHasItems)
|
|
{
|
|
return Visibility.Visible;
|
|
}
|
|
|
|
return Visibility.Collapsed;
|
|
}
|
|
}
|
|
|
|
public Visibility AddButtonVisibility
|
|
{
|
|
get
|
|
{
|
|
var hasRightToCreateAll = BeWoApp.LoggedOnUser.HasRight(UserRightType.CreateAll);
|
|
var hasRightToCreateBetreuungsschluessel = BeWoApp.LoggedOnUser.HasRight(UserRightType.Betreuungsschluessel_Create);
|
|
var hasRightToViewAll = BeWoApp.LoggedOnUser.HasRight(UserRightType.ViewAll);
|
|
var hasRightToViewBetreuungsschluessel = BeWoApp.LoggedOnUser.HasRight(UserRightType.Betreuungsschluessel_View);
|
|
|
|
//var hasRightToViewEmployees = BeWoApp.LoggedOnUser.HasRight(UserRightType.EmployeeView_View);
|
|
|
|
return (hasRightToCreateAll || hasRightToCreateBetreuungsschluessel) && (hasRightToViewAll || hasRightToViewBetreuungsschluessel) ? Visibility.Visible : Visibility.Collapsed;
|
|
}
|
|
}
|
|
|
|
public SupportConceptApprovalPeriodEmployeeRelListVM(IEnumerable<SupportConceptApprovalPeriodEmployeeRelDC> pDCs) : base(pDCs)
|
|
{
|
|
VMList.ListChanged += delegate
|
|
{
|
|
FirePropertyChanged(PropertyName_GridVisibility);
|
|
};
|
|
}
|
|
}
|
|
} |