Bläddra i källkod

More cleanup of views and controllers

pull/8/head
Daniel Covington 6 månader sedan
förälder
incheckning
7951df5715
8 ändrade filer med 362 tillägg och 10 borttagningar
  1. +1
    -1
      App/Controllers/Home/HomeController.asp
  2. +43
    -0
      App/Controllers/Kit/KitController.asp
  3. +31
    -8
      App/DomainModels/KitRepository.asp
  4. +73
    -0
      App/Views/Home/createTrackingKit.asp
  5. +32
    -0
      App/Views/Kit/createTrackingKit.asp
  6. +80
    -0
      App/Views/Kit/delete.asp
  7. +80
    -0
      App/Views/Kit/edit.asp
  8. +22
    -1
      App/Views/Kit/index.asp

+ 1
- 1
App/Controllers/Home/HomeController.asp Visa fil

@@ -20,7 +20,7 @@ Class HomeController
Model.PageSize = page_size Model.PageSize = page_size
Model.PageCount = page_count Model.PageCount = page_count
Model.RecordCount = record_count Model.RecordCount = record_count
%> <!--#include file="../../Views/Home/CreateKit.asp"--> <%
%> <!--#include file="../../Views/Home/CreateTrackingKit.asp"--> <%
End Sub End Sub


Public Sub Search Public Sub Search


+ 43
- 0
App/Controllers/Kit/KitController.asp Visa fil

@@ -143,7 +143,27 @@ Class KitController
MVC.RedirectToAction "Index" MVC.RedirectToAction "Index"
'End If 'End If
End Sub 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"

%> <!--#include file="../../Views/Kit/CreateTrackingKit.asp"--> <%
End Sub
Public Sub Create Public Sub Create


dim form_params : set form_params = FormCache.DeserializeForm("NewKit") dim form_params : set form_params = FormCache.DeserializeForm("NewKit")
@@ -189,6 +209,29 @@ Class KitController
'End If 'End If
End Sub 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 Public Sub Delete
dim id : id = Request.QueryString("Id") dim id : id = Request.QueryString("Id")
set Model = new Delete_ViewModel_Class set Model = new Delete_ViewModel_Class


+ 31
- 8
App/DomainModels/KitRepository.asp Visa fil

@@ -10,10 +10,20 @@ Class KitModel_Class
Public ID '90 Public ID '90
Public JobNumber '106 Public JobNumber '106
Public Jcode '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 Private Sub Class_Initialize
'ValidateExitsts Me, "","" '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 Sub


End CLass End CLass
@@ -138,7 +148,7 @@ Class KitRepository_Class




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], [CreatedOn], [LabelsPrinted], [ExportedToSnailWorks], [InkJetJob], [JobType], [Filename], [Cass], [Status], [OutboundSTID], [InboundSTID] FROM [Kit] WHERE ID = ?"
dim rs : set rs = DAL.Query(sql,ID) dim rs : set rs = DAL.Query(sql,ID)
If rs.EOF then If rs.EOF then
Err.Raise 1, "KitRepository_Class", KitNotFoundException("ID", ID) Err.Raise 1, "KitRepository_Class", KitNotFoundException("ID", ID)
@@ -152,7 +162,7 @@ Class KitRepository_Class
End Function End Function


Public Function Find(where_kvarray, order_string_or_array) 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 If Not IsEmpty(where_kvarray) then
sql = sql & " WHERE " sql = sql & " WHERE "
@@ -185,7 +195,7 @@ Class KitRepository_Class
End Function End Function


Public Function FindPaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) 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 If Not IsEmpty(where_kvarray) then
sql = sql & " WHERE " sql = sql & " WHERE "
@@ -227,7 +237,7 @@ Class KitRepository_Class
End Function End Function


Public Function SearchTablePaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) 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 If Not IsEmpty(where_kvarray) then
sql = sql & " WHERE " sql = sql & " WHERE "
@@ -305,15 +315,21 @@ Class KitRepository_Class
"VALUES (?,?,?,?)" "VALUES (?,?,?,?)"
DAL.Execute sql, Array(model.JobNumber, _ DAL.Execute sql, Array(model.JobNumber, _
model.Jcode,Now(),"Labels") 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) dim rs : set rs = DAL.Query(sql, empty)
model.ID = rs("ID") model.ID = rs("ID")
Destroy rs Destroy rs
End Sub End Sub

