浏览代码

This is really working now

pull/1/head
Daniel Covington 7 个月前
父节点
当前提交
39f132a76a
共有 14 个文件被更改,包括 128 次插入67 次删除
  1. +14
    -4
      App/Controllers/Home/HomeController.asp
  2. +27
    -2
      App/Controllers/Kit/KitController.asp
  3. +1
    -1
      App/DAL/lib.DAL.asp
  4. +5
    -4
      App/DomainModels/KitLabelsRepository.asp
  5. +66
    -0
      App/DomainModels/KitRepository.asp
  6. +7
    -0
      App/ViewModels/KitViewModels.asp
  7. +1
    -1
      App/Views/Home/Index.asp
  8. +1
    -2
      App/Views/Kit/index.asp
  9. +1
    -1
      App/Views/Shared/layout.header.asp
  10. +0
    -15
      Data/Migrations/Example_01_Create_Example_Table.asp
  11. +0
    -18
      Data/Migrations/Example_02_Insert_Records_To_Example_Table.asp
  12. +0
    -18
      Data/Migrations/Example_03_Insert_More_Records_To_Example_Table.asp
  13. +2
    -1
      Data/Migrations/migrate.asp
  14. +3
    -0
      web.config

+ 14
- 4
App/Controllers/Home/HomeController.asp 查看文件

@@ -40,10 +40,20 @@ Class HomeController

End Sub

Public Sub PostCreateKit
End Sub

Public Sub Print
Dim objAccess, objDB, objReport, objPrinter
' Create an instance of Access application
Set objAccess = Server.CreateObject("Access.Application")
set objDB = objAccess.OpenCurrentDatabase("F:\Development\Tracking_Kits\Data\webdata - Copy.mdb",0)
set objDB = objAccess.DoCmd.OpenReport ("rptKitLables" ,0)
objAccess.DoCmd.Close 3
'Set objReport = objDB.DoCmd.OpenReport("KitLabels", 0) ' 2 represents acViewPreview
'objAccess.DoCmd.OutputTo 3,"rptKitLables",acFormatPDF, Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\test1.pdf",0
objAccess.Quit
Set objAccess = Nothing
End Sub
End Class

MVC.Dispatch

+ 27
- 2
App/Controllers/Kit/KitController.asp 查看文件

@@ -4,15 +4,29 @@
<%
Class KitController
Public Model
Public Sub SwitchBoardIndex

dim page_size : page_size = 10
dim page_num : page_num = Choice(Len(Request.Querystring("page_num")) > 0, Request.Querystring("page_num"), 1)
dim page_count, record_count
set Model = new PagedIndex_ViewModel_Class
Model.Title = "Tracking Kits"
set Model.Kit = KitRepository.PagedIndexView(page_size, page_num, page_count, record_count)
Model.CurrentPageNumber = page_num
Model.PageSize = page_size
Model.PageCount = page_count
Model.RecordCount = record_count
%> <!--#include file="../../Views/Kit/SwitchBoardIndex.asp"--> <%

End Sub
Public Sub Index

dim page_size : page_size = 10
dim page_num : page_num = Choice(Len(Request.Querystring("page_num")) > 0, Request.Querystring("page_num"), 1)
dim page_count, record_count
set Model = new PagedIndex_ViewModel_Class
Model.Title = "Kit"
set Model.Kit = KitRepository.FindPaged(empty, "ID", page_size, page_num, page_count, record_count)
Model.Title = "Tracking Kits"
set Model.Kit = KitRepository.FindPaged(empty, "ID", page_size, page_num, page_count, record_count)
Model.CurrentPageNumber = page_num
Model.PageSize = page_size
Model.PageCount = page_count
@@ -37,6 +51,17 @@ Class KitController

End Sub

