Public release
This commit is contained in:
commit
4ef567d257
152
.gitignore
vendored
Normal file
152
.gitignore
vendored
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
/packages/
|
||||||
|
/_ReSharper.Caches/
|
||||||
|
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/rider,dotnetcore,jetbrains+all
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=rider,dotnetcore,jetbrains+all
|
||||||
|
|
||||||
|
### DotnetCore ###
|
||||||
|
# .NET Core build folders
|
||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
|
||||||
|
# Common node modules locations
|
||||||
|
/node_modules
|
||||||
|
/wwwroot/node_modules
|
||||||
|
|
||||||
|
### JetBrains+all ###
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/**/usage.statistics.xml
|
||||||
|
.idea/**/dictionaries
|
||||||
|
.idea/**/shelf
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
.idea/**/contentModel.xml
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
.idea/**/dbnavigator.xml
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
.idea/**/libraries
|
||||||
|
|
||||||
|
# Gradle and Maven with auto-import
|
||||||
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
|
# auto-import.
|
||||||
|
# .idea/artifacts
|
||||||
|
# .idea/compiler.xml
|
||||||
|
# .idea/jarRepositories.xml
|
||||||
|
# .idea/modules.xml
|
||||||
|
# .idea/*.iml
|
||||||
|
# .idea/modules
|
||||||
|
# *.iml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
# File-based project format
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
.idea/httpRequests
|
||||||
|
|
||||||
|
# Android studio 3.1+ serialized cache file
|
||||||
|
.idea/caches/build_file_checksums.ser
|
||||||
|
|
||||||
|
### JetBrains+all Patch ###
|
||||||
|
# Ignores the whole .idea folder and all .iml files
|
||||||
|
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
|
||||||
|
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
|
||||||
|
|
||||||
|
*.iml
|
||||||
|
modules.xml
|
||||||
|
.idea/misc.xml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
# Sonarlint plugin
|
||||||
|
.idea/sonarlint
|
||||||
|
|
||||||
|
### Rider ###
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
|
||||||
|
# Gradle and Maven with auto-import
|
||||||
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
|
# auto-import.
|
||||||
|
# .idea/artifacts
|
||||||
|
# .idea/compiler.xml
|
||||||
|
# .idea/jarRepositories.xml
|
||||||
|
# .idea/modules.xml
|
||||||
|
# .idea/*.iml
|
||||||
|
# .idea/modules
|
||||||
|
# *.iml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
|
||||||
|
# File-based project format
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
|
||||||
|
# Android studio 3.1+ serialized cache file
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/rider,dotnetcore,jetbrains+all
|
||||||
|
database.db
|
||||||
|
regkey.txt
|
23
LICENSE
Normal file
23
LICENSE
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Laura Hausmann
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
|
10
README.md
Normal file
10
README.md
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# bahnplan.web or DBNav2
|
||||||
|
|
||||||
|
- Copy database.db.example to database.db
|
||||||
|
- Generate a random string (or use something else) and save it to regkey.txt to allow registrations
|
||||||
|
|
||||||
|
## DISCLAIMER
|
||||||
|
- This is very early alpha
|
||||||
|
- Stuff WILL break
|
||||||
|
- I am not responsible if some DB guy comes knocking on your doorstep if you use this or this software creates any kind of other damages
|
||||||
|
- Most importantly: have fun.
|
16
bahnplan.sln
Normal file
16
bahnplan.sln
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bahnplan.web", "bahnplan.web\bahnplan.web.csproj", "{41B83C7E-6F7E-4EE0-A332-D87A7FE3183E}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{41B83C7E-6F7E-4EE0-A332-D87A7FE3183E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{41B83C7E-6F7E-4EE0-A332-D87A7FE3183E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{41B83C7E-6F7E-4EE0-A332-D87A7FE3183E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{41B83C7E-6F7E-4EE0-A332-D87A7FE3183E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
29
bahnplan.web/Controllers/TestController.cs
Normal file
29
bahnplan.web/Controllers/TestController.cs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace bahnplan.web.Controllers {
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
public class TestController : ControllerBase {
|
||||||
|
[HttpGet]
|
||||||
|
public ApiResponse Get() {
|
||||||
|
return 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
146
bahnplan.web/JSON/CardResponse/CardResponse.cs
Normal file
146
bahnplan.web/JSON/CardResponse/CardResponse.cs
Normal file
|
@ -0,0 +1,146 @@
|
||||||
|
// <auto-generated />
|
||||||
|
//
|
||||||
|
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
|
||||||
|
//
|
||||||
|
// using bahnplan.web.JSON.CardResponse;
|
||||||
|
//
|
||||||
|
// var cardResponse = CardResponse.FromJson(jsonString);
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
|
||||||
|
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 }
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
61
bahnplan.web/JSON/ListOrdersResponse/ListOrdersResponse.cs
Normal file
61
bahnplan.web/JSON/ListOrdersResponse/ListOrdersResponse.cs
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
// <auto-generated />
|
||||||
|
//
|
||||||
|
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
|
||||||
|
//
|
||||||
|
// using bahnplan.web.JSON;
|
||||||
|
//
|
||||||
|
// var listOrdersResponse = ListOrdersResponse.FromJson(jsonString);
|
||||||
|
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
159
bahnplan.web/JSON/OEAPIResponse.cs
Normal file
159
bahnplan.web/JSON/OEAPIResponse.cs
Normal file
|
@ -0,0 +1,159 @@
|
||||||
|
// <auto-generated />
|
||||||
|
//
|
||||||
|
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
|
||||||
|
//
|
||||||
|
// using bahnplan.web.JSON;
|
||||||
|
//
|
||||||
|
// var oeapiResponse = OeapiResponse.FromJson(jsonString);
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
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 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; }
|
||||||
|
}
|
||||||
|
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
|
||||||
|
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 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);
|
||||||
|
}
|
||||||
|
}
|
434
bahnplan.web/JSON/TicketResponse.cs
Normal file
434
bahnplan.web/JSON/TicketResponse.cs
Normal file
|
@ -0,0 +1,434 @@
|
||||||
|
// <auto-generated />
|
||||||
|
//
|
||||||
|
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
|
||||||
|
//
|
||||||
|
// using bahnplan.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 bahnplan.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)]
|
||||||
|
public PosinfoElement Posinfo { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FluffyChildlist {
|
||||||
|
[J("posinfo", NullValueHandling = NV.Ignore)]
|
||||||
|
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)]
|
||||||
|
public 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)]
|
||||||
|
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)]
|
||||||
|
public 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 Out Out { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Out {
|
||||||
|
[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)]
|
||||||
|
public 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 CanConvert(Type objectType) {
|
||||||
|
return 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
bahnplan.web/Pages/Card.cshtml
Normal file
15
bahnplan.web/Pages/Card.cshtml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
@page
|
||||||
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@model CardModel
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Card";
|
||||||
|
Response.Redirect("/Cards");
|
||||||
|
|
||||||
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
|
Response.Redirect("/");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Card saved. Redirecting...
|
71
bahnplan.web/Pages/Card.cshtml.cs
Normal file
71
bahnplan.web/Pages/Card.cshtml.cs
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
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;
|
||||||
|
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") {
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
44
bahnplan.web/Pages/Cards.cshtml
Normal file
44
bahnplan.web/Pages/Cards.cshtml
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
@page
|
||||||
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@model CardsModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Cards";
|
||||||
|
|
||||||
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
|
Response.Redirect("/");
|
||||||
|
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>
|
||||||
|
<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>
|
21
bahnplan.web/Pages/Cards.cshtml.cs
Normal file
21
bahnplan.web/Pages/Cards.cshtml.cs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using bahnplan.web.database;
|
||||||
|
using bahnplan.web.database.Tables;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace bahnplan.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();
|
||||||
|
Cards = db.Cards.Where(p => p.UserId == int.Parse(HttpContext.Session.GetString("uid"))).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
bahnplan.web/Pages/Delete.cshtml
Normal file
17
bahnplan.web/Pages/Delete.cshtml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
@page
|
||||||
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@using bahnplan.web.database
|
||||||
|
@using System.Linq
|
||||||
|
@model DeleteModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Home";
|
||||||
|
|
||||||
|
|
||||||
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
|
Response.Redirect("/");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Layout = null;
|
||||||
|
Response.Redirect(Request.Headers["Referer"]);
|
||||||
|
}
|
50
bahnplan.web/Pages/Delete.cshtml.cs
Normal file
50
bahnplan.web/Pages/Delete.cshtml.cs
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
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 {
|
||||||
|
public User AuthorizedUser;
|
||||||
|
|
||||||
|
public void OnGet() {
|
||||||
|
if (HttpContext.Session.GetString("authorized") != "true")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var uid = int.Parse(HttpContext.Session.GetString("uid"));
|
||||||
|
using var db = new Database.DbConn();
|
||||||
|
AuthorizedUser = db.Users.FirstOrDefault(p => p.UserId == uid);
|
||||||
|
var id = int.Parse(Request.Query["id"]);
|
||||||
|
|
||||||
|
switch (Request.Query["item"]) {
|
||||||
|
case "trip": {
|
||||||
|
db.Trips.Delete(p => p.TripId == id);
|
||||||
|
db.Legs.Delete(p => p.TripId == id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "leg": {
|
||||||
|
var tripid = db.Legs.First(p => p.LegId == id).TripId;
|
||||||
|
db.Legs.Delete(p => p.LegId == id);
|
||||||
|
if (!db.Legs.Any(p => p.TripId == tripid))
|
||||||
|
db.Trips.Delete(p => p.TripId == tripid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "ticket": {
|
||||||
|
db.Legs.Where(p => p.LegId == id).Set(p => p.TicketId, 0).Update();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "card": {
|
||||||
|
db.Cards.Delete(p => p.CardId == id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
bahnplan.web/Pages/Error.cshtml
Normal file
25
bahnplan.web/Pages/Error.cshtml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
@page
|
||||||
|
@model ErrorModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Error";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1 class="text-danger">Error.</h1>
|
||||||
|
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||||
|
|
||||||
|
@if (Model.ShowRequestId) {
|
||||||
|
<p>
|
||||||
|
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
<h3>Development Mode</h3>
|
||||||
|
<p>
|
||||||
|
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||||
|
It can result in displaying sensitive information from exceptions to end users.
|
||||||
|
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||||
|
and restarting the app.
|
||||||
|
</p>
|
27
bahnplan.web/Pages/Error.cshtml.cs
Normal file
27
bahnplan.web/Pages/Error.cshtml.cs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
namespace bahnplan.web.Pages {
|
||||||
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
|
public class ErrorModel : PageModel {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
88
bahnplan.web/Pages/Index.cshtml
Normal file
88
bahnplan.web/Pages/Index.cshtml
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
@page
|
||||||
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@using bahnplan.web.database
|
||||||
|
@using System.Linq
|
||||||
|
@model IndexModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Home";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
@if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
|
<h1 class="display-4">Welcome</h1>
|
||||||
|
<p>Please log in 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">Date</th>
|
||||||
|
<th scope="col">Origin</th>
|
||||||
|
<th scope="col">Via</th>
|
||||||
|
<th scope="col">Destination</th>
|
||||||
|
<th scope="col">Actions</th>
|
||||||
|
<th scope="col">Danger zone</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.OrderBy(p => db.Legs.First(a => a.TripId == p.TripId).ArrTime)) {
|
||||||
|
var legs = db.Legs.Where(p => p.TripId == trip.TripId).OrderBy(p => p.DepTime).ToList();
|
||||||
|
var dates = DateTime.Parse(legs.First().DepTime).Date == DateTime.Parse(legs.Last().DepTime).Date ? legs.First().DepTime.Substring(0, 10) : legs.First().DepTime.Substring(0, 10) + "<br/>" + legs.Last().DepTime.Substring(0, 10);
|
||||||
|
<tr>
|
||||||
|
<td>@Html.Raw(dates)</td>
|
||||||
|
<td>@Html.Raw(legs.First().DepStation.PadRight(30, ' ').Substring(0, 30).Replace(" ", " "))</td>
|
||||||
|
<td>
|
||||||
|
@((from index in from leg in legs where leg.TrainType == "placeholder" select legs.IndexOf(leg) select legs[index - 1].ArrStation).ToList().DefaultIfEmpty("-").Aggregate((s1, s2) => $"{s1}, {s2}"))
|
||||||
|
</td>
|
||||||
|
<td>@Html.Raw(legs.Last().ArrStation.PadRight(30, ' ').Substring(0, 30).Replace(" ", " "))</td>
|
||||||
|
<td>
|
||||||
|
<a class="btn btn-sm btn-primary" href="/Trip?id=@trip.TripId">View</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=trip&id=@trip.TripId">Delete Trip</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 oeffisear.ch</h3>
|
||||||
|
<br/>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control" name="link" placeholder="oeffisear.ch link / shortcode">
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
25
bahnplan.web/Pages/Index.cshtml.cs
Normal file
25
bahnplan.web/Pages/Index.cshtml.cs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
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 {
|
||||||
|
public User AuthorizedUser;
|
||||||
|
|
||||||
|
public void OnGet() {
|
||||||
|
if (HttpContext.Session.GetString("authorized") != "true")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var uid = int.Parse(HttpContext.Session.GetString("uid"));
|
||||||
|
using var db = new Database.DbConn();
|
||||||
|
AuthorizedUser = db.Users.FirstOrDefault(p => p.UserId == uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
52
bahnplan.web/Pages/Inspection.cshtml
Normal file
52
bahnplan.web/Pages/Inspection.cshtml
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
@page
|
||||||
|
@using bahnplan.web.database
|
||||||
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@model InspectionModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Inspection";
|
||||||
|
|
||||||
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
|
Response.Redirect("/");
|
||||||
|
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>
|
||||||
|
|
||||||
|
<img src="@Model.Ticket.TicketQr" alt="Ticketcode"/>
|
||||||
|
<img src="@Model.Ticket.TicketSecCode" alt="Sichtmerkmal"/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
@Model.Ticket.TicketInfo
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
@if (Model.Ticket.TicketInfo.Contains("BC 50")) {
|
||||||
|
await using var db = new Database.DbConn();
|
||||||
|
if (db.Cards.Any(p => p.Value == 50 && p.Traveller == Model.Ticket.Traveller)) {
|
||||||
|
var card = db.Cards.First(p => p.Value == 50 && p.Traveller == Model.Ticket.Traveller);
|
||||||
|
<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"/>
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
<div class="alert alert-warning" role="alert">
|
||||||
|
I would show your BahnCard but you haven't added a card matching the value and name of the ticket yet. <a href="/Cards">You can do that now</a>.
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Model.Ticket.TicketInfo.Contains("BC 25")) {
|
||||||
|
await using var db = new Database.DbConn();
|
||||||
|
if (db.Cards.Any(p => p.Value == 25 && p.Traveller == Model.Ticket.Traveller)) {
|
||||||
|
var card = db.Cards.First(p => p.Value == 25 && p.Traveller == Model.Ticket.Traveller);
|
||||||
|
<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"/>
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
<div class="alert alert-warning" role="alert">
|
||||||
|
I would show your BahnCard but you haven't added a card matching the value and name of the ticket yet. <a href="/Cards">You can do that now</a>.
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
22
bahnplan.web/Pages/Inspection.cshtml.cs
Normal file
22
bahnplan.web/Pages/Inspection.cshtml.cs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using bahnplan.web.database;
|
||||||
|
using bahnplan.web.database.Tables;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace bahnplan.web.Pages {
|
||||||
|
public class InspectionModel : PageModel {
|
||||||
|
public Ticket Ticket;
|
||||||
|
public Leg Leg;
|
||||||
|
public void OnGet() {
|
||||||
|
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"]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
bahnplan.web/Pages/Login.cshtml
Normal file
25
bahnplan.web/Pages/Login.cshtml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
@page
|
||||||
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@model LoginModel
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Login";
|
||||||
|
if (HttpContext.Session.GetString("authorized") == "true") {
|
||||||
|
Response.Redirect("/");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<h3>@ViewData["Title"]</h3>
|
||||||
|
|
||||||
|
<form method="POST">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="InputUser">Username</label>
|
||||||
|
<input type="text" class="form-control" id="InputUser" name="user">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="InputPassword">Password</label>
|
||||||
|
<input type="password" class="form-control" id="InputPassword" name="pass">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
|
</form>
|
51
bahnplan.web/Pages/Login.cshtml.cs
Normal file
51
bahnplan.web/Pages/Login.cshtml.cs
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
using bahnplan.web.database;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace bahnplan.web.Pages {
|
||||||
|
public class LoginModel : PageModel {
|
||||||
|
public void OnPost() {
|
||||||
|
if (!Request.HasFormContentType || string.IsNullOrWhiteSpace(Request.Form["user"]) || string.IsNullOrWhiteSpace(Request.Form["pass"]))
|
||||||
|
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());
|
||||||
|
if (user == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var uid = user.UserId;
|
||||||
|
HttpContext.Session.SetString("uid", uid.ToString());
|
||||||
|
HttpContext.Session.SetString("authorized", "true");
|
||||||
|
|
||||||
|
//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++) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
7
bahnplan.web/Pages/Logout.cshtml
Normal file
7
bahnplan.web/Pages/Logout.cshtml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
@page
|
||||||
|
@model LogoutModel
|
||||||
|
|
||||||
|
@{
|
||||||
|
Layout = null;
|
||||||
|
Response.Redirect("/");
|
||||||
|
}
|
16
bahnplan.web/Pages/Logout.cshtml.cs
Normal file
16
bahnplan.web/Pages/Logout.cshtml.cs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
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 {
|
||||||
|
public class LogoutModel : PageModel {
|
||||||
|
public void OnGet() {
|
||||||
|
HttpContext.Session.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
bahnplan.web/Pages/OEAPI.cshtml
Normal file
15
bahnplan.web/Pages/OEAPI.cshtml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
@page
|
||||||
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@model OEAPIModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "OEAPI";
|
||||||
|
|
||||||
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
|
Response.Redirect("/");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Response.Redirect("/Trip?id=" + Model.TripId + "&edit=true");
|
||||||
|
}
|
||||||
|
|
||||||
|
Trip saved. Redirecting...
|
71
bahnplan.web/Pages/OEAPI.cshtml.cs
Normal file
71
bahnplan.web/Pages/OEAPI.cshtml.cs
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
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
|
||||||
|
|
||||||
|
namespace bahnplan.web.Pages {
|
||||||
|
public class OEAPIModel : PageModel {
|
||||||
|
public int TripId;
|
||||||
|
|
||||||
|
public void OnGet() {
|
||||||
|
|
||||||
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var link = Request.Query["link"].ToString();
|
||||||
|
var shortcode = link;
|
||||||
|
if (link.Contains("oeffisear.ch"))
|
||||||
|
shortcode = link.Split("/#/").Last();
|
||||||
|
var jid = shortcode.Split("/").Last();
|
||||||
|
shortcode = shortcode.Split("/").First();
|
||||||
|
|
||||||
|
using var db = new Database.DbConn();
|
||||||
|
var response = new WebClient().DownloadString($"https://oeffisear.ch/journeys?{{\"reqId\":\"{shortcode}\"}}");
|
||||||
|
|
||||||
|
var parsed = OeapiResponse.FromJson(response);
|
||||||
|
|
||||||
|
var tripId = Request.Query["action"] == "addleg"
|
||||||
|
? int.Parse(Request.Query["tripid"])
|
||||||
|
: db.InsertWithInt32Identity(new Trip {UserId = int.Parse(HttpContext.Session.GetString("uid"))});
|
||||||
|
|
||||||
|
foreach (var journey in parsed.Data.Journeys[jid].Legs) {
|
||||||
|
var arrtime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
var deptime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
arrtime = arrtime.AddSeconds((long) journey.Arrival.PlannedTime).ToLocalTime();
|
||||||
|
deptime = deptime.AddSeconds((long) journey.Departure.PlannedTime).ToLocalTime();
|
||||||
|
db.InsertWithInt32Identity(new Leg {
|
||||||
|
TripId = tripId,
|
||||||
|
UserId = int.Parse(HttpContext.Session.GetString("uid")),
|
||||||
|
TrainType = journey.Line.ProductName,
|
||||||
|
TrainNr = int.Parse(journey.Line.TripNum),
|
||||||
|
ArrStation = journey.Arrival.Point.Stop.Name,
|
||||||
|
ArrStationId = int.Parse(journey.Arrival.Point.Stop.Id),
|
||||||
|
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"),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
TripId = tripId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
bahnplan.web/Pages/Privacy.cshtml
Normal file
8
bahnplan.web/Pages/Privacy.cshtml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
@page
|
||||||
|
@model PrivacyModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Privacy Policy";
|
||||||
|
}
|
||||||
|
<h1>@ViewData["Title"]</h1>
|
||||||
|
|
||||||
|
<p>Use this page to detail your site's privacy policy.</p>
|
19
bahnplan.web/Pages/Privacy.cshtml.cs
Normal file
19
bahnplan.web/Pages/Privacy.cshtml.cs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
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 void OnGet() { }
|
||||||
|
}
|
||||||
|
}
|
29
bahnplan.web/Pages/Register.cshtml
Normal file
29
bahnplan.web/Pages/Register.cshtml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
@page
|
||||||
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@model RegisterModel
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Register";
|
||||||
|
if (HttpContext.Session.GetString("authorized") == "true") {
|
||||||
|
Response.Redirect("/");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<h3>@ViewData["Title"]</h3>
|
||||||
|
|
||||||
|
<form method="POST">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="InputUser">Username</label>
|
||||||
|
<input type="text" class="form-control" id="InputUser" name="user">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="InputPassword">Password</label>
|
||||||
|
<input type="password" class="form-control" id="InputPassword" name="pass">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="InputCode">Register Code</label>
|
||||||
|
<input type="password" class="form-control" id="InputCode" name="code">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
|
</form>
|
33
bahnplan.web/Pages/Register.cshtml.cs
Normal file
33
bahnplan.web/Pages/Register.cshtml.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
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 {
|
||||||
|
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"]))
|
||||||
|
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());
|
||||||
|
if (user != null)
|
||||||
|
return; //user already exists
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
70
bahnplan.web/Pages/Shared/_Layout.cshtml
Normal file
70
bahnplan.web/Pages/Shared/_Layout.cshtml
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
@using Microsoft.AspNetCore.Http
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
<title>@ViewData["Title"] - DB Navigator 2.0</title>
|
||||||
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css"/>
|
||||||
|
<link rel="stylesheet" href="~/css/site.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<nav class="navbar navbar-expand-md navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" asp-area="" asp-page="/Index">DB Navigator <sup>v2</sup></a>
|
||||||
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||||
|
aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="navbar-collapse collapse">
|
||||||
|
<ul class="navbar-nav flex-grow-1">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
|
||||||
|
</li>
|
||||||
|
@if (Context.Session.GetString("authorized") == "true") {
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-page="/Cards">Cards</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
<ul class="navbar-nav ml-auto">
|
||||||
|
@if (Context.Session.GetString("authorized") != "true") {
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-page="/Login">Login</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-page="/Register">Register</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asp-area="" asp-page="/Logout">Logout</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
<div class="container">
|
||||||
|
<main role="main" class="pb-3">
|
||||||
|
@RenderBody()
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer class="border-top footer text-muted">
|
||||||
|
<div class="container">
|
||||||
|
© 2020 - Laura Hausmann - <a asp-area="" asp-page="/Privacy">Privacy</a>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||||
|
<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)
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,2 @@
|
||||||
|
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||||
|
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
15
bahnplan.web/Pages/Ticket.cshtml
Normal file
15
bahnplan.web/Pages/Ticket.cshtml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
@page
|
||||||
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@model TicketModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Ticket";
|
||||||
|
|
||||||
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
|
Response.Redirect("/");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Response.Redirect("/Trip?id=" + Model.TripId + "&edit=true");
|
||||||
|
}
|
||||||
|
|
||||||
|
Ticket saved. Redirecting...
|
117
bahnplan.web/Pages/Ticket.cshtml.cs
Normal file
117
bahnplan.web/Pages/Ticket.cshtml.cs
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
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;
|
||||||
|
|
||||||
|
namespace bahnplan.web.Pages {
|
||||||
|
public class TicketModel : PageModel {
|
||||||
|
public int TripId;
|
||||||
|
|
||||||
|
public void OnGet() {
|
||||||
|
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"
|
||||||
|
? int.Parse(Request.Query["tripid"])
|
||||||
|
: 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()) {
|
||||||
|
db.InsertWithInt32Identity(new Leg {
|
||||||
|
TripId = tripId,
|
||||||
|
UserId = int.Parse(HttpContext.Session.GetString("uid")),
|
||||||
|
TrainType = leg.TrainType,
|
||||||
|
TrainNr = leg.TrainNr,
|
||||||
|
ArrStation = leg.ArrStation,
|
||||||
|
ArrStationId = leg.ArrStationId,
|
||||||
|
ArrTime = leg.ArrTime,
|
||||||
|
DepStation = leg.DepStation,
|
||||||
|
DepStationId = leg.DepStationId,
|
||||||
|
DepTime = leg.DepTime,
|
||||||
|
TicketId = ticketId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
TripId = tripId;
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
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", Request.Query["order"])),
|
||||||
|
new XElement("authname", new XAttribute("tln", Request.Query["name"])))).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 = TicketResponse.FromJson(json);
|
||||||
|
|
||||||
|
var tripId = Request.Query["action"] == "addleg"
|
||||||
|
? int.Parse(Request.Query["tripid"])
|
||||||
|
: db.InsertWithInt32Identity(new Trip {UserId = int.Parse(HttpContext.Session.GetString("uid"))});
|
||||||
|
|
||||||
|
var ticketId = db.InsertWithInt32Identity(new Ticket {
|
||||||
|
OrderId = Request.Query["order"],
|
||||||
|
TicketInfo = parsed.Rporderdetails.Order.Tcklist.Tck.Mtk.Txt,
|
||||||
|
TicketQr = parsed.Rporderdetails.Order.Tcklist.Tck.Htdata.Ht.First(p => p.Name == "barcode").Text,
|
||||||
|
TicketSecCode = parsed.Rporderdetails.Order.Tcklist.Tck.Htdata.Ht.First(p => p.Name == "sichtmerkmal").Text,
|
||||||
|
UserId = int.Parse(HttpContext.Session.GetString("uid")),
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var leg in parsed.Rporderdetails.Order.Schedulelist.Out.Trainlist.Train) {
|
||||||
|
db.InsertWithInt32Identity(new Leg {
|
||||||
|
TripId = tripId,
|
||||||
|
UserId = int.Parse(HttpContext.Session.GetString("uid")),
|
||||||
|
TrainType = leg.Gattung,
|
||||||
|
TrainNr = int.Parse(leg.Zugnummer),
|
||||||
|
ArrStation = leg.Arr.Name,
|
||||||
|
ArrStationId = int.Parse(leg.Arr.BhfNr),
|
||||||
|
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),
|
||||||
|
TicketId = ticketId,
|
||||||
|
});
|
||||||
|
|
||||||
|
db.InsertWithInt32Identity(new TicketLeg {
|
||||||
|
TicketId = ticketId,
|
||||||
|
TrainType = leg.Gattung,
|
||||||
|
TrainNr = int.Parse(leg.Zugnummer),
|
||||||
|
ArrStation = leg.Arr.Name,
|
||||||
|
ArrStationId = int.Parse(leg.Arr.BhfNr),
|
||||||
|
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),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
TripId = tripId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
179
bahnplan.web/Pages/Trip.cshtml
Normal file
179
bahnplan.web/Pages/Trip.cshtml
Normal file
|
@ -0,0 +1,179 @@
|
||||||
|
@page
|
||||||
|
@using bahnplan.web.database
|
||||||
|
@using Microsoft.AspNetCore.Http
|
||||||
|
@model TripModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Trip";
|
||||||
|
|
||||||
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
|
Response.Redirect("/");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Request.Query.ContainsKey("separator")) {
|
||||||
|
Response.Redirect(Request.Headers["Referer"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var dep = Model.Legs.First().DepStation;
|
||||||
|
var arr = Model.Legs.Last().ArrStation;
|
||||||
|
var deplenmax = Model.Legs.Max(p => p.DepStation.Length) + 1;
|
||||||
|
var arrlenmax = Model.Legs.Max(p => p.ArrStation.Length) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p>
|
||||||
|
Your Trip from <b>@dep</b> to <b>@arr</b>, starting @DateTime.Parse(Model.Legs.First().DepTime).ToString("yyyy-MM-dd HH:mm")
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<code>
|
||||||
|
@foreach (var leg in Model.Legs) {
|
||||||
|
if (leg.TrainType == "placeholder") {
|
||||||
|
<div>
|
||||||
|
... ..:.. ... - ... ... - ..:.. ...
|
||||||
|
</div>
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var deptime = DateTime.Parse(leg.DepTime);
|
||||||
|
var arrtime = DateTime.Parse(leg.ArrTime);
|
||||||
|
var date = DateTime.Parse(leg.DepTime).ToString("dd.MM.");
|
||||||
|
var dept = date + " " + deptime.ToString("HH:mm");
|
||||||
|
var depst = leg.DepStation.PadRight(20, ' ').Substring(0, 20).Replace(" ", " ");
|
||||||
|
var arrt = arrtime.ToString("HH:mm");
|
||||||
|
var arrst = leg.ArrStation.PadRight(20, ' ').Substring(0, 20).Replace(" ", " ");
|
||||||
|
var line = leg.TrainType.PadLeft(5).Replace(" ", " ") + " " + leg.TrainNr.ToString().PadRight(5).Replace(" ", " ");
|
||||||
|
<div>
|
||||||
|
@dept @Html.Raw(depst) - @Html.Raw(line) - @arrt @Html.Raw(arrst)
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Date</th>
|
||||||
|
<th scope="col">Departure</th>
|
||||||
|
<th scope="col">Arrival</th>
|
||||||
|
<th scope="col">Train</th>
|
||||||
|
@if (!Request.Query.ContainsKey("edit")) {
|
||||||
|
<th scope="col">Actions</th>
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
<th scope="col">Danger zone</th>
|
||||||
|
}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var leg in Model.Legs) {
|
||||||
|
if (leg.TrainType == "placeholder") {
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
@if (!Request.Query.ContainsKey("edit")) {
|
||||||
|
<td></td>
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
<td>
|
||||||
|
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=leg&id=@leg.LegId">- Separator</a>
|
||||||
|
</td>
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var deptime = DateTime.Parse(leg.DepTime);
|
||||||
|
var arrtime = DateTime.Parse(leg.ArrTime);
|
||||||
|
var date = DateTime.Parse(leg.DepTime).ToString("ddd, dd.MM.");
|
||||||
|
var dept = deptime.ToString("HH:mm");
|
||||||
|
var arrt = arrtime.ToString("HH:mm");
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@date
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<b>@dept</b> @Html.Raw(leg.DepStation.PadRight(30, ' ').Substring(0, 30).Replace(" ", " "))
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<b>@arrt</b> @Html.Raw(leg.ArrStation.PadRight(30, ' ').Substring(0, 30).Replace(" ", " "))
|
||||||
|
</td>
|
||||||
|
<td>@leg.TrainType @leg.TrainNr</td>
|
||||||
|
@if (!Request.Query.ContainsKey("edit")) {
|
||||||
|
<td>
|
||||||
|
@if (leg.TicketId != 0) {
|
||||||
|
<a class="btn btn-sm btn-danger" href="/Inspection?id=@leg.TicketId&leg=@leg.LegId" target="_blank">Ticket</a>
|
||||||
|
}
|
||||||
|
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>
|
||||||
|
</td>
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
<td>
|
||||||
|
@{
|
||||||
|
await using var db = new Database.DbConn();
|
||||||
|
if (!db.Legs.Any(p => p.DepTime == leg.DepTime + "_placeholder")) {
|
||||||
|
<a class="btn btn-sm btn-outline-secondary" href="?separator=true&legid=@leg.LegId&id=@leg.TripId">+ Separator</a>
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
<a class="btn btn-sm btn-outline-secondary disabled" href="?separator=true&legid=@leg.LegId&id=@leg.TripId">+ Separator</a>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=leg&id=@leg.LegId">- Leg</a>
|
||||||
|
@if (leg.TicketId != 0) {
|
||||||
|
<a class="btn btn-sm btn-outline-danger" href="/Delete?item=ticket&id=@leg.LegId">- Ticket</a>
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
<a class="btn btn-sm btn-outline-danger disabled">- Ticket</a>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
}
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (!Request.Query.ContainsKey("edit")) {
|
||||||
|
<a class="btn btn-sm btn-secondary" href="/Trip?id=@Request.Query["id"]&edit=true">Edit Trip</a>
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
<a class="btn btn-sm btn-secondary" href="/Trip?id=@Request.Query["id"]">Back</a>
|
||||||
|
<br/>
|
||||||
|
<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 leg(s) from ticket</h3>
|
||||||
|
<br/>
|
||||||
|
<input type="hidden" name="action" value="addleg">
|
||||||
|
<input type="hidden" name="tripid" value="@Request.Query["id"]">
|
||||||
|
<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 leg(s) from oeffisear.ch</h3>
|
||||||
|
<br/>
|
||||||
|
<input type="hidden" name="action" value="addleg">
|
||||||
|
<input type="hidden" name="tripid" value="@Request.Query["id"]">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control" name="link" placeholder="oeffisear.ch link / shortcode">
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
49
bahnplan.web/Pages/Trip.cshtml.cs
Normal file
49
bahnplan.web/Pages/Trip.cshtml.cs
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using bahnplan.web.database;
|
||||||
|
using bahnplan.web.database.Tables;
|
||||||
|
using LinqToDB;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace bahnplan.web.Pages {
|
||||||
|
public class TripModel : PageModel {
|
||||||
|
public List<Leg> Legs;
|
||||||
|
public Ticket Ticket;
|
||||||
|
|
||||||
|
public void OnGet() {
|
||||||
|
|
||||||
|
if (HttpContext.Session.GetString("authorized") != "true") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var db = new Database.DbConn();
|
||||||
|
if (Request.Query.ContainsKey("separator")) {
|
||||||
|
var leg = db.Legs.First(p => p.LegId == int.Parse(Request.Query["legid"]));
|
||||||
|
db.Insert(new Leg {
|
||||||
|
TripId = int.Parse(Request.Query["id"]),
|
||||||
|
UserId = int.Parse(HttpContext.Session.GetString("uid")),
|
||||||
|
TrainType = "placeholder",
|
||||||
|
TrainNr = int.Parse(Request.Query["legid"]),
|
||||||
|
ArrStation = "_",
|
||||||
|
ArrStationId = 0,
|
||||||
|
ArrTime = "_",
|
||||||
|
DepStation = "_",
|
||||||
|
DepStationId = 0,
|
||||||
|
DepTime = leg.DepTime + "_placeholder",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var legs = db.Legs.Where(p => p.TripId == int.Parse(Request.Query["id"])).ToList();
|
||||||
|
Legs = new List<Leg>();
|
||||||
|
foreach (var j in legs) {
|
||||||
|
Legs.Add(j);
|
||||||
|
if (j.TicketId != 0)
|
||||||
|
Ticket = db.Tickets.First(p => p.TicketId == j.TicketId);
|
||||||
|
}
|
||||||
|
|
||||||
|
Legs = Legs.OrderBy(p => p.DepTime).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
bahnplan.web/Pages/_ViewImports.cshtml
Normal file
3
bahnplan.web/Pages/_ViewImports.cshtml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
@using bahnplan.web
|
||||||
|
@namespace bahnplan.web.Pages
|
||||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
3
bahnplan.web/Pages/_ViewStart.cshtml
Normal file
3
bahnplan.web/Pages/_ViewStart.cshtml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
@{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
25
bahnplan.web/Program.cs
Normal file
25
bahnplan.web/Program.cs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using bahnplan.web.database;
|
||||||
|
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;
|
||||||
|
Directory.CreateDirectory(Variables.TicketDir);
|
||||||
|
CreateHostBuilder(args).Build().Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||||
|
Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
|
||||||
|
}
|
||||||
|
}
|
20
bahnplan.web/Properties/launchSettings.json
Normal file
20
bahnplan.web/Properties/launchSettings.json
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:25266",
|
||||||
|
"sslPort": 44319
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"bahnplan.web": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": false,
|
||||||
|
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
63
bahnplan.web/Startup.cs
Normal file
63
bahnplan.web/Startup.cs
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
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 IConfiguration Configuration { get; }
|
||||||
|
|
||||||
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
|
public void ConfigureServices(IServiceCollection services) {
|
||||||
|
services.AddRazorPages();
|
||||||
|
services.AddSession(options => {
|
||||||
|
options.IdleTimeout = TimeSpan.MaxValue;
|
||||||
|
options.Cookie.HttpOnly = true;
|
||||||
|
options.Cookie.IsEssential = true;
|
||||||
|
});
|
||||||
|
#if (DEBUG)
|
||||||
|
services.AddControllers().AddRazorRuntimeCompilation();
|
||||||
|
#else
|
||||||
|
services.AddControllers();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
|
||||||
|
if (env.IsDevelopment()) {
|
||||||
|
app.UseDeveloperExceptionPage();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
app.UseExceptionHandler("/Error");
|
||||||
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||||
|
app.UseHsts();
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
app.UseSession();
|
||||||
|
|
||||||
|
app.UseStaticFiles();
|
||||||
|
|
||||||
|
app.UseRouting();
|
||||||
|
|
||||||
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
app.UseEndpoints(endpoints => {
|
||||||
|
endpoints.MapRazorPages();
|
||||||
|
endpoints.MapControllers();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
bahnplan.web/Variables.cs
Normal file
9
bahnplan.web/Variables.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace bahnplan.web {
|
||||||
|
public class Variables {
|
||||||
|
public const string DataDir = "data";
|
||||||
|
public static readonly string TicketDir = Path.Combine(DataDir, "tickets");
|
||||||
|
}
|
||||||
|
}
|
9
bahnplan.web/appsettings.Development.json
Normal file
9
bahnplan.web/appsettings.Development.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
bahnplan.web/appsettings.json
Normal file
10
bahnplan.web/appsettings.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft": "Warning",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*"
|
||||||
|
}
|
70
bahnplan.web/bahnplan.web.csproj
Normal file
70
bahnplan.web/bahnplan.web.csproj
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Update="Pages\Ticket.cshtml">
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Update="Pages\Trip.cshtml">
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Update="Pages\Logout.cshtml">
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Update="Pages\OEAPI.cshtml">
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Update="Pages\Inspection.cshtml">
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Update="Pages\Delete.cshtml">
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Update="Pages\Card.cshtml">
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Update="Pages\Cards.cshtml">
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Pages\Ticket.cshtml.cs">
|
||||||
|
<DependentUpon>Ticket.cshtml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Pages\Logout.cshtml.cs">
|
||||||
|
<DependentUpon>Logout.cshtml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Pages\OEAPI.cshtml.cs">
|
||||||
|
<DependentUpon>OEAPI.cshtml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Pages\Inspection.cshtml.cs">
|
||||||
|
<DependentUpon>Inspection.cshtml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Pages\Delete.cshtml.cs">
|
||||||
|
<DependentUpon>Delete.cshtml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Pages\Cards.cshtml.cs">
|
||||||
|
<DependentUpon>Cards.cshtml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="linq2db" Version="2.9.8" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.4" />
|
||||||
|
<PackageReference Include="Microsoft.Data.Sqlite" Version="3.1.4" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
BIN
bahnplan.web/database.db.example
Normal file
BIN
bahnplan.web/database.db.example
Normal file
Binary file not shown.
38
bahnplan.web/database/Database.cs
Normal file
38
bahnplan.web/database/Database.cs
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using bahnplan.web.database.Tables;
|
||||||
|
using LinqToDB;
|
||||||
|
using LinqToDB.Configuration;
|
||||||
|
|
||||||
|
namespace bahnplan.web.database {
|
||||||
|
public class Database {
|
||||||
|
public class ConnectionStringSettings : IConnectionStringSettings {
|
||||||
|
public string ConnectionString { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string ProviderName { get; set; }
|
||||||
|
public bool IsGlobal => false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Settings : ILinqToDBSettings {
|
||||||
|
public IEnumerable<IDataProviderSettings> DataProviders => Enumerable.Empty<IDataProviderSettings>();
|
||||||
|
|
||||||
|
public string DefaultConfiguration => "SQLite";
|
||||||
|
public string DefaultDataProvider => "SQLite";
|
||||||
|
|
||||||
|
public IEnumerable<IConnectionStringSettings> ConnectionStrings {
|
||||||
|
get { yield return new ConnectionStringSettings {Name = "db", ProviderName = "SQLite", ConnectionString = @"Data Source=database.db;"}; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DbConn : LinqToDB.Data.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<TicketLeg> TicketLegs => GetTable<TicketLeg>();
|
||||||
|
public ITable<Trip> Trips => GetTable<Trip>();
|
||||||
|
public ITable<Card> Cards => GetTable<Card>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
51
bahnplan.web/database/Tables/Card.cs
Normal file
51
bahnplan.web/database/Tables/Card.cs
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
using LinqToDB.Mapping;
|
||||||
|
|
||||||
|
namespace bahnplan.web.database.Tables {
|
||||||
|
[Table(Name = "Cards")]
|
||||||
|
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 = "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; }
|
||||||
|
}
|
||||||
|
}
|
42
bahnplan.web/database/Tables/Leg.cs
Normal file
42
bahnplan.web/database/Tables/Leg.cs
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
using LinqToDB.Mapping;
|
||||||
|
|
||||||
|
namespace bahnplan.web.database.Tables {
|
||||||
|
[Table(Name = "Legs")]
|
||||||
|
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 = "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 = "ArrStationID"), NotNull]
|
||||||
|
public int ArrStationId { 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; }
|
||||||
|
}
|
||||||
|
}
|
30
bahnplan.web/database/Tables/Ticket.cs
Normal file
30
bahnplan.web/database/Tables/Ticket.cs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
using LinqToDB.Mapping;
|
||||||
|
|
||||||
|
namespace bahnplan.web.database.Tables {
|
||||||
|
[Table(Name = "Tickets")]
|
||||||
|
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 = "TicketSecCode"), NotNull]
|
||||||
|
public string TicketSecCode { get; set; }
|
||||||
|
|
||||||
|
[Column(Name = "TicketPkPass"), NotNull]
|
||||||
|
public string TicketPkPass { get; set; }
|
||||||
|
|
||||||
|
[Column(Name = "Traveller")]
|
||||||
|
public string Traveller { get; set; }
|
||||||
|
}
|
||||||
|
}
|
36
bahnplan.web/database/Tables/TicketLeg.cs
Normal file
36
bahnplan.web/database/Tables/TicketLeg.cs
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
using LinqToDB.Mapping;
|
||||||
|
|
||||||
|
namespace bahnplan.web.database.Tables {
|
||||||
|
[Table(Name = "TicketLegs")]
|
||||||
|
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 = "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 = "ArrStationID"), NotNull]
|
||||||
|
public int ArrStationId { get; set; }
|
||||||
|
|
||||||
|
[Column(Name = "ArrStation"), NotNull]
|
||||||
|
public string ArrStation { get; set; }
|
||||||
|
|
||||||
|
[Column(Name = "ArrTime"), NotNull]
|
||||||
|
public string ArrTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
13
bahnplan.web/database/Tables/Trip.cs
Normal file
13
bahnplan.web/database/Tables/Trip.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
using LinqToDB.Mapping;
|
||||||
|
|
||||||
|
namespace bahnplan.web.database.Tables {
|
||||||
|
[Table(Name = "Trips")]
|
||||||
|
public class Trip {
|
||||||
|
[Column(Name = "TripID"), PrimaryKey, Identity, NotNull]
|
||||||
|
public int TripId { get; set; }
|
||||||
|
|
||||||
|
[Column(Name = "UserID"), PrimaryKey, NotNull]
|
||||||
|
public int UserId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
16
bahnplan.web/database/Tables/User.cs
Normal file
16
bahnplan.web/database/Tables/User.cs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
using LinqToDB.Mapping;
|
||||||
|
|
||||||
|
namespace bahnplan.web.database.Tables {
|
||||||
|
[Table(Name = "Users")]
|
||||||
|
public class User {
|
||||||
|
[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; }
|
||||||
|
}
|
||||||
|
}
|
71
bahnplan.web/wwwroot/css/site.css
Normal file
71
bahnplan.web/wwwroot/css/site.css
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||||
|
for details on configuring this project to bundle and minify static web assets. */
|
||||||
|
|
||||||
|
a.navbar-brand {
|
||||||
|
white-space: normal;
|
||||||
|
text-align: center;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Provide sufficient contrast against white background */
|
||||||
|
a {
|
||||||
|
color: #0366d6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #1b6ec2;
|
||||||
|
border-color: #1861ac;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #1b6ec2;
|
||||||
|
border-color: #1861ac;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sticky footer styles
|
||||||
|
-------------------------------------------------- */
|
||||||
|
html {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
html {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.border-top {
|
||||||
|
border-top: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
.border-bottom {
|
||||||
|
border-bottom: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-shadow {
|
||||||
|
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||||
|
}
|
||||||
|
|
||||||
|
button.accept-policy {
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sticky footer styles
|
||||||
|
-------------------------------------------------- */
|
||||||
|
html {
|
||||||
|
position: relative;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
/* Margin bottom by footer height */
|
||||||
|
margin-bottom: 60px;
|
||||||
|
}
|
||||||
|
.footer {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
white-space: nowrap;
|
||||||
|
line-height: 60px; /* Vertically center the text there */
|
||||||
|
}
|
BIN
bahnplan.web/wwwroot/favicon.ico
Normal file
BIN
bahnplan.web/wwwroot/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
4
bahnplan.web/wwwroot/js/site.js
Normal file
4
bahnplan.web/wwwroot/js/site.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||||
|
// for details on configuring this project to bundle and minify static web assets.
|
||||||
|
|
||||||
|
// Write your Javascript code.
|
22
bahnplan.web/wwwroot/lib/bootstrap/LICENSE
Normal file
22
bahnplan.web/wwwroot/lib/bootstrap/LICENSE
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2011-2018 Twitter, Inc.
|
||||||
|
Copyright (c) 2011-2018 The Bootstrap Authors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
3719
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css
vendored
Normal file
3719
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map
vendored
Normal file
1
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css.map
vendored
Normal file
File diff suppressed because one or more lines are too long
7
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css
vendored
Normal file
7
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map
vendored
Normal file
1
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css.map
vendored
Normal file
File diff suppressed because one or more lines are too long
331
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css
vendored
Normal file
331
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css
vendored
Normal file
|
@ -0,0 +1,331 @@
|
||||||
|
/*!
|
||||||
|
* Bootstrap Reboot v4.3.1 (https://getbootstrap.com/)
|
||||||
|
* Copyright 2011-2019 The Bootstrap Authors
|
||||||
|
* Copyright 2011-2019 Twitter, Inc.
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||||
|
*/
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-family: sans-serif;
|
||||||
|
line-height: 1.15;
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: #212529;
|
||||||
|
text-align: left;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
[tabindex="-1"]:focus {
|
||||||
|
outline: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
box-sizing: content-box;
|
||||||
|
height: 0;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
abbr[title],
|
||||||
|
abbr[data-original-title] {
|
||||||
|
text-decoration: underline;
|
||||||
|
-webkit-text-decoration: underline dotted;
|
||||||
|
text-decoration: underline dotted;
|
||||||
|
cursor: help;
|
||||||
|
border-bottom: 0;
|
||||||
|
-webkit-text-decoration-skip-ink: none;
|
||||||
|
text-decoration-skip-ink: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
address {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
font-style: normal;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol,
|
||||||
|
ul,
|
||||||
|
dl {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol ol,
|
||||||
|
ul ul,
|
||||||
|
ol ul,
|
||||||
|
ul ol {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dt {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
dd {
|
||||||
|
margin-bottom: .5rem;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote {
|
||||||
|
margin: 0 0 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
b,
|
||||||
|
strong {
|
||||||
|
font-weight: bolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub,
|
||||||
|
sup {
|
||||||
|
position: relative;
|
||||||
|
font-size: 75%;
|
||||||
|
line-height: 0;
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub {
|
||||||
|
bottom: -.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
sup {
|
||||||
|
top: -.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #007bff;
|
||||||
|
text-decoration: none;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #0056b3;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:not([href]):not([tabindex]) {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:not([href]):not([tabindex]):focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre,
|
||||||
|
code,
|
||||||
|
kbd,
|
||||||
|
samp {
|
||||||
|
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
figure {
|
||||||
|
margin: 0 0 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
vertical-align: middle;
|
||||||
|
border-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
overflow: hidden;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
caption {
|
||||||
|
padding-top: 0.75rem;
|
||||||
|
padding-bottom: 0.75rem;
|
||||||
|
color: #6c757d;
|
||||||
|
text-align: left;
|
||||||
|
caption-side: bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
text-align: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
display: inline-block;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:focus {
|
||||||
|
outline: 1px dotted;
|
||||||
|
outline: 5px auto -webkit-focus-ring-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
input,
|
||||||
|
button,
|
||||||
|
select,
|
||||||
|
optgroup,
|
||||||
|
textarea {
|
||||||
|
margin: 0;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
button,
|
||||||
|
input {
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
button,
|
||||||
|
select {
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
word-wrap: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
button,
|
||||||
|
[type="button"],
|
||||||
|
[type="reset"],
|
||||||
|
[type="submit"] {
|
||||||
|
-webkit-appearance: button;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:not(:disabled),
|
||||||
|
[type="button"]:not(:disabled),
|
||||||
|
[type="reset"]:not(:disabled),
|
||||||
|
[type="submit"]:not(:disabled) {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
button::-moz-focus-inner,
|
||||||
|
[type="button"]::-moz-focus-inner,
|
||||||
|
[type="reset"]::-moz-focus-inner,
|
||||||
|
[type="submit"]::-moz-focus-inner {
|
||||||
|
padding: 0;
|
||||||
|
border-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="radio"],
|
||||||
|
input[type="checkbox"] {
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="date"],
|
||||||
|
input[type="time"],
|
||||||
|
input[type="datetime-local"],
|
||||||
|
input[type="month"] {
|
||||||
|
-webkit-appearance: listbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
overflow: auto;
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
min-width: 0;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
legend {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 0;
|
||||||
|
margin-bottom: .5rem;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
line-height: inherit;
|
||||||
|
color: inherit;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
progress {
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
[type="number"]::-webkit-inner-spin-button,
|
||||||
|
[type="number"]::-webkit-outer-spin-button {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
[type="search"] {
|
||||||
|
outline-offset: -2px;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
[type="search"]::-webkit-search-decoration {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-file-upload-button {
|
||||||
|
font: inherit;
|
||||||
|
-webkit-appearance: button;
|
||||||
|
}
|
||||||
|
|
||||||
|
output {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
summary {
|
||||||
|
display: list-item;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
template {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
[hidden] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
/*# sourceMappingURL=bootstrap-reboot.css.map */
|
1
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map
vendored
Normal file
1
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.css.map
vendored
Normal file
File diff suppressed because one or more lines are too long
8
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css
vendored
Normal file
8
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
/*!
|
||||||
|
* Bootstrap Reboot v4.3.1 (https://getbootstrap.com/)
|
||||||
|
* Copyright 2011-2019 The Bootstrap Authors
|
||||||
|
* Copyright 2011-2019 Twitter, Inc.
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||||
|
*/*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}
|
||||||
|
/*# sourceMappingURL=bootstrap-reboot.min.css.map */
|
1
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map
vendored
Normal file
1
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap-reboot.min.css.map
vendored
Normal file
File diff suppressed because one or more lines are too long
10038
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap.css
vendored
Normal file
10038
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map
vendored
Normal file
1
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap.css.map
vendored
Normal file
File diff suppressed because one or more lines are too long
7
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css
vendored
Normal file
7
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map
vendored
Normal file
1
bahnplan.web/wwwroot/lib/bootstrap/dist/css/bootstrap.min.css.map
vendored
Normal file
File diff suppressed because one or more lines are too long
7013
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js
vendored
Normal file
7013
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map
vendored
Normal file
1
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
7
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js
vendored
Normal file
7
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map
vendored
Normal file
1
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.bundle.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
4435
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.js
vendored
Normal file
4435
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map
vendored
Normal file
1
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
7
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js
vendored
Normal file
7
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map
vendored
Normal file
1
bahnplan.web/wwwroot/lib/bootstrap/dist/js/bootstrap.min.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,12 @@
|
||||||
|
Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||||
|
these files except in compliance with the License. You may obtain a copy of the
|
||||||
|
License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software distributed
|
||||||
|
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||||
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations under the License.
|
432
bahnplan.web/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js
vendored
Normal file
432
bahnplan.web/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js
vendored
Normal file
|
@ -0,0 +1,432 @@
|
||||||
|
// Unobtrusive validation support library for jQuery and jQuery Validate
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
// @version v3.2.11
|
||||||
|
|
||||||
|
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
|
||||||
|
/*global document: false, jQuery: false */
|
||||||
|
|
||||||
|
(function (factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
// AMD. Register as an anonymous module.
|
||||||
|
define("jquery.validate.unobtrusive", ['jquery-validation'], factory);
|
||||||
|
} else if (typeof module === 'object' && module.exports) {
|
||||||
|
// CommonJS-like environments that support module.exports
|
||||||
|
module.exports = factory(require('jquery-validation'));
|
||||||
|
} else {
|
||||||
|
// Browser global
|
||||||
|
jQuery.validator.unobtrusive = factory(jQuery);
|
||||||
|
}
|
||||||
|
}(function ($) {
|
||||||
|
var $jQval = $.validator,
|
||||||
|
adapters,
|
||||||
|
data_validation = "unobtrusiveValidation";
|
||||||
|
|
||||||
|
function setValidationValues(options, ruleName, value) {
|
||||||
|
options.rules[ruleName] = value;
|
||||||
|
if (options.message) {
|
||||||
|
options.messages[ruleName] = options.message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function splitAndTrim(value) {
|
||||||
|
return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g);
|
||||||
|
}
|
||||||
|
|
||||||
|
function escapeAttributeValue(value) {
|
||||||
|
// As mentioned on http://api.jquery.com/category/selectors/
|
||||||
|
return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1");
|
||||||
|
}
|
||||||
|
|
||||||
|
function getModelPrefix(fieldName) {
|
||||||
|
return fieldName.substr(0, fieldName.lastIndexOf(".") + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendModelPrefix(value, prefix) {
|
||||||
|
if (value.indexOf("*.") === 0) {
|
||||||
|
value = value.replace("*.", prefix);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onError(error, inputElement) { // 'this' is the form element
|
||||||
|
var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
|
||||||
|
replaceAttrValue = container.attr("data-valmsg-replace"),
|
||||||
|
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
|
||||||
|
|
||||||
|
container.removeClass("field-validation-valid").addClass("field-validation-error");
|
||||||
|
error.data("unobtrusiveContainer", container);
|
||||||
|
|
||||||
|
if (replace) {
|
||||||
|
container.empty();
|
||||||
|
error.removeClass("input-validation-error").appendTo(container);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
error.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onErrors(event, validator) { // 'this' is the form element
|
||||||
|
var container = $(this).find("[data-valmsg-summary=true]"),
|
||||||
|
list = container.find("ul");
|
||||||
|
|
||||||
|
if (list && list.length && validator.errorList.length) {
|
||||||
|
list.empty();
|
||||||
|
container.addClass("validation-summary-errors").removeClass("validation-summary-valid");
|
||||||
|
|
||||||
|
$.each(validator.errorList, function () {
|
||||||
|
$("<li />").html(this.message).appendTo(list);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSuccess(error) { // 'this' is the form element
|
||||||
|
var container = error.data("unobtrusiveContainer");
|
||||||
|
|
||||||
|
if (container) {
|
||||||
|
var replaceAttrValue = container.attr("data-valmsg-replace"),
|
||||||
|
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
|
||||||
|
|
||||||
|
container.addClass("field-validation-valid").removeClass("field-validation-error");
|
||||||
|
error.removeData("unobtrusiveContainer");
|
||||||
|
|
||||||
|
if (replace) {
|
||||||
|
container.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onReset(event) { // 'this' is the form element
|
||||||
|
var $form = $(this),
|
||||||
|
key = '__jquery_unobtrusive_validation_form_reset';
|
||||||
|
if ($form.data(key)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Set a flag that indicates we're currently resetting the form.
|
||||||
|
$form.data(key, true);
|
||||||
|
try {
|
||||||
|
$form.data("validator").resetForm();
|
||||||
|
} finally {
|
||||||
|
$form.removeData(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
$form.find(".validation-summary-errors")
|
||||||
|
.addClass("validation-summary-valid")
|
||||||
|
.removeClass("validation-summary-errors");
|
||||||
|
$form.find(".field-validation-error")
|
||||||
|
.addClass("field-validation-valid")
|
||||||
|
.removeClass("field-validation-error")
|
||||||
|
.removeData("unobtrusiveContainer")
|
||||||
|
.find(">*") // If we were using valmsg-replace, get the underlying error
|
||||||
|
.removeData("unobtrusiveContainer");
|
||||||
|
}
|
||||||
|
|
||||||
|
function validationInfo(form) {
|
||||||
|
var $form = $(form),
|
||||||
|
result = $form.data(data_validation),
|
||||||
|
onResetProxy = $.proxy(onReset, form),
|
||||||
|
defaultOptions = $jQval.unobtrusive.options || {},
|
||||||
|
execInContext = function (name, args) {
|
||||||
|
var func = defaultOptions[name];
|
||||||
|
func && $.isFunction(func) && func.apply(form, args);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
result = {
|
||||||
|
options: { // options structure passed to jQuery Validate's validate() method
|
||||||
|
errorClass: defaultOptions.errorClass || "input-validation-error",
|
||||||
|
errorElement: defaultOptions.errorElement || "span",
|
||||||
|
errorPlacement: function () {
|
||||||
|
onError.apply(form, arguments);
|
||||||
|
execInContext("errorPlacement", arguments);
|
||||||
|
},
|
||||||
|
invalidHandler: function () {
|
||||||
|
onErrors.apply(form, arguments);
|
||||||
|
execInContext("invalidHandler", arguments);
|
||||||
|
},
|
||||||
|
messages: {},
|
||||||
|
rules: {},
|
||||||
|
success: function () {
|
||||||
|
onSuccess.apply(form, arguments);
|
||||||
|
execInContext("success", arguments);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
attachValidation: function () {
|
||||||
|
$form
|
||||||
|
.off("reset." + data_validation, onResetProxy)
|
||||||
|
.on("reset." + data_validation, onResetProxy)
|
||||||
|
.validate(this.options);
|
||||||
|
},
|
||||||
|
validate: function () { // a validation function that is called by unobtrusive Ajax
|
||||||
|
$form.validate();
|
||||||
|
return $form.valid();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$form.data(data_validation, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
$jQval.unobtrusive = {
|
||||||
|
adapters: [],
|
||||||
|
|
||||||
|
parseElement: function (element, skipAttach) {
|
||||||
|
/// <summary>
|
||||||
|
/// Parses a single HTML element for unobtrusive validation attributes.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="element" domElement="true">The HTML element to be parsed.</param>
|
||||||
|
/// <param name="skipAttach" type="Boolean">[Optional] true to skip attaching the
|
||||||
|
/// validation to the form. If parsing just this single element, you should specify true.
|
||||||
|
/// If parsing several elements, you should specify false, and manually attach the validation
|
||||||
|
/// to the form when you are finished. The default is false.</param>
|
||||||
|
var $element = $(element),
|
||||||
|
form = $element.parents("form")[0],
|
||||||
|
valInfo, rules, messages;
|
||||||
|
|
||||||
|
if (!form) { // Cannot do client-side validation without a form
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
valInfo = validationInfo(form);
|
||||||
|
valInfo.options.rules[element.name] = rules = {};
|
||||||
|
valInfo.options.messages[element.name] = messages = {};
|
||||||
|
|
||||||
|
$.each(this.adapters, function () {
|
||||||
|
var prefix = "data-val-" + this.name,
|
||||||
|
message = $element.attr(prefix),
|
||||||
|
paramValues = {};
|
||||||
|
|
||||||
|
if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy)
|
||||||
|
prefix += "-";
|
||||||
|
|
||||||
|
$.each(this.params, function () {
|
||||||
|
paramValues[this] = $element.attr(prefix + this);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.adapt({
|
||||||
|
element: element,
|
||||||
|
form: form,
|
||||||
|
message: message,
|
||||||
|
params: paramValues,
|
||||||
|
rules: rules,
|
||||||
|
messages: messages
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.extend(rules, { "__dummy__": true });
|
||||||
|
|
||||||
|
if (!skipAttach) {
|
||||||
|
valInfo.attachValidation();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
parse: function (selector) {
|
||||||
|
/// <summary>
|
||||||
|
/// Parses all the HTML elements in the specified selector. It looks for input elements decorated
|
||||||
|
/// with the [data-val=true] attribute value and enables validation according to the data-val-*
|
||||||
|
/// attribute values.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="selector" type="String">Any valid jQuery selector.</param>
|
||||||
|
|
||||||
|
// $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one
|
||||||
|
// element with data-val=true
|
||||||
|
var $selector = $(selector),
|
||||||
|
$forms = $selector.parents()
|
||||||
|
.addBack()
|
||||||
|
.filter("form")
|
||||||
|
.add($selector.find("form"))
|
||||||
|
.has("[data-val=true]");
|
||||||
|
|
||||||
|
$selector.find("[data-val=true]").each(function () {
|
||||||
|
$jQval.unobtrusive.parseElement(this, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
$forms.each(function () {
|
||||||
|
var info = validationInfo(this);
|
||||||
|
if (info) {
|
||||||
|
info.attachValidation();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
adapters = $jQval.unobtrusive.adapters;
|
||||||
|
|
||||||
|
adapters.add = function (adapterName, params, fn) {
|
||||||
|
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation.</summary>
|
||||||
|
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||||
|
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
||||||
|
/// <param name="params" type="Array" optional="true">[Optional] An array of parameter names (strings) that will
|
||||||
|
/// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and
|
||||||
|
/// mmmm is the parameter name).</param>
|
||||||
|
/// <param name="fn" type="Function">The function to call, which adapts the values from the HTML
|
||||||
|
/// attributes into jQuery Validate rules and/or messages.</param>
|
||||||
|
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||||
|
if (!fn) { // Called with no params, just a function
|
||||||
|
fn = params;
|
||||||
|
params = [];
|
||||||
|
}
|
||||||
|
this.push({ name: adapterName, params: params, adapt: fn });
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
adapters.addBool = function (adapterName, ruleName) {
|
||||||
|
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
||||||
|
/// the jQuery Validate validation rule has no parameter values.</summary>
|
||||||
|
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||||
|
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
||||||
|
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
|
||||||
|
/// of adapterName will be used instead.</param>
|
||||||
|
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||||
|
return this.add(adapterName, function (options) {
|
||||||
|
setValidationValues(options, ruleName || adapterName, true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) {
|
||||||
|
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
||||||
|
/// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and
|
||||||
|
/// one for min-and-max). The HTML parameters are expected to be named -min and -max.</summary>
|
||||||
|
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||||
|
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
||||||
|
/// <param name="minRuleName" type="String">The name of the jQuery Validate rule to be used when you only
|
||||||
|
/// have a minimum value.</param>
|
||||||
|
/// <param name="maxRuleName" type="String">The name of the jQuery Validate rule to be used when you only
|
||||||
|
/// have a maximum value.</param>
|
||||||
|
/// <param name="minMaxRuleName" type="String">The name of the jQuery Validate rule to be used when you
|
||||||
|
/// have both a minimum and maximum value.</param>
|
||||||
|
/// <param name="minAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
|
||||||
|
/// contains the minimum value. The default is "min".</param>
|
||||||
|
/// <param name="maxAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
|
||||||
|
/// contains the maximum value. The default is "max".</param>
|
||||||
|
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||||
|
return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) {
|
||||||
|
var min = options.params.min,
|
||||||
|
max = options.params.max;
|
||||||
|
|
||||||
|
if (min && max) {
|
||||||
|
setValidationValues(options, minMaxRuleName, [min, max]);
|
||||||
|
}
|
||||||
|
else if (min) {
|
||||||
|
setValidationValues(options, minRuleName, min);
|
||||||
|
}
|
||||||
|
else if (max) {
|
||||||
|
setValidationValues(options, maxRuleName, max);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
adapters.addSingleVal = function (adapterName, attribute, ruleName) {
|
||||||
|
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
||||||
|
/// the jQuery Validate validation rule has a single value.</summary>
|
||||||
|
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||||
|
/// in the data-val-nnnn HTML attribute(where nnnn is the adapter name).</param>
|
||||||
|
/// <param name="attribute" type="String">[Optional] The name of the HTML attribute that contains the value.
|
||||||
|
/// The default is "val".</param>
|
||||||
|
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
|
||||||
|
/// of adapterName will be used instead.</param>
|
||||||
|
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||||
|
return this.add(adapterName, [attribute || "val"], function (options) {
|
||||||
|
setValidationValues(options, ruleName || adapterName, options.params[attribute]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$jQval.addMethod("__dummy__", function (value, element, params) {
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
$jQval.addMethod("regex", function (value, element, params) {
|
||||||
|
var match;
|
||||||
|
if (this.optional(element)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
match = new RegExp(params).exec(value);
|
||||||
|
return (match && (match.index === 0) && (match[0].length === value.length));
|
||||||
|
});
|
||||||
|
|
||||||
|
$jQval.addMethod("nonalphamin", function (value, element, nonalphamin) {
|
||||||
|
var match;
|
||||||
|
if (nonalphamin) {
|
||||||
|
match = value.match(/\W/g);
|
||||||
|
match = match && match.length >= nonalphamin;
|
||||||
|
}
|
||||||
|
return match;
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($jQval.methods.extension) {
|
||||||
|
adapters.addSingleVal("accept", "mimtype");
|
||||||
|
adapters.addSingleVal("extension", "extension");
|
||||||
|
} else {
|
||||||
|
// for backward compatibility, when the 'extension' validation method does not exist, such as with versions
|
||||||
|
// of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for
|
||||||
|
// validating the extension, and ignore mime-type validations as they are not supported.
|
||||||
|
adapters.addSingleVal("extension", "extension", "accept");
|
||||||
|
}
|
||||||
|
|
||||||
|
adapters.addSingleVal("regex", "pattern");
|
||||||
|
adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");
|
||||||
|
adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range");
|
||||||
|
adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength");
|
||||||
|
adapters.add("equalto", ["other"], function (options) {
|
||||||
|
var prefix = getModelPrefix(options.element.name),
|
||||||
|
other = options.params.other,
|
||||||
|
fullOtherName = appendModelPrefix(other, prefix),
|
||||||
|
element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0];
|
||||||
|
|
||||||
|
setValidationValues(options, "equalTo", element);
|
||||||
|
});
|
||||||
|
adapters.add("required", function (options) {
|
||||||
|
// jQuery Validate equates "required" with "mandatory" for checkbox elements
|
||||||
|
if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") {
|
||||||
|
setValidationValues(options, "required", true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
adapters.add("remote", ["url", "type", "additionalfields"], function (options) {
|
||||||
|
var value = {
|
||||||
|
url: options.params.url,
|
||||||
|
type: options.params.type || "GET",
|
||||||
|
data: {}
|
||||||
|
},
|
||||||
|
prefix = getModelPrefix(options.element.name);
|
||||||
|
|
||||||
|
$.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {
|
||||||
|
var paramName = appendModelPrefix(fieldName, prefix);
|
||||||
|
value.data[paramName] = function () {
|
||||||
|
var field = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']");
|
||||||
|
// For checkboxes and radio buttons, only pick up values from checked fields.
|
||||||
|
if (field.is(":checkbox")) {
|
||||||
|
return field.filter(":checked").val() || field.filter(":hidden").val() || '';
|
||||||
|
}
|
||||||
|
else if (field.is(":radio")) {
|
||||||
|
return field.filter(":checked").val() || '';
|
||||||
|
}
|
||||||
|
return field.val();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
setValidationValues(options, "remote", value);
|
||||||
|
});
|
||||||
|
adapters.add("password", ["min", "nonalphamin", "regex"], function (options) {
|
||||||
|
if (options.params.min) {
|
||||||
|
setValidationValues(options, "minlength", options.params.min);
|
||||||
|
}
|
||||||
|
if (options.params.nonalphamin) {
|
||||||
|
setValidationValues(options, "nonalphamin", options.params.nonalphamin);
|
||||||
|
}
|
||||||
|
if (options.params.regex) {
|
||||||
|
setValidationValues(options, "regex", options.params.regex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
adapters.add("fileextensions", ["extensions"], function (options) {
|
||||||
|
setValidationValues(options, "extension", options.params.extensions);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
$jQval.unobtrusive.parse(document);
|
||||||
|
});
|
||||||
|
|
||||||
|
return $jQval.unobtrusive;
|
||||||
|
}));
|
5
bahnplan.web/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js
vendored
Normal file
5
bahnplan.web/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22
bahnplan.web/wwwroot/lib/jquery-validation/LICENSE.md
Normal file
22
bahnplan.web/wwwroot/lib/jquery-validation/LICENSE.md
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Copyright Jörn Zaefferer
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
1158
bahnplan.web/wwwroot/lib/jquery-validation/dist/additional-methods.js
vendored
Normal file
1158
bahnplan.web/wwwroot/lib/jquery-validation/dist/additional-methods.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
4
bahnplan.web/wwwroot/lib/jquery-validation/dist/additional-methods.min.js
vendored
Normal file
4
bahnplan.web/wwwroot/lib/jquery-validation/dist/additional-methods.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1601
bahnplan.web/wwwroot/lib/jquery-validation/dist/jquery.validate.js
vendored
Normal file
1601
bahnplan.web/wwwroot/lib/jquery-validation/dist/jquery.validate.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
4
bahnplan.web/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js
vendored
Normal file
4
bahnplan.web/wwwroot/lib/jquery-validation/dist/jquery.validate.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
36
bahnplan.web/wwwroot/lib/jquery/LICENSE.txt
Normal file
36
bahnplan.web/wwwroot/lib/jquery/LICENSE.txt
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
Copyright JS Foundation and other contributors, https://js.foundation/
|
||||||
|
|
||||||
|
This software consists of voluntary contributions made by many
|
||||||
|
individuals. For exact contribution history, see the revision history
|
||||||
|
available at https://github.com/jquery/jquery
|
||||||
|
|
||||||
|
The following license applies to all parts of this software except as
|
||||||
|
documented below:
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
All files located in the node_modules and external directories are
|
||||||
|
externally maintained libraries used by this software which have their
|
||||||
|
own licenses; we recommend you read them, as their terms may differ from
|
||||||
|
the terms above.
|
10364
bahnplan.web/wwwroot/lib/jquery/dist/jquery.js
vendored
Normal file
10364
bahnplan.web/wwwroot/lib/jquery/dist/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
2
bahnplan.web/wwwroot/lib/jquery/dist/jquery.min.js
vendored
Normal file
2
bahnplan.web/wwwroot/lib/jquery/dist/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
bahnplan.web/wwwroot/lib/jquery/dist/jquery.min.map
vendored
Normal file
1
bahnplan.web/wwwroot/lib/jquery/dist/jquery.min.map
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in a new issue