#11 removed uneeded code and updated kit edit to resolve errors

已合併
dcovington 1 天之前 將 1 次代碼提交從 LabelRecordsRemoveFrom合併至 master
  1. +43
    -1
      App/Controllers/Kit/KitController.asp
  2. +0
    -94
      App/Views/Kit/SwitchBoardPurpleEnvelopeEdit.asp

+ 43
- 1
App/Controllers/Kit/KitController.asp 查看文件

@@ -97,7 +97,6 @@ Class KitController
dim id : id = Request.QueryString("Id") dim id : id = Request.QueryString("Id")
set Model = new SwitchBoard_ViewModel_Class set Model = new SwitchBoard_ViewModel_Class
set Model.Kit = KitRepository.SwitchBoardPurpleEnvelopeEditFindById(id) set Model.Kit = KitRepository.SwitchBoardPurpleEnvelopeEditFindById(id)
set Model.Labels = InkjetRecordsRepository.Find(Array("KitId =?",id),empty)
set Model.StidDropDown = SettingsRepository.GetStidDropDownRS() set Model.StidDropDown = SettingsRepository.GetStidDropDownRS()
set Model.ColorsDropDown = ColorsRepository.GetColorsDropDownRS() set Model.ColorsDropDown = ColorsRepository.GetColorsDropDownRS()
set Model.Precincts = InkjetRecordsRepository.GetDistinctPrecinctsByKitId(id) set Model.Precincts = InkjetRecordsRepository.GetDistinctPrecinctsByKitId(id)
@@ -280,8 +279,51 @@ Class KitController
MVC.RequirePost MVC.RequirePost
HTMLSecurity.OnInvalidAntiCsrfTokenRedirectToActionExt "KitEditForm", Request.Form("nonce"), "Edit", Array("Id", Request.Form("Id")) HTMLSecurity.OnInvalidAntiCsrfTokenRedirectToActionExt "KitEditForm", Request.Form("nonce"), "Edit", Array("Id", Request.Form("Id"))
dim ID : ID = Request.Form("Id") dim ID : ID = Request.Form("Id")
dim originalModel : set originalModel = KitRepository.FindByID(ID)
dim model : set model = KitRepository.FindByID(ID) dim model : set model = KitRepository.FindByID(ID)
set model = Automapper.AutoMap(Request.Form, model) set model = Automapper.AutoMap(Request.Form, model)

' Handle date fields - if empty string, preserve original value or set to Null
If Len(Trim(model.CreatedOn & "")) = 0 Then
model.CreatedOn = originalModel.CreatedOn
End If
If Len(Trim(model.LabelsPrinted & "")) = 0 Then
model.LabelsPrinted = Null
End If
If Len(Trim(model.ExportedToSnailWorks & "")) = 0 Then
model.ExportedToSnailWorks = Null
End If

' Handle boolean/numeric fields - convert "True"/"False" strings to proper numeric values
If UCase(Trim(model.InkJetJob & "")) = "TRUE" Then
model.InkJetJob = -1
ElseIf UCase(Trim(model.InkJetJob & "")) = "FALSE" Then
model.InkJetJob = 0
ElseIf Len(Trim(model.InkJetJob & "")) = 0 Then
model.InkJetJob = 0
End If

If UCase(Trim(model.Cass & "")) = "TRUE" Then
model.Cass = -1
ElseIf UCase(Trim(model.Cass & "")) = "FALSE" Then
model.Cass = 0
ElseIf Len(Trim(model.Cass & "")) = 0 Then
model.Cass = 0
End If

' Handle numeric fields - if empty string, set to 0 or Null
If Len(Trim(model.OfficeCopiesAmount & "")) = 0 Then
model.OfficeCopiesAmount = 0
End If

' Handle STID fields - if empty string, set to Null
If Len(Trim(model.OutboundSTID & "")) = 0 Then
model.OutboundSTID = Null
End If
If Len(Trim(model.InboundSTID & "")) = 0 Then
model.InboundSTID = Null
End If

'model.Validate 'model.Validate
'If model.Validator.HasErrors then 'If model.Validator.HasErrors then
FormCache.SerializeForm "EditKit", Request.Form FormCache.SerializeForm "EditKit", Request.Form


+ 0
- 94
App/Views/Kit/SwitchBoardPurpleEnvelopeEdit.asp 查看文件

