JobEmployeePanel.xaml.cs 2.0 KB

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