LogikalGroup.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Collections.Generic;
  2. using InABox.Integration.Logikal;
  3. namespace PRSDesktop.Integrations.Logikal;
  4. public class LogikalGroup : LogikalItem, ILogikalGroup
  5. {
  6. public string Code { get; set; }
  7. public string Description { get; set; }
  8. public string Parent { get; set; }
  9. public override void ValidateQuery(string sql, List<string> errors)
  10. {
  11. ValidateField(sql, nameof(Code), errors);
  12. ValidateField(sql, nameof(Description), errors);
  13. ValidateField(sql, nameof(Parent), errors);
  14. }
  15. public static string SQL =
  16. $@"select distinct
  17. upper([group]) as [{nameof(Code)}],
  18. [group] as [{nameof(Description)}],
  19. '' as [{nameof(Parent)}]
  20. from (
  21. select case [ArticleType] when 2 then 'Profiles' when 5 then 'Gasket' when 8 then 'Components' when 30 then 'Fills' else '???' end as 'group' from articles
  22. union
  23. select case [ArticleType] when 2 then 'Profiles' when 5 then 'Gasket' when 8 then 'Components' when 30 then 'Fills' else '???' end as 'group' from profilebars
  24. union
  25. select 'Glass' as 'group' from glass
  26. )";
  27. /*
  28. select distinct
  29. cast(d.[DiscountGroup] as text) as [{nameof(Code)}],
  30. d.[name] as [{nameof(Description)}]
  31. from
  32. EstimationDiscounts d
  33. where
  34. coalesce(d.[DiscountGroup],'') <> ''
  35. */
  36. }