LogikalProfile.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using InABox.Core;
  2. using InABox.Logikal;
  3. using System;
  4. using System.Collections.Generic;
  5. namespace Comal.Classes
  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 ElevationSQL =
  18. "select \n" +
  19. $" p.[ArticleCode_BaseNumber] as {nameof(Code)}, \n" +
  20. $" p.[description] as {nameof(Description)}, \n" +
  21. $" p.[length_output] as {nameof(Length)}, \n" +
  22. $" c.[ColorName] as {nameof(Finish)}, \n" +
  23. $" 1.0 as {nameof(Quantity)}, \n" +
  24. $" 0.0 as {nameof(Cost)} \n" +
  25. "from \n" +
  26. " profiles p \n" +
  27. "left outer join \n" +
  28. " insertions i on p.[insertionid] = i.[insertionid] \n" +
  29. "left outer join \n" +
  30. " elevations e on i.[elevationid] = e.[elevationid] \n" +
  31. "left outer join \n" +
  32. " colors c on p.[lk_colorid] = c.[colorid] \n" +
  33. "where \n" +
  34. " 1=1";
  35. public static String BillOfMaterialsSQL =
  36. "select \n" +
  37. $" b.[ArticleCode_BaseNumber] as {nameof(Code)}, \n" +
  38. $" b.[description] as {nameof(Description)}, \n" +
  39. $" b.[length_output] as {nameof(Length)}, \n" +
  40. $" c.[ColorName] as {nameof(Finish)}, \n" +
  41. $" 1.0 as {nameof(Quantity)}, \n" +
  42. $" 0.0 as {nameof(Cost)} \n" +
  43. "from \n" +
  44. " profilebars b \n" +
  45. "left outer join \n" +
  46. " insertions i on b.[insertionid] = i.[insertionid] \n" +
  47. "left outer join \n" +
  48. " elevations e on i.[elevationid] = e.[elevationid] \n" +
  49. "left outer join \n" +
  50. " colors c on b.[lk_colorid] = c.[colorid] \n" +
  51. "where \n" +
  52. " 1=1";
  53. }
  54. }