Files
BeWoPlaner/BeWo/View/Search/EmployeeSearchView.cs
2016-06-27 01:45:38 +02:00

52 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Media;
using BeWo.ServiceProxy;
using BeWo.Core.Service;
using BS.Shared.DataContracts.Compact;
namespace BeWo.View.Search
{
public class EmployeeSearchView : GenericSearchView<CompactEmployeeDC>
{
public EmployeeSearchView()
{
if (!DesignerProperties.GetIsInDesignMode(this))
{
ThemeColor = FindResource("EmployeeContentBrush") as Brush;
}
}
public bool ShowArchived { get; set; }
public new SearchMode SearchMode { get; set; }
protected override void GetAll(Action<List<CompactEmployeeDC>> pCallBack)
{
if (ShowArchived)
{
ServiceFacade.DoEmployeeServiceAsync(
s => s.GetAllActiveAndArchivedEmployeesCompact(),
r =>
{
r.Sort((x, y) => (x.LastName + ", " + x.FirstName).CompareTo(y.LastName + ", " + y.FirstName));
pCallBack(r);
});
}
else
{
if (SearchMode == SearchMode.OnlyTeamMember)
{
Cache.GetInstance().GetAllTeamMemberForEmployee(BeWoApp.LoggedOnUser.Employee, pCallBack);
}
else
{
Cache.GetInstance().GetAllActiveEmployeesCompact(pCallBack);
}
}
}
}
}