diff --git a/App/Controllers/Home/HomeController.asp b/App/Controllers/Home/HomeController.asp index 60e2c96..3030697 100644 --- a/App/Controllers/Home/HomeController.asp +++ b/App/Controllers/Home/HomeController.asp @@ -20,7 +20,7 @@ Class HomeController Model.PageSize = page_size Model.PageCount = page_count Model.RecordCount = record_count - %> <% + %> <% End Sub Public Sub Search diff --git a/App/Controllers/Kit/KitController.asp b/App/Controllers/Kit/KitController.asp index 59c95b3..d497ccd 100644 --- a/App/Controllers/Kit/KitController.asp +++ b/App/Controllers/Kit/KitController.asp @@ -143,7 +143,27 @@ Class KitController MVC.RedirectToAction "Index" 'End If End Sub + Public Sub CreateTrackingKit + dim form_params : set form_params = FormCache.DeserializeForm("NewKit") + + dim ID : ID = Request.QueryString("Id") + dim model : set model = new Create_ViewModel_Class + model.Title = "Create Kit " + model.JCode = ID + dim ugh : set ugh = JurisdictionRepository.Find(Array("[JCode] = ?",ID),empty) + set model.Jurisdiction = ugh.pop() + + 'If Not form_params Is Nothing then + ' set Model = Automapper.AutoMap(form_params, New Create_ViewModel_Class) + 'Else + ' set Model = new Create_ViewModel_Class + 'End If + + HTMLSecurity.SetAntiCSRFToken "KitCreateForm" + + %> <% + End Sub Public Sub Create dim form_params : set form_params = FormCache.DeserializeForm("NewKit") @@ -189,6 +209,29 @@ Class KitController 'End If End Sub + Public Sub CreateTrackingKitPost + + MVC.RequirePost + HtmlSecurity.OnInvalidAntiCSRFTokenRedirectToAction "KitCreateForm", Request.Form("nonce"), "Create" + + dim new_Kit_model : set new_Kit_model = Automapper.AutoMap(Request.Form, new KitModel_Class) + + 'new_Kit_model.Validator.Validate + + 'If new_Kit_model.Validator.HasErrors then + ' FormCache.SerializeForm "NewKit", Request.Form + ' Flash.Errors = new_Kit_model.Validator.Errors + ' MVC.RedirectToAction "Create" + 'Else + + KitRepository.AddNew new_Kit_model + KitLabelsRepository.BulkAdd new_Kit_model.ID,Request.Form("Amount") + ' FormCache.ClearForm "NewKit" + Flash.Success = "Kit added." + MVC.RedirectToAction "Index" + 'End If + End Sub + Public Sub Delete dim id : id = Request.QueryString("Id") set Model = new Delete_ViewModel_Class diff --git a/App/DomainModels/KitRepository.asp b/App/DomainModels/KitRepository.asp index c660f9e..96b64f9 100644 --- a/App/DomainModels/KitRepository.asp +++ b/App/DomainModels/KitRepository.asp @@ -10,10 +10,20 @@ Class KitModel_Class Public ID '90 Public JobNumber '106 Public Jcode '106 + Public CreatedOn '122 + Public LabelsPrinted '122 + Public ExportedToSnailWorks '122 + Public InkJetJob '90 + Public JobType '106 + Public Filename '106 + Public Cass '90 + Public Status '106 + Public OutboundSTID '106 + Public InboundSTID '106 Private Sub Class_Initialize 'ValidateExitsts Me, "","" - Class_Get_Properties = Array("ID, JobNumber, Jcode") + Class_Get_Properties = Array("ID, JobNumber, Jcode, CreatedOn, LabelsPrinted, ExportedToSnailWorks, InkJetJob, JobType, Filename, Cass, Status, OutboundSTID, InboundSTID") End Sub End CLass @@ -138,7 +148,7 @@ Class KitRepository_Class Public Function FindByID(ID) - dim sql : sql = "Select [ID], [JobNumber], [Jcode] FROM [Kit] WHERE ID = ?" + dim sql : sql = "Select [ID], [JobNumber], [Jcode], [CreatedOn], [LabelsPrinted], [ExportedToSnailWorks], [InkJetJob], [JobType], [Filename], [Cass], [Status], [OutboundSTID], [InboundSTID] FROM [Kit] WHERE ID = ?" dim rs : set rs = DAL.Query(sql,ID) If rs.EOF then Err.Raise 1, "KitRepository_Class", KitNotFoundException("ID", ID) @@ -152,7 +162,7 @@ Class KitRepository_Class End Function Public Function Find(where_kvarray, order_string_or_array) - dim sql : sql = "Select [ID], [JobNumber], [Jcode] FROM [Kit]" + dim sql : sql = "Select [ID], [JobNumber], [Jcode], [CreatedOn], [LabelsPrinted], [ExportedToSnailWorks], [InkJetJob], [JobType], [Filename], [Cass], [Status], [OutboundSTID], [InboundSTID] FROM [Kit]" If Not IsEmpty(where_kvarray) then sql = sql & " WHERE " @@ -185,7 +195,7 @@ Class KitRepository_Class End Function Public Function FindPaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) - dim sql : sql = "Select [ID], [JobNumber], [Jcode] FROM [Kit]" + dim sql : sql = "Select [ID], [JobNumber], [Jcode], [CreatedOn], [LabelsPrinted], [ExportedToSnailWorks], [InkJetJob], [JobType], [Filename], [Cass], [Status], [OutboundSTID], [InboundSTID] FROM [Kit]" If Not IsEmpty(where_kvarray) then sql = sql & " WHERE " @@ -227,7 +237,7 @@ Class KitRepository_Class End Function Public Function SearchTablePaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) - dim sql : sql = "Select [ID], [JobNumber], [Jcode] FROM [Kit]" + dim sql : sql = "Select [ID], [JobNumber], [Jcode], [CreatedOn], [LabelsPrinted], [ExportedToSnailWorks], [InkJetJob], [JobType], [Filename], [Cass], [Status], [OutboundSTID], [InboundSTID] FROM [Kit]" If Not IsEmpty(where_kvarray) then sql = sql & " WHERE " @@ -305,15 +315,21 @@ Class KitRepository_Class "VALUES (?,?,?,?)" DAL.Execute sql, Array(model.JobNumber, _ model.Jcode,Now(),"Labels") - sql = "SELECT TOP 1 ID FROM [Kit] ORDER BY ID DESC" + sql = "SELECT TOP 1 ID FROM [Kit] ORDER BY ID DESC" dim rs : set rs = DAL.Query(sql, empty) model.ID = rs("ID") Destroy rs End Sub - - Public Sub Update(model) +Public Sub Update(model) dim sql : sql = "UPDATE [Kit] SET [JobNumber] = ?," &_ "[Jcode] = ?," &_ + "[CreatedOn] = ?," &_ + "[LabelsPrinted] = ?," &_ + "[ExportedToSnailWorks] = ?," &_ + "[InkJetJob] = ?," &_ + "[JobType] = ?," &_ + "[Filename] = ?," &_ + "[Cass] = ?," &_ "[Status] = ?," &_ "[OutboundSTID] = ?," &_ "[InboundSTID] = ?" &_ @@ -321,6 +337,13 @@ Class KitRepository_Class DAL.Execute sql, Array(model.JobNumber, _ model.Jcode, _ + model.CreatedOn, _ + model.LabelsPrinted, _ + model.ExportedToSnailWorks, _ + model.InkJetJob, _ + model.JobType, _ + model.Filename, _ + model.Cass, _ model.Status, _ model.OutboundSTID, _ model.InboundSTID, _ diff --git a/App/Views/Home/createTrackingKit.asp b/App/Views/Home/createTrackingKit.asp new file mode 100644 index 0000000..96b1cef --- /dev/null +++ b/App/Views/Home/createTrackingKit.asp @@ -0,0 +1,73 @@ +
JCode | +Name | +Mailing_Address | +CSZ | ++ |
---|---|---|---|---|
<% = H(Jurisdiction.JCode) %> | +<% = H(Jurisdiction.Name) %> | +<% = H(Jurisdiction.Mailing_Address) %> | +<% = H(Jurisdiction.CSZ) %> | ++ <%= HTML.LinkToExt("", "Kit", "createTrackingKit", Array("Id", Jurisdiction.JCode), Array("class", "btn btn-primary")) %> + | +