diff --git a/App/Controllers/Kit/KitController.asp b/App/Controllers/Kit/KitController.asp index af2e14e..59c95b3 100644 --- a/App/Controllers/Kit/KitController.asp +++ b/App/Controllers/Kit/KitController.asp @@ -33,6 +33,31 @@ Class KitController Model.RecordCount = record_count %> <% End Sub + + Public Sub SwitchBoardPurpleEnvelopeEditPost + MVC.RequirePost + HTMLSecurity.OnInvalidAntiCsrfTokenRedirectToActionExt "KitEditForm", Request.Form("nonce"), "Edit", Array("Id", Request.Form("Id")) + dim ID : ID = Request.Form("Id") + dim model : set model = KitRepository.SwitchBoardPurpleEnvelopeEditFindById(ID) + set model = Automapper.AutoMap(Request.Form, model) + if Request.Form("InBoundTracking") = "on" Then + model.InboundSTID = SettingsRepository.FindByName("Inbound STID") + end if + + + model.Status = "Ready to Assign Labels" + 'model.Validate + 'If model.Validator.HasErrors then + FormCache.SerializeForm "EditKit", Request.Form + ' Flash.Errors = model.Validator.Errors + ' MVC.RedirectToActionExt "Edit", Array("Id",ID) + 'Else + KitRepository.Update model + FormCache.ClearForm "EditKit" + Flash.Success = "Kit updated." + MVC.RedirectToAction "Index" + 'End If + End Sub Public Sub SwitchBoardPurpleEnvelopeEdit @@ -40,6 +65,7 @@ Class KitController set Model = new SwitchBoard_ViewModel_Class set Model.Kit = KitRepository.SwitchBoardPurpleEnvelopeEditFindById(id) set Model.Labels = InkjetRecordsRepository.Find(Array("KitId =?",id),empty) + set Model.StidDropDown = SettingsRepository.GetStidDropDownRS() Model.Title = "Purple Envelopes for " HTMLSecurity.SetAntiCSRFToken "KitEditForm" %> <% diff --git a/App/DomainModels/KitRepository.asp b/App/DomainModels/KitRepository.asp index 138b04d..c660f9e 100644 --- a/App/DomainModels/KitRepository.asp +++ b/App/DomainModels/KitRepository.asp @@ -24,6 +24,7 @@ Class IndexKitModel_Class Public ID Public JobNumber '90 + Public Jcode Public Jurisdiction '106 Public LabelCount '106 Public CreatedOn @@ -34,10 +35,12 @@ Class IndexKitModel_Class Public Filename Public Cass Public Status + Public OutboundSTID + Public InboundSTID Private Sub Class_Initialize 'ValidateExitsts Me, "","" - Class_Get_Properties = Array("ID, JobNumber, Jurisdiction,LabelCount,CreatedOn,LabelsPrinted,ExportedToSnailWorks,InkJetJob,JobType,Filename,Cass,Status") + Class_Get_Properties = Array("ID, JobNumber,Jcode, Jurisdiction,LabelCount,CreatedOn,LabelsPrinted,ExportedToSnailWorks,InkJetJob,JobType,Filename,Cass,Status,OutboundSTID,InboundSTID") End Sub End Class @@ -49,10 +52,10 @@ End Class Class KitRepository_Class Public Function PagedPurpleEnvelopsIndexView(per_page, page_num, ByRef page_count, ByRef record_count) - dim sql : sql = "SELECT Kit.ID,Kit.JobNumber as [JobNumber], " &_ + dim sql : sql = "SELECT Kit.ID,Kit.JobNumber as [JobNumber],Kit.JCode, " &_ "Jurisdiction.Name As Jurisdiction," &_ "(SELECT COUNT(*) From InkjetRecords Where KitId = Kit.ID)" &_ - " As [LabelCount],[CreatedOn],[LabelsPrinted],[ExportedToSnailWorks],[InkJetJob],[JobType],[Filename],[Cass],[Status] FROM Kit INNER JOIN Jurisdiction ON Kit.Jcode = Jurisdiction.JCode Where Kit.JobType = 'Purple Envelopes';" + " As [LabelCount],[CreatedOn],[LabelsPrinted],[ExportedToSnailWorks],[InkJetJob],[JobType],[Filename],[Cass],[Status],[OutboundSTID],[InboundSTID] FROM Kit INNER JOIN Jurisdiction ON Kit.Jcode = Jurisdiction.JCode Where Kit.JobType = 'Purple Envelopes';" dim list : set list = new LinkedList_Class dim rs : set rs = DAL.PagedQuery(sql, empty, per_page, page_num) @@ -103,7 +106,7 @@ Class KitRepository_Class 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],[JobType] FROM Kit INNER JOIN Jurisdiction ON Kit.Jcode = Jurisdiction.JCode " &_ + " As [LabelCount],[CreatedOn],[LabelsPrinted],[ExportedToSnailWorks],[JobType],[Status] FROM Kit INNER JOIN Jurisdiction ON Kit.Jcode = Jurisdiction.JCode " &_ "WHERE ID = ? AND Kit.JobType = 'Labels'" dim rs : set rs = DAL.Query(sql,ID) @@ -117,10 +120,10 @@ Class KitRepository_Class End Function Public Function SwitchBoardPurpleEnvelopeEditFindById(ID) - dim sql : sql = "SELECT Kit.ID,Kit.JobNumber as [JobNumber], " &_ + dim sql : sql = "SELECT Kit.ID,Kit.JobNumber as [JobNumber],Kit.JCode, " &_ "Jurisdiction.Name As Jurisdiction," &_ "(SELECT COUNT(*) From InkjetRecords Where KitID = Kit.ID)" &_ - " As [LabelCount],[CreatedOn],[LabelsPrinted],[ExportedToSnailWorks],[JobType] FROM Kit INNER JOIN Jurisdiction ON Kit.Jcode = Jurisdiction.JCode " &_ + " As [LabelCount],[CreatedOn],[LabelsPrinted],[ExportedToSnailWorks],[JobType],[Status],[OutboundSTID],[InboundSTID] FROM Kit INNER JOIN Jurisdiction ON Kit.Jcode = Jurisdiction.JCode " &_ "WHERE ID = ? " dim rs : set rs = DAL.Query(sql,ID) @@ -310,11 +313,17 @@ Class KitRepository_Class Public Sub Update(model) dim sql : sql = "UPDATE [Kit] SET [JobNumber] = ?," &_ - "[Jcode] = ?" &_ + "[Jcode] = ?," &_ + "[Status] = ?," &_ + "[OutboundSTID] = ?," &_ + "[InboundSTID] = ?" &_ " WHERE [ID] = ?" DAL.Execute sql, Array(model.JobNumber, _ model.Jcode, _ + model.Status, _ + model.OutboundSTID, _ + model.InboundSTID, _ model.ID) End Sub diff --git a/App/DomainModels/SettingsRepository.asp b/App/DomainModels/SettingsRepository.asp index f078251..5e4bb6c 100644 --- a/App/DomainModels/SettingsRepository.asp +++ b/App/DomainModels/SettingsRepository.asp @@ -24,6 +24,13 @@ End CLass Class SettingsRepository_Class + Public Function GetStidDropDownRS() + dim sql : sql = "Select RIGHT([Name],LEN(NAME)-6) & ' ' & [STID] as [OPTION] ,[Value] AS [STID] from Settings WHERE [Name] LIKE '(STID)%'" + dim rs : set rs = DAL.Query(sql,empty) + set GetStidDropDownRS = rs + + End Function + Public Function FindByID(ID) dim sql : sql = "Select [ID], [Name], [Value] FROM [Settings] WHERE ID = ?" dim rs : set rs = DAL.Query(sql,ID) @@ -34,6 +41,17 @@ Class SettingsRepository_Class End If End Function + Public Function FindByName(Name) + dim sql : sql = "Select [Value] FROM [Settings] WHERE [Name] = ?" + dim rs : set rs = DAL.Query(sql,Name) + If rs.EOF then + Err.Raise 1, "SettingsRepository_Class", SettingsNotFoundException("Name", Name) + Else + FindByName = rs(0).Value + End If + End Function + + Public Function GetAll(orderBy) set GetAll = Find(empty,orderBy) End Function diff --git a/App/ViewModels/KitViewModels.asp b/App/ViewModels/KitViewModels.asp index c6634fd..45d92c5 100644 --- a/App/ViewModels/KitViewModels.asp +++ b/App/ViewModels/KitViewModels.asp @@ -19,6 +19,7 @@ Class SwitchBoard_ViewModel_Class Public Title Public Kit Public Labels + Public StidDropDown End Class Class SwitchBoard_PurpleEnvelopesViewModel_Class diff --git a/App/Views/Kit/SwitchBoardPurpleEnvelopeEdit.asp b/App/Views/Kit/SwitchBoardPurpleEnvelopeEdit.asp index afac87c..8d16d8e 100644 --- a/App/Views/Kit/SwitchBoardPurpleEnvelopeEdit.asp +++ b/App/Views/Kit/SwitchBoardPurpleEnvelopeEdit.asp @@ -9,6 +9,19 @@

