Umschreiben nach Vorschrift JSON Dokumentation

This commit is contained in:
ja
2022-01-10 13:57:12 +01:00
parent d750ae4a19
commit 949721800d
2 changed files with 78 additions and 53 deletions

View File

@@ -423,41 +423,61 @@
//addNewRow(SDL,Bez,Datguenstig,KartNr) //addNewRow(SDL,Bez,Datguenstig,KartNr)
// Pagemethods.filltable2(<%' =tbl_mainpage %> , SDL, Bez, Datguenstig, KartNr) // Pagemethods.filltable2(<%' =tbl_mainpage %> , SDL, Bez, Datguenstig, KartNr)
//} //}
var data = { var data = {};
"Kennzeichen": id.split(',')[0] data['Kennzeichen'] = id.split(',')[0];
};
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "LKWs.aspx/filltable2", url: "LKWs.aspx/filltable2",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
dataType: "json", dataType: "json",
async: "false",
data: JSON.stringify(data), data: JSON.stringify(data),
success: function (result) { success: function (data) {
result = data.d;
// addheader();
let strHTML = '<tr><th><td>SDL-Nr</td></th><th><td>Bezeichnung</td></th><th><td>Gueltig bis</td></th><th><td>Karten Nummer</td></th></tr>';
alert('Horray! 200 status code!'); alert('Horray! 200 status code!');
alert(result.d) // alert(result.rows.length)
renderTable(result.d) $(result).each(function () {
let row = $(this)[0];
strHTML += '<tr><td>' + row["SDL"] + '</td><td>' + row["Bez"] + '</td><td>' + row["Gueltigbis"] + '</td><td>' + row["KartNr"] + '</td></tr>';
alert(row)
$('#<%=tbl_mainpage.ClientID%>').innerHTML = strHTML;
});
}, },
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
alert("Status:" + jqXHR.status + "\nStatusText: " + textStatus + "\nError:" + errorThrown); alert("Status:" + jqXHR.status + "\nStatusText: " + textStatus + "\nError:" + errorThrown);
} }
}); });
function OnSuccess(result) {
addheader();
alert('Horray! 200 status code!');
alert(result.rows.length)
for (let i = 0; i < result.rows.length; i++) {
let row = $('<tr><td>' + result.rows[i].SDL + '</td><td>' + result.rows[i].Bez + '</td><td>' + result.rows[i].DateGueltig + '</td><td>' + result.rows[i].KartNr + '</td></tr>');
alert(row)
}
}
//filltable2(id.split(',')[0]) //filltable2(id.split(',')[0])
} }
function doPostBack_M(id_M) { function doPostBack_M(id_M) {
let Speditionslabel = document.getElementById('<%=lbl_sped_Placeholder_M.ClientID%>'); let Speditionslabel = document.getElementById('<%=lbl_sped_Placeholder_M.ClientID%>');
let natplaceholder = document.getElementById('<%=lbl_Placeholder_M.ClientID%>'); let natplaceholder = document.getElementById('<%=lbl_Placeholder_M.ClientID%>');
alert(id_M) alert(id_M)
let table_M = document.getElementById('<%=tablemain_m.ClientID%>'); let table_M = document.getElementById('<%=tbl_mainpage_M.ClientID%>');
let rowCount = table_M.rows.length; let rowCount = table_M.rows.length;
for (let i = rowCount - 1; i > 0; i--) { for (let i = rowCount - 1; i > 0; i--) {
table_M.deleteRow(i); table_M.deleteRow(i);
} }
Speditionslabel.textContent = id_M.split(',')[0]; Speditionslabel.textContent = id_M.split(',')[0];
natplaceholder.textContent = id_M.split(',')[1]; natplaceholder.textContent = id_M.split(',')[1];
//debugger
//for (let i = 0; i <= 5; i++) { //for (let i = 0; i <= 5; i++) {
// let SDL = "453543535434334543"; // let SDL = "453543535434334543";
// let Bez = "Diesel"; // let Bez = "Diesel";
@@ -466,28 +486,36 @@
//addNewRow(SDL,Bez,Datguenstig,KartNr) //addNewRow(SDL,Bez,Datguenstig,KartNr)
// Pagemethods.filltable2(<%' =tbl_mainpage_M%> , SDL, Bez, Datguenstig, KartNr) // Pagemethods.filltable2(<%' =tbl_mainpage_M%> , SDL, Bez, Datguenstig, KartNr)
//} //}
var data = { var data_m = {};
"Kennzeichen": id_M.split(',')[0] data_m['Kennzeichen'] = id.split(',')[0];
};
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "LKWs.aspx/filltable2_M", url: "LKWs.aspx/filltable2_M",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
dataType: "json", dataType: "json",
async: "false", data: JSON.stringify(data_m),
data: JSON.stringify(data), async: true,
success: function (data) { success: function (data_m) {
result = data_m.d;
// addheader();
let strHTML = '<tr><th><td> SDL-Nr </td></th><th><td> Bezeichnung </td></th><th><td> Gueltig bis</td></th><th><td>Karten Nummer</td></th></tr>';
alert('Horray! 200 status code!'); alert('Horray! 200 status code!');
alert(data.d)
renderTable_M(data.d); $(result).each(function () {
let row = $(this)[0];
strHTML += '<tr><td>' + row["SDL"] + '</td><td>' + row["Bez"] + '</td><td>' + row["Gueltigbis"] + '</td><td>' + row["KartNr"] + '</td></tr>';
alert(row)
$('#<%=tbl_mainpage_M.ClientID%>').innerHTML = strHTML;
});
}, },
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
alert("Status:" + jqXHR.status + "\nStatusText: " + textStatus + "\nError:" + errorThrown); alert("Status:" + jqXHR.status + "\nStatusText: " + textStatus + "\nError:" + errorThrown);
} }
}); });
//filltable2(id.split(',')[0]) //filltable2(id.split(',')[0])
} }

