LogikalStyle.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using InABox.Integration.Logikal;
  2. using System;
  3. using System.Collections.Generic;
  4. using InABox.Integration.Awg;
  5. namespace PRSDesktop.Integrations.Logikal
  6. {
  7. public class LogikalStyle : LogikalItem, ILogikalStyle
  8. {
  9. public String Code { get; set; }
  10. public String Description { get; set; }
  11. public double Cost { get; set; }
  12. public AwgStyleType StyleType { get; set; }
  13. public override void ValidateQuery(string sql, List<string> errors)
  14. {
  15. ValidateField(sql, nameof(Code), errors);
  16. ValidateField(sql, nameof(Description), errors);
  17. ValidateField(sql, nameof(Cost), errors);
  18. ValidateField(sql, nameof(StyleType), errors);
  19. }
  20. public static String SQL = $@"select distinct
  21. c.[ColorName] as [{nameof(Code)}],
  22. c.[ColorName] as [{nameof(Description)}] ,
  23. case c.[ColorTypeSupplier] WHEN 7 THEN 1 WHEN 11 THEN 3 WHEN 12 THEN 4 WHEN 0 THEN 5 ELSE 0 END AS [{nameof(StyleType)}],
  24. coalesce(b.[PriceCoating],0.0) as [{nameof(Cost)}]
  25. from
  26. Colors c
  27. left outer join
  28. profilebars b on c.[ColorId] = b.[LK_ColorId]
  29. where
  30. coalesce(c.[ColorName], '') <> ''";
  31. }
  32. }
  33. //case b.[ColorTypeInternal] WHEN 7 THEN 1 WHEN 335 THEN 2 WHEN 191 THEN 4 WHEN 141 THEN 5 ELSE 0 END AS [{nameof(StyleType)}],
  34. /*
  35. * Further investigation into ProfileBars.ColorTypeInternal turns up an “18” (powdercoat?) and “6” (unsure)
  36. I also found that I could go to Logikal / User Database / Colors and export the Color Database to Excel. It doesn’t give us the numbers, but when I want to try and add a color, it gave me four options – Powdercoated, Varnished, Taped or Anodized.
  37. So somehow, I’m expecting to have a maximum of 4 (or 5) unique numbers to identify the color type. If -1 is unspecified, then
  38. Powdercoated appears to be 7
  39. Anodized should be either 11 (Colors.ColorTypeSupplier) or 335 (ProfileBars.ColorTypeInternal)
  40. Varnished (Stainless?) might be 12 (Colors.ColorTypeSupplier) or 191 (ProfileBars.ColorTypeInternal)
  41. Taped (PVC?) might be 0 (Colors.ColorTypeSupplier) or 141 (ProfileBars.ColorTypeInternal)
  42. */
  43. /*
  44. * select distinct
  45. c.[ColorName] as [{nameof(Code)}],
  46. c.[ColorName] as [{nameof(Description)}] ,
  47. coalesce(b.[PriceCoating],0.0) as [{nameof(Cost)}],
  48. c.[ColorTypeSupplier],
  49. coalesce(b.ColorTypeInternal,0),
  50. case c.[ColorTypeSupplier] WHEN 7 THEN 1 WHEN 11 THEN 3 WHEN 12 THEN 4 WHEN 0 THEN 5 ELSE 0 END AS [TreatmentType],
  51. case b.[ColorTypeInternal] WHEN 7 THEN 1 WHEN 335 THEN 2 WHEN 191 THEN 4 WHEN 141 THEN 5 ELSE 0 END AS [TreatmentType2]
  52. from
  53. Colors c
  54. left outer join
  55. profilebars b on c.[ColorId] = b.[LK_ColorId]
  56. */