TimeSheetLeaveProcessor.xaml.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Windows;
  3. using FastReport.Data;
  4. using InABox.Wpf;
  5. using InABox.WPF;
  6. using javax.sql;
  7. using Microsoft.Office.Interop.Outlook;
  8. namespace PRSDesktop
  9. {
  10. public partial class TimeSheetLeaveProcessor : Window
  11. {
  12. private DateTime _from;
  13. private DateTime _to;
  14. public TimeSheetLeaveProcessor(DateTime from, DateTime to)
  15. {
  16. InitializeComponent();
  17. _from = from;
  18. _to = to;
  19. standardleave.From = from;
  20. standardleave.To = to;
  21. standardleave.Refresh(true, true);
  22. leaverequests.From = from;
  23. leaverequests.To = to;
  24. leaverequests.Refresh(true, true);
  25. }
  26. private void OK_OnClick(object sender, RoutedEventArgs e)
  27. {
  28. if(standardleave.SelectedIDs.Count == 0 && leaverequests.SelectedIDs.Count == 0)
  29. {
  30. MessageWindow.ShowMessage("You haven't selected any leave entries to process. Please tick the required entries by clicking the right-hand column.", "No entries selected");
  31. return;
  32. }
  33. if (MessageWindow.ShowYesNo("Process these leave entries?", "Process Leave"))
  34. {
  35. Progress.ShowModal("Processing Leave", (progress) =>
  36. {
  37. standardleave.Process(progress);
  38. leaverequests.Process(progress);
  39. });
  40. DialogResult = true;
  41. }
  42. }
  43. private void Cancel_OnClick(object sender, RoutedEventArgs e)
  44. {
  45. DialogResult = false;
  46. }
  47. }
  48. }