Rename to trainav

This commit is contained in:
Laura Hausmann 2022-04-29 14:59:24 +02:00
parent 0580629884
commit 8f07cee5ad
Signed by: zotan
GPG key ID: D044E84C5BE01605
100 changed files with 111 additions and 113 deletions

View file

@ -1,7 +1,4 @@
# bahnplan.web or DBNav2 # Trainav
- 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 ## DISCLAIMER
- This is very early alpha - This is very early alpha
@ -10,10 +7,10 @@
- Most importantly: have fun. - Most importantly: have fun.
## Development / testing requirements ## Development / testing requirements
- .NET Core SDK (version 5.0 or higher; arch package `dotnet-sdk`) - .NET Core SDK (version 6.0 or higher; arch package `dotnet-sdk`)
- ASP.NET Core Runtime (version 5,0 or higher; arch package `aspnet-runtime`) - ASP.NET Core Runtime (version 6.0 or higher; arch package `aspnet-runtime`)
- Redis instance running on localhost - Redis instance running on localhost
- `cd bahnplan.web` - `cd trainav.web`
- `cp database.db.example database.db` - Generate a random string (or use something else) and save it to `regkey.txt` to allow registrations
- `dotnet run` - `dotnet run`

View file

@ -1,3 +0,0 @@
@using bahnplan.web
@namespace bahnplan.web.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View file

@ -1,6 +1,6 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 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}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "trainav.web", "trainav.web\trainav.web.csproj", "{41B83C7E-6F7E-4EE0-A332-D87A7FE3183E}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View file

