LogikalGlass.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. $" 1.0 as {nameof(Quantity)}, \n" +
  28. $" g.[Price] as {nameof(Cost)} \n" +
  29. "from \n" +
  30. " glass g \n" +
  31. "left outer join \n" +
  32. " insertions i on g.[insertionid] = i.[insertionid] \n" +
  33. "left outer join \n" +
  34. " elevations e on i.[elevationid] = e.[elevationid] \n" +
  35. "where \n" +
  36. " 1=1";
  37. public static string BillOfMaterialsSQL =
  38. "select \n" +
  39. $" g.[Name] as {nameof(Code)}, \n" +
  40. $" g.[Description] as {nameof(Description)}, \n" +
  41. $" g.[width_output] as {nameof(Height)}, \n" +
  42. $" g.[height_output] as {nameof(Width)}, \n" +
  43. $" g.[Configuration] as {nameof(Treatment)}, \n" +
  44. $" '' as {nameof(Location)}, \n" +
  45. $" 1.0 as {nameof(Quantity)}, \n" +
  46. $" g.[Price] as {nameof(Cost)} \n" +
  47. "from \n" +
  48. " glass g \n" +
  49. "left outer join \n" +
  50. " insertions i on g.[insertionid] = i.[insertionid] \n" +
  51. "left outer join \n" +
  52. " elevations e on i.[elevationid] = e.[elevationid] \n" +
  53. "where \n" +
  54. " 1=1";
  55. }
  56. }