Use SSO auth, remove legacy deutschebahn endpoints
parent
6ab3774228
commit
c8f95c7e18
@ -1,214 +0,0 @@
|
||||
// <auto-generated />
|
||||
//
|
||||
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
|
||||
//
|
||||
// using trainav.web.JSON.CardResponse;
|
||||
//
|
||||
// var cardResponse = CardResponse.FromJson(jsonString);
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace trainav.web.JSON.CardResponse {
|
||||
public partial class CardResponse {
|
||||
[JsonProperty("?xml", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Xml Xml { get; set; }
|
||||
|
||||
[JsonProperty("rporderdetails", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Rporderdetails Rporderdetails { get; set; }
|
||||
}
|
||||
|
||||
public class Rporderdetails {
|
||||
[JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Version { get; set; }
|
||||
|
||||
[JsonProperty("rpheader", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Rpheader Rpheader { get; set; }
|
||||
|
||||
[JsonProperty("order", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Order Order { get; set; }
|
||||
}
|
||||
|
||||
public class Order {
|
||||
[JsonProperty("@cdt", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Cdt { get; set; }
|
||||
|
||||
[JsonProperty("@cid", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Cid { get; set; }
|
||||
|
||||
[JsonProperty("@ddt", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Ddt { get; set; }
|
||||
|
||||
[JsonProperty("@fkat", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Fkat { get; set; }
|
||||
|
||||
[JsonProperty("@ldt", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Ldt { get; set; }
|
||||
|
||||
[JsonProperty("@on", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string On { get; set; }
|
||||
|
||||
[JsonProperty("@pg", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Pg { get; set; }
|
||||
|
||||
[JsonProperty("@sdt", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Sdt { get; set; }
|
||||
|
||||
[JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Version { get; set; }
|
||||
|
||||
[JsonProperty("@vfrom", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Vfrom { get; set; }
|
||||
|
||||
[JsonProperty("@vto", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Vto { get; set; }
|
||||
|
||||
[JsonProperty("@zweg", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Zweg { get; set; }
|
||||
|
||||
[JsonProperty("tcklist", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Tcklist Tcklist { get; set; }
|
||||
|
||||
[JsonProperty("posinfolist", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Posinfolist Posinfolist { get; set; }
|
||||
}
|
||||
|
||||
public class Posinfolist {
|
||||
[JsonProperty("posinfo", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Posinfo Posinfo { get; set; }
|
||||
}
|
||||
|
||||
public class Posinfo {
|
||||
[JsonProperty("@dir", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Dir { get; set; }
|
||||
|
||||
[JsonProperty("@dirlabel", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Dirlabel { get; set; }
|
||||
|
||||
[JsonProperty("@posnr", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Posnr { get; set; }
|
||||
|
||||
[JsonProperty("@shownr", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Shownr { get; set; }
|
||||
|
||||
[JsonProperty("@state", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string State { get; set; }
|
||||
|
||||
[JsonProperty("@type", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonProperty("@typeinfo", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Typeinfo { get; set; }
|
||||
|
||||
[JsonProperty("@vfo", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Vfo { get; set; }
|
||||
|
||||
[JsonProperty("@vto", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Vto { get; set; }
|
||||
|
||||
[JsonProperty("childlist")] public object Childlist { get; set; }
|
||||
}
|
||||
|
||||
public class Tcklist {
|
||||
[JsonProperty("tck", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Tck Tck { get; set; }
|
||||
}
|
||||
|
||||
public class Tck {
|
||||
[JsonProperty("@posnr", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Posnr { get; set; }
|
||||
|
||||
[JsonProperty("htdata", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Htdata Htdata { get; set; }
|
||||
|
||||
[JsonProperty("mtk", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Mtk Mtk { get; set; }
|
||||
|
||||
[JsonProperty("bahncardimage", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Bahncardimage Bahncardimage { get; set; }
|
||||
}
|
||||
|
||||
public class Bahncardimage {
|
||||
[JsonProperty("#cdata-section", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string CdataSection { get; set; }
|
||||
}
|
||||
|
||||
public class Htdata {
|
||||
[JsonProperty("ht", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<Ht> Ht { get; set; }
|
||||
}
|
||||
|
||||
public class Ht {
|
||||
[JsonProperty("@name", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("@pos", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Pos { get; set; }
|
||||
|
||||
[JsonProperty("@type", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonProperty("#text", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Text { get; set; }
|
||||
}
|
||||
|
||||
public class Mtk {
|
||||
[JsonProperty("@dir", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Dir { get; set; }
|
||||
|
||||
[JsonProperty("@status", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Status { get; set; }
|
||||
|
||||
[JsonProperty("txt", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Txt { get; set; }
|
||||
|
||||
[JsonProperty("zb", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Zb { get; set; }
|
||||
|
||||
[JsonProperty("nvplist", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Nvplist Nvplist { get; set; }
|
||||
}
|
||||
|
||||
public class Nvplist {
|
||||
[JsonProperty("nvp", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<Nvp> Nvp { get; set; }
|
||||
}
|
||||
|
||||
public class Nvp {
|
||||
[JsonProperty("@name", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("#text", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Text { get; set; }
|
||||
}
|
||||
|
||||
public class Rpheader {
|
||||
[JsonProperty("@tnr", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Tnr { get; set; }
|
||||
|
||||
[JsonProperty("@ts", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Ts { get; set; }
|
||||
}
|
||||
|
||||
public class Xml {
|
||||
[JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Version { get; set; }
|
||||
|
||||
[JsonProperty("@encoding", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Encoding { get; set; }
|
||||
}
|
||||
|
||||
public partial class CardResponse {
|
||||
public static CardResponse FromJson(string json) => JsonConvert.DeserializeObject<CardResponse>(json, Converter.Settings);
|
||||
}
|
||||
|
||||
internal static class Converter {
|
||||
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings {
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
|
||||
DateParseHandling = DateParseHandling.None,
|
||||
Converters = {new IsoDateTimeConverter {DateTimeStyles = DateTimeStyles.AssumeUniversal}}
|
||||
};
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
// <auto-generated />
|
||||
//
|
||||
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
|
||||
//
|
||||
// using trainav.web.JSON;
|
||||
//
|
||||
// var listOrdersResponse = ListOrdersResponse.FromJson(jsonString);
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace trainav.web.JSON.ListOrdersResponse {
|
||||
public partial class ListOrdersResponse {
|
||||
[JsonProperty("?xml", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Xml Xml { get; set; }
|
||||
|
||||
[JsonProperty("rporderheadlist", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Rporderheadlist Rporderheadlist { get; set; }
|
||||
}
|
||||
|
||||
public class Rporderheadlist {
|
||||
[JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Version { get; set; }
|
||||
|
||||
[JsonProperty("rpheader", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Rpheader Rpheader { get; set; }
|
||||
|
||||
[JsonProperty("orderheadlist", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Orderheadlist Orderheadlist { get; set; }
|
||||
}
|
||||
|
||||
public class Orderheadlist {
|
||||
[JsonProperty("orderhead", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public List<Orderhead> Orderhead { get; set; }
|
||||
}
|
||||
|
||||
public class Orderhead {
|
||||
[JsonProperty("@ldt", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Ldt { get; set; }
|
||||
|
||||
[JsonProperty("@on", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string On { get; set; }
|
||||
|
||||
[JsonProperty("authtmp", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public Authtmp Authtmp { get; set; }
|
||||
}
|
||||
|
||||
public class Authtmp {
|
||||
[JsonProperty("@htmp", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Htmp { get; set; }
|
||||
|
||||
[JsonProperty("@ts", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Ts { get; set; }
|
||||
}
|
||||
|
||||
public class Rpheader {
|
||||
[JsonProperty("@tnr", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Tnr { get; set; }
|
||||
|
||||
[JsonProperty("@ts", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Ts { get; set; }
|
||||
}
|
||||
|
||||
public class Xml {
|
||||
[JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Version { get; set; }
|
||||
|
||||
[JsonProperty("@encoding", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Encoding { get; set; }
|
||||
}
|
||||
|
||||
public partial class ListOrdersResponse {
|
||||
public static ListOrdersResponse FromJson(string json) => JsonConvert.DeserializeObject<ListOrdersResponse>(json, Converter.Settings);
|
||||
}
|
||||
}
|
@ -1,434 +0,0 @@
|
||||
// <auto-generated />
|
||||
//
|
||||
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
|
||||
//
|
||||
// using trainav.web.JSON;
|
||||
//
|
||||
// var ticketResponse = TicketResponse.FromJson(jsonString);
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace trainav.web.JSON {
|
||||
using J = JsonPropertyAttribute;
|
||||
using R = Required;
|
||||
using NV = NullValueHandling;
|
||||
|
||||
public partial class TicketResponse {
|
||||
[J("?xml", NullValueHandling = NV.Ignore)]
|
||||
public Xml Xml { get; set; }
|
||||
|
||||
[J("rporderdetails", NullValueHandling = NV.Ignore)]
|
||||
public Rporderdetails Rporderdetails { get; set; }
|
||||
}
|
||||
|
||||
public class Rporderdetails {
|
||||
[J("rpheader", NullValueHandling = NV.Ignore)]
|
||||
public Rpheader Rpheader { get; set; }
|
||||
|
||||
[J("@version", NullValueHandling = NV.Ignore)]
|
||||
public string Version { get; set; }
|
||||
|
||||
[J("order", NullValueHandling = NV.Ignore)]
|
||||
public Order Order { get; set; }
|
||||
}
|
||||
|
||||
public class Order {
|
||||
[J("@cid", NullValueHandling = NV.Ignore)]
|
||||
public string Cid { get; set; }
|
||||
|
||||
[J("@cdt", NullValueHandling = NV.Ignore)]
|
||||
public string Cdt { get; set; }
|
||||
|
||||
[J("schedulelist", NullValueHandling = NV.Ignore)]
|
||||
public Schedulelist Schedulelist { get; set; }
|
||||
|
||||
[J("tcklist", NullValueHandling = NV.Ignore)]
|
||||
public Tcklist Tcklist { get; set; }
|
||||
|
||||
[J("@sdt", NullValueHandling = NV.Ignore)]
|
||||
public string Sdt { get; set; }
|
||||
|
||||
[J("@zweg", NullValueHandling = NV.Ignore)]
|
||||
public string Zweg { get; set; }
|
||||
|
||||
[J("@vto", NullValueHandling = NV.Ignore)]
|
||||
public string Vto { get; set; }
|
||||
|
||||
[J("@vfrom", NullValueHandling = NV.Ignore)]
|
||||
public string Vfrom { get; set; }
|
||||
|
||||
[J("@ldt", NullValueHandling = NV.Ignore)]
|
||||
public string Ldt { get; set; }
|
||||
|
||||
[J("@pg", NullValueHandling = NV.Ignore)]
|
||||
public string Pg { get; set; }
|
||||
|
||||
[J("posinfolist", NullValueHandling = NV.Ignore)]
|
||||
public Posinfolist Posinfolist { get; set; }
|
||||
|
||||
[J("@on", NullValueHandling = NV.Ignore)]
|
||||
public string On { get; set; }
|
||||
|
||||
[J("txt", NullValueHandling = NV.Ignore)]
|
||||
public string Txt { get; set; }
|
||||
|
||||
[J("@hkey", NullValueHandling = NV.Ignore)]
|
||||
public string Hkey { get; set; }
|
||||
|
||||
[J("reslist", NullValueHandling = NV.Ignore)]
|
||||
public Reslist Reslist { get; set; }
|
||||
|
||||
[J("@ddt", NullValueHandling = NV.Ignore)]
|
||||
public string Ddt { get; set; }
|
||||
|
||||
[J("@version", NullValueHandling = NV.Ignore)]
|
||||
public string Version { get; set; }
|
||||
|
||||
[J("@fkat", NullValueHandling = NV.Ignore)]
|
||||
public string Fkat { get; set; }
|
||||
}
|
||||
|
||||
public class Posinfolist {
|
||||
[J("posinfo", NullValueHandling = NV.Ignore), JsonConverter(typeof(SingleOrArrayConverter<PosinfoElement>))]
|
||||
public List<PosinfoElement> Posinfo { get; set; }
|
||||
}
|
||||
|
||||
public class FluffyChildlist {
|
||||
[J("posinfo", NullValueHandling = NV.Ignore), JsonConverter(typeof(SingleOrArrayConverter<PosinfoElement>))]
|
||||
public List<PosinfoElement> Posinfo { get; set; }
|
||||
}
|
||||
|
||||
public class PurplePosinfo {
|
||||
[J("@state", NullValueHandling = NV.Ignore)]
|
||||
public string State { get; set; }
|
||||
|
||||
[J("@dir", NullValueHandling = NV.Ignore)]
|
||||
public string Dir { get; set; }
|
||||
|
||||
[J("@posnr", NullValueHandling = NV.Ignore)]
|
||||
public string Posnr { get; set; }
|
||||
|
||||
[J("@type", NullValueHandling = NV.Ignore)]
|
||||
public string Type { get; set; }
|
||||
|
||||
[J("@shownr", NullValueHandling = NV.Ignore)]
|
||||
public string Shownr { get; set; }
|
||||
|
||||
[J("@dirlabel", NullValueHandling = NV.Ignore)]
|
||||
public string Dirlabel { get; set; }
|
||||
|
||||
[J("@vfo", NullValueHandling = NV.Ignore)]
|
||||
public string Vfo { get; set; }
|
||||
|
||||
[J("@typeinfo", NullValueHandling = NV.Ignore)]
|
||||
public string Typeinfo { get; set; }
|
||||
|
||||
[J("@vto", NullValueHandling = NV.Ignore)]
|
||||
public string Vto { get; set; }
|
||||
|
||||
[J("childlist", NullValueHandling = NV.Ignore)]
|
||||
public FluffyChildlist Childlist { get; set; }
|
||||
}
|
||||
|
||||
public class PurpleChildlist {
|
||||
[J("posinfo", NullValueHandling = NV.Ignore), JsonConverter(typeof(SingleOrArrayConverter<PurplePosinfo>))]
|
||||
public List<PurplePosinfo> Posinfo { get; set; }
|
||||
}
|
||||
|
||||
public class PosinfoElement {
|
||||
[J("@state", NullValueHandling = NV.Ignore)]
|
||||
public string State { get; set; }
|
||||
|
||||
[J("@dir", NullValueHandling = NV.Ignore)]
|
||||
public string Dir { get; set; }
|
||||
|
||||
[J("@posnr", NullValueHandling = NV.Ignore)]
|
||||
public string Posnr { get; set; }
|
||||
|
||||
[J("@type", NullValueHandling = NV.Ignore)]
|
||||
public string Type { get; set; }
|
||||
|
||||
[J("@shownr", NullValueHandling = NV.Ignore)]
|
||||
public string Shownr { get; set; }
|
||||
|
||||
[J("@dirlabel", NullValueHandling = NV.Ignore)]
|
||||
public string Dirlabel { get; set; }
|
||||
|
||||
[J("@vfo", NullValueHandling = NV.Ignore)]
|
||||
public string Vfo { get; set; }
|
||||
|
||||
[J("@typeinfo", NullValueHandling = NV.Ignore)]
|
||||
public string Typeinfo { get; set; }
|
||||
|
||||
[J("@vto", NullValueHandling = NV.Ignore)]
|
||||
public string Vto { get; set; }
|
||||
|
||||
[J("childlist", NullValueHandling = NV.Ignore)]
|
||||
public PurpleChildlist Childlist { get; set; }
|
||||
}
|
||||
|
||||
public class Reslist {
|
||||
[J("res", NullValueHandling = NV.Ignore), JsonConverter(typeof(SingleOrArrayConverter<Re>))]
|
||||
public List<Re> Res { get; set; }
|
||||
}
|
||||
|
||||
public class Re {
|
||||
[J("@tid", NullValueHandling = NV.Ignore)]
|
||||
public string Tid { get; set; }
|
||||
|
||||
[J("@posnr", NullValueHandling = NV.Ignore)]
|
||||
public string Posnr { get; set; }
|
||||
|
||||
[J("@dt", NullValueHandling = NV.Ignore)]
|
||||
public string Dt { get; set; }
|
||||
|
||||
[J("nvplist", NullValueHandling = NV.Ignore)]
|
||||
public Nvplist Nvplist { get; set; }
|
||||
|
||||
[J("@cdt", NullValueHandling = NV.Ignore)]
|
||||
public string Cdt { get; set; }
|
||||
|
||||
[J("plaetze", NullValueHandling = NV.Ignore)]
|
||||
public Plaetze Plaetze { get; set; }
|
||||
|
||||
[J("txt", NullValueHandling = NV.Ignore)]
|
||||
public string Txt { get; set; }
|
||||
|
||||
[J("@tn", NullValueHandling = NV.Ignore)]
|
||||
public string Tn { get; set; }
|
||||
}
|
||||
|
||||
public class Nvplist {
|
||||
[J("nvp", NullValueHandling = NV.Ignore)]
|
||||
public List<Nvp> Nvp { get; set; }
|
||||
}
|
||||
|
||||
public class Nvp {
|
||||
[J("@name", NullValueHandling = NV.Ignore)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[J("#text", NullValueHandling = NV.Ignore)]
|
||||
public string Text { get; set; }
|
||||
}
|
||||
|
||||
public class Plaetze {
|
||||
[J("platz", NullValueHandling = NV.Ignore), JsonConverter(typeof(SingleOrArrayConverter<Platz>))]
|
||||
public List<Platz> Platz { get; set; }
|
||||
}
|
||||
|
||||
public class Platz {
|
||||
[J("platznr", NullValueHandling = NV.Ignore)]
|
||||
public string Platznr { get; set; }
|
||||
|
||||
[J("wagennr", NullValueHandling = NV.Ignore)]
|
||||
public string Wagennr { get; set; }
|
||||
}
|
||||
|
||||
public class Schedulelist {
|
||||
[J("out", NullValueHandling = NV.Ignore)]
|
||||
public Journey Out { get; set; }
|
||||
|
||||
[J("ret", NullValueHandling = NV.Ignore)]
|
||||
public Journey Ret { get; set; }
|
||||
}
|
||||
|
||||
public class Journey {
|
||||
[J("txt", NullValueHandling = NV.Ignore)]
|
||||
public string Txt { get; set; }
|
||||
|
||||
[J("@posnr", NullValueHandling = NV.Ignore)]
|
||||
public string Posnr { get; set; }
|
||||
|
||||
[J("trainlist", NullValueHandling = NV.Ignore)]
|
||||
public Trainlist Trainlist { get; set; }
|
||||
}
|
||||
|
||||
public class Trainlist {
|
||||
[J("train", NullValueHandling = NV.Ignore), JsonConverter(typeof(SingleOrArrayConverter<Train>))]
|
||||
public List<Train> Train { get; set; }
|
||||
}
|
||||
|
||||
public class Train {
|
||||
[J("@tid", NullValueHandling = NV.Ignore)]
|
||||
public string Tid { get; set; }
|
||||
|
||||
[J("@type", NullValueHandling = NV.Ignore)]
|
||||
public string Type { get; set; }
|
||||
|
||||
[J("zugnr", NullValueHandling = NV.Ignore)]
|
||||
public string Zugnummer { get; set; }
|
||||
|
||||
[J("arr", NullValueHandling = NV.Ignore)]
|
||||
public Station Arr { get; set; }
|
||||
|
||||
[J("gat", NullValueHandling = NV.Ignore)]
|
||||
public string Gattung { get; set; }
|
||||
|
||||
[J("sci", NullValueHandling = NV.Ignore)]
|
||||
public string Zugklasse { get; set; }
|
||||
|
||||
[J("dep", NullValueHandling = NV.Ignore)]
|
||||
public Station Dep { get; set; }
|
||||
|
||||
[J("@tn", NullValueHandling = NV.Ignore)]
|
||||
public string Line { get; set; }
|
||||
}
|
||||
|
||||
public class Station {
|
||||
[J("x", NullValueHandling = NV.Ignore)]
|
||||
public string X { get; set; }
|
||||
|
||||
[J("y", NullValueHandling = NV.Ignore)]
|
||||
public string Y { get; set; }
|
||||
|
||||
[J("@dt", NullValueHandling = NV.Ignore)]
|
||||
public string Date { get; set; }
|
||||
|
||||
[J("ebhf_name", NullValueHandling = NV.Ignore)]
|
||||
public string EbhfName { get; set; }
|
||||
|
||||
[J("ebhf_nr", NullValueHandling = NV.Ignore)]
|
||||
public string EbhfNr { get; set; }
|
||||
|
||||
[J("@t", NullValueHandling = NV.Ignore)]
|
||||
public string Time { get; set; }
|
||||
|
||||
[J("n", NullValueHandling = NV.Ignore)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[J("nr", NullValueHandling = NV.Ignore)]
|
||||
public string BhfNr { get; set; }
|
||||
|
||||
[J("plz", NullValueHandling = NV.Ignore)]
|
||||
public string Plz { get; set; }
|
||||
|
||||
[J("ptf", NullValueHandling = NV.Ignore)]
|
||||
public string Ptf { get; set; }
|
||||
}
|
||||
|
||||
public class Tcklist {
|
||||
[J("tck", NullValueHandling = NV.Ignore), JsonConverter(typeof(SingleOrArrayConverter<Tck>))]
|
||||
public List<Tck> Tck { get; set; }
|
||||
}
|
||||
|
||||
public class Tck {
|
||||
[J("mtk", NullValueHandling = NV.Ignore)]
|
||||
public Mtk Mtk { get; set; }
|
||||
|
||||
[J("@posnr", NullValueHandling = NV.Ignore)]
|
||||
public string Posnr { get; set; }
|
||||
|
||||
[J("htdata", NullValueHandling = NV.Ignore)]
|
||||
public Htdata Htdata { get; set; }
|
||||
}
|
||||
|
||||
public class Htdata {
|
||||
[J("ht", NullValueHandling = NV.Ignore)]
|
||||
public List<Ht> Ht { get; set; }
|
||||
}
|
||||
|
||||
public class Ht {
|
||||
[J("@pos", NullValueHandling = NV.Ignore)]
|
||||
public string Pos { get; set; }
|
||||
|
||||
[J("#text", NullValueHandling = NV.Ignore)]
|
||||
public string Text { get; set; }
|
||||
|
||||
[J("@name", NullValueHandling = NV.Ignore)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[J("@type", NullValueHandling = NV.Ignore)]
|
||||
public string Type { get; set; }
|
||||
}
|
||||
|
||||
public class Mtk {
|
||||
[J("@status", NullValueHandling = NV.Ignore)]
|
||||
public string Status { get; set; }
|
||||
|
||||
[J("@dir", NullValueHandling = NV.Ignore)]
|
||||
public string Dir { get; set; }
|
||||
|
||||
[J("iss", NullValueHandling = NV.Ignore)]
|
||||
public string Iss { get; set; }
|
||||
|
||||
[J("tkey", NullValueHandling = NV.Ignore)]
|
||||
public string Tkey { get; set; }
|
||||
|
||||
[J("bc", NullValueHandling = NV.Ignore)]
|
||||
public Bc Bc { get; set; }
|
||||
|
||||
[J("nvplist", NullValueHandling = NV.Ignore)]
|
||||
public Nvplist Nvplist { get; set; }
|
||||
|
||||
[J("reisender_vorname", NullValueHandling = NV.Ignore)]
|
||||
public string ReisenderVorname { get; set; }
|
||||
|
||||
[J("reisender_nachname", NullValueHandling = NV.Ignore)]
|
||||
public string ReisenderNachname { get; set; }
|
||||
|
||||
[J("txt", NullValueHandling = NV.Ignore)]
|
||||
public string Txt { get; set; }
|
||||
|
||||
[J("zb", NullValueHandling = NV.Ignore)]
|
||||
public string Zb { get; set; }
|
||||
|
||||
[J("ot_nr_hin", NullValueHandling = NV.Ignore)]
|
||||
public string OtNrHin { get; set; }
|
||||
}
|
||||
|
||||
public class Bc {
|
||||
[J("rbs", NullValueHandling = NV.Ignore)]
|
||||
public string Rbs { get; set; }
|
||||
|
||||
[J("anz", NullValueHandling = NV.Ignore)]
|
||||
public string Anz { get; set; }
|
||||
}
|
||||
|
||||
public class Rpheader {
|
||||
[J("@ts", NullValueHandling = NV.Ignore)]
|
||||
public string Ts { get; set; }
|
||||
|
||||
[J("@tnr", NullValueHandling = NV.Ignore)]
|
||||
public string Tnr { get; set; }
|
||||
}
|
||||
|
||||
public class Xml {
|
||||
[J("@version", NullValueHandling = NV.Ignore)]
|
||||
public string Version { get; set; }
|
||||
|
||||
[J("@encoding", NullValueHandling = NV.Ignore)]
|
||||
public string Encoding { get; set; }
|
||||
}
|
||||
|
||||
public partial class TicketResponse {
|
||||
public static TicketResponse FromJson(string json) => JsonConvert.DeserializeObject<TicketResponse>(json, Converter.Settings);
|
||||
}
|
||||
|
||||
internal static class Converter {
|
||||
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings {
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
|
||||
DateParseHandling = DateParseHandling.None,
|
||||
Converters = {new IsoDateTimeConverter {DateTimeStyles = DateTimeStyles.AssumeUniversal}}
|
||||
};
|
||||
}
|
||||
|
||||
internal class SingleOrArrayConverter<T> : JsonConverter {
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override bool CanConvert(Type objectType) => objectType == typeof(List<T>);
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) {
|
||||
var token = JToken.Load(reader);
|
||||
return token.Type == JTokenType.Array ? token.ToObject<List<T>>() : new List<T> {token.ToObject<T>()};
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
@page
|
||||
@using Microsoft.AspNetCore.Http
|
||||
@using Microsoft.AspNetCore.Http.Extensions
|
||||
@model CardModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Card";
|
||||
Response.Redirect("/Cards");
|
||||
|
||||
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||
Response.Redirect($"/Login?&redir={Request.GetDisplayUrl().UrlEncode()}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Card saved. Redirecting...
|
@ -1,65 +0,0 @@
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using LinqToDB;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Newtonsoft.Json;
|
||||
using trainav.web.database;
|
||||
using trainav.web.database.Tables;
|
||||
using trainav.web.JSON.CardResponse;
|
||||
using trainav.web.JSON.ListOrdersResponse;
|
||||
|
||||
namespace trainav.web.Pages;
|
||||
|
||||
public class CardModel : PageModel {
|
||||
public void OnPost() {
|
||||
if (HttpContext.Session.GetString("authorized") != "true")
|
||||
return;
|
||||
|
||||
using var db = new Database.DbConn();
|
||||
var request = new XDocument(new XElement("rqorderheadlist",
|
||||
new XElement("rqheader", new XAttribute("ts", "2020-02-19T15:59:00"), new XAttribute("l", "de"), new XAttribute("v", "19120000"),
|
||||
new XAttribute("d", "iPad7,5"), new XAttribute("os", "iOS_13.3.1"), new XAttribute("app", "NAVIGATOR")),
|
||||
new XElement("authlogin", new XAttribute("user", Request.Form["user"]), new XAttribute("pw", Request.Form["pass"]),
|
||||
new XElement("sso", new XAttribute("genToken", "FALSE"))),
|
||||
new XElement("criteria", new XAttribute("validonly", "0")))).ToString();
|
||||
var response = new WebClient().UploadString("https://fahrkarten.bahn.de/mobile/dbc/xs.go", "POST", request);
|
||||
var xmlobj = new XmlDocument();
|
||||
xmlobj.LoadXml(response);
|
||||
var json = JsonConvert.SerializeXmlNode(xmlobj);
|
||||
var parsed = ListOrdersResponse.FromJson(json);
|
||||
|
||||
foreach (var order in parsed.Rporderheadlist.Orderheadlist.Orderhead.Where(order => order.On.StartsWith("EBC_"))) {
|
||||
request = new XDocument(new XElement("rqorderdetails", new XAttribute("version", "1.0"),
|
||||
new XElement("rqheader", new XAttribute("ts", "2019-10-31T23:20:48"), new XAttribute("l", "de"), new XAttribute("v", "19100000"),
|
||||
new XAttribute("d", "iPad7,5"), new XAttribute("os", "iOS_13.1.3"), new XAttribute("app", "NAVIGATOR")),
|
||||
new XElement("rqorder", new XAttribute("on", order.On)), new XElement("authname", new XAttribute("tln", Request.Form["name"]))))
|
||||
.ToString();
|
||||
|
||||
response = new WebClient().UploadString("https://fahrkarten.bahn.de/mobile/dbc/xs.go", "POST", request);
|
||||
xmlobj = new XmlDocument();
|
||||
xmlobj.LoadXml(response);
|
||||
json = JsonConvert.SerializeXmlNode(xmlobj);
|
||||
var parsedCard = CardResponse.FromJson(json);
|
||||
|
||||
db.InsertWithInt32Identity(new Card {
|
||||
OrderId = order.On,
|
||||
UserId = int.Parse(HttpContext.Session.GetString("uid")),
|
||||
Class = int.Parse(parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "klasse").Text),
|
||||
Value = int.Parse(parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "rbs").Text),
|
||||
CardNumber = parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "bcnummer").Text,
|
||||
CardInfo = parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Txt,
|
||||
CardQr = parsedCard.Rporderdetails.Order.Tcklist.Tck.Htdata.Ht.First(p => p.Name == "barcode").Text,
|
||||
CardSecCode = parsedCard.Rporderdetails.Order.Tcklist.Tck.Htdata.Ht.First(p => p.Name == "sichtmerkmal").Text,
|
||||
CardImage = parsedCard.Rporderdetails.Order.Tcklist.Tck.Bahncardimage.CdataSection,
|
||||
Traveller = parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "inhaber").Text,
|
||||
ValidFrom = parsedCard.Rporderdetails.Order.Vfrom,
|
||||
ValidTo = parsedCard.Rporderdetails.Order.Vto,
|
||||
QrValidFrom = parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "ebcbarcodegueltigab").Text,
|
||||
QrValidTo = parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "ebcbarcodegueltigbis").Text
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -1,169 +0,0 @@
|
||||
@page
|
||||
@using Microsoft.AspNetCore.Http
|
||||
@using Microsoft.AspNetCore.Http.Extensions
|
||||
@using System.Text
|
||||
@model CardsModel
|
||||
@{
|
||||
ViewData["Title"] = "Cards";
|
||||
|
||||
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||
Response.Redirect($"/Login?&redir={Request.GetDisplayUrl().UrlEncode()}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Request.Query.ContainsKey("refresh")) {
|
||||
Response.Redirect("?edit=true");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@if (Request.Query["edit"] == "true") {
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Card</th>
|
||||
<th>Number</th>
|
||||
<th>Traveller</th>
|
||||
<th>Card Validity</th>
|
||||
<th>QR Validity</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var card in Model.Cards) {
|
||||
<tr>
|
||||
<td>@card.CardInfo.TrimEnd('#')</td>
|
||||
<td>@card.CardNumber</td>
|
||||
<td>@card.Traveller</td>
|
||||
<td>
|
||||
@{
|
||||
var from = DateTime.Parse(card.ValidFrom);
|
||||
var to = DateTime.Parse(card.ValidTo);
|
||||
if (from > DateTime.Now) {
|
||||
<span style="color: red">
|
||||
@card.ValidFrom.Split("T")[0]
|
||||
</span>
|
||||
}
|
||||
else {
|
||||
@card.ValidFrom.Split("T")[0]
|
||||
}
|
||||
<br/>
|
||||
if (to < DateTime.Now) {
|
||||
<span style="color: red">
|
||||
@card.ValidTo.Split("T")[0]
|
||||
</span>
|
||||
}
|
||||
else {
|
||||
@card.ValidTo.Split("T")[0]
|
||||
}
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@{
|
||||
var qrfrom = DateTime.Parse(card.QrValidFrom);
|
||||
var qrto = DateTime.Parse(card.QrValidTo);
|
||||
if (qrfrom > DateTime.Now) {
|
||||
<span style="color: red">
|
||||
@card.QrValidFrom.Split("T")[0]
|
||||
</span>
|
||||
}
|
||||
else {
|
||||
@card.QrValidFrom.Split("T")[0]
|
||||
}
|
||||
<br/>
|
||||
if (qrto < DateTime.Now) {
|
||||
<span style="color: red">
|
||||
@card.QrValidTo.Split("T")[0]
|
||||
</span>
|
||||
}
|
||||
else {
|
||||
@card.QrValidTo.Split("T")[0]
|
||||
}
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-primary" href="?refresh=@card.CardId">Refresh QR</a>
|
||||
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=card&id=@card.CardId&redir=@Request.GetDisplayUrl().UrlEncode()">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<p>
|
||||
Please refresh your BahnCard list in the mobile DB Navigator before clicking "Refresh QR". This will be fixed in a later release.
|
||||
</p>
|
||||
<a class="btn btn-sm btn-secondary" href="@Request.Path">Back</a>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
}
|
||||
else if (Model.Cards.Any()) {
|
||||
foreach (var card in Model.Cards) {
|
||||
if (!card.CardQr.StartsWith("data:image/png"))
|
||||
card.CardQr = Encoding.UTF8.GetString(Convert.FromBase64String(card.CardQr));
|
||||
if (!card.CardSecCode.StartsWith("data:image/png"))
|
||||
card.CardSecCode = Encoding.UTF8.GetString(Convert.FromBase64String(card.CardSecCode));
|
||||
if (!card.CardImage.StartsWith("<?xml"))
|
||||
card.CardImage = Encoding.UTF8.GetString(Convert.FromBase64String(card.CardImage));
|
||||
|
||||
<div class="flex-grid">
|
||||
<div class="flex-col">
|
||||
<img src="@card.CardQr" alt="Ticketcode"/>
|
||||
</div>
|
||||
<div class="flex-col">
|
||||
<img src="@card.CardSecCode" alt="Sichtmerkmal"/>
|
||||
</div>
|
||||
<div class="flex-col">
|
||||
<div class="bahncard-outer">
|
||||
<img class="bahncard" src='data:image/svg+xml;base64,@card.CardImage.Base64Encode()' alt="Bahncardimage"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
var from = DateTime.Parse(card.ValidFrom);
|
||||
var to = DateTime.Parse(card.ValidTo);
|
||||
var qrfrom = DateTime.Parse(card.QrValidFrom);
|
||||
var qrto = DateTime.Parse(card.QrValidTo);
|
||||
|
||||
if (from > DateTime.Now) {
|
||||
<div class="alert alert-info" role="alert">
|
||||
The above card is not valid yet.
|
||||
</div>
|
||||
}
|
||||
if (to < DateTime.Now) {
|
||||
<div class="alert alert-warning" role="alert">
|
||||
The above card is expired.
|
||||
</div>
|
||||
}
|
||||
if (qrfrom > DateTime.Now && !(from > DateTime.Now)) {
|
||||
<div class="alert alert-info" role="alert">
|
||||
The above QR code is somehow not valid yet. Congrats, please open a bug report.
|
||||
</div>
|
||||
}
|
||||
if (qrto < DateTime.Now) {
|
||||
<div class="alert alert-warning" role="alert">
|
||||
The above QR code is expired. Please refresh the card. <a href="/Cards?edit=true">You can do that now</a>.
|
||||
</div>
|
||||
}
|
||||
<br/>
|
||||
}
|
||||
<br/>
|
||||
<a class="btn btn-sm btn-secondary" href="?edit=true">Edit cards</a>
|
||||
}
|
||||
|
||||
@if (!Model.Cards.Any() || Request.Query["edit"] == "true") {
|
||||
<h3>Get Cards from bahn.de account</h3>
|
||||
<br/>
|
||||
<form method="POST" action="/Card">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" id="InputUser" name="user" placeholder="bahn.de username">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="password" class="form-control" id="InputPassword" name="pass" placeholder="bahn.de password">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" id="inputName" name="name" placeholder="Last name of traveller">
|
||||
</div>
|
||||
@Html.AntiForgeryToken()
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using LinqToDB;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Newtonsoft.Json;
|
||||
using trainav.web.database;
|
||||
using trainav.web.database.Tables;
|
||||
using trainav.web.JSON.CardResponse;
|
||||
|
||||
namespace trainav.web.Pages;
|
||||
|
||||
public class CardsModel : PageModel {
|
||||
public List<Card> Cards;
|
||||
|
||||
public void OnGet() {
|
||||
if (HttpContext.Session.GetString("authorized") != "true")
|
||||
return;
|
||||
|
||||
using var db = new Database.DbConn();
|
||||
|
||||
if (Request.Query.ContainsKey("refresh")) {
|
||||
var card = db.Cards.First(p => p.CardId == int.Parse(Request.Query["refresh"]));
|
||||
if (card.UserId != int.Parse(HttpContext.Session.GetString("uid")))
|
||||
return;
|
||||
|
||||
var request = new XDocument(new XElement("rqorderdetails", new XAttribute("version", "1.0"),
|
||||
new XElement("rqheader", new XAttribute("ts", "2019-10-31T23:20:48"), new XAttribute("l", "de"),
|
||||
new XAttribute("v", "19100000"), new XAttribute("d", "iPad7,5"), new XAttribute("os", "iOS_13.1.3"),
|
||||
new XAttribute("app", "NAVIGATOR")), new XElement("rqorder", new XAttribute("on", card.OrderId)),
|
||||
new XElement("authname", new XAttribute("tln", card.Traveller.Split(" ").Last())))).ToString();
|
||||
|
||||
var response = new WebClient().UploadString("https://fahrkarten.bahn.de/mobile/dbc/xs.go", "POST", request);
|
||||
var xmlobj = new XmlDocument();
|
||||
xmlobj.LoadXml(response);
|
||||
var json = JsonConvert.SerializeXmlNode(xmlobj);
|
||||
var parsedCard = CardResponse.FromJson(json);
|
||||
|
||||
card.CardQr = parsedCard.Rporderdetails.Order.Tcklist.Tck.Htdata.Ht.First(p => p.Name == "barcode").Text;
|
||||
card.CardSecCode = parsedCard.Rporderdetails.Order.Tcklist.Tck.Htdata.Ht.First(p => p.Name == "sichtmerkmal").Text;
|
||||
card.CardImage = parsedCard.Rporderdetails.Order.Tcklist.Tck.Bahncardimage.CdataSection;
|
||||
card.QrValidFrom = parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "ebcbarcodegueltigab").Text;
|
||||
card.QrValidTo = parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "ebcbarcodegueltigbis").Text;
|
||||
|
||||
db.Update(card);
|
||||
return;
|
||||
}
|
||||
|
||||
Cards = db.Cards.Where(p => p.UserId == int.Parse(HttpContext.Session.GetString("uid"))).ToList();
|
||||
}
|
||||
}
|
@ -1,101 +1,97 @@
|
||||
@page
|
||||
@using LinqToDB
|
||||
@using Microsoft.AspNetCore.Http
|
||||
@using Microsoft.AspNetCore.Http.Extensions
|
||||
@using LinqToDB
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@using trainav.web.Utils
|
||||
@using trainav.web.database
|
||||
@model IndexModel
|
||||
@{
|
||||
ViewData["Title"] = "Home";
|
||||
ViewData["Title"] = "Home";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
@if (HttpContext.Session.GetString("authorized") != "true") {
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Please <a href="/Login">log in</a> to see your personal plan.</p>
|
||||
}
|
||||
else {
|
||||
<h1 class="display-4">
|
||||
Welcome, @Model.AuthorizedUser.Username
|
||||
</h1>
|
||||
<p>
|
||||
Here are your planned trips.
|
||||
</p>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Origin</th>
|
||||
<th scope="col">Via</th>
|
||||
<th scope="col">Destination</th>
|
||||
<th scope="col">Comments</th>
|
||||
<th scope="col">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@{
|
||||
await using var db = new Database.DbConn();
|
||||
var trips = db.Trips.Where(p => p.UserId == Model.AuthorizedUser.UserId).ToList();
|
||||
<h1 class="display-4">
|
||||
Welcome, @Model.AuthorizedUser.Username
|
||||
</h1>
|
||||
<p>
|
||||
Here are your planned trips.
|
||||
</p>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Origin</th>
|
||||
<th scope="col">Via</th>
|
||||
<th scope="col">Destination</th>
|
||||
<th scope="col">Comments</th>
|
||||
<th scope="col">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@{
|
||||
await using var db = new Database.DbConn();
|
||||
var trips = db.Trips.Where(p => p.UserId == Model.AuthorizedUser.UserId).ToList();
|
||||
|
||||
foreach (var trip in trips.Where(trip => !db.Legs.Any(p => p.TripId == trip.TripId))) {
|
||||
await db.DeleteAsync(trip);
|
||||
trips = db.Trips.Where(p => p.UserId == Model.AuthorizedUser.UserId).ToList();
|
||||
}
|
||||
foreach (var trip in trips.Where(trip => !db.Legs.Any(p => p.TripId == trip.TripId))) {
|
||||
await db.DeleteAsync(trip);
|
||||
trips = db.Trips.Where(p => p.UserId == Model.AuthorizedUser.UserId).ToList();
|
||||
}
|
||||
|
||||
foreach (var trip in trips.OrderBy(p => db.Legs.Where(a => a.TripId == p.TripId).OrderBy(leg => leg.DepTime).First().DepTime)) {
|
||||
var legs = db.Legs.Where(p => p.TripId == trip.TripId).OrderBy(p => p.DepTime).ToList();
|
||||
<tr>
|
||||
<td>
|
||||
<b>@legs.First().DepStation.Delimit(30)</b>
|
||||
<br/>
|
||||
<small>@DateTime.Parse(legs.First().DepTime).ToString("ddd dd.MM.yyyy, HH:mm")</small>
|
||||
</td>
|
||||
<td>
|
||||
@((from index in from leg in legs where leg.TrainType == "placeholder" select legs.IndexOf(leg) select legs[index - 1].ArrStation.Delimit(30)).ToList().DefaultIfEmpty("-").Aggregate((s1, s2) => $"{s1}, {s2}"))
|
||||
</td>
|
||||
<td>
|
||||
<b>@legs.Last().ArrStation.Delimit(30)</b>
|
||||
<br/>
|
||||
<small>@DateTime.Parse(legs.Last().ArrTime).ToString("ddd dd.MM.yyyy, HH:mm")</small>
|
||||
</td>
|
||||
<td>
|
||||
@Html.Raw(legs.Where(leg => !string.IsNullOrWhiteSpace(leg.Comment)).Select(p => p.Comment.Replace(", ", "<br/>")).DefaultIfEmpty("").Aggregate((s1, s2) => $"{s1}<br/>{s2}"))
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-primary" href="/Trip?id=@trip.TripId">View</a>
|
||||
|
||||
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=trip&id=@trip.TripId&redir=@Request.GetDisplayUrl().UrlEncode()">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<br/>
|
||||
<div class="d-flex flex-row" style="justify-content: space-between">
|
||||
<div class="d-flex p-2" style="width: 40%">
|
||||
<form style="width: 100%" method="GET" action="/Ticket">
|
||||
<h3>Add trip from ticket</h3>
|
||||
<br/>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="order" placeholder="bahn.de order #">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Last name of traveller">
|
||||
</div>
|
||||
<br/>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="d-flex p-2" style="width: 40%">
|
||||
<form style="width: 100%" method="GET" action="/OEAPI">
|
||||
<h3>Add trip from <a href="https://oeffisear.ch" target="_blank">oeffisear.ch</a> or <a href="https://transit.ztn.sh" target="_blank">transit.ztn.sh</a></h3>
|
||||
<br/>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="link" placeholder="paste link / shortcode here">
|
||||
</div>
|
||||
<br/>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
foreach (var trip in trips.OrderBy(p => db.Legs.Where(a => a.TripId == p.TripId).OrderBy(leg => leg.DepTime).First().DepTime)) {
|
||||
var legs = db.Legs.Where(p => p.TripId == trip.TripId).OrderBy(p => p.DepTime).ToList();
|
||||
<tr>
|
||||
<td>
|
||||
<b>@legs.First().DepStation.Delimit(30)</b>
|
||||
<br/>
|
||||
<small>@DateTime.Parse(legs.First().DepTime).ToString("ddd dd.MM.yyyy, HH:mm")</small>
|
||||
</td>
|
||||
<td>
|
||||
@((from index in from leg in legs where leg.TrainType == "placeholder" select legs.IndexOf(leg) select legs[index - 1].ArrStation.Delimit(30)).ToList().DefaultIfEmpty("-").Aggregate((s1, s2) => $"{s1}, {s2}"))
|
||||
</td>
|
||||
<td>
|
||||
<b>@legs.Last().ArrStation.Delimit(30)</b>
|
||||
<br/>
|
||||
<small>@DateTime.Parse(legs.Last().ArrTime).ToString("ddd dd.MM.yyyy, HH:mm")</small>
|
||||
</td>
|
||||
<td>
|
||||
@Html.Raw(legs.Where(leg => !string.IsNullOrWhiteSpace(leg.Comment)).Select(p => p.Comment.Replace(", ", "<br/>")).DefaultIfEmpty("").Aggregate((s1, s2) => $"{s1}<br/>{s2}"))
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-primary" href="/Trip?id=@trip.TripId">View</a>
|
||||
|
||||
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=trip&id=@trip.TripId&redir=@Request.GetDisplayUrl().UrlEncode()">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<br/>
|
||||
<div class="d-flex flex-row" style="justify-content: space-between">
|
||||
<div class="d-flex p-2" style="width: 40%">
|
||||
<form style="width: 100%" method="GET" action="/Ticket">
|
||||
<h3>Add trip from ticket</h3>
|
||||
<br/>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="order" placeholder="bahn.de order #">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="name" placeholder="Last name of traveller">
|
||||
</div>
|
||||
<br/>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="d-flex p-2" style="width: 40%">
|
||||
<form style="width: 100%" method="GET" action="/OEAPI">
|
||||
<h3>Add trip from <a href="https://oeffisear.ch" target="_blank">oeffisear.ch</a> or <a href="https://transit.ztn.sh" target="_blank">transit.ztn.sh</a></h3>
|
||||
<br/>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="link" placeholder="paste link / shortcode here">
|
||||
</div>
|
||||
<br/>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,151 +0,0 @@
|
||||
@page
|
||||
@using Microsoft.AspNetCore.Http
|
||||
@using Microsoft.AspNetCore.Http.Extensions
|
||||
@using trainav.web.database
|
||||
@using System.Text
|
||||
@model InspectionModel
|
||||
@{
|
||||
ViewData["Title"] = "Inspection";
|
||||
|
||||
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||
Response.Redirect($"/Login?&redir={Request.GetDisplayUrl().UrlEncode()}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Model.Leg.UserId != int.Parse(HttpContext.Session.GetString("uid"))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
<p>
|
||||
Ticket for <b>@Model.Leg.TrainType @Model.Leg.TrainNr</b> from <b>@Model.Leg.DepStation</b> to <b>@Model.Leg.ArrStation</b>, starting @DateTime.Parse(Model.Leg.DepTime).ToString("yyyy-MM-dd HH:mm")
|
||||
</p>
|
||||
<div class="flex-grid">
|
||||
<div class="flex-col">
|
||||
<img src="@Model.Ticket.TicketQr" alt="Ticketcode"/>
|
||||
</div>
|
||||
<div class="flex-col">
|
||||
<img src="@Model.Ticket.TicketSecCode" alt="Sichtmerkmal"/>
|
||||