LogikalProfile.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using InABox.Core;
  2. using InABox.Integration.Logikal;
  3. using System;
  4. using System.Collections.Generic;
  5. namespace PRSDesktop.Integrations.Logikal
  6. {
  7. public class LogikalProfile : LogikalBOMItem, ILogikalProfile
  8. {
  9. public double Length { get; set; }
  10. public string? Finish { get; set; }
  11. public override void ValidateQuery(string sql, List<string> errors)
  12. {
  13. base.ValidateQuery(sql, errors);
  14. ValidateField(sql, nameof(Length), errors);
  15. ValidateField(sql, nameof(Finish), errors);
  16. }
  17. public static String DesignSQL = $@"
  18. select
  19. p.[ArticleCode_BaseNumber] as {nameof(Code)},
  20. p.[description] as {nameof(Description)},
  21. p.[length_output] as {nameof(Length)},
  22. c.[PowderID] as {nameof(Finish)},
  23. p.[Amount] as {nameof(Quantity)},
  24. p.[Price] as {nameof(Cost)}
  25. from
  26. profiles p
  27. left outer join
  28. colors c on p.[lk_colorid] = c.[colorid]
  29. join
  30. insertions i on p.[insertionid] = i.[insertionid]
  31. join
  32. elevations e on i.[elevationid] = e.[elevationid]
  33. ";
  34. public static String BillOfMaterialsSQL = $@"
  35. select
  36. a.[ArticleCode_BaseNumber] as {nameof(Code)},
  37. a.[description] as {nameof(Description)},
  38. a.[length_output] as {nameof(Length)},
  39. c.[PowderID] as {nameof(Finish)},
  40. a.[Amount] as {nameof(Quantity)},
  41. a.[Price] as {nameof(Cost)}
  42. from
  43. allprofiles a
  44. left outer join
  45. colors c on a.[lk_colorid] = c.[colorid]
  46. ";
  47. }
  48. }