55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Windows.Media;
|
|
using BeWo.ServiceProxy;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using Color = System.Drawing.Color;
|
|
|
|
namespace BeWo.ViewModel.ListViewModel
|
|
{
|
|
public class DienstInfoListVM : AbstractDCListMapperVM<DienstInfoDC, DienstInfoVM>
|
|
{
|
|
public DienstInfoListVM(List<DienstInfoDC> pDCs): base(pDCs)
|
|
{
|
|
}
|
|
|
|
public List<SolidColorBrush> AllBrushes
|
|
{
|
|
get
|
|
{
|
|
var lTemp = typeof(Color).GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Static).Select(pi => (Color)pi.GetGetMethod().Invoke(null, null)).ToList();
|
|
for (int i = lTemp.Count - 1; i >= 0; i--)
|
|
{
|
|
var o = lTemp[i];
|
|
if (o.Name.ToLower().Contains("black"))
|
|
lTemp.Remove(o);
|
|
else if (o.Name.ToLower().Contains("red"))
|
|
lTemp.Remove(o);
|
|
}
|
|
|
|
lTemp.Sort((x, y) => x.GetBrightness().CompareTo(y.GetBrightness()));
|
|
|
|
return lTemp.Select(c => new SolidColorBrush(System.Windows.Media.Color.FromArgb(c.A, c.R, c.G, c.B))).ToList();
|
|
}
|
|
}
|
|
public List<CompactWohnheimDC> AllWohnheime
|
|
{
|
|
get
|
|
{
|
|
var liste = new List<CompactWohnheimDC>();
|
|
liste.Add(new CompactWohnheimDC
|
|
{
|
|
WohnheimOid = -1,
|
|
WohnheimName = ""
|
|
});
|
|
liste.AddRange(ServiceFacade.DoCustomerServiceSync(x => x.GetAllActiveWohnheimeCompact()));
|
|
return liste.OrderBy(l => l.WohnheimName).ToList();
|
|
}
|
|
}
|
|
}
|
|
} |