Public Sub SwitchBoardEdit
dim id : id = Request.QueryString("Id")
set Model = new SwitchBoard_ViewModel_Class
set Model.Kit = KitRepository.SwitchBoardEditFindById(id)
set Model.Labels = KitLabelsRepository.Find(Array("KitId =?",id),empty)
Model.Title = "Kit for "
HTMLSecurity.SetAntiCSRFToken "KitEditForm"
%> <!--#include file="../../Views/Kit/SwitchBoardEdit.asp"--> <%
End Sub

Public Sub Edit

dim id : id = Request.QueryString("Id")


+ 1
- 1
App/DAL/lib.DAL.asp 查看文件

@@ -21,7 +21,7 @@ dim DAL__Singleton : set DAL__Singleton = Nothing
Function DAL()
If DAL__Singleton is Nothing then
set DAL__Singleton = new Database_Class
DAL__Singleton.Initialize "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\webdata.mdb;"
DAL__Singleton.Initialize "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\webdata - Copy.mdb;"

End If
set DAL = DAL__Singleton


+ 5
- 4
App/DomainModels/KitLabelsRepository.asp 查看文件

@@ -207,13 +207,14 @@ Class KitLabelsRepository_Class
NewKitLabel.OutboundIMBDigits ="00716" & MailingID & NewKitLabel.OutboundSerial & "000000000"
NewKitLabel.InBoundIMBDigits = "00778" & MailingID & NewKitLabel.InBoundSerial & right(Jurisdiction.IMB_Digits,9)
dim imbJson : imbJson = rest.FullRequestNoBody("get","/ppro-tools-api/imb/encode?imb=" & NewKitLabel.OutboundIMBDigits)
json.loadJSON(imbJson)
'dim ugh : set ugh = json.loadJSON(rest.FullRequestNoBody("get","/ppro-tools-api/imb/encode?imb=" & NewKitLabel.OutboundIMBDigits))
NewKitLabel.OutboundIMB = json.Data("imb") 'left(rest.FullRequestNoBody("get","/ppro-tools-api/imb/encode?imb=" & "000000000"),250)
NewKitLabel.OutboundIMB = json.Data("imb")
NewKitLabel.OutboundIMBPNG = json.Data("imbImage")
imbJson = rest.FullRequestNoBody("get","/ppro-tools-api/imb/encode?imb=" & NewKitLabel.InBoundIMBDigits )
json.loadJSON(imbJson)
NewKitLabel.InBoundIMB = json.Data("imb") 'left(rest.FullRequestNoBody("get","/ppro-tools-api/imb/encode?imb=" & NewKitLabel.InBoundIMBDigits),250)
NewKitLabel.InBoundIMB = json.Data("imb")
NewKitLabel.INBOUNDIMBPNG = json.Data("imbImage")
me.AddNew NewKitLabel
Next
@@ -221,7 +222,7 @@ Class KitLabelsRepository_Class
DAL.Execute "UPDATE Settings SET [Value] ='" & (Amount * 2) + serialOffset & "' Where [Name] ='SerialOffset'",empty

'https://postalpro.usps.com/ppro-tools-api/imb/encode?imb=00778202248200000081493019915
End Sub


+ 66
- 0
App/DomainModels/KitRepository.asp 查看文件

@@ -18,12 +18,78 @@ Class KitModel_Class

End CLass

Class IndexKitModel_Class
Public Validator
Public Class_Get_Properties

Public ID
Public JobNumber '90
Public Jurisdiction '106
Public LabelCount '106
Public CreatedOn
Public LabelsPrinted
Public ExportedToSnailWorks

Private Sub Class_Initialize
'ValidateExitsts Me, "",""
Class_Get_Properties = Array("ID, JobNumber, Jurisdiction,LabelCount,CreatedOn,LabelsPrinted,ExportedToSnailWorks")
End Sub
End Class


'=======================================================================================================================
' Kit Repository
'=======================================================================================================================

Class KitRepository_Class