Public Sub Update(model)
Public Sub Update(model)
dim sql : sql = "UPDATE [Kit] SET [JobNumber] = ?," &_ dim sql : sql = "UPDATE [Kit] SET [JobNumber] = ?," &_
"[Jcode] = ?," &_ "[Jcode] = ?," &_
"[CreatedOn] = ?," &_
"[LabelsPrinted] = ?," &_
"[ExportedToSnailWorks] = ?," &_
"[InkJetJob] = ?," &_
"[JobType] = ?," &_
"[Filename] = ?," &_
"[Cass] = ?," &_
"[Status] = ?," &_ "[Status] = ?," &_
"[OutboundSTID] = ?," &_ "[OutboundSTID] = ?," &_
"[InboundSTID] = ?" &_ "[InboundSTID] = ?" &_
@@ -321,6 +337,13 @@ Class KitRepository_Class


DAL.Execute sql, Array(model.JobNumber, _ DAL.Execute sql, Array(model.JobNumber, _
model.Jcode, _ model.Jcode, _
model.CreatedOn, _
model.LabelsPrinted, _
model.ExportedToSnailWorks, _
model.InkJetJob, _
model.JobType, _
model.Filename, _
model.Cass, _
model.Status, _ model.Status, _
model.OutboundSTID, _ model.OutboundSTID, _
model.InboundSTID, _ model.InboundSTID, _


+ 73
- 0
App/Views/Home/createTrackingKit.asp Visa fil

@@ -0,0 +1,73 @@
<h2>Create Kit</h2>
<div class="row">
<div class="col-md-8 col-sm-8 col-xs-12">
<%= H(Model.RecordCount) %> <%= Choice(Model.RecordCount >=2," Jurisdictions"," Jurisdiction") %> found. Showing <%= H(Model.PageSize) %> records per page.
</div>
<div class="col-md-4 col-sm-4 col-xs-12">

<%= HTML.FormTag("Home", "Search", empty, empty) %>

<div class="col-md-10 col-sm-10 col-xs-12">
<label class="sr-only" for="search">Search</label>
<div class="input-group">
<input type="text" class="form-control input-search" value='<%= Choice(Request.Form.Count = 0,Request.QueryString("q"),Request.Form("q")) %>' name="q" id="search" placeholder="Search">
<span class="input-group-addon group-icon"><span class="glyphicon glyphicon-eye-open"></span>
<button type="submit" class="btn btn-success"><i class="bi bi-search"></i>Search</buttton>
</div>
</div>

</form>
</div>
</div>
<table id="Jurisdiction" class="table table-striped">
<thead>
<tr>
<th style="text-align: left">JCode</th>
<th style="text-align: left">Name</th>
<th style="text-align: left">Mailing_Address</th>
<th style="text-align: left">CSZ</th>
<th></th>
</tr>
</thead>
<tbody>
<% dim it : set it = Model.Jurisdiction.Iterator %>
<% dim Jurisdiction %>
<% While it.HasNext %>
<% set Jurisdiction = it.GetNext() %>
<tr>
<td><% = H(Jurisdiction.JCode) %></td>
<td><% = H(Jurisdiction.Name) %></td>
<td><% = H(Jurisdiction.Mailing_Address) %></td>
<td><% = H(Jurisdiction.CSZ) %></td>
<td>
<%= HTML.LinkToExt("<i class='bi bi-play-btn'></i>", "Kit", "createTrackingKit", Array("Id", Jurisdiction.JCode), Array("class", "btn btn-primary")) %>
</td>
</tr>
<% Wend %>
</tbody>
</table>
<div>
<% If Model.CurrentPageNumber <> 1 then %>
<%= HTML.LinkToExt("<i class='bi bi-chevron-left'></i><i class='bi bi-chevron-left'></i>", MVC.ControllerName, MVC.ActionName, Array("page_num", 1,"q", Choice(Request.Form.Count = 0,Request.QueryString("q"),Request.Form("q"))), Array("class", "btn btn-default")) %>
&nbsp;
<%= HTML.LinkToExt("<i class='bi bi-chevron-left'></i>", MVC.ControllerName, MVC.ActionName, Array("page_num", Model.CurrentPageNumber - 1,"q", Choice(Request.Form.Count = 0,Request.QueryString("q"),Request.Form("q"))), Array("class", "btn btn-default")) %>
&nbsp;
<% Else %>
<a class='btn btn-default disabled'><i class='bi bi-chevron-left'></i><i class='bi bi-chevron-left'></i></a>
&nbsp;
<a class='btn btn-default disabled'><i class='bi bi-chevron-left'></i></a>
&nbsp;
<% End If %>
<% If CInt(Model.CurrentPageNumber) < CInt(Model.PageCount) then %>
<%= HTML.LinkToExt("<i class='bi bi-chevron-right'></i>", MVC.ControllerName, MVC.ActionName, Array("page_num", Model.CurrentPageNumber + 1,"q", Choice(Request.Form.Count = 0,Request.QueryString("q"),Request.Form("q"))), Array("class", "btn btn-default")) %>
&nbsp;
<%= HTML.LinkToExt("<i class='bi bi-chevron-right'></i><i class='bi bi-chevron-right'></i>", MVC.ControllerName, MVC.ActionName, Array("page_num", Model.PageCount,"q", Choice(Request.Form.Count = 0,Request.QueryString("q"),Request.Form("q"))), Array("class", "btn btn-default")) %>
&nbsp;
<% Else %>
<a class='btn btn-default disabled'><i class='bi bi-chevron-right'></i><i class='bi bi-chevron-right'></i></a>
&nbsp;
<a class='btn btn-default disabled'><i class='bi bi-chevron-right'></i></a>
&nbsp;
<% End If %>
</div>
</div>

+ 32
- 0
App/Views/Kit/createTrackingKit.asp Visa fil

@@ -0,0 +1,32 @@
<h2><%= H(Model.Title) %> For <%=H(Model.Jurisdiction.Name) %> JCODE: <%= H(Model.JCODE) %> </h2>

<%= HTML.FormTag("Kit", "CreatePost", empty, empty) %>
<%= HTML.Hidden("nonce", HTMLSecurity.GetAntiCSRFToken("KitCreateForm")) %>
<%= HTML.Hidden("Jcode", Model.Jcode) %>
<%= HTML.Hidden("JobType", "Labels") %>
<hr />

<div class="form-group">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="JobNumber">JobNumber</label>
<%= HTML.TextboxExt("JobNumber", Model.JobNumber, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="Amount">Amount of Labels</label>
<%= HTML.TextboxExt("Amount", Model.Amount, Array("class", "form-control")) %>
</div>
</div>
</div>
<p></p>
<%= HTML.Button("submit", "<i class='glyphicon glyphicon-ok'></i> Create", "btn-primary") %>
&nbsp;&nbsp;
<%= HTML.LinkToExt("<i class='glyphicon glyphicon-remove'></i> Cancel", "Kit", "Index", empty, Array("class", "btn btn-default")) %>
</div>

</form>

+ 80
- 0
App/Views/Kit/delete.asp Visa fil

@@ -26,6 +26,86 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="CreatedOn">CreatedOn</label>
<%= HTML.TextboxExt("CreatedOn", Model.Kit.CreatedOn, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="LabelsPrinted">LabelsPrinted</label>
<%= HTML.TextboxExt("LabelsPrinted", Model.Kit.LabelsPrinted, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="ExportedToSnailWorks">ExportedToSnailWorks</label>
<%= HTML.TextboxExt("ExportedToSnailWorks", Model.Kit.ExportedToSnailWorks, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="InkJetJob">InkJetJob</label>
<%= HTML.TextboxExt("InkJetJob", Model.Kit.InkJetJob, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="JobType">JobType</label>
<%= HTML.TextboxExt("JobType", Model.Kit.JobType, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="Filename">Filename</label>
<%= HTML.TextboxExt("Filename", Model.Kit.Filename, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="Cass">Cass</label>
<%= HTML.TextboxExt("Cass", Model.Kit.Cass, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="Status">Status</label>
<%= HTML.TextboxExt("Status", Model.Kit.Status, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="OutboundSTID">OutboundSTID</label>
<%= HTML.TextboxExt("OutboundSTID", Model.Kit.OutboundSTID, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="InboundSTID">InboundSTID</label>
<%= HTML.TextboxExt("InboundSTID", Model.Kit.InboundSTID, Array("class", "form-control")) %>
</div>
</div>
</div>
</div> </div>
</div> </div>
</form> </form>

+ 80
- 0
App/Views/Kit/edit.asp Visa fil

@@ -18,6 +18,86 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="CreatedOn">CreatedOn</label>
<%= HTML.TextboxExt("CreatedOn", Model.Kit.CreatedOn, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="LabelsPrinted">LabelsPrinted</label>
<%= HTML.TextboxExt("LabelsPrinted", Model.Kit.LabelsPrinted, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="ExportedToSnailWorks">ExportedToSnailWorks</label>
<%= HTML.TextboxExt("ExportedToSnailWorks", Model.Kit.ExportedToSnailWorks, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="InkJetJob">InkJetJob</label>
<%= HTML.TextboxExt("InkJetJob", Model.Kit.InkJetJob, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="JobType">JobType</label>
<%= HTML.TextboxExt("JobType", Model.Kit.JobType, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="Filename">Filename</label>
<%= HTML.TextboxExt("Filename", Model.Kit.Filename, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="Cass">Cass</label>
<%= HTML.TextboxExt("Cass", Model.Kit.Cass, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="Status">Status</label>
<%= HTML.TextboxExt("Status", Model.Kit.Status, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="OutboundSTID">OutboundSTID</label>
<%= HTML.TextboxExt("OutboundSTID", Model.Kit.OutboundSTID, Array("class", "form-control")) %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="InboundSTID">InboundSTID</label>
<%= HTML.TextboxExt("InboundSTID", Model.Kit.InboundSTID, Array("class", "form-control")) %>
</div>
</div>
</div>
<hr /> <hr />
<div class="form-group"> <div class="form-group">
<% = HTML.Button("submit", "<i class='glyphicon glyphicon-ok'></i> Save", "btn-primary") %> <% = HTML.Button("submit", "<i class='glyphicon glyphicon-ok'></i> Save", "btn-primary") %>


+ 22
- 1
App/Views/Kit/index.asp Visa fil

@@ -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,6 +27,17 @@
<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 style="text-align: left">CreatedOn</th>
<th style="text-align: left">LabelsPrinted</th>
<th style="text-align: left">ExportedToSnailWorks</th>
<th style="text-align: left">InkJetJob</th>
<th style="text-align: left">JobType</th>
<th style="text-align: left">Filename</th>
<th style="text-align: left">Cass</th>
<th style="text-align: left">Status</th>
<th style="text-align: left">OutboundSTID</th>
<th style="text-align: left">InboundSTID</th>
<th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -41,6 +52,16 @@
<td><% = H(Kit.ID) %></td> <td><% = H(Kit.ID) %></td>
<td><% = H(Kit.JobNumber) %></td> <td><% = H(Kit.JobNumber) %></td>
<td><% = H(Kit.Jcode) %></td> <td><% = H(Kit.Jcode) %></td>
<td><% = H(Kit.CreatedOn) %></td>
<td><% = H(Kit.LabelsPrinted) %></td>
<td><% = H(Kit.ExportedToSnailWorks) %></td>
<td><% = H(Kit.InkJetJob) %></td>
<td><% = H(Kit.JobType) %></td>
<td><% = H(Kit.Filename) %></td>
<td><% = H(Kit.Cass) %></td>
<td><% = H(Kit.Status) %></td>
<td><% = H(Kit.OutboundSTID) %></td>
<td><% = H(Kit.InboundSTID) %></td>
</tr> </tr>
<% Wend %> <% Wend %>
</tbody> </tbody>


Laddar…
Avbryt
Spara

Powered by TurnKey Linux.