Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

SnailWorksRepository.asp 6.3KB

4 månader sedan
4 månader sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <%
  2. '=======================================================================================================================
  3. ' Settings Model
  4. '=======================================================================================================================
  5. Class SnailWorksExportModel_Class
  6. Public Header
  7. Public DetailRecords
  8. End Class
  9. Class SnailWorksExportHeaderModel_Class
  10. Public Class_Get_Properties
  11. Public RecordType
  12. Public Version
  13. Public UserId
  14. Public ClientName
  15. Public ParentClientName
  16. Public JobName
  17. Public JobDescription
  18. Public SplitName
  19. Public SplitDescription
  20. Public PieceType
  21. Public MailDate
  22. Public UploadType
  23. Public TrackedQuanity
  24. Public PiecesMailed
  25. Public TargetInHomeDateStart
  26. Public TargetInHomeDateEnd
  27. Public ConfirmationEmail
  28. Public JobId
  29. Public SplitId
  30. Public TypeOfTracking
  31. Public ReturnedPostalRoutingCode
  32. Public ReportId1
  33. Public Report1Email
  34. Public ReportId2
  35. Public Report2Email
  36. Public INFOONLY
  37. Private Sub Class_Initialize
  38. 'ValidateExitsts Me, "",""
  39. Class_Get_Properties = Array("RecordType","Version","UserId","ClientName","ParentClientName","JobName" _
  40. ,"JobDescription","SplitName","SplitDescription","PieceType","MailDate","UploadType" _
  41. ,"TrackedQuanity","PiecesMailed","TargetInHomeDateStart","TargetInHomeDateEnd","ConfirmationEmail","JobId" _
  42. ,"SplitId","TypeOfTracking","ReturnedPostalRoutingCode","ReportId1","Report1Email","ReportId2","Report2Email","INFOONLY")
  43. End Sub
  44. End CLass
  45. Class SnailWorksExportDetailModel_Class
  46. Public Class_Get_Properties
  47. Public RecordType
  48. Public CustomerUniqueIdentifier
  49. Public IMB
  50. Public Greeting
  51. Public FirstName
  52. Public MI
  53. Public LastName
  54. Public Suffix
  55. Public FullName
  56. Public Company
  57. Public Title
  58. Public Address1
  59. Public Address2
  60. Public City
  61. Public State
  62. Public Zip
  63. Public UserDefined1
  64. Public UserDefined2
  65. Public UserDefined3
  66. Public UserDefinedIdentifier4
  67. Public UserDefinedIdentifier5
  68. Public SeedIndicator
  69. Public InductionPoint
  70. Public InductionDate
  71. Public InBoundIMB
  72. Public IMCB
  73. Public IMTB
  74. Private Sub Class_Initialize
  75. 'ValidateExitsts Me, "",""
  76. Class_Get_Properties = Array("RecordType","CustomerUniqueIdentifier","IMB","Greeting","FirstName" _
  77. ,"MI","LastName","Suffix","FullName","Company","Title","Address1","Address2","City","State","Zip" _
  78. ,"UserDefined1","UserDefined2","UserDefined3","UserDefinedIdentifier4","UserDefinedIdentifier5" _
  79. ,"SeedIndicator","InductionPoint","InductionDate","InBoundIMB","IMCB","IMTB")
  80. End Sub
  81. End Class
  82. '=======================================================================================================================
  83. ' SnailWorks Repository
  84. '=======================================================================================================================
  85. Class SnailWorksRepository_Class
  86. Public Function GetSnailWorksExportById(id)
  87. dim SnailWorksExport:set SnailWorksExport = new SnailWorksExportModel_Class
  88. set SnailWorksExport.Header = GetSnailWorksHeaderByKitId(id)
  89. set SnailWorksExport.DetailRecords = FindSnailWorksDetailRecordsByKitId(id)
  90. set GetSnailWorksExportById = SnailWorksExport
  91. End Function
  92. Private Function GetSnailWorksHeaderByKitId(id)
  93. Dim Header:Set Header = New SnailWorksExportHeaderModel_Class
  94. dim sql : sql = "SELECT ""H"" as RecordType,""5.2"" as Version, ""KCI2024Type2FTPUser"" as UserId,[Jcode] as ClientName,"""" as ParentClientName," &_
  95. """Tracking Kit - "" & [JobNumber] as JobName,"""" as JobDescription,"""" as SplitName,"""" as SplitDescription,""L"" as PieceType," &_
  96. "Year(Now()) & ""/"" & RIGHT(""0"" & Month(Now()),2) & ""/"" & RIGHT(""0"" & Day(Now()),2) as MailDate,""N"" as UploadType,"""" as TrackedQuanity," &_
  97. """"" as PiecesMailed,"""" as TargetInHomeDateStart,"""" as TargetInHomeDateEnd,""amandaw@kentcommunications.com"" as ConfirmationEmail,"""" as JobId," &_
  98. """"" as SplitId,""R"" as TypeofTracking,"""" as ReturnedPostalRoutingCode,"""" as ReportId1," &_
  99. """"" as Report1Email,"""" as ReportId2,"""" as Report2Email,"""" as INFOONLY From Kit WHERE ID =?;"
  100. dim rs : set rs = DAL.Query(sql,id)
  101. If rs.EOF then
  102. Err.Raise 1, "GetSnailWorksHeaderByKitId", "SnailWorksHeaderByKitId was not found with Id of: " & id
  103. Else
  104. Set GetSnailWorksHeaderByKitId = Automapper.AutoMap(rs,"SnailWorksExportHeaderModel_Class")
  105. Destroy rs
  106. End If
  107. End Function
  108. Private Function FindSnailWorksDetailRecordsByKitId(id)
  109. dim sql : sql = "SELECT ""D"" as RecordType, OutboundSerial as CustomerUniqueIdentifier, OutboundIMBDigits as IMB, """" as Greeting , """" as FirstName," &_
  110. """"" as MI, """" as LastName,"""" as Suffix,"""" as FullName,"""" as Address1,"""" as Address2,"""" as City,"""" as State," &_
  111. """"" as Zip,Jcode as UserDefined1,"""" as UserDefined2,"""" as UserDefined3,"""" as UserDefinedIdentifier4,"""" as UserDefinedIdentifier5,"""" as SeedIndicator," &_
  112. """"" as InductionPoint,"""" as InductionDate,InBoundIMBDigits as InboundIMB,"""" as IMCB,"""" as IMTB " &_
  113. "FROM (InkjetRecords RIGHT JOIN [KitLabels] ON InkjetRecords.KitLabelID = KitLabels.ID) INNER JOIN Kit On Kit.ID = KitLabels.KitID WHERE KitLabels.KitID = ?"
  114. dim rs : set rs = DAL.Query(sql,id)
  115. If rs.EOF then
  116. Err.Raise 1,"FindSnailWorksDetailRecordsByKitId","FindSnailWorksDetailRecordsByKitId was not ound with Id of: " & id
  117. Else
  118. set FindSnailWorksDetailRecordsByKitId = SnailWorksDetailRecordList(rs)
  119. Destroy rs
  120. End If
  121. End Function
  122. Private Function SnailWorksDetailRecordList(rs)
  123. dim list : set list = new LinkedList_Class
  124. dim model
  125. Do until rs.EOF
  126. set model = new SnailWorksExportDetailModel_Class
  127. list.Push Automapper.AutoMap(rs, model)
  128. rs.MoveNext
  129. Loop
  130. set SnailWorksDetailRecordList = list
  131. End Function
  132. End Class
  133. dim SnailWorksRepository__Singleton
  134. Function SnailWorksRepository()
  135. If IsEmpty(SnailWorksRepository__Singleton) then
  136. set SnailWorksRepository__Singleton = new SnailWorksRepository_Class
  137. End If
  138. set SnailWorksRepository = SnailWorksRepository__Singleton
  139. End Function
  140. %>

Powered by TurnKey Linux.