Public Function PagedIndexView(per_page, page_num, ByRef page_count, ByRef record_count)
dim sql : sql = "SELECT Kit.ID,Kit.JobNumber as [JobNumber], " &_
"Jurisdiction.Name As Jurisdiction," &_
"(SELECT COUNT(*) From KitLabels Where KitId = Kit.ID)" &_
" As [LabelCount],[CreatedOn],[LabelsPrinted],[ExportedToSnailWorks] FROM Kit INNER JOIN Jurisdiction ON Kit.Jcode = Jurisdiction.JCode;"

dim list : set list = new LinkedList_Class
dim rs : set rs = DAL.PagedQuery(sql, empty, per_page, page_num)
If Not rs.EOF and Not (IsEmpty(per_page) and IsEmpty(page_num) and IsEmpty(page_count) and IsEmpty(record_count)) then
rs.PageSize = per_page
rs.AbsolutePage = page_num
page_count = rs.PageCount
record_count = rs.RecordCount
End If
set PagedIndexView = PagedIndexViewKitList(rs, per_page)
Destroy rs
End Function

Private Function PagedIndexViewKitList(rs, per_page)
dim list : set list = new LinkedList_Class

dim x : x =0
Do While x < per_page and Not rs.EOF
list.Push Automapper.AutoMap(rs, new IndexKitModel_Class)
x = x +1
rs.MoveNext
Loop
set PagedIndexViewKitList = list
End Function
Public Function SwitchBoardEditFindById(ID)
dim sql : sql = "SELECT Kit.ID,Kit.JobNumber as [JobNumber], " &_
"Jurisdiction.Name As Jurisdiction," &_
"(SELECT COUNT(*) From KitLabels Where KitId = Kit.ID)" &_
" As [LabelCount],[CreatedOn],[LabelsPrinted],[ExportedToSnailWorks] FROM Kit INNER JOIN Jurisdiction ON Kit.Jcode = Jurisdiction.JCode " &_
"WHERE ID = ?"

dim rs : set rs = DAL.Query(sql,ID)
If rs.EOF then
Err.Raise 1, "KitRepository_Class", KitNotFoundException("ID", ID)
Else
set SwitchBoardEditFindByID = Automapper.AutoMap(rs,"IndexKitModel_Class")
End If


End Function

Public Function FindByID(ID)
dim sql : sql = "Select [ID], [JobNumber], [Jcode] FROM [Kit] WHERE ID = ?"
dim rs : set rs = DAL.Query(sql,ID)


+ 7
- 0
App/ViewModels/KitViewModels.asp 查看文件

@@ -15,6 +15,13 @@ Class Edit_ViewModel_Class

End Class

Class SwitchBoard_ViewModel_Class
Public Title
Public Kit
Public Labels
End Class


Class Create_ViewModel_Class
Public Title
Public JobNumber


+ 1
- 1
App/Views/Home/Index.asp 查看文件

@@ -10,7 +10,7 @@
<div class="list-group">
<a href="#" class="list-group-item list-group-item-action active">Switchboard</a>
<%= Html.LinkTOExt("Create Kit","Home","CreateKit",empty,Array("Class","list-group-item list-group-item-action")) %>
<%= Html.LinkTOExt("View Current Kits","Home","ViewKits",empty,Array("Class","list-group-item list-group-item-action")) %>
<%= Html.LinkTOExt("View Current Kits","Kit","SwitchBoardIndex",empty,Array("Class","list-group-item list-group-item-action")) %>
</div>
</div>
</div


+ 1
- 2
App/Views/Kit/index.asp 查看文件

@@ -2,7 +2,7 @@
<div class="row">
<div class="col-md-8 col-sm-8 col-xs-12">
<%= H(Model.RecordCount) %> Kit found. Showing <%= H(Model.PageSize) %> records per page.
<%= HTML.LinkToExt("<i class='bi bi-plus-square-fill'></i> New","Kit", "Create", empty, Array("class", "btn btn-xs btn-primary")) %>
<%'= HTML.LinkToExt("<i class='bi bi-plus-square-fill'></i> New","Kit", "Create", empty, Array("class", "btn btn-xs btn-primary")) %>
</div>
<div class="col-md-4 col-sm-4 col-xs-12">

