display card/qr expiry & refresh; refactor Cards page; code cleanup

This commit is contained in:
Laura Hausmann 2020-06-12 00:37:55 +02:00
parent 484d853f46
commit 5eacd5a7ec
Signed by: zotan
GPG key ID: 5EC1D38FFC321311
42 changed files with 859 additions and 611 deletions

View file

@ -1,29 +1,21 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace bahnplan.web.Controllers {
[ApiController]
[Route("api/[controller]")]
[ApiController, Route("api/[controller]")]
public class TestController : ControllerBase {
[HttpGet]
public ApiResponse Get() {
return new ApiResponse("test", 4);
}
public ApiResponse Get() => new ApiResponse("test", 4);
}
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
public class ApiResponse {
public string String1 { get; }
public int Int1 { get; }
public ApiResponse(string string1, int int1) {
String1 = string1;
Int1 = int1;
Int1 = int1;
}
public string String1 { get; }
public int Int1 { get; }
}
}

View file

@ -11,136 +11,204 @@ using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace bahnplan.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; }
}
namespace bahnplan.web.JSON.CardResponse {
public partial class CardResponse {
[JsonProperty("?xml", NullValueHandling = NullValueHandling.Ignore)]
public Xml Xml { 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; }
}
[JsonProperty("rporderdetails", NullValueHandling = NullValueHandling.Ignore)]
public Rporderdetails Rporderdetails { 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 Rporderdetails {
[JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)]
public string Version { get; set; }
public class Posinfolist
{
[JsonProperty("posinfo", NullValueHandling = NullValueHandling.Ignore)] public Posinfo Posinfo { get; set; }
}
[JsonProperty("rpheader", NullValueHandling = NullValueHandling.Ignore)]
public Rpheader Rpheader { 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; }
}
[JsonProperty("order", NullValueHandling = NullValueHandling.Ignore)]
public Order Order { get; set; }
}
public class Tcklist
{
[JsonProperty("tck", NullValueHandling = NullValueHandling.Ignore)] public Tck Tck { get; set; }
}
public class Order {
[JsonProperty("@cdt", NullValueHandling = NullValueHandling.Ignore)]
public string Cdt { 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; }
}
[JsonProperty("@cid", NullValueHandling = NullValueHandling.Ignore)]
public string Cid { get; set; }
public class Bahncardimage
{
[JsonProperty("#cdata-section", NullValueHandling = NullValueHandling.Ignore)] public string CdataSection { get; set; }
}
[JsonProperty("@ddt", NullValueHandling = NullValueHandling.Ignore)]
public string Ddt { get; set; }
public class Htdata
{
[JsonProperty("ht", NullValueHandling = NullValueHandling.Ignore)] public List<Ht> Ht { get; set; }
}
[JsonProperty("@fkat", NullValueHandling = NullValueHandling.Ignore)]
public string Fkat { 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; }
}
[JsonProperty("@ldt", NullValueHandling = NullValueHandling.Ignore)]
public string Ldt { 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; }
}
[JsonProperty("@on", NullValueHandling = NullValueHandling.Ignore)]
public string On { get; set; }
public class Nvplist
{
[JsonProperty("nvp", NullValueHandling = NullValueHandling.Ignore)] public List<Nvp> Nvp { get; set; }
}
[JsonProperty("@pg", NullValueHandling = NullValueHandling.Ignore)]
public string Pg { 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; }
}
[JsonProperty("@sdt", NullValueHandling = NullValueHandling.Ignore)]
public string Sdt { 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; }
}
[JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)]
public string Version { 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; }
}
[JsonProperty("@vfrom", NullValueHandling = NullValueHandling.Ignore)]
public string Vfrom { get; set; }
public partial class CardResponse
{
public static CardResponse FromJson(string json) => JsonConvert.DeserializeObject<CardResponse>(json, Converter.Settings);
}
[JsonProperty("@vto", NullValueHandling = NullValueHandling.Ignore)]
public string Vto { get; set; }
internal static class Converter
{
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
Converters =
{
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
},
};
}
}
[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}}
};
}
}

View file