@@ -99,99 +99,5 @@
<% ELSE %> <% ELSE %>
<p><strong>Office Copies Amount :</strong> <%= Model.Kit.OfficeCopiesAmount %></p> <p><strong>Office Copies Amount :</strong> <%= Model.Kit.OfficeCopiesAmount %></p>
<% END IF %> <% END IF %>
<button class="btn btn-primary" id="toggleChild">Show Label Records</button>
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-4">
<table id="KitLabels" class="table table-striped child-records" style="display:none">
<thead>
<tr>
<th></th>
<th style="text-align: left">ID</th>
<th style="text-align: left">KitID</th>
<th style="text-align: left">KitLabelID</th>
<th style="text-align: left">VOTERID</th>
<th style="text-align: left">LASTNAME</th>
<th style="text-align: left">FIRSTNAME</th>
<th style="text-align: left">MIDDLENAME</th>
<th style="text-align: left">SUFFIX</th>
<th style="text-align: left">PRECINCT</th>
<th style="text-align: left">ADDRESS1</th>
<th style="text-align: left">ADDRESS2</th>
<th style="text-align: left">ADDRESS3</th>
<th style="text-align: left">ADDRESS4</th>
<th style="text-align: left">ADDRESS5</th>
<th style="text-align: left">APPSENT</th>
<th style="text-align: left">APPRETURNED</th>
<th style="text-align: left">BALSENT</th>
<th style="text-align: left">BALRETURNED</th>
<th style="text-align: left">CountingBoard</th>
<th style="text-align: left">UOCAVASTATUS</th>
<th style="text-align: left">EMAILADDRESS</th>
<th style="text-align: left">PHONENUMBER</th>
<th style="text-align: left">BALLOT_NUMBER</th>
<th style="text-align: left">CassADDRESS1</th>
<th style="text-align: left">CassADDRESS2</th>
<th style="text-align: left">CassADDRESS3</th>
<th style="text-align: left">CassADDRESS4</th>
<th style="text-align: left">CassADDRESS5</th>
<th></th>
</tr>
</thead>
<tbody>
<% dim it : set it = Model.Labels.Iterator %>
<% dim KitLabels %>
<% While it.HasNext %>
<% set KitLabels = it.GetNext() %>
<tr>
<td>
<%= HTML.LinkToExt("<i class='bi bi-search'></i>", "InkjetRecords", "Edit", Array("Id", KitLabels.ID), Array("class", "btn btn-primary")) %>
</td>
<td><% = H(KitLabels.ID) %></td>
<td><% = H(KitLabels.KitId) %></td>
<td><% = H(KitLabels.KitLabelID) %></td>
<td><% = H(KitLabels.VOTERID) %></td>
<td><% = H(KitLabels.LASTNAME) %></td>
<td><% = H(KitLabels.FIRSTNAME) %></td>
<td><% = H(KitLabels.MIDDLENAME) %></td>
<td><% = H(KitLabels.SUFFIX) %></td>
<td><% = H(KitLabels.PRECINCT) %></td>
<td><% = H(KitLabels.ADDRESS1) %></td>
<td><% = H(KitLabels.ADDRESS2) %></td>
<td><% = H(KitLabels.ADDRESS3) %></td>
<td><% = H(KitLabels.ADDRESS4) %></td>
<td><% = H(KitLabels.ADDRESS5) %></td>
<td><% = H(KitLabels.APPSENT) %></td>
<td><% = H(KitLabels.APPRETURNED) %></td>
<td><% = H(KitLabels.BALSENT) %></td>
<td><% = H(KitLabels.BALRETURNED) %></td>
<td><% = H(KitLabels.CountingBoard) %></td>
<td><% = H(KitLabels.UOCAVASTATUS) %></td>
<td><% = H(KitLabels.EMAILADDRESS) %></td>
<td><% = H(KitLabels.PHONENUMBER) %></td>
<td><% = H(KitLabels.BALLOT_NUMBER) %></td>
<td><% = H(KitLabels.CassADDRESS1) %></td>
<td><% = H(KitLabels.CassADDRESS2) %></td>
<td><% = H(KitLabels.CassADDRESS3) %></td>
<td><% = H(KitLabels.CassADDRESS4) %></td>
<td><% = H(KitLabels.CassADDRESS5) %></td>

</tr>
<% Wend %>
</tbody>
</table>
</div>
</div>
<script>
document.getElementById('toggleChild').addEventListener('click', function() {
var childRecords = document.querySelector('.child-records');
if (childRecords.style.display === 'none') {
childRecords.style.display = 'block';
this.textContent = 'Hide Label Records';
} else {
childRecords.style.display = 'none';
this.textContent = 'Show Label Records';
}
});
</script>

Loading…
取消
儲存

Powered by TurnKey Linux.