@ -1,7 +1,7 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace bahnplan.web.Controllers { namespace trainav.web.Controllers {
[ApiController, Route("api/[controller]")] [ApiController, Route("api/[controller]")]
public class TestController : ControllerBase { public class TestController : ControllerBase {
[HttpGet] [HttpGet]

View file

@ -2,7 +2,7 @@
// //
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do: // To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
// //
// using bahnplan.web.JSON.CardResponse; // using trainav.web.JSON.CardResponse;
// //
// var cardResponse = CardResponse.FromJson(jsonString); // var cardResponse = CardResponse.FromJson(jsonString);
@ -11,7 +11,7 @@ using System.Globalization;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
namespace bahnplan.web.JSON.CardResponse { namespace trainav.web.JSON.CardResponse {
public partial class CardResponse { public partial class CardResponse {
[JsonProperty("?xml", NullValueHandling = NullValueHandling.Ignore)] [JsonProperty("?xml", NullValueHandling = NullValueHandling.Ignore)]
public Xml Xml { get; set; } public Xml Xml { get; set; }

View file

@ -2,14 +2,14 @@
// //
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do: // To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
// //
// using bahnplan.web.JSON; // using trainav.web.JSON;
// //
// var listOrdersResponse = ListOrdersResponse.FromJson(jsonString); // var listOrdersResponse = ListOrdersResponse.FromJson(jsonString);
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace bahnplan.web.JSON.ListOrdersResponse { namespace trainav.web.JSON.ListOrdersResponse {
public partial class ListOrdersResponse { public partial class ListOrdersResponse {
[JsonProperty("?xml", NullValueHandling = NullValueHandling.Ignore)] [JsonProperty("?xml", NullValueHandling = NullValueHandling.Ignore)]
public Xml Xml { get; set; } public Xml Xml { get; set; }

View file

@ -2,14 +2,14 @@
// //
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do: // To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
// //
// using bahnplan.web.JSON; // using trainav.web.JSON;
// //
// var oeapiResponse = OeapiResponse.FromJson(jsonString); // var oeapiResponse = OeapiResponse.FromJson(jsonString);
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace bahnplan.web.JSON { namespace trainav.web.JSON {
using J = JsonPropertyAttribute; using J = JsonPropertyAttribute;
using R = Required; using R = Required;
using N = NullValueHandling; using N = NullValueHandling;

View file

@ -2,7 +2,7 @@
// //
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do: // To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
// //
// using bahnplan.web.JSON; // using trainav.web.JSON;
// //
// var ticketResponse = TicketResponse.FromJson(jsonString); // var ticketResponse = TicketResponse.FromJson(jsonString);
@ -13,7 +13,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
namespace bahnplan.web.JSON { namespace trainav.web.JSON {
using J = JsonPropertyAttribute; using J = JsonPropertyAttribute;
using R = Required; using R = Required;
using NV = NullValueHandling; using NV = NullValueHandling;

View file

@ -1,12 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using LinqToDB; using LinqToDB;
using LinqToDB.Data; using LinqToDB.Data;
using trainav.web.database;
using trainav.web.database.Tables;
namespace bahnplan.web { namespace trainav.web {
public static class Migrations { public static class Migrations {
private const int DbVer = 1; private const int DbVer = 1;

View file

@ -2,16 +2,16 @@ using System.Linq;
using System.Net; using System.Net;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using bahnplan.web.JSON.CardResponse;
using bahnplan.web.JSON.ListOrdersResponse;
using LinqToDB; using LinqToDB;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json; using Newtonsoft.Json;
using trainav.web.database;
using trainav.web.database.Tables;
using trainav.web.JSON.CardResponse;
using trainav.web.JSON.ListOrdersResponse;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class CardModel : PageModel { public class CardModel : PageModel {
public void OnPost() { public void OnPost() {
if (HttpContext.Session.GetString("authorized") != "true") if (HttpContext.Session.GetString("authorized") != "true")

View file

@ -3,15 +3,15 @@ using System.Linq;
using System.Net; using System.Net;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using bahnplan.web.JSON.CardResponse;
using LinqToDB; using LinqToDB;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json; using Newtonsoft.Json;
using trainav.web.database;
using trainav.web.database.Tables;
using trainav.web.JSON.CardResponse;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class CardsModel : PageModel { public class CardsModel : PageModel {
public List<Card> Cards; public List<Card> Cards;

View file

@ -1,7 +1,7 @@
@page @page
@using Microsoft.AspNetCore.Http @using Microsoft.AspNetCore.Http
@using Microsoft.AspNetCore.Http.Extensions @using Microsoft.AspNetCore.Http.Extensions
@using bahnplan.web.database @using trainav.web.database
@model DeleteModel @model DeleteModel
@{ @{
ViewData["Title"] = "Home"; ViewData["Title"] = "Home";

View file

@ -1,11 +1,11 @@
using System.Linq; using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using LinqToDB; using LinqToDB;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using trainav.web.database;
using trainav.web.database.Tables;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class DeleteModel : PageModel { public class DeleteModel : PageModel {
public User AuthorizedUser; public User AuthorizedUser;

View file

@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class ErrorModel : PageModel { public class ErrorModel : PageModel {
private readonly ILogger<ErrorModel> _logger; private readonly ILogger<ErrorModel> _logger;

View file

@ -1,5 +1,5 @@
@page @page
@model bahnplan.web.Pages.GenIcs @model trainav.web.Pages.GenIcs
@{ @{
Layout = null; Layout = null;
Response.ContentType = "text/calendar"; Response.ContentType = "text/calendar";

View file

@ -4,17 +4,17 @@ using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using CsvHelper; using CsvHelper;
using CsvHelper.Configuration.Attributes; using CsvHelper.Configuration.Attributes;
using Ical.Net.CalendarComponents; using Ical.Net.CalendarComponents;
using Ical.Net.DataTypes; using Ical.Net.DataTypes;
using Ical.Net.Serialization; using Ical.Net.Serialization;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using trainav.web.database;
using trainav.web.database.Tables;
using Calendar = Ical.Net.Calendar; using Calendar = Ical.Net.Calendar;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class GenIcs : PageModel { public class GenIcs : PageModel {
public string IcsOutput; public string IcsOutput;
public List<Leg> Legs; public List<Leg> Legs;

View file

@ -2,7 +2,7 @@
@using Microsoft.AspNetCore.Http @using Microsoft.AspNetCore.Http
@using Microsoft.AspNetCore.Http.Extensions @using Microsoft.AspNetCore.Http.Extensions
@using LinqToDB @using LinqToDB
@using bahnplan.web.database @using trainav.web.database
@model IndexModel @model IndexModel
@{ @{
ViewData["Title"] = "Home"; ViewData["Title"] = "Home";

View file

@ -1,10 +1,10 @@
using System.Linq; using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using trainav.web.database;
using trainav.web.database.Tables;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class IndexModel : PageModel { public class IndexModel : PageModel {
public User AuthorizedUser; public User AuthorizedUser;

View file

@ -1,7 +1,7 @@
@page @page
@using Microsoft.AspNetCore.Http @using Microsoft.AspNetCore.Http
@using Microsoft.AspNetCore.Http.Extensions @using Microsoft.AspNetCore.Http.Extensions
@using bahnplan.web.database @using trainav.web.database
@using System.Text @using System.Text
@model InspectionModel @model InspectionModel
@{ @{

View file

@ -1,12 +1,12 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using trainav.web.database;
using trainav.web.database.Tables;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class InspectionModel : PageModel { public class InspectionModel : PageModel {
public Leg Leg; public Leg Leg;
public Ticket Ticket; public Ticket Ticket;

View file

@ -3,11 +3,11 @@ using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Web; using System.Web;
using bahnplan.web.database;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using trainav.web.database;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class LoginModel : PageModel { public class LoginModel : PageModel {
public void OnPost() { public void OnPost() {
if (!Request.HasFormContentType || string.IsNullOrWhiteSpace(Request.Form["user"]) || string.IsNullOrWhiteSpace(Request.Form["pass"])) if (!Request.HasFormContentType || string.IsNullOrWhiteSpace(Request.Form["user"]) || string.IsNullOrWhiteSpace(Request.Form["pass"]))

View file

@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class LogoutModel : PageModel { public class LogoutModel : PageModel {
public void OnGet() { public void OnGet() {
HttpContext.Session.Clear(); HttpContext.Session.Clear();

View file

@ -2,17 +2,17 @@
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using bahnplan.web.JSON;
using LinqToDB; using LinqToDB;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Leg = bahnplan.web.database.Tables.Leg; using trainav.web.database;
using trainav.web.database.Tables;
using trainav.web.JSON;
using Leg = trainav.web.database.Tables.Leg;
// ReSharper disable PossibleInvalidOperationException // ReSharper disable PossibleInvalidOperationException
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class OEAPIModel : PageModel { public class OEAPIModel : PageModel {
public int TripId; public int TripId;
@ -56,7 +56,7 @@ namespace bahnplan.web.Pages {
if (extractedTrainNo.Length > 0) if (extractedTrainNo.Length > 0)
trainNo = int.Parse(extractedTrainNo); trainNo = int.Parse(extractedTrainNo);
} }
db.InsertWithInt32Identity(new Leg { db.InsertWithInt32Identity(new database.Tables.Leg {
TripId = tripId, TripId = tripId,
UserId = int.Parse(HttpContext.Session.GetString("uid")), UserId = int.Parse(HttpContext.Session.GetString("uid")),
TrainType = journey.Line.ProductName, TrainType = journey.Line.ProductName,

View file

@ -1,7 +1,7 @@
@page @page
@using Microsoft.AspNetCore.Http @using Microsoft.AspNetCore.Http
@using Microsoft.AspNetCore.Http.Extensions @using Microsoft.AspNetCore.Http.Extensions
@using bahnplan.web.database @using trainav.web.database
@model PlainModel @model PlainModel
@{ @{
ViewData["Title"] = "Plain"; ViewData["Title"] = "Plain";

View file

@ -1,10 +1,10 @@
using System.Linq; using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using trainav.web.database;
using trainav.web.database.Tables;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class PlainModel : PageModel { public class PlainModel : PageModel {
public User AuthorizedUser; public User AuthorizedUser;

View file

@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class PrivacyModel : PageModel { public class PrivacyModel : PageModel {
private readonly ILogger<PrivacyModel> _logger; private readonly ILogger<PrivacyModel> _logger;

View file

@ -1,11 +1,11 @@
using System.Linq; using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using LinqToDB; using LinqToDB;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using trainav.web.database;
using trainav.web.database.Tables;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class RegisterModel : PageModel { public class RegisterModel : PageModel {
public void OnPost() { public void OnPost() {
if (!Request.HasFormContentType if (!Request.HasFormContentType

View file

@ -4,7 +4,7 @@
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>@ViewData["Title"] - DB Navigator 2.0</title> <title>@ViewData["Title"] - Trainav</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css"/> <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css"/>
<link rel="stylesheet" href="~/css/site.css"/> <link rel="stylesheet" href="~/css/site.css"/>
</head> </head>
@ -12,7 +12,7 @@
<header> <header>
<nav class="navbar navbar-expand-md navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3"> <nav class="navbar navbar-expand-md navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container"> <div class="container">
<a class="navbar-brand" asp-area="" asp-page="/Index">DB Navigator <sup>v2</sup></a> <a class="navbar-brand" asp-area="" asp-page="/Index">Trainav <sup>v2</sup></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent" <button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation"> aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>

View file

@ -1,10 +1,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using trainav.web.database;
using trainav.web.database.Tables;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class SharedTripModel : PageModel { public class SharedTripModel : PageModel {
public List<Leg> Legs; public List<Leg> Legs;
public bool RedirToIndex; public bool RedirToIndex;

View file

@ -3,16 +3,16 @@ using System.Linq;
using System.Net; using System.Net;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using bahnplan.web.JSON;
using LinqToDB; using LinqToDB;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json; using Newtonsoft.Json;
using Leg = bahnplan.web.database.Tables.Leg; using trainav.web.database;
using trainav.web.database.Tables;
using trainav.web.JSON;
using Leg = trainav.web.database.Tables.Leg;
namespace bahnplan.web.Pages; namespace trainav.web.Pages;
public class TicketModel : PageModel { public class TicketModel : PageModel {
public int TripId; public int TripId;
@ -36,7 +36,7 @@ public class TicketModel : PageModel {
var lastleg_ticket = 0; var lastleg_ticket = 0;
foreach (var leg in db.TicketLegs.Where(p => p.TicketId == ticketId).ToList()) { foreach (var leg in db.TicketLegs.Where(p => p.TicketId == ticketId).ToList()) {
if (leg.TrainType == "placeholder") { if (leg.TrainType == "placeholder") {
db.Insert(new Leg { db.Insert(new database.Tables.Leg {
TripId = tripId, TripId = tripId,
UserId = int.Parse(HttpContext.Session.GetString("uid")), UserId = int.Parse(HttpContext.Session.GetString("uid")),
TrainType = "placeholder", TrainType = "placeholder",
@ -51,7 +51,7 @@ public class TicketModel : PageModel {
continue; continue;
} }
lastleg_ticket = db.InsertWithInt32Identity(new Leg { lastleg_ticket = db.InsertWithInt32Identity(new database.Tables.Leg {
TripId = tripId, TripId = tripId,
UserId = int.Parse(HttpContext.Session.GetString("uid")), UserId = int.Parse(HttpContext.Session.GetString("uid")),
TrainType = leg.TrainType, TrainType = leg.TrainType,
@ -70,7 +70,7 @@ public class TicketModel : PageModel {
var lastleg = 0; var lastleg = 0;
foreach (var leg in db.TicketLegs.Where(p => p.TicketId == ticketId2).ToList()) foreach (var leg in db.TicketLegs.Where(p => p.TicketId == ticketId2).ToList())
db.InsertWithInt32Identity(new Leg { db.InsertWithInt32Identity(new database.Tables.Leg {
TripId = tripId, TripId = tripId,
UserId = int.Parse(HttpContext.Session.GetString("uid")), UserId = int.Parse(HttpContext.Session.GetString("uid")),
TrainType = leg.TrainType, TrainType = leg.TrainType,
@ -167,7 +167,7 @@ public class TicketModel : PageModel {
var lastticketleg = 0; var lastticketleg = 0;
foreach (var leg in parsed.Rporderdetails.Order.Schedulelist.Out.Trainlist.Train) { foreach (var leg in parsed.Rporderdetails.Order.Schedulelist.Out.Trainlist.Train) {
lastleg = db.InsertWithInt32Identity(new Leg { lastleg = db.InsertWithInt32Identity(new database.Tables.Leg {
TripId = tripId, TripId = tripId,
UserId = int.Parse(HttpContext.Session.GetString("uid")), UserId = int.Parse(HttpContext.Session.GetString("uid")),
TrainType = leg.Gattung, TrainType = leg.Gattung,
@ -195,7 +195,7 @@ public class TicketModel : PageModel {
} }
if (parsed.Rporderdetails.Order.Schedulelist.Ret != null) { if (parsed.Rporderdetails.Order.Schedulelist.Ret != null) {
db.Insert(new Leg { db.Insert(new database.Tables.Leg {
TripId = tripId, TripId = tripId,
UserId = int.Parse(HttpContext.Session.GetString("uid")), UserId = int.Parse(HttpContext.Session.GetString("uid")),
TrainType = "placeholder", TrainType = "placeholder",
@ -221,7 +221,7 @@ public class TicketModel : PageModel {
}); });
foreach (var leg in parsed.Rporderdetails.Order.Schedulelist.Ret.Trainlist.Train) { foreach (var leg in parsed.Rporderdetails.Order.Schedulelist.Ret.Trainlist.Train) {
db.InsertWithInt32Identity(new Leg { db.InsertWithInt32Identity(new database.Tables.Leg {
TripId = tripId, TripId = tripId,
UserId = int.Parse(HttpContext.Session.GetString("uid")), UserId = int.Parse(HttpContext.Session.GetString("uid")),
TrainType = leg.Gattung, TrainType = leg.Gattung,

View file

@ -1,12 +1,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using LinqToDB; using LinqToDB;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using trainav.web.database;
using trainav.web.database.Tables;
namespace bahnplan.web.Pages { namespace trainav.web.Pages {
public class TripModel : PageModel { public class TripModel : PageModel {
public List<Leg> Legs; public List<Leg> Legs;
public bool RedirToIndex; public bool RedirToIndex;

View file

@ -0,0 +1,3 @@
@using trainav.web
@namespace trainav.web.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View file

@ -1,12 +1,12 @@
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using bahnplan.web.database;
using LinqToDB.Common; using LinqToDB.Common;
using LinqToDB.Data; using LinqToDB.Data;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using trainav.web.database;
namespace bahnplan.web { namespace trainav.web {
public class Program { public class Program {
public static void Main(string[] args) { public static void Main(string[] args) {
DataConnection.DefaultSettings = new Database.Settings(); DataConnection.DefaultSettings = new Database.Settings();

View file

@ -5,7 +5,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
namespace bahnplan.web { namespace trainav.web {
public class Startup { public class Startup {
public Startup(IConfiguration configuration) => Configuration = configuration; public Startup(IConfiguration configuration) => Configuration = configuration;

View file

@ -1,6 +1,6 @@
using System.IO; using System.IO;
namespace bahnplan.web { namespace trainav.web {
public class Variables { public class Variables {
public const string DataDir = "data"; public const string DataDir = "data";
public static readonly string TicketDir = Path.Combine(DataDir, "tickets"); public static readonly string TicketDir = Path.Combine(DataDir, "tickets");

View file

@ -1,11 +1,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using bahnplan.web.database.Tables;
using LinqToDB; using LinqToDB;
using LinqToDB.Configuration; using LinqToDB.Configuration;
using LinqToDB.Data; using LinqToDB.Data;
using trainav.web.database.Tables;
namespace bahnplan.web.database { namespace trainav.web.database {
public class Database { public class Database {
public class ConnectionStringSettings : IConnectionStringSettings { public class ConnectionStringSettings : IConnectionStringSettings {
public string ConnectionString { get; set; } public string ConnectionString { get; set; }

View file

@ -1,6 +1,6 @@
using LinqToDB.Mapping; using LinqToDB.Mapping;
namespace bahnplan.web.database.Tables { namespace trainav.web.database.Tables {
[Table(Name = "Cards")] [Table(Name = "Cards")]
public class Card { public class Card {
[Column(Name = "CardID"), PrimaryKey, Identity, NotNull] [Column(Name = "CardID"), PrimaryKey, Identity, NotNull]

View file

@ -1,6 +1,6 @@
using LinqToDB.Mapping; using LinqToDB.Mapping;
namespace bahnplan.web.database.Tables { namespace trainav.web.database.Tables {
[Table(Name = "DbInfo")] [Table(Name = "DbInfo")]
public class DbInfo { public class DbInfo {
[Column(Name = "ID"), PrimaryKey, Identity, NotNull] public int Id { get; set; } [Column(Name = "ID"), PrimaryKey, Identity, NotNull] public int Id { get; set; }

View file

@ -1,6 +1,6 @@
using LinqToDB.Mapping; using LinqToDB.Mapping;
namespace bahnplan.web.database.Tables { namespace trainav.web.database.Tables {
[Table(Name = "Legs")] [Table(Name = "Legs")]
public class Leg { public class Leg {
[Column(Name = "LegID"), PrimaryKey, Identity, NotNull] [Column(Name = "LegID"), PrimaryKey, Identity, NotNull]

View file

@ -1,6 +1,6 @@
using LinqToDB.Mapping; using LinqToDB.Mapping;
namespace bahnplan.web.database.Tables { namespace trainav.web.database.Tables {
[Table(Name = "Tickets")] [Table(Name = "Tickets")]
public class Ticket { public class Ticket {
[Column(Name = "TicketID"), PrimaryKey, Identity, NotNull] public int TicketId { get; set; } [Column(Name = "TicketID"), PrimaryKey, Identity, NotNull] public int TicketId { get; set; }

View file

@ -1,6 +1,6 @@
using LinqToDB.Mapping; using LinqToDB.Mapping;
namespace bahnplan.web.database.Tables { namespace trainav.web.database.Tables {
[Table(Name = "TicketLegs")] [Table(Name = "TicketLegs")]
public class TicketLeg { public class TicketLeg {
[Column(Name = "TicketLegID"), PrimaryKey, Identity, NotNull] [Column(Name = "TicketLegID"), PrimaryKey, Identity, NotNull]

View file

@ -1,6 +1,6 @@
using LinqToDB.Mapping; using LinqToDB.Mapping;
namespace bahnplan.web.database.Tables { namespace trainav.web.database.Tables {
[Table(Name = "Trips")] [Table(Name = "Trips")]
public class Trip { public class Trip {
[Column(Name = "TripID"), PrimaryKey, Identity, NotNull] [Column(Name = "TripID"), PrimaryKey, Identity, NotNull]

View file

@ -1,6 +1,6 @@
using LinqToDB.Mapping; using LinqToDB.Mapping;
namespace bahnplan.web.database.Tables { namespace trainav.web.database.Tables {
[Table(Name = "Users")] [Table(Name = "Users")]
public class User { public class User {
[Column(Name = "UserID"), PrimaryKey, Identity, NotNull] [Column(Name = "UserID"), PrimaryKey, Identity, NotNull]

View file

Can't render this file because it is too large.

View file

@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net60</TargetFramework> <TargetFramework>net60</TargetFramework>
<RootNamespace>bahnplan.web</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -68,15 +69,15 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CsvHelper" Version="18.0.0"/> <PackageReference Include="CsvHelper" Version="18.0.0" />
<PackageReference Include="Ical.Net" Version="4.2.0"/> <PackageReference Include="Ical.Net" Version="4.2.0" />
<PackageReference Include="linq2db" Version="3.2.3"/> <PackageReference Include="linq2db" Version="3.2.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.2"/> <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.2" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.3"/> <PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.3" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.2"/> <PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.115"/> <PackageReference Include="System.Data.SQLite.Core" Version="1.0.115" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0"/> <PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB