LogikalGlass.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using InABox.Logikal;
  2. using System.Collections.Generic;
  3. namespace Comal.Classes
  4. {
  5. public class LogikalGlass : LogikalBOMItem, ILogikalGlass
  6. {
  7. public string Treatment { get; set; }
  8. public double Height { get; set; }
  9. public double Width { get; set; }
  10. public string Location { get; set; }
  11. public override void ValidateQuery(string sql, List<string> errors)
  12. {
  13. base.ValidateQuery(sql, errors);
  14. ValidateField(sql, nameof(Treatment), errors);
  15. ValidateField(sql, nameof(Height), errors);
  16. ValidateField(sql, nameof(Width), errors);
  17. ValidateField(sql, nameof(Location), errors);
  18. }
  19. public static string ElevationSQL =
  20. "select \n" +
  21. $" g.[Name] as {nameof(Code)}, \n" +
  22. $" g.[Description] as {nameof(Description)}, \n" +
  23. $" g.[width_output] as {nameof(Height)}, \n" +
  24. $" g.[height_output] as {nameof(Width)}, \n" +
  25. $" g.[Configuration] as {nameof(Treatment)}, \n" +
  26. $" '' as {nameof(Location)}, \n" +
  27. $" g.[Amount] as {nameof(Quantity)}, \n" +
  28. $" g.[Price] as {nameof(Cost)} \n" +
  29. "from \n" +
  30. " glass g \n" +
  31. "where \n" +
  32. " 1=1";
  33. public static string BillOfMaterialsSQL =
  34. "select \n" +
  35. $" g.[Name] as {nameof(Code)}, \n" +
  36. $" g.[Description] as {nameof(Description)}, \n" +
  37. $" g.[width_output] as {nameof(Height)}, \n" +
  38. $" g.[height_output] as {nameof(Width)}, \n" +
  39. $" g.[Configuration] as {nameof(Treatment)}, \n" +
  40. $" '' as {nameof(Location)}, \n" +
  41. $" g.[Amount] as {nameof(Quantity)}, \n" +
  42. $" g.[Price] as {nameof(Cost)} \n" +
  43. "from \n" +
  44. " glass g \n" +
  45. "left outer join \n" +
  46. " insertions i on g.[insertionid] = i.[insertionid] \n" +
  47. "left outer join \n" +
  48. " elevations e on i.[elevationid] = e.[elevationid] \n" +
  49. "where \n" +
  50. " 1=1";
  51. }
  52. }