| @@ -40,10 +40,20 @@ Class HomeController | |||||
| End Sub | 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 | End Class | ||||
| MVC.Dispatch | MVC.Dispatch | ||||
| @@ -4,15 +4,29 @@ | |||||
| <% | <% | ||||
| Class KitController | Class KitController | ||||
| Public Model | 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 | Public Sub Index | ||||
| dim page_size : page_size = 10 | 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_num : page_num = Choice(Len(Request.Querystring("page_num")) > 0, Request.Querystring("page_num"), 1) | ||||
| dim page_count, record_count | dim page_count, record_count | ||||
| set Model = new PagedIndex_ViewModel_Class | 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.CurrentPageNumber = page_num | ||||
| Model.PageSize = page_size | Model.PageSize = page_size | ||||
| Model.PageCount = page_count | Model.PageCount = page_count | ||||
| @@ -37,6 +51,17 @@ Class KitController | |||||
| End Sub | 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 | Public Sub Edit | ||||
| dim id : id = Request.QueryString("Id") | dim id : id = Request.QueryString("Id") | ||||
| @@ -21,7 +21,7 @@ dim DAL__Singleton : set DAL__Singleton = Nothing | |||||
| Function DAL() | Function DAL() | ||||
| If DAL__Singleton is Nothing then | If DAL__Singleton is Nothing then | ||||
| set DAL__Singleton = new Database_Class | 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 | End If | ||||
| set DAL = DAL__Singleton | set DAL = DAL__Singleton | ||||
| @@ -207,13 +207,14 @@ Class KitLabelsRepository_Class | |||||
| NewKitLabel.OutboundIMBDigits ="00716" & MailingID & NewKitLabel.OutboundSerial & "000000000" | NewKitLabel.OutboundIMBDigits ="00716" & MailingID & NewKitLabel.OutboundSerial & "000000000" | ||||
| NewKitLabel.InBoundIMBDigits = "00778" & MailingID & NewKitLabel.InBoundSerial & right(Jurisdiction.IMB_Digits,9) | 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) | dim imbJson : imbJson = rest.FullRequestNoBody("get","/ppro-tools-api/imb/encode?imb=" & NewKitLabel.OutboundIMBDigits) | ||||
| json.loadJSON(imbJson) | 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") | NewKitLabel.OutboundIMBPNG = json.Data("imbImage") | ||||
| imbJson = rest.FullRequestNoBody("get","/ppro-tools-api/imb/encode?imb=" & NewKitLabel.InBoundIMBDigits ) | imbJson = rest.FullRequestNoBody("get","/ppro-tools-api/imb/encode?imb=" & NewKitLabel.InBoundIMBDigits ) | ||||
| json.loadJSON(imbJson) | 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") | NewKitLabel.INBOUNDIMBPNG = json.Data("imbImage") | ||||
| me.AddNew NewKitLabel | me.AddNew NewKitLabel | ||||
| Next | Next | ||||
| @@ -221,7 +222,7 @@ Class KitLabelsRepository_Class | |||||
| DAL.Execute "UPDATE Settings SET [Value] ='" & (Amount * 2) + serialOffset & "' Where [Name] ='SerialOffset'",empty | 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 | End Sub | ||||
| @@ -18,12 +18,78 @@ Class KitModel_Class | |||||
| End 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 | ' Kit Repository | ||||
| '======================================================================================================================= | '======================================================================================================================= | ||||
| Class KitRepository_Class | 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) | Public Function FindByID(ID) | ||||
| dim sql : sql = "Select [ID], [JobNumber], [Jcode] FROM [Kit] WHERE ID = ?" | dim sql : sql = "Select [ID], [JobNumber], [Jcode] FROM [Kit] WHERE ID = ?" | ||||
| dim rs : set rs = DAL.Query(sql,ID) | dim rs : set rs = DAL.Query(sql,ID) | ||||
| @@ -15,6 +15,13 @@ Class Edit_ViewModel_Class | |||||
| End Class | End Class | ||||
| Class SwitchBoard_ViewModel_Class | |||||
| Public Title | |||||
| Public Kit | |||||
| Public Labels | |||||
| End Class | |||||
| Class Create_ViewModel_Class | Class Create_ViewModel_Class | ||||
| Public Title | Public Title | ||||
| Public JobNumber | Public JobNumber | ||||
| @@ -10,7 +10,7 @@ | |||||
| <div class="list-group"> | <div class="list-group"> | ||||
| <a href="#" class="list-group-item list-group-item-action active">Switchboard</a> | <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("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> | </div> | ||||
| </div | </div | ||||
| @@ -2,7 +2,7 @@ | |||||
| <div class="row"> | <div class="row"> | ||||
| <div class="col-md-8 col-sm-8 col-xs-12"> | <div class="col-md-8 col-sm-8 col-xs-12"> | ||||
| <%= H(Model.RecordCount) %> Kit found. Showing <%= H(Model.PageSize) %> records per page. | <%= 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> | ||||
| <div class="col-md-4 col-sm-4 col-xs-12"> | <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">ID</th> | ||||
| <th style="text-align: left">JobNumber</th> | <th style="text-align: left">JobNumber</th> | ||||
| <th style="text-align: left">Jcode</th> | <th style="text-align: left">Jcode</th> | ||||
| <th></th> | |||||
| </tr> | </tr> | ||||
| </thead> | </thead> | ||||
| <tbody> | <tbody> | ||||
| @@ -7,7 +7,7 @@ | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
| <title><%= siteTitle %></title> | <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 --> | <!-- Latest compiled and minified CSS --> | ||||
| <%= HTML.StylesheetTag(appCss) %> | <%= HTML.StylesheetTag(appCss) %> | ||||
| <%= HTML.StylesheetTag(iconsCss) %> | <%= HTML.StylesheetTag(iconsCss) %> | ||||
| @@ -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" | |||||
| %> | |||||
| @@ -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" | |||||
| %> | |||||
| @@ -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" | |||||
| %> | |||||
| @@ -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 | '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. | ' 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 | Migrations.Tracing = false | ||||
| %> | %> | ||||
| @@ -34,6 +34,7 @@ Migrations.Tracing = false | |||||
| <!--#include file="Migration_03_Create_Settings_Table.asp"--> | <!--#include file="Migration_03_Create_Settings_Table.asp"--> | ||||
| <!--#include file="Migration_04_Create_Kit_Table.asp"--> | <!--#include file="Migration_04_Create_Kit_Table.asp"--> | ||||
| <!--#include file="Migration_05_Create_Kit_Labels_Table.asp"--> | <!--#include file="Migration_05_Create_Kit_Labels_Table.asp"--> | ||||
| <!--#include file="Migration_06_Alter_Kit_Tabl.asp"--> | |||||
| <% | <% | ||||
| Sub HandleMigration | Sub HandleMigration | ||||
| putl "<b>Starting Version: " & Migrations.Version & "</b>" | putl "<b>Starting Version: " & Migrations.Version & "</b>" | ||||
| @@ -7,4 +7,7 @@ | |||||
| </files> | </files> | ||||
| </defaultDocument> | </defaultDocument> | ||||
| </system.webServer> | </system.webServer> | ||||
| <system.web> | |||||
| <identity impersonate="true" /> | |||||
| </system.web> | |||||
| </configuration> | </configuration> | ||||
Powered by TurnKey Linux.