Created On: <%= Model.Kit.CreatedOn %>

Labels Printed On : <%= Model.Kit.LabelsPrinted %>

Exported to SnailWorks On: <%= Model.Kit.ExportedToSnailWorks %>

+ <% IF Model.Kit.Status = "Ready To Assign STIDS" THEN %> +

Select Outbound STID:

+ <%= HTML.FormTag("Kit","SwitchBoardPurpleEnvelopeEditPost",empty,empty) %> + <%= HTML.Hidden("nonce", HTMLSecurity.GetAntiCSRFToken("KitEditForm")) %> + <%= HTML.Hidden("Id", Model.Kit.ID) %> + <%= HTML.DropDownListExt("OutboundSTID","hmm",Model.StidDropDown,"STID","OPTION",Array("Class","form-select")) %> +

+ <%= HTML.Checkbox("InBoundTracking",0) %> Inbound Tracking +

+ <%= HTML.Button("submit", " Save", "btn-primary") %> + +

+ <% END IF %> diff --git a/App/Views/Kit/SwitchBoardPurpleEnvelopeIndex.asp b/App/Views/Kit/SwitchBoardPurpleEnvelopeIndex.asp index 38b2afb..1547e41 100644 --- a/App/Views/Kit/SwitchBoardPurpleEnvelopeIndex.asp +++ b/App/Views/Kit/SwitchBoardPurpleEnvelopeIndex.asp @@ -33,6 +33,8 @@ Import File Has Been Cassed Status + Outbound STID + Inbound STID @@ -53,6 +55,8 @@ <% = H(Kit.Filename) %> <% = H(Kit.Cass) %> <% = H(Kit.Status) %> + <% = H(Kit.OutboundSTID) %> + <% = H(Kit.InboundSTID) %> <% Wend %> diff --git a/Data/Migrations/migrate.asp b/Data/Migrations/migrate.asp index 680d744..69d0a5e 100644 --- a/Data/Migrations/migrate.asp +++ b/Data/Migrations/migrate.asp @@ -42,6 +42,7 @@ Migrations.Tracing = false + <% Sub HandleMigration putl "Starting Version: " & Migrations.Version & "" diff --git a/ImportService/TrackingDataImport.vbs b/ImportService/TrackingDataImport.vbs index 942cc73..43a47d2 100644 --- a/ImportService/TrackingDataImport.vbs +++ b/ImportService/TrackingDataImport.vbs @@ -173,6 +173,7 @@ Sub ImportCass Next oConn.Execute("UPDATE Kit SET Status ='Ready To Assign STIDS' WHERE ID =" & KitID & ";") + oConn.Execute("UPDATE Kit SET [Cass] = 1 WHERE ID =" & KitID & ";") End Sub Sub RunMailManager