using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;
using Comal.Classes;
using System.ComponentModel;
using InABox.Core;
using InABox.Wpf;
namespace PRSDesktop
{
///
/// Interaction logic for JobEmployeePanel.xaml
///
public partial class JobEmployeePanel : UserControl, IPanel, IMasterDetailControl
{
public JobEmployeePanel()
{
InitializeComponent();
Employees.OnChanged += (o,e) => Qualifications.Refresh(false, true);
}
public Job? Master
{
get => Employees.Master;
set
{
Employees.Master = value;
Qualifications.Master = value;
}
}
public bool IsReady { get; set; }
public event DataModelUpdateEvent? OnUpdateDataModel;
public void CreateToolbarButtons(IPanelHost host)
{
}
public string SectionName => "Job Employees";
public DataModel DataModel(Selection selection)
{
var ids = Employees.ExtractValues(x => x.ID, selection).ToArray();
return new JobEmployeeDataModel(new Filter(x => x.ID).InList(ids));
}
public void Heartbeat(TimeSpan time)
{
}
public void Refresh()
{
Qualifications.Refresh(false, true);
Employees.Refresh(false, true);
}
public Dictionary Selected()
{
return new Dictionary
{ { typeof(JobEmployee).EntityName(), Employees.SelectedRows } };
}
public void Setup()
{
Employees.Refresh(true, false);
Qualifications.Refresh(true, false);
}
public void Shutdown(CancelEventArgs? cancel)
{
}
public Dictionary DataEnvironment()
{
return new Dictionary();
}
}
}