From 3f7b85ac2ba4312afd0b0fcf73f1803067117e55 Mon Sep 17 00:00:00 2001 From: ja Date: Mon, 10 Jan 2022 13:57:12 +0100 Subject: [PATCH] Umschreiben nach Vorschrift JSON Dokumentation --- Customers/LKWs.aspx | 77 +++++++++++++++++++++++------------------- Customers/LKWs.aspx.vb | 64 +++++++++++++---------------------- 2 files changed, 67 insertions(+), 74 deletions(-) diff --git a/Customers/LKWs.aspx b/Customers/LKWs.aspx index 9cd3306..59ef1b0 100644 --- a/Customers/LKWs.aspx +++ b/Customers/LKWs.aspx @@ -333,9 +333,9 @@ //addNewRow(SDL,Bez,Datguenstig,KartNr) // Pagemethods.filltable2(<%' =tbl_mainpage %> , SDL, Bez, Datguenstig, KartNr) //} - var data = { - "Kennzeichen": id.split(',')[0] - }; + var data = {}; + data['Kennzeichen'] = id.split(',')[0]; + $.ajax({ @@ -343,23 +343,28 @@ url: "LKWs.aspx/filltable2", contentType: "application/json; charset=utf-8", dataType: "json", + async: true, data: JSON.stringify(data), - success: function (result) { - OnSuccess(result.d); + success: function (data) { + result = data.d; + // addheader(); + let strHTML = 'SDL-NrBezeichnungGueltig bisKarten Nummer'; + alert('Horray! 200 status code!'); + // alert(result.rows.length) + $(result).each(function () { + let row = $(this)[0]; + strHTML += '' + row["SDL"] + '' + row["Bez"] + '' + row["Gueltigbis"] + '' + row["KartNr"] + ''; + + alert(row) + $('#<%=tbl_mainpage.ClientID%>').innerHTML = strHTML; + }); }, error: function (jqXHR, textStatus, 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 = $('' + result.rows[i].SDL + '' + result.rows[i].Bez + '' + result.rows[i].DateGueltig + '' + result.rows[i].KartNr + ''); - alert(row) - } - } + //filltable2(id.split(',')[0]) } function doPostBack_M(id_M) { @@ -367,7 +372,7 @@ let natplaceholder = document.getElementById('<%=lbl_Placeholder_M.ClientID%>'); alert(id_M) let table_M = document.getElementById('<%=tbl_mainpage_M.ClientID%>'); - var rowCount = table_M.rows.length; + let rowCount = table_M.rows.length; for (let i = rowCount - 1; i > 0; i--) { table_M.deleteRow(i); @@ -385,32 +390,36 @@ //addNewRow(SDL,Bez,Datguenstig,KartNr) // Pagemethods.filltable2(<%' =tbl_mainpage_M%> , SDL, Bez, Datguenstig, KartNr) //} - var data = { - "Kennzeichen": id_M.split(',')[0] - }; + var data_m = {}; + data_m['Kennzeichen'] = id.split(',')[0]; $.ajax({ type: "POST", url: "LKWs.aspx/filltable2_M", contentType: "application/json; charset=utf-8", dataType: "json", - data: JSON.stringify(data), - success: function (result) { - OnSuccess_M(result.d); - }, - error: function (jqXHR, textStatus, errorThrown) { - alert("Status:" + jqXHR.status + "\nStatusText: " + textStatus + "\nError:" + errorThrown); - } + data: JSON.stringify(data_m), + async: true, + success: function (data_m) { + result = data_m.d; + // addheader(); + let strHTML = ' SDL-Nr Bezeichnung Gueltig bisKarten Nummer'; + alert('Horray! 200 status code!'); + + $(result).each(function () { + let row = $(this)[0]; + strHTML += '' + row["SDL"] + '' + row["Bez"] + '' + row["Gueltigbis"] + '' + row["KartNr"] + ''; + + alert(row) + $('#<%=tbl_mainpage_M.ClientID%>').innerHTML = strHTML; + }); + }, + error: function (jqXHR, textStatus, errorThrown) { + alert("Status:" + jqXHR.status + "\nStatusText: " + textStatus + "\nError:" + errorThrown); + } + }); - function OnSuccess_M(result_M) { - addheader_M(); - alert('Horray! 200 status code!'); - alert(result_M.rows.length) - for (let i = 0; i < result_M.rows.length; i++) { - let row = $('' + result_M.rows[i].SDL + '' + result_M.rows[i].Bez + '' + result_M.rows[i].DateGueltig + '' + result_M.rows[i].KartNr + ''); - alert(row) - } - } + //filltable2(id.split(',')[0]) } diff --git a/Customers/LKWs.aspx.vb b/Customers/LKWs.aspx.vb index 955ccc1..c3a3125 100644 --- a/Customers/LKWs.aspx.vb +++ b/Customers/LKWs.aspx.vb @@ -400,54 +400,38 @@ Partial Class LKWS - Public Shared Function filltable2(Kennzeichen As String) As Table - Dim tbl As Table = New Table - tbl.EnableViewState = True + Public Shared Function filltable2(Kennzeichen As String) As 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(401940, Kennzeichen) For Each l2 In list2 - Dim tc_SDLNr As TableCell = New TableCell - Dim tc_Bezeichnung As TableCell = New TableCell - Dim tc_GueltigBis As TableCell = New TableCell - Dim tc_KartNr As TableCell = New TableCell - Dim tr As TableRow = New TableRow - - tc_SDLNr.Text = l2.SDLNr.ToString - tc_Bezeichnung.Text = l2.Kategorie.ToString - tc_GueltigBis.Text = l2.GültigBis.ToString - tc_KartNr.Text = l2.KartenNr.ToString - tr.Cells.Add(tc_SDLNr) - tr.Cells.Add(tc_Bezeichnung) - tr.Cells.Add(tc_GueltigBis) - tr.Cells.Add(tc_KartNr) - tr.Attributes.Add("style", "background-color:#ff2500;color:#fff;font-weight:400;") - tbl.Rows.Add(tr) + Dim Entrytemp As New Entry + 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 - Return tbl + Return list End Function + Public Class Entry + 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 - Public Shared Function filltable2_M(Kennzeichen As String) As Table + Public Shared Function filltable2_M(Kennzeichen As String) As 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(401940, Kennzeichen) - Dim Tbl As New Table - Tbl.EnableViewState = True For Each l2 In list2 - Dim tc_SDLNr As TableCell = New TableCell - Dim tc_Bezeichnung As TableCell = New TableCell - Dim tc_GueltigBis As TableCell = New TableCell - Dim tc_KartNr As TableCell = New TableCell - Dim tr_M As TableRow = New TableRow - - tc_SDLNr.Text = l2.SDLNr.ToString - tc_Bezeichnung.Text = l2.Kategorie.ToString - tc_GueltigBis.Text = l2.GültigBis.ToString - tc_KartNr.Text = l2.KartenNr.ToString - tr_M.Cells.Add(tc_SDLNr) - tr_M.Cells.Add(tc_Bezeichnung) - tr_M.Cells.Add(tc_GueltigBis) - tr_M.Cells.Add(tc_KartNr) - tr_M.Attributes.Add("style", "background-color:#ff2500;color:#fff;font-weight:400;") - Tbl.Rows.Add(tr_M) + Dim Entrytemp As New Entry + 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 - Return Tbl + Return list End Function End Class