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

View File

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

View File

@ -2,7 +2,7 @@
//
// 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);
@ -11,7 +11,7 @@ using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace bahnplan.web.JSON.CardResponse {
namespace trainav.web.JSON.CardResponse {
public partial class CardResponse {
[JsonProperty("?xml", NullValueHandling = NullValueHandling.Ignore)]
public Xml Xml { get; set; }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,15 +3,15 @@ using System.Linq;
using System.Net;
using System.Xml;
using System.Xml.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using bahnplan.web.JSON.CardResponse;
using LinqToDB;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
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 List<Card> Cards;

View File

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

View File

@ -1,11 +1,11 @@
using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using LinqToDB;
using Microsoft.AspNetCore.Http;
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 User AuthorizedUser;

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,10 @@
using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using Microsoft.AspNetCore.Http;
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 User AuthorizedUser;

View File

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

View File

@ -1,12 +1,12 @@
using System;
using System.Linq;
using System.Text;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using Microsoft.AspNetCore.Http;
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 Leg Leg;
public Ticket Ticket;

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,10 @@
using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using Microsoft.AspNetCore.Http;
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 User AuthorizedUser;

View File

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

View File

@ -1,11 +1,11 @@
using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
using LinqToDB;
using Microsoft.AspNetCore.Http;
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 void OnPost() {
if (!Request.HasFormContentType

View File

@ -4,7 +4,7 @@
<head>
<meta charset="utf-8"/>
<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="~/css/site.css"/>
</head>
@ -12,7 +12,7 @@
<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>
<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"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>

View File

@ -1,10 +1,10 @@
using System.Collections.Generic;
using System.Linq;
using bahnplan.web.database;
using bahnplan.web.database.Tables;
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 List<Leg> Legs;
public bool RedirToIndex;

View File

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

View File

@ -1,12 +1,12 @@
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;
using trainav.web.database;
using trainav.web.database.Tables;
namespace bahnplan.web.Pages {
namespace trainav.web.Pages {
public class TripModel : PageModel {
public List<Leg> Legs;
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.Threading;
using bahnplan.web.database;
using LinqToDB.Common;
using LinqToDB.Data;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using trainav.web.database;
namespace bahnplan.web {
namespace trainav.web {
public class Program {
public static void Main(string[] args) {
DataConnection.DefaultSettings = new Database.Settings();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
using LinqToDB.Mapping;
namespace bahnplan.web.database.Tables {
namespace trainav.web.database.Tables {
[Table(Name = "Users")]
public class User {
[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>
<TargetFramework>net60</TargetFramework>
<RootNamespace>bahnplan.web</RootNamespace>
</PropertyGroup>
<ItemGroup>
@ -68,15 +69,15 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CsvHelper" Version="18.0.0"/>
<PackageReference Include="Ical.Net" Version="4.2.0"/>
<PackageReference Include="linq2db" Version="3.2.3"/>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.2"/>
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.3"/>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.2"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/>
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.115"/>
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0"/>
<PackageReference Include="CsvHelper" Version="18.0.0" />
<PackageReference Include="Ical.Net" Version="4.2.0" />
<PackageReference Include="linq2db" Version="3.2.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.2" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.3" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.115" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
</ItemGroup>
</Project>

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB