LogikalCommon.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using Comal.Classes;
  2. using InABox.Core;
  3. using InABox.Wpf;
  4. using InABox.WPF;
  5. using javax.swing;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace PRSDesktop.Integrations.Logikal
  12. {
  13. public static class LogikalCommon
  14. {
  15. //public static JobStatus? JobStatus { get; private set; }
  16. //public static TaxCode? TaxCode { get; private set; }
  17. //public static ProductDimensionUnit? ProfileUOM { get; private set; }
  18. //public static ProductDimensionUnit? ComponentUOM { get; private set; }
  19. //public static ProductDimensionUnit? GlassUOM { get; private set; }
  20. public static bool CheckSettings(LogikalSettings settings)
  21. {
  22. // List<String> errors = new();
  23. //
  24. // MultiQuery query = new MultiQuery();
  25. //
  26. // Progress.ShowModal("Checking Settings", progress =>
  27. // {
  28. //
  29. // if (settings.ImportJobs)
  30. // query.Add(
  31. // new Filter<JobStatus>(x => x.ID).IsEqualTo(settings.JobStatus.ID),
  32. // Columns.All<JobStatus>()
  33. // );
  34. //
  35. // query.Add(
  36. // new Filter<TaxCode>(x => x.ID).IsEqualTo(settings.TaxCode.ID),
  37. // Columns.All<TaxCode>()
  38. // );
  39. //
  40. // query.Add(
  41. // new Filter<ProductDimensionUnit>(x => x.ID)
  42. // .InList([settings.ProfileUom.ID, settings.GasketUom, settings.ComponentUom.ID, settings.GlassUom.ID]),
  43. // Columns.All<ProductDimensionUnit>()
  44. // );
  45. //
  46. // query.Query();
  47. // });
  48. //
  49. // if (settings.ImportJobs)
  50. // {
  51. // JobStatus = query.Get<JobStatus>().ToObjects<JobStatus>().FirstOrDefault();
  52. // if (JobStatus == null)
  53. // errors.Add("Job Status has not been configured correctly!");
  54. // }
  55. //
  56. // TaxCode = query.Get<TaxCode>().ToObjects<TaxCode>().FirstOrDefault();
  57. // if (TaxCode == null)
  58. // errors.Add("Tax Code has not been configured correctly!");
  59. //
  60. // var _uoms = query.Get<ProductDimensionUnit>().ToObjects<ProductDimensionUnit>().ToList();
  61. // ProfileUOM = _uoms.FirstOrDefault(x => string.Equals(x.Code, settings.ProfileUom));
  62. // ComponentUOM = _uoms.FirstOrDefault(x => string.Equals(x.Code, settings.ComponentUom));
  63. // GlassUOM = _uoms.FirstOrDefault(x => string.Equals(x.Code, settings.GlassUom));
  64. //
  65. // if (ProfileUOM == null)
  66. // errors.Add("Profile UOM has not been configured correctly!");
  67. //
  68. // if (ComponentUOM == null)
  69. // errors.Add("Component UOM has not been configured correctly!");
  70. //
  71. // if (GlassUOM == null)
  72. // errors.Add("Glass UOM has not been configured correctly!");
  73. //
  74. // if (errors.Any())
  75. // {
  76. // MessageWindow.ShowMessage(
  77. // $"Some Configuration Settings are incorrect:\n\n- {string.Join("\n- ", errors)}\n\nPlease correct this and try again.",
  78. // "Error");
  79. // return false;
  80. // }
  81. return true;
  82. }
  83. }
  84. }