InvoiceCalculationSelector.xaml.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System.Windows;
  2. using PRS.Shared;
  3. namespace PRSDesktop
  4. {
  5. public partial class InvoiceCalculationSelector : Window
  6. {
  7. public InvoiceTimeCalculation TimeCalculation
  8. {
  9. get => LabourDetails.IsChecked == true
  10. ? InvoiceTimeCalculation.Detailed
  11. : LabourActivity.IsChecked == true
  12. ? InvoiceTimeCalculation.Activity
  13. : InvoiceTimeCalculation.Collapsed;
  14. set
  15. {
  16. switch (value)
  17. {
  18. case InvoiceTimeCalculation.Detailed :
  19. LabourDetails.IsChecked = true;
  20. break;
  21. case InvoiceTimeCalculation.Activity :
  22. LabourActivity.IsChecked = true;
  23. break;
  24. case InvoiceTimeCalculation.Collapsed :
  25. LabourCollapsed.IsChecked = true;
  26. break;
  27. }
  28. }
  29. }
  30. public InvoiceMaterialCalculation MaterialCalculation
  31. {
  32. get => PartsDetails.IsChecked == true
  33. ? InvoiceMaterialCalculation.Detailed
  34. : PartsProduct.IsChecked == true
  35. ? InvoiceMaterialCalculation.Product
  36. : PartsCostCentre.IsChecked == true
  37. ? InvoiceMaterialCalculation.CostCentre
  38. : InvoiceMaterialCalculation.Collapsed;
  39. set
  40. {
  41. switch (value)
  42. {
  43. case InvoiceMaterialCalculation.Detailed :
  44. PartsDetails.IsChecked = true;
  45. break;
  46. case InvoiceMaterialCalculation.Product :
  47. PartsProduct.IsChecked = true;
  48. break;
  49. case InvoiceMaterialCalculation.CostCentre :
  50. PartsCostCentre.IsChecked = true;
  51. break;
  52. case InvoiceMaterialCalculation.Collapsed :
  53. PartsCollapsed.IsChecked = true;
  54. break;
  55. }
  56. }
  57. }
  58. public InvoiceCalculationSelector()
  59. {
  60. InitializeComponent();
  61. }
  62. private void OK_OnClick(object sender, RoutedEventArgs e)
  63. {
  64. DialogResult = true;
  65. }
  66. private void Cancel_OnClick(object sender, RoutedEventArgs e)
  67. {
  68. DialogResult = false;
  69. }
  70. }
  71. }