View File

@@ -459,43 +459,40 @@ Partial Class LKWS
End Sub End Sub
End Class End Class
<WebMethod(BufferResponse:=False, CacheDuration:=120, Description:="Funktion zum zurückgeben einer Tabelle", EnableSession:=False, TransactionOption:=EnterpriseServices.TransactionOption.NotSupported)> <WebMethod>
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=False)> <ScriptMethod(ResponseFormat:=ResponseFormat.Json)>
Public Shared Function filltable2(Kennzeichen As String) As List(Of Entry) Public Shared Function filltable2(Kennzeichen As String) As List(Of Entry)
Dim strtemp2 As String = Kennzeichen.Remove(Kennzeichen.Length - 1, 1)
Dim strtemp3 As String = strtemp2.Remove(0, 1)
MsgBox(Kdnrtext + vbCr + strtemp3)
Dim list As List(Of Entry) = New List(Of Entry) Dim list As List(Of Entry) = New List(Of Entry)
Dim list2 As List(Of VERAG_PROG_ALLGEMEIN.cSDL) = VERAG_PROG_ALLGEMEIN.cSDL.GET_LIST_WEB_LKW(Integer.Parse(Kdnrtext), Kennzeichen) Dim list2 As List(Of VERAG_PROG_ALLGEMEIN.cSDL) = VERAG_PROG_ALLGEMEIN.cSDL.GET_LIST_WEB_LKW(401940, Kennzeichen)
If list2.Count > 0 Then
For Each l2 In list2 For Each l2 In list2
Dim entr As Entry = New Entry(l2.SDLNr.ToString, l2.Kategorie.ToString, l2.GültigBis.ToString, l2.KartenNr.ToString) Dim Entrytemp As New Entry
list.Add(entr) Entrytemp.SDL = l2.SDLNr.ToString
Entrytemp.Bez = l2.Kategorie.ToString
Entrytemp.GueltigBis = l2.GültigBis.ToString
Entrytemp.Kartnr = l2.KartenNr.ToString
list.Add(Entrytemp)
Next Next
ElseIf list2.Count = 0 Then
Dim container As New Entry("Keine", "gültigen", "Daten", "gefunden!")
list.Add(container)
End If
Return list Return list
End Function End Function
Public Class Entry
<WebMethod(BufferResponse:=False, CacheDuration:=120, Description:="Funktion zum zurückgeben einer Tabelle", EnableSession:=False, TransactionOption:=EnterpriseServices.TransactionOption.NotSupported)> Public SDL As String = String.Empty
Public Bez As String = String.Empty
Public Gueltigbis As String = String.Empty
Public KartNr As String = String.Empty
End Class
<WebMethod>
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=False)> <ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=False)>
Public Shared Function filltable2_M(Kennzeichen As String) As List(Of Entry) Public Shared Function filltable2_M(Kennzeichen As String) As List(Of Entry)
Dim strtemp2 As String = Kennzeichen.Remove(Kennzeichen.Length - 1, 1)
Dim strtemp3 As String = strtemp2.Remove(0, 1)
MsgBox(Kdnrtext + vbCr + strtemp3)
Dim list As List(Of Entry) = New List(Of Entry) Dim list As List(Of Entry) = New List(Of Entry)
Dim list2 As List(Of VERAG_PROG_ALLGEMEIN.cSDL) = VERAG_PROG_ALLGEMEIN.cSDL.GET_LIST_WEB_LKW(Integer.Parse(Kdnrtext), Kennzeichen) Dim list2 As List(Of VERAG_PROG_ALLGEMEIN.cSDL) = VERAG_PROG_ALLGEMEIN.cSDL.GET_LIST_WEB_LKW(401940, Kennzeichen)
If list2.Count > 0 Then
For Each l2 In list2 For Each l2 In list2
Dim entr As Entry = New Entry(l2.SDLNr.ToString, l2.Kategorie.ToString, l2.GültigBis.ToString, l2.KartenNr.ToString) Dim Entrytemp As New Entry
list.Add(entr) Entrytemp.SDL = l2.SDLNr.ToString
Entrytemp.Bez = l2.Kategorie.ToString
Entrytemp.Gueltigbis = l2.GültigBis.ToString
Entrytemp.KartNr = l2.KartenNr.ToString
list.Add(Entrytemp)
Next Next
ElseIf list2.Count = 0 Then
Dim container As New Entry("Keine", "gültigen", "Daten", "gefunden!")
list.Add(container)
End If
Return list Return list
End Function End Function
End Class End Class