@@ -27,7 +27,6 @@
<th style="text-align: left">ID</th>
<th style="text-align: left">JobNumber</th>
<th style="text-align: left">Jcode</th>
<th></th>
</tr>
</thead>
<tbody>


+ 1
- 1
App/Views/Shared/layout.header.asp 查看文件

@@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">

<title><%= siteTitle %></title>
<link rel="icon" href="/dist/images/DALL·E 2024-04-03 09.33.12 - Design a sleek and modern website icon that embodies digital innovation and connectivity. The icon should feature abstract geometric shapes, such as c (1).ico" type="image/x-icon">
<!-- Latest compiled and minified CSS -->
<%= HTML.StylesheetTag(appCss) %>
<%= HTML.StylesheetTag(iconsCss) %>


+ 0
- 15
Data/Migrations/Example_01_Create_Example_Table.asp 查看文件

@@ -1,15 +0,0 @@
<%
Class Example_01_Create_Example_Table
Public Migration

Public Sub Up
Migration.Do "create table Example_Table (id int not null, name varchar(100) not null)"
End Sub
Public Sub Down
Migration.Do "drop table Example_Table"
End Sub
End Class

Migrations.Add "Example_01_Create_Example_Table"
%>

+ 0
- 18
Data/Migrations/Example_02_Insert_Records_To_Example_Table.asp 查看文件

@@ -1,18 +0,0 @@
<%
Class Example_02_Insert_Records_To_Example_Table
Public Migration

Public Sub Up
dim i
For i = 1 to 100
Migration.Do "INSERT INTO Example_Table (id, name) VALUES (" & i & ", 'Name " & i & "');"
Next
End Sub
Public Sub Down
Migration.Do "DELETE FROM Example_Table WHERE id >= 1 and id <= 100"
End Sub
End Class

Migrations.Add "Example_02_Insert_Records_To_Example_Table"
%>

+ 0
- 18
Data/Migrations/Example_03_Insert_More_Records_To_Example_Table.asp 查看文件

@@ -1,18 +0,0 @@
<%
Class Example_03_Insert_More_Records_To_Example_Table
Public Migration

Public Sub Up
dim i
For i = 101 to 200
Migration.Do "INSERT INTO Example_Table (id, name) VALUES (" & i & ", 'ANOTHER Name " & i & "');"
Next
End Sub
Public Sub Down
Migration.Do "DELETE FROM Example_Table WHERE id >= 101 and id <= 200"
End Sub
End Class

Migrations.Add "Example_03_Insert_More_Records_To_Example_Table"
%>

+ 2
- 1
Data/Migrations/migrate.asp 查看文件

@@ -24,7 +24,7 @@ End Sub
'TODO: This can be refactored by not having the individual migration files auto-add themselves, but then this file must manually add each one using a slightly dIfferent
' naming convention, i.e. given include file 01_Create_Users.asp the command would be Migrations.Add "Migration_01_Create_Users" or such. At least this way is automated.

Migrations.Initialize "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\webdata.mdb;"
Migrations.Initialize "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\webdata - Copy.mdb;"

Migrations.Tracing = false
%>
@@ -34,6 +34,7 @@ Migrations.Tracing = false
<!--#include file="Migration_03_Create_Settings_Table.asp"-->
<!--#include file="Migration_04_Create_Kit_Table.asp"-->
<!--#include file="Migration_05_Create_Kit_Labels_Table.asp"-->
<!--#include file="Migration_06_Alter_Kit_Tabl.asp"-->
<%
Sub HandleMigration
putl "<b>Starting Version: " & Migrations.Version & "</b>"


+ 3
- 0
web.config 查看文件

@@ -7,4 +7,7 @@
</files>
</defaultDocument>
</system.webServer>
<system.web>
<identity impersonate="true" />
</system.web>
</configuration>

正在加载...
取消
保存

Powered by TurnKey Linux.