@ -9,53 +9,67 @@
using System.Collections.Generic;
using Newtonsoft.Json;
namespace bahnplan.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; }
}
namespace bahnplan.web.JSON.ListOrdersResponse {
public partial class ListOrdersResponse {
[JsonProperty("?xml", NullValueHandling = NullValueHandling.Ignore)]
public Xml Xml { 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; }
}
[JsonProperty("rporderheadlist", NullValueHandling = NullValueHandling.Ignore)]
public Rporderheadlist Rporderheadlist { get; set; }
}
public class Orderheadlist
{
[JsonProperty("orderhead", NullValueHandling = NullValueHandling.Ignore)] public List<Orderhead> Orderhead { get; set; }
}
public class Rporderheadlist {
[JsonProperty("@version", NullValueHandling = NullValueHandling.Ignore)]
public string Version { 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; }
}
[JsonProperty("rpheader", NullValueHandling = NullValueHandling.Ignore)]
public Rpheader Rpheader { 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; }
}
[JsonProperty("orderheadlist", NullValueHandling = NullValueHandling.Ignore)]
public Orderheadlist Orderheadlist { 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 Orderheadlist {
[JsonProperty("orderhead", NullValueHandling = NullValueHandling.Ignore)]
public List<Orderhead> Orderhead { 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 class Orderhead {
[JsonProperty("@ldt", NullValueHandling = NullValueHandling.Ignore)]
public string Ldt { get; set; }
public partial class ListOrdersResponse
{
public static ListOrdersResponse FromJson(string json) => JsonConvert.DeserializeObject<ListOrdersResponse>(json, Converter.Settings);
}
}
[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);
}
}

View file

@ -9,151 +9,254 @@
using System.Collections.Generic;
using Newtonsoft.Json;
namespace bahnplan.web.JSON
{
using J = JsonPropertyAttribute;
using R = Required;
using N = NullValueHandling;
namespace bahnplan.web.JSON {
using J = JsonPropertyAttribute;
using R = Required;
using N = NullValueHandling;
public partial class OeapiResponse
{
[J("status", NullValueHandling = N.Ignore)] public string Status { get; set; }
[J("msg", NullValueHandling = N.Ignore)] public string Msg { get; set; }
[J("data", NullValueHandling = N.Ignore)] public Data Data { get; set; }
}
public partial class OeapiResponse {
[J("status", NullValueHandling = N.Ignore)]
public string Status { get; set; }
public class Data
{
[J("reqId", NullValueHandling = N.Ignore)] public string ReqId { get; set; }
[J("lastUpdated", NullValueHandling = N.Ignore)] public long? LastUpdated { get; set; }
[J("params", NullValueHandling = N.Ignore)] public Params Params { get; set; }
[J("journeys", NullValueHandling = N.Ignore)] public Dictionary<string, OJourney> Journeys { get; set; }
}
[J("msg", NullValueHandling = N.Ignore)]
public string Msg { get; set; }
public class OJourney
{
[J("lastUpdated", NullValueHandling = N.Ignore)] public long? LastUpdated { get; set; }
[J("legs", NullValueHandling = N.Ignore)] public List<Leg> Legs { get; set; }
[J("price")] public object Price { get; set; }
}
[J("data", NullValueHandling = N.Ignore)]
public Data Data { get; set; }
}
public class Leg
{
[J("isWalking", NullValueHandling = N.Ignore)] public bool? IsWalking { get; set; }
[J("isTransfer", NullValueHandling = N.Ignore)] public bool? IsTransfer { get; set; }
[J("cancelled", NullValueHandling = N.Ignore)] public bool? Cancelled { get; set; }
[J("departure", NullValueHandling = N.Ignore)] public Arrival Departure { get; set; }
[J("arrival", NullValueHandling = N.Ignore)] public Arrival Arrival { get; set; }
[J("polyline")] public object Polyline { get; set; }
[J("distance")] public object Distance { get; set; }
[J("line", NullValueHandling = N.Ignore)] public Line Line { get; set; }
[J("direction", NullValueHandling = N.Ignore)] public string Direction { get; set; }
[J("stopovers", NullValueHandling = N.Ignore)] public List<Stopover> Stopovers { get; set; }
[J("remarks", NullValueHandling = N.Ignore)] public List<Remark> Remarks { get; set; }
}
public class Data {
[J("reqId", NullValueHandling = N.Ignore)]
public string ReqId { get; set; }
public class Arrival
{
[J("point", NullValueHandling = N.Ignore)] public Point Point { get; set; }
[J("plannedTime")] public long? PlannedTime { get; set; }
[J("prognosedTime")] public long? PrognosedTime { get; set; }
[J("plannedPlatform")] public string PlannedPlatform { get; set; }
[J("prognosedPlatform")] public object PrognosedPlatform { get; set; }
}
[J("lastUpdated", NullValueHandling = N.Ignore)]
public long? LastUpdated { get; set; }
public class Point
{
[J("stop", NullValueHandling = N.Ignore)] public Stop Stop { get; set; }
[J("location")] public object Location { get; set; }
}
[J("params", NullValueHandling = N.Ignore)]
public Params Params { get; set; }
public class Stop
{
[J("id", NullValueHandling = N.Ignore)] public string Id { get; set; }
[J("name", NullValueHandling = N.Ignore)] public string Name { get; set; }
[J("location", NullValueHandling = N.Ignore)] public Location Location { get; set; }
[J("products", NullValueHandling = N.Ignore)] public Products Products { get; set; }
[J("station")] public object Station { get; set; }
}
[J("journeys", NullValueHandling = N.Ignore)]
public Dictionary<string, OJourney> Journeys { get; set; }
}
public class Location
{
[J("latitude", NullValueHandling = N.Ignore)] public double? Latitude { get; set; }
[J("longitude", NullValueHandling = N.Ignore)] public double? Longitude { get; set; }
[J("name")] public object Name { get; set; }
[J("address")] public object Address { get; set; }
[J("id")] public object Id { get; set; }
}
public class OJourney {
[J("lastUpdated", NullValueHandling = N.Ignore)]
public long? LastUpdated { get; set; }
public class Products
{
[J("nationalExp", NullValueHandling = N.Ignore)] public bool? NationalExp { get; set; }
[J("national", NullValueHandling = N.Ignore)] public bool? National { get; set; }
[J("regionalExp", NullValueHandling = N.Ignore)] public bool? RegionalExp { get; set; }
[J("regional", NullValueHandling = N.Ignore)] public bool? Regional { get; set; }
[J("suburban", NullValueHandling = N.Ignore)] public bool? Suburban { get; set; }
[J("bus", NullValueHandling = N.Ignore)] public bool? Bus { get; set; }
[J("ferry", NullValueHandling = N.Ignore)] public bool? Ferry { get; set; }
[J("subway", NullValueHandling = N.Ignore)] public bool? Subway { get; set; }
[J("tram", NullValueHandling = N.Ignore)] public bool? Tram { get; set; }
[J("taxi", NullValueHandling = N.Ignore)] public bool? Taxi { get; set; }
}
[J("legs", NullValueHandling = N.Ignore)]
public List<Leg> Legs { get; set; }
public class Line
{
[J("id", NullValueHandling = N.Ignore)] public string Id { get; set; }
[J("name", NullValueHandling = N.Ignore)] public string Name { get; set; }
[J("mode", NullValueHandling = N.Ignore)] public string Mode { get; set; }
[J("product", NullValueHandling = N.Ignore)] public string Product { get; set; }
[J("tripNum", NullValueHandling = N.Ignore)] public string TripNum { get; set; }
[J("productName", NullValueHandling = N.Ignore)] public string ProductName { get; set; }
[J("fullProductName", NullValueHandling = N.Ignore)] public string FullProductName { get; set; }
[J("operator")] public object Operator { get; set; }
[J("additionalName")] public string AdditionalName { get; set; }
}
[J("price")] public object Price { get; set; }
}
public class Remark
{
[J("type", NullValueHandling = N.Ignore)] public string Type { get; set; }
[J("code", NullValueHandling = N.Ignore)] public string Code { get; set; }
[J("summary")] public string Summary { get; set; }
[J("text", NullValueHandling = N.Ignore)] public string Text { get; set; }
[J("tripId")] public object TripId { get; set; }
}
public class Leg {
[J("isWalking", NullValueHandling = N.Ignore)]
public bool? IsWalking { get; set; }
public class Stopover
{
[J("stop", NullValueHandling = N.Ignore)] public Stop Stop { get; set; }
[J("cancelled", NullValueHandling = N.Ignore)] public bool? Cancelled { get; set; }
[J("departure", NullValueHandling = N.Ignore)] public Arrival Departure { get; set; }
[J("arrival", NullValueHandling = N.Ignore)] public Arrival Arrival { get; set; }
}
[J("isTransfer", NullValueHandling = N.Ignore)]
public bool? IsTransfer { get; set; }
public class Params
{
[J("fromPoint", NullValueHandling = N.Ignore)] public Point FromPoint { get; set; }
[J("toPoint", NullValueHandling = N.Ignore)] public Point ToPoint { get; set; }
[J("viaPoint")] public object ViaPoint { get; set; }
[J("earlierRef")] public object EarlierRef { get; set; }
[J("laterRef")] public object LaterRef { get; set; }
[J("results")] public object Results { get; set; }
[J("stopovers", NullValueHandling = N.Ignore)] public bool? Stopovers { get; set; }
[J("polylines", NullValueHandling = N.Ignore)] public bool? Polylines { get; set; }
[J("remarks", NullValueHandling = N.Ignore)] public bool? Remarks { get; set; }
[J("bikeFriendly")] public object BikeFriendly { get; set; }
[J("tickets", NullValueHandling = N.Ignore)] public bool? Tickets { get; set; }
[J("startWithWalking")] public object StartWithWalking { get; set; }
[J("scheduledDays")] public object ScheduledDays { get; set; }
[J("accessibility", NullValueHandling = N.Ignore)] public string Accessibility { get; set; }
[J("transfers")] public object Transfers { get; set; }
[J("transferTime")] public object TransferTime { get; set; }
[J("arrival")] public object Arrival { get; set; }
[J("departure", NullValueHandling = N.Ignore)] public long? Departure { get; set; }
[J("products", NullValueHandling = N.Ignore)] public Products Products { get; set; }
}
[J("cancelled", NullValueHandling = N.Ignore)]
public bool? Cancelled { get; set; }
public partial class OeapiResponse
{
public static OeapiResponse FromJson(string json) => JsonConvert.DeserializeObject<OeapiResponse>(json, Converter.Settings);
}
}
[J("departure", NullValueHandling = N.Ignore)]
public Arrival Departure { get; set; }
[J("arrival", NullValueHandling = N.Ignore)]
public Arrival Arrival { get; set; }
[J("polyline")] public object Polyline { get; set; }
[J("distance")] public object Distance { get; set; }
[J("line", NullValueHandling = N.Ignore)]
public Line Line { get; set; }
[J("direction", NullValueHandling = N.Ignore)]
public string Direction { get; set; }
[J("stopovers", NullValueHandling = N.Ignore)]
public List<Stopover> Stopovers { get; set; }
[J("remarks", NullValueHandling = N.Ignore)]
public List<Remark> Remarks { get; set; }
}
public class Arrival {
[J("point", NullValueHandling = N.Ignore)]
public Point Point { get; set; }
[J("plannedTime")] public long? PlannedTime { get; set; }
[J("prognosedTime")] public long? PrognosedTime { get; set; }
[J("plannedPlatform")] public string PlannedPlatform { get; set; }
[J("prognosedPlatform")] public object PrognosedPlatform { get; set; }
}
public class Point {
[J("stop", NullValueHandling = N.Ignore)]
public Stop Stop { get; set; }
[J("location")] public object Location { get; set; }
}
public class Stop {
[J("id", NullValueHandling = N.Ignore)]
public string Id { get; set; }
[J("name", NullValueHandling = N.Ignore)]
public string Name { get; set; }
[J("location", NullValueHandling = N.Ignore)]
public Location Location { get; set; }
[J("products", NullValueHandling = N.Ignore)]
public Products Products { get; set; }
[J("station")] public object Station { get; set; }
}
public class Location {
[J("latitude", NullValueHandling = N.Ignore)]
public double? Latitude { get; set; }
[J("longitude", NullValueHandling = N.Ignore)]
public double? Longitude { get; set; }
[J("name")] public object Name { get; set; }
[J("address")] public object Address { get; set; }
[J("id")] public object Id { get; set; }
}
public class Products {
[J("nationalExp", NullValueHandling = N.Ignore)]
public bool? NationalExp { get; set; }
[J("national", NullValueHandling = N.Ignore)]
public bool? National { get; set; }
[J("regionalExp", NullValueHandling = N.Ignore)]
public bool? RegionalExp { get; set; }
[J("regional", NullValueHandling = N.Ignore)]
public bool? Regional { get; set; }
[J("suburban", NullValueHandling = N.Ignore)]
public bool? Suburban { get; set; }
[J("bus", NullValueHandling = N.Ignore)]
public bool? Bus { get; set; }
[J("ferry", NullValueHandling = N.Ignore)]
public bool? Ferry { get; set; }
[J("subway", NullValueHandling = N.Ignore)]
public bool? Subway { get; set; }
[J("tram", NullValueHandling = N.Ignore)]
public bool? Tram { get; set; }
[J("taxi", NullValueHandling = N.Ignore)]
public bool? Taxi { get; set; }
}
public class Line {
[J("id", NullValueHandling = N.Ignore)]
public string Id { get; set; }
[J("name", NullValueHandling = N.Ignore)]
public string Name { get; set; }
[J("mode", NullValueHandling = N.Ignore)]
public string Mode { get; set; }
[J("product", NullValueHandling = N.Ignore)]
public string Product { get; set; }
[J("tripNum", NullValueHandling = N.Ignore)]
public string TripNum { get; set; }
[J("productName", NullValueHandling = N.Ignore)]
public string ProductName { get; set; }
[J("fullProductName", NullValueHandling = N.Ignore)]
public string FullProductName { get; set; }
[J("operator")] public object Operator { get; set; }
[J("additionalName")] public string AdditionalName { get; set; }
}
public class Remark {
[J("type", NullValueHandling = N.Ignore)]
public string Type { get; set; }
[J("code", NullValueHandling = N.Ignore)]
public string Code { get; set; }
[J("summary")] public string Summary { get; set; }
[J("text", NullValueHandling = N.Ignore)]
public string Text { get; set; }
[J("tripId")] public object TripId { get; set; }
}
public class Stopover {
[J("stop", NullValueHandling = N.Ignore)]
public Stop Stop { get; set; }
[J("cancelled", NullValueHandling = N.Ignore)]
public bool? Cancelled { get; set; }
[J("departure", NullValueHandling = N.Ignore)]
public Arrival Departure { get; set; }
[J("arrival", NullValueHandling = N.Ignore)]
public Arrival Arrival { get; set; }
}
public class Params {
[J("fromPoint", NullValueHandling = N.Ignore)]
public Point FromPoint { get; set; }
[J("toPoint", NullValueHandling = N.Ignore)]
public Point ToPoint { get; set; }
[J("viaPoint")] public object ViaPoint { get; set; }
[J("earlierRef")] public object EarlierRef { get; set; }
[J("laterRef")] public object LaterRef { get; set; }
[J("results")] public object Results { get; set; }
[J("stopovers", NullValueHandling = N.Ignore)]
public bool? Stopovers { get; set; }
[J("polylines", NullValueHandling = N.Ignore)]
public bool? Polylines { get; set; }
[J("remarks", NullValueHandling = N.Ignore)]
public bool? Remarks { get; set; }
[J("bikeFriendly")] public object BikeFriendly { get; set; }
[J("tickets", NullValueHandling = N.Ignore)]
public bool? Tickets { get; set; }
[J("startWithWalking")] public object StartWithWalking { get; set; }
[J("scheduledDays")] public object ScheduledDays { get; set; }
[J("accessibility", NullValueHandling = N.Ignore)]
public string Accessibility { get; set; }
[J("transfers")] public object Transfers { get; set; }
[J("transferTime")] public object TransferTime { get; set; }
[J("arrival")] public object Arrival { get; set; }
[J("departure", NullValueHandling = N.Ignore)]
public long? Departure { get; set; }
[J("products", NullValueHandling = N.Ignore)]
public Products Products { get; set; }
}
public partial class OeapiResponse {
public static OeapiResponse FromJson(string json) => JsonConvert.DeserializeObject<OeapiResponse>(json, Converter.Settings);
}
}

View file

@ -246,8 +246,7 @@ namespace bahnplan.web.JSON {
}
public class Trainlist {
[J("train", NullValueHandling = NV.Ignore)]
[JsonConverter(typeof(SingleOrArrayConverter<Train>))]
[J("train", NullValueHandling = NV.Ignore), JsonConverter(typeof(SingleOrArrayConverter<Train>))]
public List<Train> Train { get; set; }
}
@ -411,22 +410,20 @@ namespace bahnplan.web.JSON {
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings {
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
Converters = {new IsoDateTimeConverter {DateTimeStyles = DateTimeStyles.AssumeUniversal}},
Converters = {new IsoDateTimeConverter {DateTimeStyles = DateTimeStyles.AssumeUniversal}}
};
}
internal class SingleOrArrayConverter<T> : JsonConverter {
public override bool CanConvert(Type objectType) {
return objectType == typeof(List<T>);
}
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 bool CanWrite => false;
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) {
throw new NotImplementedException();
}

View file

@ -5,7 +5,7 @@
@{
ViewData["Title"] = "Card";
Response.Redirect("/Cards");
if (HttpContext.Session.GetString("authorized") != "true") {
Response.Redirect("/");
return;

View file

@ -4,22 +4,19 @@ using System.Xml;
using System.Xml.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using bahnplan.web.JSON;
using bahnplan.web.JSON.CardResponse;
using bahnplan.web.JSON.ListOrdersResponse;
using LinqToDB;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
using Leg = bahnplan.web.database.Tables.Leg;
namespace bahnplan.web.Pages {
public class CardModel : PageModel {
public void OnPost() {
if (HttpContext.Session.GetString("authorized") != "true") {
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"),
@ -63,7 +60,7 @@ namespace bahnplan.web.Pages {
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,
QrValidTo = parsedCard.Rporderdetails.Order.Tcklist.Tck.Mtk.Nvplist.Nvp.First(p => p.Name == "ebcbarcodegueltigbis").Text
});
}
}

View file

@ -8,37 +8,140 @@
Response.Redirect("/");
return;
}
if (Request.Query.ContainsKey("refresh")) {
Response.Redirect("?edit=true");
return;
}
}
@foreach (var card in Model.Cards) {
<img src="@card.CardQr" alt="Ticketcode"/>
<img src="@card.CardSecCode" alt="Sichtmerkmal"/>
<a href="/Delete?item=card&id=@card.CardId">
<img style="margin: -50px; height: 450px; transform: rotate(-90deg); position: relative; left: 130px" src='data:image/svg+xml;base64,@card.CardImage.Base64Encode()' alt="Bahncardimage"/>
</a>
@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">Delete</a>
</td>
</tr>
}
</tbody>
</table>
<a class="btn btn-sm btn-secondary" href="@Request.Path">Back</a>
<br/>
<br/>
<br/>
}
<p style="text-align: right">
Click on the BahnCard Image to remove a card.
</p>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<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>
else if (Model.Cards.Any()) {
foreach (var card in Model.Cards) {
<img src="@card.CardQr" alt="Ticketcode"/>
<img src="@card.CardSecCode" alt="Sichtmerkmal"/>
<img style="margin: -50px; height: 450px; transform: rotate(-90deg); position: relative; left: 130px" src='data:image/svg+xml;base64,@card.CardImage.Base64Encode()' alt="Bahncardimage"/>
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>
}

View file

@ -1,20 +1,51 @@
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Xml;
using System.Xml.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using bahnplan.web.JSON.CardResponse;
using LinqToDB;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
namespace bahnplan.web.Pages {
public class CardsModel : PageModel {
public List<Card> Cards;
public void OnGet() {
if (HttpContext.Session.GetString("authorized") != "true") {
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"]));
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;
}
using var db = new Database.DbConn();
Cards = db.Cards.Where(p => p.UserId == int.Parse(HttpContext.Session.GetString("uid"))).ToList();
}
}

View file

@ -1,7 +1,6 @@
@page
@using Microsoft.AspNetCore.Http
@using bahnplan.web.database
@using System.Linq
@model DeleteModel
@{
ViewData["Title"] = "Home";
@ -13,19 +12,19 @@
if (Request.Query.ContainsKey("confirm") && Request.Query["confirm"] == "true") {
Layout = null;
Response.Redirect(Request.Headers["Referer"]);
Response.Redirect("/");
return;
}
else {
<h3>Are you sure?</h3>
<p>
You are attempting to delete
@{
await using var db = new Database.DbConn();
}
@switch (Request.Query["item"]) {
<h3>Are you sure?</h3>
<p>
You are attempting to delete
@{
await using var db = new Database.DbConn();
switch (Request.Query["item"]) {
case "trip": {
var legs = db.Legs.Where(p => p.TripId == int.Parse(Request.Query["id"])).OrderBy(p => p.DepTime).ToList();;
var legs = db.Legs.Where(p => p.TripId == int.Parse(Request.Query["id"])).OrderBy(p => p.DepTime).ToList();
<span>
the trip from <b>@legs.First().DepStation</b> to <b>@legs.Last().ArrStation</b>, starting <i>@legs.First().DepTime</i>
@ -48,8 +47,8 @@
break;
}
}
</p>
<a href="@Request.Headers["Referer"]" class="btn btn-sm btn-secondary">Cancel</a>
<a href="/Delete?item=@Request.Query["item"]&id=@Request.Query["id"]&confirm=true" class="btn btn-sm btn-danger">Confirm</a>
}
}
</p>
<a href="@Request.Headers["Referer"]" class="btn btn-sm btn-secondary">Cancel</a>
<a href="/Delete?item=@Request.Query["item"]&id=@Request.Query["id"]&confirm=true" class="btn btn-sm btn-danger">Confirm</a>
}

View file

@ -1,14 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using LinqToDB;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace bahnplan.web.Pages {
public class DeleteModel : PageModel {

View file

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
@ -10,16 +6,14 @@ using Microsoft.Extensions.Logging;
namespace bahnplan.web.Pages {
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class ErrorModel : PageModel {
private readonly ILogger<ErrorModel> _logger;
public ErrorModel(ILogger<ErrorModel> logger) => _logger = logger;
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
private readonly ILogger<ErrorModel> _logger;
public ErrorModel(ILogger<ErrorModel> logger) {
_logger = logger;
}
public void OnGet() {
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}

View file

@ -1,7 +1,6 @@
@page
@using Microsoft.AspNetCore.Http
@using bahnplan.web.database
@using System.Linq
@model IndexModel
@{
ViewData["Title"] = "Home";

View file

@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace bahnplan.web.Pages {
public class IndexModel : PageModel {

View file

@ -1,10 +1,10 @@
@page
@using bahnplan.web.database
@using Microsoft.AspNetCore.Http
@using bahnplan.web.database
@model InspectionModel
@{
ViewData["Title"] = "Inspection";
if (HttpContext.Session.GetString("authorized") != "true") {
Response.Redirect("/");
return;
@ -29,6 +29,32 @@
<img src="@card.CardQr" alt="Ticketcode"/>
<img src="@card.CardSecCode" alt="Sichtmerkmal"/>
<img style="margin: -50px; height: 450px; transform: rotate(-90deg); position: relative; left: 130px" src='data:image/svg+xml;base64,@card.CardImage.Base64Encode()' alt="Bahncardimage"/>
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>
}
}
else {
<div class="alert alert-warning" role="alert">
@ -43,6 +69,32 @@ else if (Model.Ticket.TicketInfo.Contains("BC 25")) {
<img src="@card.CardQr" alt="Ticketcode"/>
<img src="@card.CardSecCode" alt="Sichtmerkmal"/>
<img style="margin: -50px; height: 450px; transform: rotate(-90deg); position: relative; left: 130px" src='data:image/svg+xml;base64,@card.CardImage.Base64Encode()' alt="Bahncardimage"/>
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>
}
}
else {
<div class="alert alert-warning" role="alert">

View file

@ -1,4 +1,3 @@
using System.Collections.Generic;
using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
@ -7,16 +6,16 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
namespace bahnplan.web.Pages {
public class InspectionModel : PageModel {
public Leg Leg;
public Ticket Ticket;
public Leg Leg;
public void OnGet() {
if (HttpContext.Session.GetString("authorized") != "true") {
if (HttpContext.Session.GetString("authorized") != "true")
return;
}
using var db = new Database.DbConn();
Ticket = db.Tickets.First(p => p.TicketId == int.Parse(Request.Query["id"]));
Leg = db.Legs.First(p => p.LegId == int.Parse(Request.Query["leg"]));
Leg = db.Legs.First(p => p.LegId == int.Parse(Request.Query["leg"]));
}
}
}

View file

@ -1,3 +1,4 @@
using System;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
@ -12,8 +13,7 @@ namespace bahnplan.web.Pages {
return;
using var db = new Database.DbConn();
var user = db.Users.FirstOrDefault(p => p.Username == Request.Form["user"].ToString()
&& p.Password == Request.Form["pass"].ToString().Sha256());
var user = db.Users.FirstOrDefault(p => p.Username == Request.Form["user"].ToString() && p.Password == Request.Form["pass"].ToString().Sha256());
if (user == null)
return;
@ -24,28 +24,26 @@ namespace bahnplan.web.Pages {
//TODO
}
}
public static class StringExtensions {
public static string Sha256(this string rawData) {
// Create a SHA256
using var sha256Hash = SHA256.Create();
// ComputeHash - returns byte array
var bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(rawData));
// Convert byte array to a string
var builder = new StringBuilder();
for (var i = 0; i < bytes.Length; i++) {
for (var i = 0; i < bytes.Length; i++)
builder.Append(bytes[i].ToString("x2"));
}
return builder.ToString();
}
public static string Base64Encode(this string plainText) {
var plainTextBytes = Encoding.UTF8.GetBytes(plainText);
return System.Convert.ToBase64String(plainTextBytes);
return Convert.ToBase64String(plainTextBytes);
}
}
}

View file

@ -4,4 +4,4 @@
@{
Layout = null;
Response.Redirect("/");
}
}

View file

@ -1,10 +1,3 @@
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using LinqToDB;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace bahnplan.web.Pages {

View file

@ -3,12 +3,12 @@
@model OEAPIModel
@{
ViewData["Title"] = "OEAPI";
if (HttpContext.Session.GetString("authorized") != "true") {
Response.Redirect("/");
return;
}
Response.Redirect("/Trip?id=" + Model.TripId + "&edit=true");
}

View file

@ -1,21 +1,12 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using bahnplan.web.JSON;
using LinqToDB;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Leg = bahnplan.web.database.Tables.Leg;
// ReSharper disable PossibleInvalidOperationException
@ -25,11 +16,9 @@ namespace bahnplan.web.Pages {
public int TripId;
public void OnGet() {
if (HttpContext.Session.GetString("authorized") != "true") {
if (HttpContext.Session.GetString("authorized") != "true")
return;
}
var link = Request.Query["link"].ToString();
var shortcode = link;
if (link.Contains("oeffisear.ch"))
@ -61,7 +50,7 @@ namespace bahnplan.web.Pages {
ArrTime = arrtime.ToString("yyyy-MM-ddTHH:mm:ss"),
DepStation = journey.Departure.Point.Stop.Name,
DepStationId = int.Parse(journey.Departure.Point.Stop.Id),
DepTime = deptime.ToString("yyyy-MM-ddTHH:mm:ss"),
DepTime = deptime.ToString("yyyy-MM-ddTHH:mm:ss")
});
}

View file

@ -1,18 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace bahnplan.web.Pages {
public class PrivacyModel : PageModel {
private readonly ILogger<PrivacyModel> _logger;
public PrivacyModel(ILogger<PrivacyModel> logger) {
_logger = logger;
}
public PrivacyModel(ILogger<PrivacyModel> logger) => _logger = logger;
public void OnGet() { }
}

View file

@ -1,6 +1,4 @@
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using LinqToDB;
@ -10,21 +8,21 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
namespace bahnplan.web.Pages {
public class RegisterModel : PageModel {
public void OnPost() {
if (!Request.HasFormContentType || string.IsNullOrWhiteSpace(Request.Form["user"]) || string.IsNullOrWhiteSpace(Request.Form["pass"]) || string.IsNullOrWhiteSpace(Request.Form["code"]))
if (!Request.HasFormContentType
|| string.IsNullOrWhiteSpace(Request.Form["user"])
|| string.IsNullOrWhiteSpace(Request.Form["pass"])
|| string.IsNullOrWhiteSpace(Request.Form["code"]))
return;
if (Request.Form["code"] != System.IO.File.ReadAllLines("regkey.txt")[0])
return;
using var db = new Database.DbConn();
var user = db.Users.FirstOrDefault(p => p.Username == Request.Form["user"].ToString());
using var db = new Database.DbConn();
var user = db.Users.FirstOrDefault(p => p.Username == Request.Form["user"].ToString());
if (user != null)
return; //user already exists
var uid = db.InsertWithInt32Identity(new User {
Username = Request.Form["user"].ToString(),
Password = Request.Form["pass"].ToString().Sha256(),
});
var uid = db.InsertWithInt32Identity(new User {Username = Request.Form["user"].ToString(), Password = Request.Form["pass"].ToString().Sha256()});
HttpContext.Session.SetString("uid", uid.ToString());
HttpContext.Session.SetString("authorized", "true");

View file

@ -65,6 +65,6 @@
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@RenderSection("Scripts", required: false)
@RenderSection("Scripts", false)
</body>
</html>

View file

@ -3,12 +3,12 @@
@model TicketModel
@{
ViewData["Title"] = "Ticket";
if (HttpContext.Session.GetString("authorized") != "true") {
Response.Redirect("/");
return;
}
Response.Redirect("/Trip?id=" + Model.TripId + "&edit=true");
}

View file

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using bahnplan.web.database;
@ -11,9 +7,7 @@ using bahnplan.web.database.Tables;
using bahnplan.web.JSON;
using LinqToDB;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Leg = bahnplan.web.database.Tables.Leg;
@ -22,11 +16,9 @@ namespace bahnplan.web.Pages {
public int TripId;
public void OnGet() {
if (HttpContext.Session.GetString("authorized") != "true") {
if (HttpContext.Session.GetString("authorized") != "true")
return;
}
using var db = new Database.DbConn();
if (db.Tickets.Any(p => p.OrderId == Request.Query["order"].ToString())) {
var tripId = Request.Query["action"] == "addleg"
@ -34,7 +26,7 @@ namespace bahnplan.web.Pages {
: db.InsertWithInt32Identity(new Trip {UserId = int.Parse(HttpContext.Session.GetString("uid"))});
var ticketId = db.Tickets.First(p => p.OrderId == Request.Query["order"].ToString()).TicketId;
foreach (var leg in db.TicketLegs.Where(p => p.TicketId == ticketId).ToList()) {
foreach (var leg in db.TicketLegs.Where(p => p.TicketId == ticketId).ToList())
db.InsertWithInt32Identity(new Leg {
TripId = tripId,
UserId = int.Parse(HttpContext.Session.GetString("uid")),
@ -46,9 +38,8 @@ namespace bahnplan.web.Pages {
DepStation = leg.DepStation,
DepStationId = leg.DepStationId,
DepTime = leg.DepTime,
TicketId = ticketId,
TicketId = ticketId
});
}
TripId = tripId;
}
@ -79,7 +70,7 @@ namespace bahnplan.web.Pages {
TicketPkPass = parsed.Rporderdetails.Order.Tcklist.Tck.Htdata.Ht.First(p => p.Name == "pass").Text, // application/vnd.apple.pkpass;base64
Traveller = parsed.Rporderdetails.Order.Tcklist.Tck.Mtk.ReisenderVorname
+ " "
+ parsed.Rporderdetails.Order.Tcklist.Tck.Mtk.ReisenderNachname,
+ parsed.Rporderdetails.Order.Tcklist.Tck.Mtk.ReisenderNachname
});
foreach (var leg in parsed.Rporderdetails.Order.Schedulelist.Out.Trainlist.Train) {
@ -94,7 +85,7 @@ namespace bahnplan.web.Pages {
DepStation = leg.Dep.Name,
DepStationId = int.Parse(leg.Dep.BhfNr),
DepTime = leg.Dep.Date.Replace("00:00:00", leg.Dep.Time),
TicketId = ticketId,
TicketId = ticketId
});
db.InsertWithInt32Identity(new TicketLeg {
@ -106,7 +97,7 @@ namespace bahnplan.web.Pages {
ArrTime = leg.Arr.Date.Replace("00:00:00", leg.Arr.Time),
DepStation = leg.Dep.Name,
DepStationId = int.Parse(leg.Dep.BhfNr),
DepTime = leg.Dep.Date.Replace("00:00:00", leg.Dep.Time),
DepTime = leg.Dep.Date.Replace("00:00:00", leg.Dep.Time)
});
}

View file

@ -1,10 +1,10 @@
@page
@using bahnplan.web.database
@using Microsoft.AspNetCore.Http
@using bahnplan.web.database
@model TripModel
@{
ViewData["Title"] = "Trip";
if (HttpContext.Session.GetString("authorized") != "true") {
Response.Redirect("/");
return;
@ -107,8 +107,8 @@
else {
<a class="btn btn-sm btn-danger disabled">Ticket</a>
}
<a class="btn btn-sm btn-primary" href="https://marudor.de/details/@leg.TrainType @leg.TrainNr/@(deptime.ToUniversalTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds)000/?station=@leg.DepStationId">Marudor</a>
<a class="btn btn-sm btn-warning" href="https://travelynx.de/s/@leg.DepStationId?train=@leg.TrainType @leg.TrainNr">Travelynx</a>
<a class="btn btn-sm btn-primary" href="https://marudor.de/details/@leg.TrainType @leg.TrainNr/@(deptime.ToUniversalTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds)000/?station=@leg.DepStationId" target="_blank">Marudor</a>
<a class="btn btn-sm btn-warning" href="https://travelynx.de/s/@leg.DepStationId?train=@leg.TrainType @leg.TrainNr" target="_blank">Travelynx</a>
</td>
}
else {

View file

@ -11,9 +11,8 @@ namespace bahnplan.web.Pages {
public List<Leg> Legs;
public void OnGet() {
if (HttpContext.Session.GetString("authorized") != "true") {
if (HttpContext.Session.GetString("authorized") != "true")
return;
}
using var db = new Database.DbConn();
if (Request.Query.ContainsKey("separator")) {
@ -28,7 +27,7 @@ namespace bahnplan.web.Pages {
ArrTime = "_",
DepStation = "_",
DepStationId = 0,
DepTime = leg.DepTime + "_placeholder",
DepTime = leg.DepTime + "_placeholder"
});
return;
}

View file

@ -1,20 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using bahnplan.web.database;
using LinqToDB.Common;
using LinqToDB.Data;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace bahnplan.web {
public class Program {
public static void Main(string[] args) {
DataConnection.DefaultSettings = new Database.Settings();
LinqToDB.Common.Configuration.Linq.AllowMultipleQuery = true;
DataConnection.DefaultSettings = new Database.Settings();
Configuration.Linq.AllowMultipleQuery = true;
Directory.CreateDirectory(Variables.TicketDir);
CreateHostBuilder(args).Build().Run();
}

View file

@ -1,20 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace bahnplan.web {
public class Startup {
public Startup(IConfiguration configuration) {
Configuration = configuration;
}
public Startup(IConfiguration configuration) => Configuration = configuration;
public IConfiguration Configuration { get; }

View file

@ -1,4 +1,3 @@
using System;
using System.IO;
namespace bahnplan.web {

View file

@ -3,6 +3,7 @@ using System.Linq;
using bahnplan.web.database.Tables;
using LinqToDB;
using LinqToDB.Configuration;
using LinqToDB.Data;
namespace bahnplan.web.database {
public class Database {
@ -24,15 +25,15 @@ namespace bahnplan.web.database {
}
}
public class DbConn : LinqToDB.Data.DataConnection {
public class DbConn : DataConnection {
public DbConn() : base("db") { }
public ITable<User> Users => GetTable<User>();
public ITable<Leg> Legs => GetTable<Leg>();
public ITable<Ticket> Tickets => GetTable<Ticket>();
public ITable<User> Users => GetTable<User>();
public ITable<Leg> Legs => GetTable<Leg>();
public ITable<Ticket> Tickets => GetTable<Ticket>();
public ITable<TicketLeg> TicketLegs => GetTable<TicketLeg>();
public ITable<Trip> Trips => GetTable<Trip>();
public ITable<Card> Cards => GetTable<Card>();
public ITable<Trip> Trips => GetTable<Trip>();
public ITable<Card> Cards => GetTable<Card>();
}
}
}

View file

@ -5,47 +5,33 @@ namespace bahnplan.web.database.Tables {
public class Card {
[Column(Name = "CardID"), PrimaryKey, Identity, NotNull]
public int CardId { get; set; }
[Column(Name = "OrderID"), NotNull]
public string OrderId { get; set; }
[Column(Name = "UserID"), NotNull]
public int UserId { get; set; }
[Column(Name = "CardNumber"), NotNull]
public string CardNumber { get; set; }
[Column(Name = "OrderID"), NotNull] public string OrderId { get; set; }
[Column(Name = "Class"), NotNull]
public int Class { get; set; }
[Column(Name = "Value"), NotNull]
public int Value { get; set; }
[Column(Name = "Traveller")]
public string Traveller { get; set; }
[Column(Name = "CardQR")]
public string CardQr { get; set; }
[Column(Name = "CardSecCode")]
public string CardSecCode { get; set; }
[Column(Name = "CardImage")]
public string CardImage { get; set; }
[Column(Name = "CardInfo")]
public string CardInfo { get; set; }
[Column(Name = "UserID"), NotNull] public int UserId { get; set; }
[Column(Name = "ValidFrom")]
public string ValidFrom { get; set; }
[Column(Name = "ValidTo")]
public string ValidTo { get; set; }
[Column(Name = "QRValidFrom")]
public string QrValidFrom { get; set; }
[Column(Name = "QRValidTo")]
public string QrValidTo { get; set; }
[Column(Name = "CardNumber"), NotNull] public string CardNumber { get; set; }
[Column(Name = "Class"), NotNull] public int Class { get; set; }
[Column(Name = "Value"), NotNull] public int Value { get; set; }
[Column(Name = "Traveller")] public string Traveller { get; set; }
[Column(Name = "CardQR")] public string CardQr { get; set; }
[Column(Name = "CardSecCode")] public string CardSecCode { get; set; }
[Column(Name = "CardImage")] public string CardImage { get; set; }
[Column(Name = "CardInfo")] public string CardInfo { get; set; }
[Column(Name = "ValidFrom")] public string ValidFrom { get; set; }
[Column(Name = "ValidTo")] public string ValidTo { get; set; }
[Column(Name = "QRValidFrom")] public string QrValidFrom { get; set; }
[Column(Name = "QRValidTo")] public string QrValidTo { get; set; }
}
}

View file

@ -5,38 +5,29 @@ namespace bahnplan.web.database.Tables {
public class Leg {
[Column(Name = "LegID"), PrimaryKey, Identity, NotNull]
public int LegId { get; set; }
[Column(Name = "TripID"), NotNull]
public int TripId { get; set; }
[Column(Name = "UserID"), NotNull]
public int UserId { get; set; }
[Column(Name = "TripID"), NotNull] public int TripId { get; set; }
[Column(Name = "UserID"), NotNull] public int UserId { get; set; }
[Column(Name = "TrainType"), NotNull] public string TrainType { get; set; }
[Column(Name = "TrainNr"), NotNull] public int TrainNr { get; set; }
[Column(Name = "TrainType"), NotNull]
public string TrainType { get; set; }
[Column(Name = "TrainNr"), NotNull]
public int TrainNr { get; set; }
[Column(Name = "DepStationID"), NotNull]
public int DepStationId { get; set; }
[Column(Name = "DepStation"), NotNull]
public string DepStation { get; set; }
[Column(Name = "DepTime"), NotNull]
public string DepTime { get; set; }
[Column(Name = "DepStation"), NotNull] public string DepStation { get; set; }
[Column(Name = "DepTime"), NotNull] public string DepTime { get; set; }
[Column(Name = "ArrStationID"), NotNull]
public int ArrStationId { get; set; }
[Column(Name = "ArrStation"), NotNull]
public string ArrStation { get; set; }
[Column(Name = "ArrStation"), NotNull] public string ArrStation { get; set; }
[Column(Name = "ArrTime"), NotNull]
public string ArrTime { get; set; }
[Column(Name = "TicketID")]
public int TicketId { get; set; }
[Column(Name = "ArrTime"), NotNull] public string ArrTime { get; set; }
[Column(Name = "TicketID")] public int TicketId { get; set; }
}
}

View file

@ -5,26 +5,21 @@ namespace bahnplan.web.database.Tables {
public class Ticket {
[Column(Name = "TicketID"), PrimaryKey, Identity, NotNull]
public int TicketId { get; set; }
[Column(Name = "OrderID"), NotNull]
public string OrderId { get; set; }
[Column(Name = "UserID"), NotNull]
public int UserId { get; set; }
[Column(Name = "TicketInfo"), NotNull]
public string TicketInfo { get; set; }
[Column(Name = "TicketQR"), NotNull]
public string TicketQr { get; set; }
[Column(Name = "OrderID"), NotNull] public string OrderId { get; set; }
[Column(Name = "UserID"), NotNull] public int UserId { get; set; }
[Column(Name = "TicketInfo"), NotNull] public string TicketInfo { get; set; }
[Column(Name = "TicketQR"), NotNull] public string TicketQr { get; set; }
[Column(Name = "TicketSecCode"), NotNull]
public string TicketSecCode { get; set; }
[Column(Name = "TicketPkPass"), NotNull]
public string TicketPkPass { get; set; }
[Column(Name = "Traveller")]
public string Traveller { get; set; }
[Column(Name = "Traveller")] public string Traveller { get; set; }
}
}

View file

@ -5,32 +5,25 @@ namespace bahnplan.web.database.Tables {
public class TicketLeg {
[Column(Name = "TicketLegID"), PrimaryKey, Identity, NotNull]
public int TicketLegId { get; set; }
[Column(Name = "TicketID"), NotNull]
public int TicketId { get; set; }
[Column(Name = "TrainType"), NotNull]
public string TrainType { get; set; }
[Column(Name = "TrainNr"), NotNull]
public int TrainNr { get; set; }
[Column(Name = "TicketID"), NotNull] public int TicketId { get; set; }
[Column(Name = "TrainType"), NotNull] public string TrainType { get; set; }
[Column(Name = "TrainNr"), NotNull] public int TrainNr { get; set; }
[Column(Name = "DepStationID"), NotNull]
public int DepStationId { get; set; }
[Column(Name = "DepStation"), NotNull]
public string DepStation { get; set; }
[Column(Name = "DepTime"), NotNull]
public string DepTime { get; set; }
[Column(Name = "DepStation"), NotNull] public string DepStation { get; set; }
[Column(Name = "DepTime"), NotNull] public string DepTime { get; set; }
[Column(Name = "ArrStationID"), NotNull]
public int ArrStationId { get; set; }
[Column(Name = "ArrStation"), NotNull]
public string ArrStation { get; set; }
[Column(Name = "ArrStation"), NotNull] public string ArrStation { get; set; }
[Column(Name = "ArrTime"), NotNull]
public string ArrTime { get; set; }
[Column(Name = "ArrTime"), NotNull] public string ArrTime { get; set; }
}
}

View file

@ -1,10 +1,9 @@
using LinqToDB.Mapping;
namespace bahnplan.web.database.Tables {
[Table(Name = "Trips")]
public class Trip {
[Column(Name = "TripID"), PrimaryKey, Identity, NotNull]
[Column(Name = "TripID"), PrimaryKey, Identity, NotNull]
public int TripId { get; set; }
[Column(Name = "UserID"), PrimaryKey, NotNull]

View file

@ -1,4 +1,3 @@
using System;
using LinqToDB.Mapping;
namespace bahnplan.web.database.Tables {
@ -7,10 +6,8 @@ namespace bahnplan.web.database.Tables {
[Column(Name = "UserID"), PrimaryKey, Identity, NotNull]
public int UserId { get; set; }
[Column(Name = "Username"), NotNull]
public string Username { get; set; }
[Column(Name = "Password"), NotNull]
public string Password { get; set; }
[Column(Name = "Username"), NotNull] public string Username { get; set; }
[Column(Name = "Password"), NotNull] public string Password { get; set; }
}
}

View file

@ -5303,7 +5303,7 @@
for (var i = 0, len = elements.length; i < len; i++) {
var _ret = _loop(i, len);
if (_ret === "continue") continue;
if (_ret === "continue")
}
return createdDocument.body.innerHTML;

View file

@ -2725,7 +2725,7 @@
for (var i = 0, len = elements.length; i < len; i++) {
var _ret = _loop(i, len);
if (_ret === "continue") continue;
if (_ret === "continue")
}
return createdDocument.body.innerHTML;

View file

@ -322,7 +322,7 @@ $.extend( $.validator, {
];
if ( event.which === 9 && this.elementValue( element ) === "" || $.inArray( event.keyCode, excludedKeys ) !== -1 ) {
return;
} else if ( element.name in this.submitted || element.name in this.invalid ) {
this.element( element );
}

View file

@ -2804,7 +2804,7 @@ function nodeName( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
};
}
var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );