JobEmployeePanel.xaml.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Controls;
  5. using Comal.Classes;
  6. using InABox.Core;
  7. namespace PRSDesktop
  8. {
  9. /// <summary>
  10. /// Interaction logic for JobEmployeePanel.xaml
  11. /// </summary>
  12. public partial class JobEmployeePanel : UserControl, IPanel<JobEmployee>, IJobControl
  13. {
  14. public JobEmployeePanel()
  15. {
  16. InitializeComponent();
  17. Employees.OnChanged += grid => Qualifications.Refresh(false, true);
  18. }
  19. public Guid ParentID
  20. {
  21. get => Employees.ParentID;
  22. set
  23. {
  24. Employees.ParentID = value;
  25. Qualifications.ParentID = value;
  26. }
  27. }
  28. public JobPanelSettings Settings { get; set; }
  29. public bool IsReady { get; set; }
  30. public event DataModelUpdateEvent OnUpdateDataModel;
  31. public void CreateToolbarButtons(IPanelHost host)
  32. {
  33. }
  34. public string SectionName => "Job Employees";
  35. public DataModel DataModel(Selection selection)
  36. {
  37. var ids = Employees.ExtractValues(x => x.ID, selection).ToArray();
  38. return new JobEmployeeDataModel(new Filter<JobEmployee>(x => x.ID).InList(ids));
  39. }
  40. public void Heartbeat(TimeSpan time)
  41. {
  42. }
  43. public void Refresh()
  44. {
  45. Qualifications.Refresh(false, true);
  46. Employees.Refresh(false, true);
  47. }
  48. public Dictionary<string, object[]> Selected()
  49. {
  50. return new Dictionary<string, object[]>();
  51. }
  52. public void Setup()
  53. {
  54. Employees.Refresh(true, false);
  55. Qualifications.Refresh(true, false);
  56. }
  57. public void Shutdown()
  58. {
  59. }
  60. public Dictionary<Type, CoreTable> DataEnvironment()
  61. {
  62. return new Dictionary<Type, CoreTable>();
  63. }
  64. }
  65. }