Compare commits
No commits in common. "main" and "main" have entirely different histories.
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,3 @@
|
|||||||
*.sqlite
|
|
||||||
*.sln
|
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
##
|
##
|
||||||
|
|||||||
53
Database.cs
53
Database.cs
@ -1,53 +0,0 @@
|
|||||||
using System.Data;
|
|
||||||
using Microsoft.Data.Sqlite;
|
|
||||||
|
|
||||||
namespace Database
|
|
||||||
{
|
|
||||||
public class Database
|
|
||||||
{
|
|
||||||
public static void CreateDatabaseQuery(SqliteConnection conn)
|
|
||||||
{
|
|
||||||
string createTableQuery = @"
|
|
||||||
CREATE TABLE [Books] (
|
|
||||||
[ID] INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
[Name] TEXT NOT NULL,
|
|
||||||
[YearOfRelease] INTEGER,
|
|
||||||
[Total] INTEGER,
|
|
||||||
[Available] INTEGER,
|
|
||||||
[AuthorID] INTEGER,
|
|
||||||
[PublisherID] INTEGER,
|
|
||||||
FOREIGN KEY ([AuthorID]) REFERENCES [Authors]([ID]),
|
|
||||||
FOREIGN KEY ([PublisherID]) REFERENCES [Publisher]([ID])
|
|
||||||
);
|
|
||||||
CREATE TABLE [Authors] (
|
|
||||||
[ID] INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
[Name] TEXT,
|
|
||||||
[Surname] TEXT,
|
|
||||||
[DateOfBirth] DATE
|
|
||||||
);
|
|
||||||
CREATE TABLE [Publisher] (
|
|
||||||
[ID] INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
[Name] TEXT,
|
|
||||||
[State] TEXT
|
|
||||||
);
|
|
||||||
CREATE TABLE [Borrows] (
|
|
||||||
[ID] INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
[DateOfBorrow] DATE,
|
|
||||||
[DateOfReturn] DATE,
|
|
||||||
[ReturnDue] DATE,
|
|
||||||
[UserID] INTEGER,
|
|
||||||
[BookID] INTEGER,
|
|
||||||
FOREIGN KEY ([UserID]) REFERENCES [Users]([ID]),
|
|
||||||
FOREIGN KEY ([BookID]) REFERENCES [Books]([ID])
|
|
||||||
);
|
|
||||||
CREATE TABLE [Users] (
|
|
||||||
[ID] INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
[Name] TEXT,
|
|
||||||
[Surname] TEXT
|
|
||||||
);";
|
|
||||||
SqliteCommand command = conn.CreateCommand();
|
|
||||||
command.CommandText = createTableQuery;
|
|
||||||
command.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
16
Dockerfile
16
Dockerfile
@ -1,16 +0,0 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY *.csproj ./
|
|
||||||
|
|
||||||
RUN dotnet restore
|
|
||||||
|
|
||||||
RUN dotnet add package Microsoft.Data.Sqlite
|
|
||||||
|
|
||||||
COPY . ./
|
|
||||||
|
|
||||||
RUN dotnet build --configuration Debug
|
|
||||||
|
|
||||||
CMD ["bash"]
|
|
||||||
|
|
||||||
1
Knihovna
1
Knihovna
@ -1 +0,0 @@
|
|||||||
Subproject commit 9398c1a6de28adf3b2e7b9c41119a5d12c6488da
|
|
||||||
@ -7,12 +7,4 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Remove="Normalizace/**/*.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.10" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.9" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -1,102 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.Data.Sqlite;
|
|
||||||
|
|
||||||
class Program
|
|
||||||
{
|
|
||||||
static void Main()
|
|
||||||
{
|
|
||||||
using var conn = new SqliteConnection("Data Source=students.db;");
|
|
||||||
conn.Open();
|
|
||||||
|
|
||||||
void Exec(string sql)
|
|
||||||
{
|
|
||||||
using var cmd = conn.CreateCommand();
|
|
||||||
cmd.CommandText = sql;
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- DDL + data (vložit SQL bloky z části #2) ---
|
|
||||||
Exec(@"
|
|
||||||
PRAGMA foreign_keys = ON;
|
|
||||||
DROP TABLE IF EXISTS StudentChoice; DROP TABLE IF EXISTS Friendship;
|
|
||||||
DROP TABLE IF EXISTS Subject; DROP TABLE IF EXISTS Student;
|
|
||||||
|
|
||||||
CREATE TABLE Student (id INTEGER PRIMARY KEY, full_name TEXT NOT NULL, abbrev TEXT);
|
|
||||||
CREATE TABLE Subject (id INTEGER PRIMARY KEY, code TEXT NOT NULL UNIQUE, name TEXT NOT NULL);
|
|
||||||
CREATE TABLE Friendship (student_id INTEGER NOT NULL, friend_id INTEGER NOT NULL,
|
|
||||||
PRIMARY KEY(student_id, friend_id),
|
|
||||||
FOREIGN KEY (student_id) REFERENCES Student(id) ON DELETE CASCADE,
|
|
||||||
FOREIGN KEY (friend_id) REFERENCES Student(id) ON DELETE CASCADE);
|
|
||||||
CREATE TABLE StudentChoice (student_id INTEGER NOT NULL, pref_order INTEGER NOT NULL CHECK(pref_order IN (1,2)),
|
|
||||||
subject_id INTEGER NOT NULL,
|
|
||||||
PRIMARY KEY(student_id, pref_order),
|
|
||||||
FOREIGN KEY (student_id) REFERENCES Student(id) ON DELETE CASCADE,
|
|
||||||
FOREIGN KEY (subject_id) REFERENCES Subject(id) ON DELETE RESTRICT);
|
|
||||||
|
|
||||||
INSERT INTO Student (id, full_name, abbrev) VALUES
|
|
||||||
(1,'Petr Zahradil','Za'),
|
|
||||||
(2,'Antonín Neužil','Ne'),
|
|
||||||
(3,'Eva Kárná','Ka'),
|
|
||||||
(4,'Pavel Troup','Tr'),
|
|
||||||
(5,'Jan Zavadil','Za'),
|
|
||||||
(6,'Irina Kornienko','Ko'),
|
|
||||||
(7,'Sabina Křížová','Kr');
|
|
||||||
|
|
||||||
INSERT INTO Subject (id, code, name) VALUES
|
|
||||||
(1,'MA','Matematika'),(2,'DEJ','Dějepis'),(3,'ANG','Angličtina'),
|
|
||||||
(4,'TV','Tělesná výchova'),(5,'OS','Operační systémy'),
|
|
||||||
(6,'NET','Počítačové sítě'),(7,'PRG','Programování');
|
|
||||||
|
|
||||||
INSERT INTO Friendship VALUES
|
|
||||||
(1,2),(1,3),(2,6),(2,7),(3,4),(3,1),(4,3),(4,1),(5,1),(5,3),(6,4),(6,2),(6,3),(7,2),(7,3);
|
|
||||||
|
|
||||||
INSERT INTO StudentChoice VALUES
|
|
||||||
(1,1,1),(1,2,2),
|
|
||||||
(2,1,3),(2,2,4),
|
|
||||||
(3,1,5),(3,2,1),
|
|
||||||
(4,1,5),(4,2,6),
|
|
||||||
(5,1,7),(5,2,3),
|
|
||||||
(6,1,7),(6,2,4),
|
|
||||||
(7,1,7),(7,2,5);
|
|
||||||
");
|
|
||||||
|
|
||||||
string sql = @"
|
|
||||||
WITH FriendsAgg AS (
|
|
||||||
SELECT f.student_id, GROUP_CONCAT(s2.abbrev, ', ') AS friends_abbrev
|
|
||||||
FROM Friendship f
|
|
||||||
JOIN Student s2 ON s2.id = f.friend_id
|
|
||||||
GROUP BY f.student_id
|
|
||||||
),
|
|
||||||
Choices AS (
|
|
||||||
SELECT
|
|
||||||
sc.student_id,
|
|
||||||
MAX(CASE WHEN sc.pref_order=1 THEN sub.code END) AS VolitPr1,
|
|
||||||
MAX(CASE WHEN sc.pref_order=2 THEN sub.code END) AS VolitPr2
|
|
||||||
FROM StudentChoice sc
|
|
||||||
JOIN Subject sub ON sub.id = sc.subject_id
|
|
||||||
GROUP BY sc.student_id
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
s.full_name AS Jmeno,
|
|
||||||
s.abbrev AS Zkratka,
|
|
||||||
IFNULL(fa.friends_abbrev,'') AS Pratele,
|
|
||||||
c.VolitPr1,
|
|
||||||
c.VolitPr2
|
|
||||||
FROM Student s
|
|
||||||
LEFT JOIN FriendsAgg fa ON fa.student_id = s.id
|
|
||||||
LEFT JOIN Choices c ON c.student_id = s.id
|
|
||||||
ORDER BY s.id;";
|
|
||||||
|
|
||||||
using var cmd2 = conn.CreateCommand();
|
|
||||||
cmd2.CommandText = sql;
|
|
||||||
using var rdr = cmd2.ExecuteReader();
|
|
||||||
|
|
||||||
Console.WriteLine("Jméno | Zkratka | Přátelé | VolitPr1 | VolitPr2");
|
|
||||||
while (rdr.Read())
|
|
||||||
{
|
|
||||||
Console.WriteLine(
|
|
||||||
$"{rdr.GetString(0)} | {rdr.GetString(1)} | {rdr.GetString(2)} | {rdr.GetString(3)} | {rdr.GetString(4)}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
Binary file not shown.
@ -1,237 +0,0 @@
|
|||||||
{
|
|
||||||
"runtimeTarget": {
|
|
||||||
"name": ".NETCoreApp,Version=v9.0",
|
|
||||||
"signature": ""
|
|
||||||
},
|
|
||||||
"compilationOptions": {},
|
|
||||||
"targets": {
|
|
||||||
".NETCoreApp,Version=v9.0": {
|
|
||||||
"Normalizace/1.0.0": {
|
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.Data.Sqlite": "9.0.9"
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"Normalizace.dll": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Microsoft.Data.Sqlite/9.0.9": {
|
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.Data.Sqlite.Core": "9.0.9",
|
|
||||||
"SQLitePCLRaw.bundle_e_sqlite3": "2.1.10",
|
|
||||||
"SQLitePCLRaw.core": "2.1.10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Microsoft.Data.Sqlite.Core/9.0.9": {
|
|
||||||
"dependencies": {
|
|
||||||
"SQLitePCLRaw.core": "2.1.10"
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/net8.0/Microsoft.Data.Sqlite.dll": {
|
|
||||||
"assemblyVersion": "9.0.9.0",
|
|
||||||
"fileVersion": "9.0.925.41909"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.bundle_e_sqlite3/2.1.10": {
|
|
||||||
"dependencies": {
|
|
||||||
"SQLitePCLRaw.lib.e_sqlite3": "2.1.10",
|
|
||||||
"SQLitePCLRaw.provider.e_sqlite3": "2.1.10"
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/netstandard2.0/SQLitePCLRaw.batteries_v2.dll": {
|
|
||||||
"assemblyVersion": "2.1.10.2445",
|
|
||||||
"fileVersion": "2.1.10.2445"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.core/2.1.10": {
|
|
||||||
"dependencies": {
|
|
||||||
"System.Memory": "4.5.3"
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/netstandard2.0/SQLitePCLRaw.core.dll": {
|
|
||||||
"assemblyVersion": "2.1.10.2445",
|
|
||||||
"fileVersion": "2.1.10.2445"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.lib.e_sqlite3/2.1.10": {
|
|
||||||
"runtimeTargets": {
|
|
||||||
"runtimes/browser-wasm/nativeassets/net9.0/e_sqlite3.a": {
|
|
||||||
"rid": "browser-wasm",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/linux-arm/native/libe_sqlite3.so": {
|
|
||||||
"rid": "linux-arm",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/linux-arm64/native/libe_sqlite3.so": {
|
|
||||||
"rid": "linux-arm64",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/linux-armel/native/libe_sqlite3.so": {
|
|
||||||
"rid": "linux-armel",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/linux-mips64/native/libe_sqlite3.so": {
|
|
||||||
"rid": "linux-mips64",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/linux-musl-arm/native/libe_sqlite3.so": {
|
|
||||||
"rid": "linux-musl-arm",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/linux-musl-arm64/native/libe_sqlite3.so": {
|
|
||||||
"rid": "linux-musl-arm64",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/linux-musl-s390x/native/libe_sqlite3.so": {
|
|
||||||
"rid": "linux-musl-s390x",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/linux-musl-x64/native/libe_sqlite3.so": {
|
|
||||||
"rid": "linux-musl-x64",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/linux-ppc64le/native/libe_sqlite3.so": {
|
|
||||||
"rid": "linux-ppc64le",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/linux-s390x/native/libe_sqlite3.so": {
|
|
||||||
"rid": "linux-s390x",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/linux-x64/native/libe_sqlite3.so": {
|
|
||||||
"rid": "linux-x64",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/linux-x86/native/libe_sqlite3.so": {
|
|
||||||
"rid": "linux-x86",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/maccatalyst-arm64/native/libe_sqlite3.dylib": {
|
|
||||||
"rid": "maccatalyst-arm64",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/maccatalyst-x64/native/libe_sqlite3.dylib": {
|
|
||||||
"rid": "maccatalyst-x64",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/osx-arm64/native/libe_sqlite3.dylib": {
|
|
||||||
"rid": "osx-arm64",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/osx-x64/native/libe_sqlite3.dylib": {
|
|
||||||
"rid": "osx-x64",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/win-arm/native/e_sqlite3.dll": {
|
|
||||||
"rid": "win-arm",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/win-arm64/native/e_sqlite3.dll": {
|
|
||||||
"rid": "win-arm64",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/win-x64/native/e_sqlite3.dll": {
|
|
||||||
"rid": "win-x64",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
},
|
|
||||||
"runtimes/win-x86/native/e_sqlite3.dll": {
|
|
||||||
"rid": "win-x86",
|
|
||||||
"assetType": "native",
|
|
||||||
"fileVersion": "0.0.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.provider.e_sqlite3/2.1.10": {
|
|
||||||
"dependencies": {
|
|
||||||
"SQLitePCLRaw.core": "2.1.10"
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/net6.0/SQLitePCLRaw.provider.e_sqlite3.dll": {
|
|
||||||
"assemblyVersion": "2.1.10.2445",
|
|
||||||
"fileVersion": "2.1.10.2445"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"System.Memory/4.5.3": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"libraries": {
|
|
||||||
"Normalizace/1.0.0": {
|
|
||||||
"type": "project",
|
|
||||||
"serviceable": false,
|
|
||||||
"sha512": ""
|
|
||||||
},
|
|
||||||
"Microsoft.Data.Sqlite/9.0.9": {
|
|
||||||
"type": "package",
|
|
||||||
"serviceable": true,
|
|
||||||
"sha512": "sha512-23V9T+bci2R6YZ48PkXH84ceCVY0K+4CnkUuD/jMQmP7ZCg2n0ZC/G+ATl8MNV0OeVE6+2+gCaY3BeNSotbObg==",
|
|
||||||
"path": "microsoft.data.sqlite/9.0.9",
|
|
||||||
"hashPath": "microsoft.data.sqlite.9.0.9.nupkg.sha512"
|
|
||||||
},
|
|
||||||
"Microsoft.Data.Sqlite.Core/9.0.9": {
|
|
||||||
"type": "package",
|
|
||||||
"serviceable": true,
|
|
||||||
"sha512": "sha512-DjxZRueHp0qvZxhvW+H1IWYkSofZI8Chg710KYJjNP/6S4q3rt97pvR8AHOompkSwaN92VLKz5uw01iUt85cMg==",
|
|
||||||
"path": "microsoft.data.sqlite.core/9.0.9",
|
|
||||||
"hashPath": "microsoft.data.sqlite.core.9.0.9.nupkg.sha512"
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.bundle_e_sqlite3/2.1.10": {
|
|
||||||
"type": "package",
|
|
||||||
"serviceable": true,
|
|
||||||
"sha512": "sha512-UxWuisvZ3uVcVOLJQv7urM/JiQH+v3TmaJc1BLKl5Dxfm/nTzTUrqswCqg/INiYLi61AXnHo1M1JPmPqqLnAdg==",
|
|
||||||
"path": "sqlitepclraw.bundle_e_sqlite3/2.1.10",
|
|
||||||
"hashPath": "sqlitepclraw.bundle_e_sqlite3.2.1.10.nupkg.sha512"
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.core/2.1.10": {
|
|
||||||
"type": "package",
|
|
||||||
"serviceable": true,
|
|
||||||
"sha512": "sha512-Ii8JCbC7oiVclaE/mbDEK000EFIJ+ShRPwAvvV89GOZhQ+ZLtlnSWl6ksCNMKu/VGXA4Nfi2B7LhN/QFN9oBcw==",
|
|
||||||
"path": "sqlitepclraw.core/2.1.10",
|
|
||||||
"hashPath": "sqlitepclraw.core.2.1.10.nupkg.sha512"
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.lib.e_sqlite3/2.1.10": {
|
|
||||||
"type": "package",
|
|
||||||
"serviceable": true,
|
|
||||||
"sha512": "sha512-mAr69tDbnf3QJpRy2nJz8Qdpebdil00fvycyByR58Cn9eARvR+UiG2Vzsp+4q1tV3ikwiYIjlXCQFc12GfebbA==",
|
|
||||||
"path": "sqlitepclraw.lib.e_sqlite3/2.1.10",
|
|
||||||
"hashPath": "sqlitepclraw.lib.e_sqlite3.2.1.10.nupkg.sha512"
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.provider.e_sqlite3/2.1.10": {
|
|
||||||
"type": "package",
|
|
||||||
"serviceable": true,
|
|
||||||
"sha512": "sha512-uZVTi02C1SxqzgT0HqTWatIbWGb40iIkfc3FpFCpE/r7g6K0PqzDUeefL6P6HPhDtc6BacN3yQysfzP7ks+wSQ==",
|
|
||||||
"path": "sqlitepclraw.provider.e_sqlite3/2.1.10",
|
|
||||||
"hashPath": "sqlitepclraw.provider.e_sqlite3.2.1.10.nupkg.sha512"
|
|
||||||
},
|
|
||||||
"System.Memory/4.5.3": {
|
|
||||||
"type": "package",
|
|
||||||
"serviceable": true,
|
|
||||||
"sha512": "sha512-3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==",
|
|
||||||
"path": "system.memory/4.5.3",
|
|
||||||
"hashPath": "system.memory.4.5.3.nupkg.sha512"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
Binary file not shown.
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"runtimeOptions": {
|
|
||||||
"tfm": "net9.0",
|
|
||||||
"framework": {
|
|
||||||
"name": "Microsoft.NETCore.App",
|
|
||||||
"version": "9.0.0"
|
|
||||||
},
|
|
||||||
"configProperties": {
|
|
||||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +0,0 @@
|
|||||||
// <autogenerated />
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Normalizace")]
|
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("Normalizace")]
|
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("Normalizace")]
|
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
|
||||||
|
|
||||||
@ -1 +0,0 @@
|
|||||||
d0c0387f9ddba8177c53ed9d3592031603138b3f648fe3fb75f880029f76e5f8
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
is_global = true
|
|
||||||
build_property.TargetFramework = net9.0
|
|
||||||
build_property.TargetPlatformMinVersion =
|
|
||||||
build_property.UsingMicrosoftNETSdkWeb =
|
|
||||||
build_property.ProjectTypeGuids =
|
|
||||||
build_property.InvariantGlobalization =
|
|
||||||
build_property.PlatformNeutralAssembly =
|
|
||||||
build_property.EnforceExtendedAnalyzerRules =
|
|
||||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
|
||||||
build_property.RootNamespace = Normalizace
|
|
||||||
build_property.ProjectDir = /Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/
|
|
||||||
build_property.EnableComHosting =
|
|
||||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
|
||||||
build_property.EffectiveAnalysisLevelStyle = 9.0
|
|
||||||
build_property.EnableCodeStyleSeverity =
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
// <auto-generated/>
|
|
||||||
global using global::System;
|
|
||||||
global using global::System.Collections.Generic;
|
|
||||||
global using global::System.IO;
|
|
||||||
global using global::System.Linq;
|
|
||||||
global using global::System.Net.Http;
|
|
||||||
global using global::System.Threading;
|
|
||||||
global using global::System.Threading.Tasks;
|
|
||||||
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
cab799a6e5482d7c0a8752de89b582d103f36e3b2b16c5a0e063deac73039490
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/obj/Debug/net9.0/Normalizace.GeneratedMSBuildEditorConfig.editorconfig
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/obj/Debug/net9.0/Normalizace.AssemblyInfoInputs.cache
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/obj/Debug/net9.0/Normalizace.AssemblyInfo.cs
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/obj/Debug/net9.0/Normalizace.csproj.CoreCompileInputs.cache
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/obj/Debug/net9.0/Normalizace.csproj.AssemblyReference.cache
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/Normalizace
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/Normalizace.deps.json
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/Normalizace.runtimeconfig.json
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/Normalizace.dll
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/Normalizace.pdb
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/Microsoft.Data.Sqlite.dll
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/SQLitePCLRaw.batteries_v2.dll
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/SQLitePCLRaw.core.dll
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/SQLitePCLRaw.provider.e_sqlite3.dll
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/browser-wasm/nativeassets/net9.0/e_sqlite3.a
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/linux-arm/native/libe_sqlite3.so
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/linux-arm64/native/libe_sqlite3.so
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/linux-armel/native/libe_sqlite3.so
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/linux-mips64/native/libe_sqlite3.so
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/linux-musl-arm/native/libe_sqlite3.so
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/linux-musl-arm64/native/libe_sqlite3.so
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/linux-musl-s390x/native/libe_sqlite3.so
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/linux-musl-x64/native/libe_sqlite3.so
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/linux-ppc64le/native/libe_sqlite3.so
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/linux-s390x/native/libe_sqlite3.so
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/linux-x64/native/libe_sqlite3.so
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/linux-x86/native/libe_sqlite3.so
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/maccatalyst-arm64/native/libe_sqlite3.dylib
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/maccatalyst-x64/native/libe_sqlite3.dylib
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/osx-arm64/native/libe_sqlite3.dylib
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/osx-x64/native/libe_sqlite3.dylib
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/win-arm/native/e_sqlite3.dll
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/win-arm64/native/e_sqlite3.dll
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/win-x64/native/e_sqlite3.dll
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/bin/Debug/net9.0/runtimes/win-x86/native/e_sqlite3.dll
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/obj/Debug/net9.0/Normaliz.16E64F1A.Up2Date
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/obj/Debug/net9.0/Normalizace.dll
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/obj/Debug/net9.0/refint/Normalizace.dll
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/obj/Debug/net9.0/Normalizace.pdb
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/obj/Debug/net9.0/Normalizace.genruntimeconfig.cache
|
|
||||||
/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/obj/Debug/net9.0/ref/Normalizace.dll
|
|
||||||
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
7a4c2994e7972d5d7283df569e1f453b1f58739888209d7cd014a14281867cad
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,74 +0,0 @@
|
|||||||
{
|
|
||||||
"format": 1,
|
|
||||||
"restore": {
|
|
||||||
"/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/Normalizace.csproj": {}
|
|
||||||
},
|
|
||||||
"projects": {
|
|
||||||
"/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/Normalizace.csproj": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/Normalizace.csproj",
|
|
||||||
"projectName": "Normalizace",
|
|
||||||
"projectPath": "/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/Normalizace.csproj",
|
|
||||||
"packagesPath": "/Users/hodan/.nuget/packages/",
|
|
||||||
"outputPath": "/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/obj/",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"/Users/hodan/.nuget/NuGet/NuGet.Config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net9.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"/opt/homebrew/Cellar/dotnet/9.0.3/libexec/library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net9.0": {
|
|
||||||
"targetAlias": "net9.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"restoreAuditProperties": {
|
|
||||||
"enableAudit": "true",
|
|
||||||
"auditLevel": "low",
|
|
||||||
"auditMode": "direct"
|
|
||||||
},
|
|
||||||
"SdkAnalysisLevel": "9.0.100"
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net9.0": {
|
|
||||||
"targetAlias": "net9.0",
|
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.Data.Sqlite": {
|
|
||||||
"target": "Package",
|
|
||||||
"version": "[9.0.9, )"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "/opt/homebrew/Cellar/dotnet/9.0.3/libexec/sdk/9.0.104/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
|
||||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
|
||||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
|
||||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/hodan/.nuget/packages/</NuGetPackageRoot>
|
|
||||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/hodan/.nuget/packages/</NuGetPackageFolders>
|
|
||||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
|
||||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.2</NuGetToolVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<SourceRoot Include="/Users/hodan/.nuget/packages/" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<Import Project="$(NuGetPackageRoot)sqlitepclraw.lib.e_sqlite3/2.1.10/buildTransitive/net9.0/SQLitePCLRaw.lib.e_sqlite3.targets" Condition="Exists('$(NuGetPackageRoot)sqlitepclraw.lib.e_sqlite3/2.1.10/buildTransitive/net9.0/SQLitePCLRaw.lib.e_sqlite3.targets')" />
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
||||||
@ -1,403 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"targets": {
|
|
||||||
"net9.0": {
|
|
||||||
"Microsoft.Data.Sqlite/9.0.9": {
|
|
||||||
"type": "package",
|
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.Data.Sqlite.Core": "9.0.9",
|
|
||||||
"SQLitePCLRaw.bundle_e_sqlite3": "2.1.10",
|
|
||||||
"SQLitePCLRaw.core": "2.1.10"
|
|
||||||
},
|
|
||||||
"compile": {
|
|
||||||
"lib/netstandard2.0/_._": {}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/netstandard2.0/_._": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Microsoft.Data.Sqlite.Core/9.0.9": {
|
|
||||||
"type": "package",
|
|
||||||
"dependencies": {
|
|
||||||
"SQLitePCLRaw.core": "2.1.10"
|
|
||||||
},
|
|
||||||
"compile": {
|
|
||||||
"lib/net8.0/Microsoft.Data.Sqlite.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/net8.0/Microsoft.Data.Sqlite.dll": {
|
|
||||||
"related": ".xml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.bundle_e_sqlite3/2.1.10": {
|
|
||||||
"type": "package",
|
|
||||||
"dependencies": {
|
|
||||||
"SQLitePCLRaw.lib.e_sqlite3": "2.1.10",
|
|
||||||
"SQLitePCLRaw.provider.e_sqlite3": "2.1.10"
|
|
||||||
},
|
|
||||||
"compile": {
|
|
||||||
"lib/netstandard2.0/SQLitePCLRaw.batteries_v2.dll": {}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/netstandard2.0/SQLitePCLRaw.batteries_v2.dll": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.core/2.1.10": {
|
|
||||||
"type": "package",
|
|
||||||
"dependencies": {
|
|
||||||
"System.Memory": "4.5.3"
|
|
||||||
},
|
|
||||||
"compile": {
|
|
||||||
"lib/netstandard2.0/SQLitePCLRaw.core.dll": {}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/netstandard2.0/SQLitePCLRaw.core.dll": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.lib.e_sqlite3/2.1.10": {
|
|
||||||
"type": "package",
|
|
||||||
"compile": {
|
|
||||||
"lib/netstandard2.0/_._": {}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/netstandard2.0/_._": {}
|
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"buildTransitive/net9.0/SQLitePCLRaw.lib.e_sqlite3.targets": {}
|
|
||||||
},
|
|
||||||
"runtimeTargets": {
|
|
||||||
"runtimes/browser-wasm/nativeassets/net9.0/e_sqlite3.a": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "browser-wasm"
|
|
||||||
},
|
|
||||||
"runtimes/linux-arm/native/libe_sqlite3.so": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "linux-arm"
|
|
||||||
},
|
|
||||||
"runtimes/linux-arm64/native/libe_sqlite3.so": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "linux-arm64"
|
|
||||||
},
|
|
||||||
"runtimes/linux-armel/native/libe_sqlite3.so": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "linux-armel"
|
|
||||||
},
|
|
||||||
"runtimes/linux-mips64/native/libe_sqlite3.so": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "linux-mips64"
|
|
||||||
},
|
|
||||||
"runtimes/linux-musl-arm/native/libe_sqlite3.so": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "linux-musl-arm"
|
|
||||||
},
|
|
||||||
"runtimes/linux-musl-arm64/native/libe_sqlite3.so": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "linux-musl-arm64"
|
|
||||||
},
|
|
||||||
"runtimes/linux-musl-s390x/native/libe_sqlite3.so": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "linux-musl-s390x"
|
|
||||||
},
|
|
||||||
"runtimes/linux-musl-x64/native/libe_sqlite3.so": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "linux-musl-x64"
|
|
||||||
},
|
|
||||||
"runtimes/linux-ppc64le/native/libe_sqlite3.so": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "linux-ppc64le"
|
|
||||||
},
|
|
||||||
"runtimes/linux-s390x/native/libe_sqlite3.so": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "linux-s390x"
|
|
||||||
},
|
|
||||||
"runtimes/linux-x64/native/libe_sqlite3.so": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "linux-x64"
|
|
||||||
},
|
|
||||||
"runtimes/linux-x86/native/libe_sqlite3.so": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "linux-x86"
|
|
||||||
},
|
|
||||||
"runtimes/maccatalyst-arm64/native/libe_sqlite3.dylib": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "maccatalyst-arm64"
|
|
||||||
},
|
|
||||||
"runtimes/maccatalyst-x64/native/libe_sqlite3.dylib": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "maccatalyst-x64"
|
|
||||||
},
|
|
||||||
"runtimes/osx-arm64/native/libe_sqlite3.dylib": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "osx-arm64"
|
|
||||||
},
|
|
||||||
"runtimes/osx-x64/native/libe_sqlite3.dylib": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "osx-x64"
|
|
||||||
},
|
|
||||||
"runtimes/win-arm/native/e_sqlite3.dll": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "win-arm"
|
|
||||||
},
|
|
||||||
"runtimes/win-arm64/native/e_sqlite3.dll": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "win-arm64"
|
|
||||||
},
|
|
||||||
"runtimes/win-x64/native/e_sqlite3.dll": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "win-x64"
|
|
||||||
},
|
|
||||||
"runtimes/win-x86/native/e_sqlite3.dll": {
|
|
||||||
"assetType": "native",
|
|
||||||
"rid": "win-x86"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.provider.e_sqlite3/2.1.10": {
|
|
||||||
"type": "package",
|
|
||||||
"dependencies": {
|
|
||||||
"SQLitePCLRaw.core": "2.1.10"
|
|
||||||
},
|
|
||||||
"compile": {
|
|
||||||
"lib/net6.0/SQLitePCLRaw.provider.e_sqlite3.dll": {}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/net6.0/SQLitePCLRaw.provider.e_sqlite3.dll": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"System.Memory/4.5.3": {
|
|
||||||
"type": "package",
|
|
||||||
"compile": {
|
|
||||||
"ref/netcoreapp2.1/_._": {}
|
|
||||||
},
|
|
||||||
"runtime": {
|
|
||||||
"lib/netcoreapp2.1/_._": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"libraries": {
|
|
||||||
"Microsoft.Data.Sqlite/9.0.9": {
|
|
||||||
"sha512": "23V9T+bci2R6YZ48PkXH84ceCVY0K+4CnkUuD/jMQmP7ZCg2n0ZC/G+ATl8MNV0OeVE6+2+gCaY3BeNSotbObg==",
|
|
||||||
"type": "package",
|
|
||||||
"path": "microsoft.data.sqlite/9.0.9",
|
|
||||||
"files": [
|
|
||||||
".nupkg.metadata",
|
|
||||||
".signature.p7s",
|
|
||||||
"Icon.png",
|
|
||||||
"PACKAGE.md",
|
|
||||||
"lib/netstandard2.0/_._",
|
|
||||||
"microsoft.data.sqlite.9.0.9.nupkg.sha512",
|
|
||||||
"microsoft.data.sqlite.nuspec"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Microsoft.Data.Sqlite.Core/9.0.9": {
|
|
||||||
"sha512": "DjxZRueHp0qvZxhvW+H1IWYkSofZI8Chg710KYJjNP/6S4q3rt97pvR8AHOompkSwaN92VLKz5uw01iUt85cMg==",
|
|
||||||
"type": "package",
|
|
||||||
"path": "microsoft.data.sqlite.core/9.0.9",
|
|
||||||
"files": [
|
|
||||||
".nupkg.metadata",
|
|
||||||
".signature.p7s",
|
|
||||||
"Icon.png",
|
|
||||||
"PACKAGE.md",
|
|
||||||
"lib/net6.0/Microsoft.Data.Sqlite.dll",
|
|
||||||
"lib/net6.0/Microsoft.Data.Sqlite.xml",
|
|
||||||
"lib/net8.0/Microsoft.Data.Sqlite.dll",
|
|
||||||
"lib/net8.0/Microsoft.Data.Sqlite.xml",
|
|
||||||
"lib/netstandard2.0/Microsoft.Data.Sqlite.dll",
|
|
||||||
"lib/netstandard2.0/Microsoft.Data.Sqlite.xml",
|
|
||||||
"microsoft.data.sqlite.core.9.0.9.nupkg.sha512",
|
|
||||||
"microsoft.data.sqlite.core.nuspec"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.bundle_e_sqlite3/2.1.10": {
|
|
||||||
"sha512": "UxWuisvZ3uVcVOLJQv7urM/JiQH+v3TmaJc1BLKl5Dxfm/nTzTUrqswCqg/INiYLi61AXnHo1M1JPmPqqLnAdg==",
|
|
||||||
"type": "package",
|
|
||||||
"path": "sqlitepclraw.bundle_e_sqlite3/2.1.10",
|
|
||||||
"files": [
|
|
||||||
".nupkg.metadata",
|
|
||||||
".signature.p7s",
|
|
||||||
"lib/monoandroid90/SQLitePCLRaw.batteries_v2.dll",
|
|
||||||
"lib/net461/SQLitePCLRaw.batteries_v2.dll",
|
|
||||||
"lib/net6.0-android31.0/SQLitePCLRaw.batteries_v2.dll",
|
|
||||||
"lib/net6.0-android31.0/SQLitePCLRaw.batteries_v2.xml",
|
|
||||||
"lib/net6.0-ios14.0/SQLitePCLRaw.batteries_v2.dll",
|
|
||||||
"lib/net6.0-ios14.2/SQLitePCLRaw.batteries_v2.dll",
|
|
||||||
"lib/net6.0-tvos10.0/SQLitePCLRaw.batteries_v2.dll",
|
|
||||||
"lib/netstandard2.0/SQLitePCLRaw.batteries_v2.dll",
|
|
||||||
"lib/xamarinios10/SQLitePCLRaw.batteries_v2.dll",
|
|
||||||
"sqlitepclraw.bundle_e_sqlite3.2.1.10.nupkg.sha512",
|
|
||||||
"sqlitepclraw.bundle_e_sqlite3.nuspec"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.core/2.1.10": {
|
|
||||||
"sha512": "Ii8JCbC7oiVclaE/mbDEK000EFIJ+ShRPwAvvV89GOZhQ+ZLtlnSWl6ksCNMKu/VGXA4Nfi2B7LhN/QFN9oBcw==",
|
|
||||||
"type": "package",
|
|
||||||
"path": "sqlitepclraw.core/2.1.10",
|
|
||||||
"files": [
|
|
||||||
".nupkg.metadata",
|
|
||||||
".signature.p7s",
|
|
||||||
"lib/netstandard2.0/SQLitePCLRaw.core.dll",
|
|
||||||
"sqlitepclraw.core.2.1.10.nupkg.sha512",
|
|
||||||
"sqlitepclraw.core.nuspec"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.lib.e_sqlite3/2.1.10": {
|
|
||||||
"sha512": "mAr69tDbnf3QJpRy2nJz8Qdpebdil00fvycyByR58Cn9eARvR+UiG2Vzsp+4q1tV3ikwiYIjlXCQFc12GfebbA==",
|
|
||||||
"type": "package",
|
|
||||||
"path": "sqlitepclraw.lib.e_sqlite3/2.1.10",
|
|
||||||
"files": [
|
|
||||||
".nupkg.metadata",
|
|
||||||
".signature.p7s",
|
|
||||||
"buildTransitive/net461/SQLitePCLRaw.lib.e_sqlite3.targets",
|
|
||||||
"buildTransitive/net6.0/SQLitePCLRaw.lib.e_sqlite3.targets",
|
|
||||||
"buildTransitive/net7.0/SQLitePCLRaw.lib.e_sqlite3.targets",
|
|
||||||
"buildTransitive/net8.0/SQLitePCLRaw.lib.e_sqlite3.targets",
|
|
||||||
"buildTransitive/net9.0/SQLitePCLRaw.lib.e_sqlite3.targets",
|
|
||||||
"lib/net461/_._",
|
|
||||||
"lib/netstandard2.0/_._",
|
|
||||||
"runtimes/browser-wasm/nativeassets/net6.0/e_sqlite3.a",
|
|
||||||
"runtimes/browser-wasm/nativeassets/net7.0/e_sqlite3.a",
|
|
||||||
"runtimes/browser-wasm/nativeassets/net8.0/e_sqlite3.a",
|
|
||||||
"runtimes/browser-wasm/nativeassets/net9.0/e_sqlite3.a",
|
|
||||||
"runtimes/linux-arm/native/libe_sqlite3.so",
|
|
||||||
"runtimes/linux-arm64/native/libe_sqlite3.so",
|
|
||||||
"runtimes/linux-armel/native/libe_sqlite3.so",
|
|
||||||
"runtimes/linux-mips64/native/libe_sqlite3.so",
|
|
||||||
"runtimes/linux-musl-arm/native/libe_sqlite3.so",
|
|
||||||
"runtimes/linux-musl-arm64/native/libe_sqlite3.so",
|
|
||||||
"runtimes/linux-musl-s390x/native/libe_sqlite3.so",
|
|
||||||
"runtimes/linux-musl-x64/native/libe_sqlite3.so",
|
|
||||||
"runtimes/linux-ppc64le/native/libe_sqlite3.so",
|
|
||||||
"runtimes/linux-s390x/native/libe_sqlite3.so",
|
|
||||||
"runtimes/linux-x64/native/libe_sqlite3.so",
|
|
||||||
"runtimes/linux-x86/native/libe_sqlite3.so",
|
|
||||||
"runtimes/maccatalyst-arm64/native/libe_sqlite3.dylib",
|
|
||||||
"runtimes/maccatalyst-x64/native/libe_sqlite3.dylib",
|
|
||||||
"runtimes/osx-arm64/native/libe_sqlite3.dylib",
|
|
||||||
"runtimes/osx-x64/native/libe_sqlite3.dylib",
|
|
||||||
"runtimes/win-arm/native/e_sqlite3.dll",
|
|
||||||
"runtimes/win-arm64/native/e_sqlite3.dll",
|
|
||||||
"runtimes/win-x64/native/e_sqlite3.dll",
|
|
||||||
"runtimes/win-x86/native/e_sqlite3.dll",
|
|
||||||
"runtimes/win10-arm/nativeassets/uap10.0/e_sqlite3.dll",
|
|
||||||
"runtimes/win10-arm64/nativeassets/uap10.0/e_sqlite3.dll",
|
|
||||||
"runtimes/win10-x64/nativeassets/uap10.0/e_sqlite3.dll",
|
|
||||||
"runtimes/win10-x86/nativeassets/uap10.0/e_sqlite3.dll",
|
|
||||||
"sqlitepclraw.lib.e_sqlite3.2.1.10.nupkg.sha512",
|
|
||||||
"sqlitepclraw.lib.e_sqlite3.nuspec"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"SQLitePCLRaw.provider.e_sqlite3/2.1.10": {
|
|
||||||
"sha512": "uZVTi02C1SxqzgT0HqTWatIbWGb40iIkfc3FpFCpE/r7g6K0PqzDUeefL6P6HPhDtc6BacN3yQysfzP7ks+wSQ==",
|
|
||||||
"type": "package",
|
|
||||||
"path": "sqlitepclraw.provider.e_sqlite3/2.1.10",
|
|
||||||
"files": [
|
|
||||||
".nupkg.metadata",
|
|
||||||
".signature.p7s",
|
|
||||||
"lib/net6.0-windows7.0/SQLitePCLRaw.provider.e_sqlite3.dll",
|
|
||||||
"lib/net6.0/SQLitePCLRaw.provider.e_sqlite3.dll",
|
|
||||||
"lib/netstandard2.0/SQLitePCLRaw.provider.e_sqlite3.dll",
|
|
||||||
"sqlitepclraw.provider.e_sqlite3.2.1.10.nupkg.sha512",
|
|
||||||
"sqlitepclraw.provider.e_sqlite3.nuspec"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"System.Memory/4.5.3": {
|
|
||||||
"sha512": "3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==",
|
|
||||||
"type": "package",
|
|
||||||
"path": "system.memory/4.5.3",
|
|
||||||
"files": [
|
|
||||||
".nupkg.metadata",
|
|
||||||
".signature.p7s",
|
|
||||||
"LICENSE.TXT",
|
|
||||||
"THIRD-PARTY-NOTICES.TXT",
|
|
||||||
"lib/netcoreapp2.1/_._",
|
|
||||||
"lib/netstandard1.1/System.Memory.dll",
|
|
||||||
"lib/netstandard1.1/System.Memory.xml",
|
|
||||||
"lib/netstandard2.0/System.Memory.dll",
|
|
||||||
"lib/netstandard2.0/System.Memory.xml",
|
|
||||||
"ref/netcoreapp2.1/_._",
|
|
||||||
"system.memory.4.5.3.nupkg.sha512",
|
|
||||||
"system.memory.nuspec",
|
|
||||||
"useSharedDesignerContext.txt",
|
|
||||||
"version.txt"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"projectFileDependencyGroups": {
|
|
||||||
"net9.0": [
|
|
||||||
"Microsoft.Data.Sqlite >= 9.0.9"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"packageFolders": {
|
|
||||||
"/Users/hodan/.nuget/packages/": {}
|
|
||||||
},
|
|
||||||
"project": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/Normalizace.csproj",
|
|
||||||
"projectName": "Normalizace",
|
|
||||||
"projectPath": "/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/Normalizace.csproj",
|
|
||||||
"packagesPath": "/Users/hodan/.nuget/packages/",
|
|
||||||
"outputPath": "/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/obj/",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"/Users/hodan/.nuget/NuGet/NuGet.Config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net9.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"/opt/homebrew/Cellar/dotnet/9.0.3/libexec/library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net9.0": {
|
|
||||||
"targetAlias": "net9.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"restoreAuditProperties": {
|
|
||||||
"enableAudit": "true",
|
|
||||||
"auditLevel": "low",
|
|
||||||
"auditMode": "direct"
|
|
||||||
},
|
|
||||||
"SdkAnalysisLevel": "9.0.100"
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net9.0": {
|
|
||||||
"targetAlias": "net9.0",
|
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.Data.Sqlite": {
|
|
||||||
"target": "Package",
|
|
||||||
"version": "[9.0.9, )"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "/opt/homebrew/Cellar/dotnet/9.0.3/libexec/sdk/9.0.104/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 2,
|
|
||||||
"dgSpecHash": "V8kjKKiEZVk=",
|
|
||||||
"success": true,
|
|
||||||
"projectFilePath": "/Users/hodan/Docs/Coding/ssps/ostrece/Normalizace/Normalizace.csproj",
|
|
||||||
"expectedPackageFiles": [
|
|
||||||
"/Users/hodan/.nuget/packages/microsoft.data.sqlite/9.0.9/microsoft.data.sqlite.9.0.9.nupkg.sha512",
|
|
||||||
"/Users/hodan/.nuget/packages/microsoft.data.sqlite.core/9.0.9/microsoft.data.sqlite.core.9.0.9.nupkg.sha512",
|
|
||||||
"/Users/hodan/.nuget/packages/sqlitepclraw.bundle_e_sqlite3/2.1.10/sqlitepclraw.bundle_e_sqlite3.2.1.10.nupkg.sha512",
|
|
||||||
"/Users/hodan/.nuget/packages/sqlitepclraw.core/2.1.10/sqlitepclraw.core.2.1.10.nupkg.sha512",
|
|
||||||
"/Users/hodan/.nuget/packages/sqlitepclraw.lib.e_sqlite3/2.1.10/sqlitepclraw.lib.e_sqlite3.2.1.10.nupkg.sha512",
|
|
||||||
"/Users/hodan/.nuget/packages/sqlitepclraw.provider.e_sqlite3/2.1.10/sqlitepclraw.provider.e_sqlite3.2.1.10.nupkg.sha512",
|
|
||||||
"/Users/hodan/.nuget/packages/system.memory/4.5.3/system.memory.4.5.3.nupkg.sha512"
|
|
||||||
],
|
|
||||||
"logs": []
|
|
||||||
}
|
|
||||||
Binary file not shown.
26
Program.cs
26
Program.cs
@ -1,23 +1,3 @@
|
|||||||
using System;
|
// See https://aka.ms/new-console-template for more information
|
||||||
using Microsoft.Data.Sqlite;
|
Console.WriteLine("Hello, World!");
|
||||||
using Database.Dto;
|
Console.WriteLine("Test");
|
||||||
using Team1; // Team 1
|
|
||||||
using Team2; // Team 2
|
|
||||||
using Team3; // Team 3
|
|
||||||
using Team4; // Team 4
|
|
||||||
|
|
||||||
|
|
||||||
public class Program
|
|
||||||
{
|
|
||||||
public static void Main()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Tests.TestRunner.RunAll();
|
|
||||||
}
|
|
||||||
catch (SqliteException ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"{ex.Source}: {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
115
README.md
115
README.md
@ -1,116 +1,5 @@
|
|||||||
# Knihovna
|
# Knihovna
|
||||||
|
|
||||||
## Struktura projektu
|
|
||||||
|
|
||||||
Projekt je organizován do několika klíčových částí:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
Knihovna/
|
|
||||||
│
|
|
||||||
├── src/ # Zdrojové soubory – zde bude vaše implementace
|
|
||||||
│ ├── Funkce1.cs
|
|
||||||
│ ├── Funkce2.cs
|
|
||||||
│ └── ...
|
|
||||||
│
|
|
||||||
├── Database.cs # Definice databázových tabulek a datových modelů
|
|
||||||
│
|
|
||||||
├── Program.cs # Hlavní vstupní bod programu (spuštění aplikace)
|
|
||||||
│
|
|
||||||
└── docs/ # Dokumentace a zadání pro jednotlivé týmy
|
|
||||||
├── TymA.md
|
|
||||||
├── TymB.md
|
|
||||||
└── ...
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Popis hlavních souborů
|
|
||||||
|
|
||||||
### `./src/`
|
|
||||||
|
|
||||||
- každý tým implementuje své funkce **v samostatném souboru**, abychom se vyhnuli git konfliktům
|
|
||||||
- Například funkci pro vyhledávání knih uložte do souboru `VyhledavaniKnih.cs`.
|
|
||||||
- Tento přístup zajišťuje přehlednost, modularitu a snadné testování.
|
|
||||||
|
|
||||||
> [!IMPORTANT]
|
|
||||||
> Všechny proměnné se pojmenovávají v angličtině ve stylu PascalCase, to stejné platí pro názvy souborů.
|
|
||||||
|
|
||||||
### `Database.cs`
|
|
||||||
|
|
||||||
- Obsahuje **definici tabulek** a **datových struktur**, které reprezentují databázi (např. `Knihy`, `Ctenari`, `Vypujcky`).
|
|
||||||
- Není vhodné měnit strukturu bez předchozí domluvy s ostatními členy týmu, protože soubor je sdílený v rámci celého projektu.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### `Program.cs`
|
|
||||||
|
|
||||||
- Slouží jako **hlavní vstupní bod** aplikace.
|
|
||||||
- Zde se spouští program, načítají data a volají funkce z adresáře `src`.
|
|
||||||
- Tento soubor zajišťuje propojení všech částí projektu.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Postup při přidávání vaší práce
|
|
||||||
|
|
||||||
### Klonování repozitáře
|
|
||||||
|
|
||||||
Stáhněte si projekt lokálně pomocí GITu:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://gitea.homework.zip/shinya/Knihovna.git
|
|
||||||
```
|
|
||||||
|
|
||||||
Tímto příkazem vytvoříte lokální kopii projektu na vašem počítači.
|
|
||||||
|
|
||||||
## Úpravy a implementace
|
|
||||||
|
|
||||||
Vytvořte nebo upravte soubory v adresáři ./src/.
|
|
||||||
|
|
||||||
Dodržujte strukturu projektu a konvence psaní kódu.
|
|
||||||
|
|
||||||
Průběžně testujte své změny (např. pomocí dotnet run).
|
|
||||||
|
|
||||||
Pokud nemate dotnet tak docker compose up -d
|
|
||||||
a docker exec -it knihovna bash
|
|
||||||
Tam mate prostredi s nainstalovanym dotnetem a vsemi dependencies
|
|
||||||
|
|
||||||
## Commit a push
|
|
||||||
|
|
||||||
Jakmile máte změny hotové, proveďte následující příkazy:
|
|
||||||
|
|
||||||
Dodržujte conventional commits:
|
|
||||||
https://www.conventionalcommits.org/en/v1.0.0/
|
|
||||||
|
|
||||||
Cheatsheet:
|
|
||||||
https://ashababnoor.github.io/cheatsheets/cheatsheets/conventional-commits
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git add .
|
|
||||||
git commit -m "feat: funkce vyhledávání knih"
|
|
||||||
git push
|
|
||||||
```
|
|
||||||
|
|
||||||
Tímto nahrajete změny zpět na server.
|
|
||||||
|
|
||||||
Pozor: Před odesláním změn vždy nejprve stáhněte aktuální verzi projektu:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git pull
|
|
||||||
```
|
|
||||||
|
|
||||||
- a vyřešte případné konflikty, pokud se vyskytnou.
|
|
||||||
|
|
||||||
## Zadání projektů
|
|
||||||
|
|
||||||
V adresáři ./docs se nachází zadání pro jednotlivé týmy.
|
|
||||||
Každý tým má svůj vlastní soubor (např. TymA.md, TymB.md), který obsahuje:
|
|
||||||
|
|
||||||
- konkrétní popis úkolu,
|
|
||||||
- technické požadavky,
|
|
||||||
- a případně hodnoticí kritéria.
|
|
||||||
|
|
||||||
## Info
|
|
||||||
|
|
||||||
- Přidat, upravit, vypsat, vymazat knihy
|
- Přidat, upravit, vypsat, vymazat knihy
|
||||||
|
|
||||||
- Filtrace knih podle autora atd...
|
- Filtrace knih podle autora atd...
|
||||||
@ -131,7 +20,7 @@ Každý tým má svůj vlastní soubor (např. TymA.md, TymB.md), který obsahuj
|
|||||||
|
|
||||||
1. Struktura databáze
|
1. Struktura databáze
|
||||||
2. Informace z databáze zpracování
|
2. Informace z databáze zpracování
|
||||||
3.
|
3.
|
||||||
|
|
||||||
## Funkce
|
## Funkce
|
||||||
|
|
||||||
@ -139,7 +28,7 @@ Každý tým má svůj vlastní soubor (např. TymA.md, TymB.md), který obsahuj
|
|||||||
- GetBooksByAuthor() param. filter
|
- GetBooksByAuthor() param. filter
|
||||||
- GetBooksByName() param. filter
|
- GetBooksByName() param. filter
|
||||||
- GetStolenBooks() param. filter
|
- GetStolenBooks() param. filter
|
||||||
- GetAvailableBooks() param. filter
|
- GetAvailableBooks() param. filter
|
||||||
- GetBorrowedBooks() param. userID
|
- GetBorrowedBooks() param. userID
|
||||||
- GetBookInfo() param. knihaID
|
- GetBookInfo() param. knihaID
|
||||||
- AddBook() param. KnihaInfo
|
- AddBook() param. KnihaInfo
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
services:
|
|
||||||
knihovna:
|
|
||||||
build: .
|
|
||||||
container_name: knihovna
|
|
||||||
volumes:
|
|
||||||
- .:/app
|
|
||||||
tty: true
|
|
||||||
stdin_open: true
|
|
||||||
|
|
||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 21 KiB |
107
docs/test.md
107
docs/test.md
@ -1,107 +0,0 @@
|
|||||||
Testy:
|
|
||||||
Jde pridat knihu
|
|
||||||
Jde pridat autora
|
|
||||||
Jde pridat publishera
|
|
||||||
Jde zmenit pocet vytisku vlastnenych knihovnou
|
|
||||||
Jde Vypsat vsechny knihy
|
|
||||||
Jde provezt vypujcku
|
|
||||||
Jde pridat ctenare
|
|
||||||
Jde vratit vypujcku knihy
|
|
||||||
Jde vyhledat knihu dle autora, jmena, nevypujcenych knih, a ztracenych knih
|
|
||||||
Odstranit knhu
|
|
||||||
Upravit autora
|
|
||||||
|
|
||||||
Co maji handlovat:
|
|
||||||
Prazdne inputy od uzivatele
|
|
||||||
Consecutive r/w
|
|
||||||
Type checking
|
|
||||||
Fuzzing inputu
|
|
||||||
|
|
||||||
-----------------------------------------
|
|
||||||
|
|
||||||
Scénáře (přidání knihy) + očekávané výstupy
|
|
||||||
|
|
||||||
- Předpoklady testů:
|
|
||||||
- Existuje `AuthorID` a `PublisherID` v DB (jinak přidání knihy selže a funkce vrátí null).
|
|
||||||
- Implementace `Team2.AddBook` vkládá přes `INSERT OR IGNORE` a následně dělá `SELECT ... LIMIT 1` podle kombinace `(Name, AuthorID, PublisherID, YearOfRelease)`.
|
|
||||||
- Poznámka ke schématu: pokud tabulka `Books` NEOBSAHUJE sloupec `Available`, vkládání selže SQL chybou a funkce vrátí null. Pokud `Available` existuje (v předem připravené DB), testy s `Available` dávají smysl.
|
|
||||||
|
|
||||||
- Základní flow – úspěch:
|
|
||||||
- Vstup: validní `name`, existující `authorId`, existující `publisherId`, rozumný `year`, `total >= 0`, `available >= 0`.
|
|
||||||
- Očekávaný výstup: `BookDto` s nenulovým `Id`, hodnotami dle vstupu; návrat nenull.
|
|
||||||
|
|
||||||
- Neexistující autor:
|
|
||||||
- Vstup: `authorId` neexistuje v `Authors`.
|
|
||||||
- Očekávaný výstup: nenastane insert, funkce vrátí `null`.
|
|
||||||
|
|
||||||
- Neexistující publisher:
|
|
||||||
- Vstup: `publisherId` neexistuje v `Publisher`.
|
|
||||||
- Očekávaný výstup: nenastane insert, funkce vrátí `null`.
|
|
||||||
|
|
||||||
- Duplicita knihy (stejný `name` + `authorId` + `publisherId` + `year`):
|
|
||||||
- Pokud v DB existuje unikátní omezení na tuto kombinaci: `INSERT OR IGNORE` neprovede insert a `SELECT ... LIMIT 1` vrátí existující řádek ⇒ `BookDto` (nenull), nezdvojené data.
|
|
||||||
- Pokud v DB NEexistuje žádné unikátní omezení (výchozí schema v `Database.cs` ho nemá): dojde ke vložení DUPLIKÁTNÍHO řádku, `SELECT ... LIMIT 1` vrátí libovolný první shodný záznam ⇒ `BookDto` (nenull), ale data jsou duplicitní v tabulce.
|
|
||||||
|
|
||||||
- `name` prázdný řetězec:
|
|
||||||
- `Books.Name` je `NOT NULL`, ale prázdný řetězec NENÍ `NULL` ⇒ vložení projde.
|
|
||||||
- Očekávaný výstup: `BookDto` (nenull).
|
|
||||||
|
|
||||||
- `name` = null:
|
|
||||||
- Při předání `null` jako parametru může dojít k chybě binderu parametrů nebo k pokusu vložit `NULL` do `NOT NULL` sloupce.
|
|
||||||
- Očekávaný výstup: SQL nebo parametrická výjimka uvnitř metody ⇒ metoda chytá výjimku a vrátí `null`.
|
|
||||||
|
|
||||||
- `year` záporný nebo 0:
|
|
||||||
- Není validováno na aplikační úrovni ani ve schématu.
|
|
||||||
- Očekávaný výstup: vložení projde ⇒ `BookDto` (nenull).
|
|
||||||
|
|
||||||
- `total` záporné číslo:
|
|
||||||
- Není validováno; ve schématu žádné omezení.
|
|
||||||
- Očekávaný výstup: vložení projde ⇒ `BookDto` (nenull). Pozn.: následné reporty mohou dávat nelogické výsledky.
|
|
||||||
|
|
||||||
- `available` > `total`:
|
|
||||||
- Není validováno; pokud sloupec `Available` v DB existuje, vloží se bez kontroly.
|
|
||||||
- Očekávaný výstup: `BookDto` (nenull).
|
|
||||||
|
|
||||||
- `available` záporné:
|
|
||||||
- Není validováno; pokud sloupec existuje, vloží se.
|
|
||||||
- Očekávaný výstup: `BookDto` (nenull).
|
|
||||||
|
|
||||||
- Extrémně dlouhé `name`:
|
|
||||||
- Bez omezení délky; SQLite uloží. Může mít dopad na výkon a čitelnost.
|
|
||||||
- Očekávaný výstup: `BookDto` (nenull).
|
|
||||||
|
|
||||||
- Speciální znaky / SQL injection v `name`:
|
|
||||||
- Parametrizované dotazy ⇒ bezpečné vůči SQLi.
|
|
||||||
- Očekávaný výstup: `BookDto` (nenull).
|
|
||||||
|
|
||||||
- Současné (konkurenční) vkládání stejné knihy:
|
|
||||||
- Bez unikátního indexu hrozí race condition ⇒ vícenásobné duplicity.
|
|
||||||
- Očekávaný výstup: více identických řádků v `Books`.
|
|
||||||
|
|
||||||
- Nesoulad schématu: chybějící `Available` ve `Books`:
|
|
||||||
- `INSERT` obsahuje `Available` sloupec; pokud DB nemá `Available`, dojde k SQL chybě.
|
|
||||||
- Očekávaný výstup: metoda vrátí `null`.
|
|
||||||
|
|
||||||
-----------------------------------------
|
|
||||||
|
|
||||||
Scénáře (autor) – “stejný autor včetně DOB”
|
|
||||||
|
|
||||||
- Vytvoření autora se stejným `Name` + `Surname` + `DateOfBirth` opakovaně:
|
|
||||||
- Pokud existuje unikátní omezení nad (Name, Surname, DateOfBirth): `INSERT OR IGNORE` neprovede insert ⇒ vrácen bude existující autor (nenull).
|
|
||||||
- Pokud unikát neexistuje (výchozí schema v `Database.cs` jej nemá): vloží se DUPLIKÁT; následný `SELECT ... LIMIT 1` vrátí některého z nich ⇒ `AuthorDto` (nenull), ale v DB jsou duplicity.
|
|
||||||
|
|
||||||
- Přidání knihy k “stejnému autorovi”:
|
|
||||||
- Logika knihy pracuje výhradně s `authorId`. Pokud existují 2 různé řádky autora se stejnými údaji (Name/Surname/DOB), ale rozdílným `ID`, přidání knihy proběhne ke kterékoliv instanci podle zvoleného `authorId`.
|
|
||||||
- Očekávaný výstup: `BookDto` (nenull), navázáno na konkrétní `AuthorID`, nikoli na shodu jména/DOB.
|
|
||||||
|
|
||||||
-----------------------------------------
|
|
||||||
|
|
||||||
Edge cases (souhrn)
|
|
||||||
|
|
||||||
- Chybějící cizí klíče (`AuthorID`, `PublisherID`) ⇒ návrat `null`.
|
|
||||||
- Duplicity bez unikátních indexů ⇒ v DB vznikají vícenásobné identické záznamy.
|
|
||||||
- Schéma vs. kód: `Available` ve `Books` – pokud chybí, přidání knihy vždy selže ⇒ `null`.
|
|
||||||
- `Name` prázdný vs `NULL`: prázdný projde, `NULL` vyvolá chybu kvůli `NOT NULL`.
|
|
||||||
- Hodnoty mimo rozsah (záporné `year`/`total`/`available`) nejsou validovány.
|
|
||||||
- Neprobíhá automatické snižování zásob po výpůjčce (`Borrows` neupravují `Books.Total/Available`).
|
|
||||||
- Potenciálně nekonzistentní pluralita tabulek v jiných částech (např. `Publishers` vs `Publisher`) – neovlivňuje `Team2.AddBook`, ale je rizikem v integračních testech.
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
# Tým 1
|
|
||||||
|
|
||||||
- Obsazení: Vítek (zen), Matyáš (Masro), Jakub (Kub1no23)
|
|
||||||
- Termín odevzdání: 8.11.2025 23:59
|
|
||||||
|
|
||||||
## Implementace
|
|
||||||
|
|
||||||
- `AddAuthor(String Name, String LastName, DateTime BornDate)`
|
|
||||||
- `AddPublisher(String Name, String State)`
|
|
||||||
10
docs/tym2.md
10
docs/tym2.md
@ -1,10 +0,0 @@
|
|||||||
# Tým 2
|
|
||||||
|
|
||||||
- Obsazení: Aleš (geekon), Adam (adam)
|
|
||||||
- Termín odevzdání: 8.11.2025 23:59
|
|
||||||
|
|
||||||
## Implementace
|
|
||||||
|
|
||||||
- `AddBook(String Name, DateTime Year, int Author, int Publisher, int Copies)`
|
|
||||||
- `AddUser(String Name, String LastName)`
|
|
||||||
- `AddBorrowedBookRecord(int Book, int User, DateTime BorrowedDate, int Days=30)`
|
|
||||||
11
docs/tym3.md
11
docs/tym3.md
@ -1,11 +0,0 @@
|
|||||||
# Tým 3
|
|
||||||
|
|
||||||
- Obsazení: Fanda (divinity), Oliver (oliver), Sam (five)
|
|
||||||
- Termín odevzdání: 8.11.2025 23:59
|
|
||||||
|
|
||||||
## Implementace
|
|
||||||
|
|
||||||
- `EditBook(book Book)`
|
|
||||||
- `EditAuthor(author Author)`
|
|
||||||
- `EditPublisher(publisher Publisher)`
|
|
||||||
- `EditUser(user User)`
|
|
||||||
14
docs/tym4.md
14
docs/tym4.md
@ -1,14 +0,0 @@
|
|||||||
# Tým 4
|
|
||||||
|
|
||||||
- Obsazení: Filip (shinya), Albert (haterdotdev), Skajp
|
|
||||||
- Termín odevzdání: 8.11.2025 23:59
|
|
||||||
|
|
||||||
## Implementace
|
|
||||||
|
|
||||||
- `GetBooksByName`
|
|
||||||
- `GetBooksByAuthor`
|
|
||||||
- `GetBooksByAvailableBooks`
|
|
||||||
- `GetStolenBooks`
|
|
||||||
- `GetStolenBooksByUser`
|
|
||||||
- `GetBooksBy`
|
|
||||||
- `GetBorrowLogBy`
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
namespace Database.Dto;
|
|
||||||
|
|
||||||
|
|
||||||
public class CreateAuthorDto
|
|
||||||
{
|
|
||||||
public string Name;
|
|
||||||
public string Surname;
|
|
||||||
public DateTime DateOfBirth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AuthorDto : CreateAuthorDto
|
|
||||||
{
|
|
||||||
public int Id;
|
|
||||||
}
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
namespace Database.Dto;
|
|
||||||
|
|
||||||
public class CreateBookDto
|
|
||||||
{
|
|
||||||
|
|
||||||
public string Name;
|
|
||||||
public int YearOfRelease;
|
|
||||||
public int Total;
|
|
||||||
public AuthorDto Author;
|
|
||||||
public Publisher Publisher;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BookDto : CreateBookDto
|
|
||||||
{
|
|
||||||
public int Id;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
namespace Database.Dto;
|
|
||||||
|
|
||||||
|
|
||||||
public class BorrowCreateDto
|
|
||||||
{
|
|
||||||
public DateTime DateOfBorrow;
|
|
||||||
public DateTime DateOfReturn;
|
|
||||||
public DateTime ReturnDue;
|
|
||||||
public UserDto User;
|
|
||||||
public BookDto Book;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Borrow : BorrowCreateDto
|
|
||||||
{
|
|
||||||
public int Id;
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
namespace Database.Dto;
|
|
||||||
|
|
||||||
|
|
||||||
public class CreatePublisherDto
|
|
||||||
{
|
|
||||||
public string Name;
|
|
||||||
public string State;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Publisher : CreatePublisherDto
|
|
||||||
{
|
|
||||||
public int Id;
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
namespace Database.Dto;
|
|
||||||
|
|
||||||
|
|
||||||
public class UserCreateDto
|
|
||||||
{
|
|
||||||
public string Name;
|
|
||||||
public string Surname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class UserDto : UserCreateDto
|
|
||||||
{
|
|
||||||
public int Id;
|
|
||||||
}
|
|
||||||
572
src/Tests.cs
572
src/Tests.cs
@ -1,572 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Microsoft.Data.Sqlite;
|
|
||||||
using Database.Dto;
|
|
||||||
using Team2;
|
|
||||||
using Team3;
|
|
||||||
using Team4;
|
|
||||||
|
|
||||||
namespace Tests
|
|
||||||
{
|
|
||||||
public static class TestRunner
|
|
||||||
{
|
|
||||||
private static int _passed;
|
|
||||||
private static int _failed;
|
|
||||||
|
|
||||||
public static void RunAll()
|
|
||||||
{
|
|
||||||
_passed = 0;
|
|
||||||
_failed = 0;
|
|
||||||
|
|
||||||
Run(Test_AddBook_Success);
|
|
||||||
Run(Test_AddBook_MissingAuthor_Fails);
|
|
||||||
Run(Test_AddBook_MissingPublisher_Fails);
|
|
||||||
Run(Test_AddBook_Duplicate_AllowsWithoutUniqueIndex);
|
|
||||||
Run(Test_AddBook_EmptyName_Succeeds);
|
|
||||||
Run(Test_AddBook_NullName_Fails);
|
|
||||||
Run(Test_AddBook_NegativeValues_Succeeds);
|
|
||||||
Run(Test_AddBook_AvailableGreaterThanTotal_Succeeds);
|
|
||||||
Run(Test_Author_DuplicateSameDOB_AllowedWithoutUniqueIndex);
|
|
||||||
Run(Test_AddAuthor_EmptyName_Succeeds_And_NullName_Fails);
|
|
||||||
Run(Test_AddPublisher_Success_Duplicates_And_NullName_Fails);
|
|
||||||
Run(Test_AddUser_Success_And_DuplicatesAllowed);
|
|
||||||
Run(Test_Borrow_Success);
|
|
||||||
Run(Test_Borrow_DueDate_Default_30Days);
|
|
||||||
Run(Test_Borrow_MissingUser_Fails);
|
|
||||||
Run(Test_Borrow_MissingBook_Fails);
|
|
||||||
Run(Test_GetBooksByName_MultipleMatches);
|
|
||||||
Run(Test_GetBooksByAuthor_ReturnsBooks);
|
|
||||||
Run(Test_GetBooksByAvailableBooks_Filter);
|
|
||||||
Run(Test_StolenBooks_Scenarios);
|
|
||||||
Run(Test_StolenBooks_None_ReturnsEmpty);
|
|
||||||
Run(Test_GetAuthorById_Success_And_NotFound);
|
|
||||||
Run(Test_Team4_Methods_Throw_On_ClosedConnection);
|
|
||||||
Run(Test_Team4_All_Methods_Throw_On_ClosedConnection);
|
|
||||||
Run(Test_Team4_NotImplemented_Methods_Throw);
|
|
||||||
Run(Test_EditAuthor_Success_And_NotFound);
|
|
||||||
Run(Test_EditPublisher_Success_And_NotFound);
|
|
||||||
Run(Test_EditUser_Success_And_NotFound);
|
|
||||||
Run(Test_EditBook_Success_And_Failures);
|
|
||||||
|
|
||||||
Console.WriteLine();
|
|
||||||
Console.WriteLine($"Tests finished. Passed: {_passed}, Failed: {_failed}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Run(Action test)
|
|
||||||
{
|
|
||||||
string name = test.Method.Name;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
test();
|
|
||||||
_passed++;
|
|
||||||
Console.WriteLine($"[PASS] {name}");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_failed++;
|
|
||||||
Console.WriteLine($"[FAIL] {name}: {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static SqliteConnection NewMemoryConnection()
|
|
||||||
{
|
|
||||||
SqliteConnection conn = new SqliteConnection("Data Source=:memory:");
|
|
||||||
conn.Open();
|
|
||||||
Database.Database.CreateDatabaseQuery(conn);
|
|
||||||
return conn;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int CountBooks(SqliteConnection conn, string name, int authorId, int publisherId, int year)
|
|
||||||
{
|
|
||||||
using (SqliteCommand cmd = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = @"SELECT COUNT(*) FROM Books
|
|
||||||
WHERE Name = @name AND AuthorID = @aid AND PublisherID = @pid AND YearOfRelease = @year;";
|
|
||||||
cmd.Parameters.AddWithValue("@name", name);
|
|
||||||
cmd.Parameters.AddWithValue("@aid", authorId);
|
|
||||||
cmd.Parameters.AddWithValue("@pid", publisherId);
|
|
||||||
cmd.Parameters.AddWithValue("@year", year);
|
|
||||||
return Convert.ToInt32(cmd.ExecuteScalar());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int CountAuthors(SqliteConnection conn, string name, string surname, DateTime dob)
|
|
||||||
{
|
|
||||||
using (SqliteCommand cmd = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = @"SELECT COUNT(*) FROM Authors
|
|
||||||
WHERE Name = @name AND Surname = @surname AND DateOfBirth = @dob;";
|
|
||||||
cmd.Parameters.AddWithValue("@name", name);
|
|
||||||
cmd.Parameters.AddWithValue("@surname", surname);
|
|
||||||
cmd.Parameters.AddWithValue("@dob", dob.ToString("yyyy-MM-dd"));
|
|
||||||
return Convert.ToInt32(cmd.ExecuteScalar());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int CountUsers(SqliteConnection conn, string name, string surname)
|
|
||||||
{
|
|
||||||
using (SqliteCommand cmd = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = @"SELECT COUNT(*) FROM Users WHERE Name = @name AND Surname = @surname;";
|
|
||||||
cmd.Parameters.AddWithValue("@name", name);
|
|
||||||
cmd.Parameters.AddWithValue("@surname", surname);
|
|
||||||
return Convert.ToInt32(cmd.ExecuteScalar());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int CountBorrowsForUserBook(SqliteConnection conn, int userId, int bookId)
|
|
||||||
{
|
|
||||||
using (SqliteCommand cmd = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = @"SELECT COUNT(*) FROM Borrows WHERE UserID = @uid AND BookID = @bid;";
|
|
||||||
cmd.Parameters.AddWithValue("@uid", userId);
|
|
||||||
cmd.Parameters.AddWithValue("@bid", bookId);
|
|
||||||
return Convert.ToInt32(cmd.ExecuteScalar());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Publisher EnsurePublisher(SqliteConnection conn, string name = "Penguin", string state = "US")
|
|
||||||
{
|
|
||||||
Publisher p = Team2.Team2.AddPublisher(conn, name, state);
|
|
||||||
if (p == null || p.Id <= 0) throw new Exception("Publisher creation failed");
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static AuthorDto EnsureAuthor(SqliteConnection conn, string name = "John", string surname = "Doe", int year = 1990, int month = 1, int day = 1)
|
|
||||||
{
|
|
||||||
AuthorDto a = Team2.Team2.AddAuthor(conn, name, surname, new DateTime(year, month, day));
|
|
||||||
if (a == null || a.Id <= 0) throw new Exception("Author creation failed");
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static UserDto EnsureUser(SqliteConnection conn, string name = "Alice", string surname = "Smith")
|
|
||||||
{
|
|
||||||
UserDto u = Team2.Team2.AddUser(conn, name, surname);
|
|
||||||
if (u == null || u.Id <= 0) throw new Exception("User creation failed");
|
|
||||||
return u;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static BookDto EnsureBook(SqliteConnection conn, string title = "Sample Book", int year = 2001, int total = 3, int available = 3)
|
|
||||||
{
|
|
||||||
AuthorDto author = EnsureAuthor(conn);
|
|
||||||
Publisher publisher = EnsurePublisher(conn);
|
|
||||||
BookDto book = Team2.Team2.AddBook(conn, title, author.Id, publisher.Id, year, total, available);
|
|
||||||
if (book == null || book.Id <= 0) throw new Exception("Book creation failed");
|
|
||||||
return book;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests
|
|
||||||
|
|
||||||
// Team2 - Books
|
|
||||||
private static void Test_AddBook_Success()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
AuthorDto author = EnsureAuthor(conn);
|
|
||||||
Publisher publisher = EnsurePublisher(conn);
|
|
||||||
BookDto book = Team2.Team2.AddBook(conn, "Clean Code", author.Id, publisher.Id, 2008, 10, 10);
|
|
||||||
if (book == null || book.Id <= 0) throw new Exception("Expected book to be created");
|
|
||||||
if (book.Name != "Clean Code") throw new Exception("Name mismatch");
|
|
||||||
if (book.YearOfRelease != 2008) throw new Exception("Year mismatch");
|
|
||||||
if (book.Total != 10) throw new Exception("Total mismatch");
|
|
||||||
int cnt = CountBooks(conn, "Clean Code", author.Id, publisher.Id, 2008);
|
|
||||||
if (cnt != 1) throw new Exception("Expected exactly one row for the book");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_AddBook_MissingAuthor_Fails()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
Publisher publisher = EnsurePublisher(conn);
|
|
||||||
BookDto book = Team2.Team2.AddBook(conn, "No Author Book", 99999, publisher.Id, 2020, 1, 1);
|
|
||||||
if (book != null) throw new Exception("Expected null when author does not exist");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_AddBook_MissingPublisher_Fails()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
AuthorDto author = EnsureAuthor(conn);
|
|
||||||
BookDto book = Team2.Team2.AddBook(conn, "No Publisher Book", author.Id, 99999, 2020, 1, 1);
|
|
||||||
if (book != null) throw new Exception("Expected null when publisher does not exist");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_AddBook_Duplicate_AllowsWithoutUniqueIndex()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
AuthorDto author = EnsureAuthor(conn);
|
|
||||||
Publisher publisher = EnsurePublisher(conn);
|
|
||||||
BookDto b1 = Team2.Team2.AddBook(conn, "Duplicate", author.Id, publisher.Id, 2021, 2, 2);
|
|
||||||
if (b1 == null) throw new Exception("First insert failed");
|
|
||||||
BookDto b2 = Team2.Team2.AddBook(conn, "Duplicate", author.Id, publisher.Id, 2021, 2, 2);
|
|
||||||
if (b2 == null) throw new Exception("Second insert unexpectedly failed");
|
|
||||||
int cnt = CountBooks(conn, "Duplicate", author.Id, publisher.Id, 2021);
|
|
||||||
if (cnt < 2) throw new Exception("Expected duplicates without a unique index");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_AddBook_EmptyName_Succeeds()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
AuthorDto author = EnsureAuthor(conn);
|
|
||||||
Publisher publisher = EnsurePublisher(conn);
|
|
||||||
BookDto book = Team2.Team2.AddBook(conn, "", author.Id, publisher.Id, 2000, 1, 1);
|
|
||||||
if (book == null) throw new Exception("Empty string name should be allowed (NOT NULL != empty)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_AddBook_NullName_Fails()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
AuthorDto author = EnsureAuthor(conn);
|
|
||||||
Publisher publisher = EnsurePublisher(conn);
|
|
||||||
#pragma warning disable CS8625, CS8604, CS8600
|
|
||||||
BookDto book = Team2.Team2.AddBook(conn, (string)(object)null, author.Id, publisher.Id, 2000, 1, 1);
|
|
||||||
#pragma warning restore CS8625, CS8604, CS8600
|
|
||||||
if (book != null) throw new Exception("Expected null when inserting NULL into NOT NULL column");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_AddBook_NegativeValues_Succeeds()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
AuthorDto author = EnsureAuthor(conn);
|
|
||||||
Publisher publisher = EnsurePublisher(conn);
|
|
||||||
BookDto book = Team2.Team2.AddBook(conn, "NegativeVals", author.Id, publisher.Id, -1, -5, -2);
|
|
||||||
if (book == null) throw new Exception("Negative values should not be validated at DB level here");
|
|
||||||
if (book.YearOfRelease != -1) throw new Exception("Year not stored as provided");
|
|
||||||
if (book.Total != -5) throw new Exception("Total not stored as provided");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_AddBook_AvailableGreaterThanTotal_Succeeds()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
AuthorDto author = EnsureAuthor(conn);
|
|
||||||
Publisher publisher = EnsurePublisher(conn);
|
|
||||||
BookDto book = Team2.Team2.AddBook(conn, "AvailGtTotal", author.Id, publisher.Id, 2010, 1, 5);
|
|
||||||
if (book == null) throw new Exception("Available > Total currently not validated; insert should succeed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_Author_DuplicateSameDOB_AllowedWithoutUniqueIndex()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
string name = "Jane";
|
|
||||||
string surname = "Doe";
|
|
||||||
DateTime dob = new DateTime(1995, 5, 5);
|
|
||||||
AuthorDto a1 = Team2.Team2.AddAuthor(conn, name, surname, dob);
|
|
||||||
if (a1 == null) throw new Exception("First author insert failed");
|
|
||||||
AuthorDto a2 = Team2.Team2.AddAuthor(conn, name, surname, dob);
|
|
||||||
if (a2 == null) throw new Exception("Second author insert unexpectedly failed");
|
|
||||||
int cnt = CountAuthors(conn, name, surname, dob);
|
|
||||||
if (cnt < 2) throw new Exception("Expected duplicate authors without a unique index");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Team2 - Users
|
|
||||||
private static void Test_AddAuthor_EmptyName_Succeeds_And_NullName_Fails()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
// Empty name should be allowed (NOT NULL != empty)
|
|
||||||
AuthorDto a1 = Team2.Team2.AddAuthor(conn, "", "S", new DateTime(1990, 1, 1));
|
|
||||||
if (a1 == null || a1.Id <= 0) throw new Exception("Empty author name should be allowed");
|
|
||||||
// Null name should fail and return null
|
|
||||||
#pragma warning disable CS8625, CS8604, CS8600
|
|
||||||
AuthorDto a2 = Team2.Team2.AddAuthor(conn, (string)(object)null, "S", new DateTime(1990, 1, 1));
|
|
||||||
#pragma warning restore CS8625, CS8604, CS8600
|
|
||||||
if (a2 != null) throw new Exception("Expected null when inserting NULL author name");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_AddPublisher_Success_Duplicates_And_NullName_Fails()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
Publisher p1 = Team2.Team2.AddPublisher(conn, "PubX", "CZ");
|
|
||||||
if (p1 == null || p1.Id <= 0) throw new Exception("Publisher insert failed");
|
|
||||||
Publisher p2 = Team2.Team2.AddPublisher(conn, "PubX", "CZ");
|
|
||||||
if (p2 == null || p2.Id <= 0) throw new Exception("Duplicate publisher insert unexpectedly failed");
|
|
||||||
#pragma warning disable CS8625, CS8604, CS8600
|
|
||||||
Publisher p3 = Team2.Team2.AddPublisher(conn, (string)(object)null, "CZ");
|
|
||||||
#pragma warning restore CS8625, CS8604, CS8600
|
|
||||||
if (p3 != null) throw new Exception("Expected null when inserting NULL publisher name");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_AddUser_Success_And_DuplicatesAllowed()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
UserDto u1 = Team2.Team2.AddUser(conn, "Bob", "Brown");
|
|
||||||
if (u1 == null || u1.Id <= 0) throw new Exception("User insert failed");
|
|
||||||
UserDto u2 = Team2.Team2.AddUser(conn, "Bob", "Brown");
|
|
||||||
if (u2 == null || u2.Id <= 0) throw new Exception("Duplicate user insert unexpectedly failed");
|
|
||||||
int cnt = CountUsers(conn, "Bob", "Brown");
|
|
||||||
if (cnt < 2) throw new Exception("Expected duplicate users without a unique index");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Team2 - Borrow
|
|
||||||
private static void Test_Borrow_Success()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
UserDto user = EnsureUser(conn);
|
|
||||||
BookDto book = EnsureBook(conn, "Borrowed Book", 2015, 5, 5);
|
|
||||||
DateTime borrowed = DateTime.UtcNow.Date;
|
|
||||||
Borrow borrow = Team2.Team2.AddBorrowedBookRecord(conn, book.Id, user.Id, borrowed);
|
|
||||||
if (borrow == null || borrow.Id <= 0) throw new Exception("Borrow creation failed");
|
|
||||||
if (borrow.User == null || borrow.User.Id != user.Id) throw new Exception("Borrow.User mismatch");
|
|
||||||
if (borrow.Book == null || borrow.Book.Id != book.Id) throw new Exception("Borrow.Book mismatch");
|
|
||||||
int cnt = CountBorrowsForUserBook(conn, user.Id, book.Id);
|
|
||||||
if (cnt != 1) throw new Exception("Expected exactly one borrow record");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_Borrow_DueDate_Default_30Days()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
UserDto user = EnsureUser(conn);
|
|
||||||
BookDto book = EnsureBook(conn, "Borrowed Book 2", 2016, 2, 2);
|
|
||||||
DateTime borrowed = new DateTime(2020, 1, 1);
|
|
||||||
Borrow borrow = Team2.Team2.AddBorrowedBookRecord(conn, book.Id, user.Id, borrowed);
|
|
||||||
if (borrow == null) throw new Exception("Borrow creation failed");
|
|
||||||
DateTime expectedDue = borrowed.AddDays(30);
|
|
||||||
if (borrow.ReturnDue.Date != expectedDue.Date) throw new Exception($"ReturnDue mismatch: got {borrow.ReturnDue.Date:yyyy-MM-dd}, expected {expectedDue:yyyy-MM-dd}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_Borrow_MissingUser_Fails()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
BookDto book = EnsureBook(conn);
|
|
||||||
Borrow borrow = Team2.Team2.AddBorrowedBookRecord(conn, book.Id, 999999, DateTime.UtcNow.Date);
|
|
||||||
if (borrow != null) throw new Exception("Expected null when borrowing with missing user");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_Borrow_MissingBook_Fails()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
UserDto user = EnsureUser(conn);
|
|
||||||
Borrow borrow = Team2.Team2.AddBorrowedBookRecord(conn, 999999, user.Id, DateTime.UtcNow.Date);
|
|
||||||
if (borrow != null) throw new Exception("Expected null when borrowing with missing book");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Team4 - Queries and exceptions
|
|
||||||
private static void Test_GetBooksByName_MultipleMatches()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
BookDto b1 = EnsureBook(conn, "SameName", 2000, 1, 1);
|
|
||||||
BookDto b2 = EnsureBook(conn, "SameName", 2001, 2, 2);
|
|
||||||
List<BookDto> books = Team4.Team4.GetBooksByName(conn, "SameName");
|
|
||||||
if (books == null || books.Count < 2) throw new Exception("Expected at least two books with same name");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_GetBooksByAuthor_ReturnsBooks()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
AuthorDto author = EnsureAuthor(conn, "Auth", "One", 1980, 1, 1);
|
|
||||||
Publisher publisher = EnsurePublisher(conn, "P1", "US");
|
|
||||||
BookDto b1 = Team2.Team2.AddBook(conn, "ByAuthor1", author.Id, publisher.Id, 2010, 1, 1);
|
|
||||||
BookDto b2 = Team2.Team2.AddBook(conn, "ByAuthor2", author.Id, publisher.Id, 2011, 1, 1);
|
|
||||||
List<BookDto> books = Team4.Team4.GetBooksByAuthor(conn, author);
|
|
||||||
if (books == null || books.Count < 2) throw new Exception("Expected two books by author");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_GetBooksByAvailableBooks_Filter()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
BookDto b1 = EnsureBook(conn, "Stock1", 2000, 0, 0);
|
|
||||||
BookDto b2 = EnsureBook(conn, "Stock2", 2001, 2, 2);
|
|
||||||
List<BookDto> books = Team4.Team4.GetBooksByAvailableBooks(conn, 1);
|
|
||||||
if (books == null) throw new Exception("Expected list, got null");
|
|
||||||
bool hasStock2 = false;
|
|
||||||
for (int i = 0; i < books.Count; i++)
|
|
||||||
{
|
|
||||||
if (books[i].Name == "Stock2") { hasStock2 = true; break; }
|
|
||||||
}
|
|
||||||
if (!hasStock2) throw new Exception("Expected Stock2 in results for minStock=1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_StolenBooks_Scenarios()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
UserDto user = EnsureUser(conn);
|
|
||||||
BookDto book = EnsureBook(conn, "Overdue", 2005, 1, 1);
|
|
||||||
// Borrow far in the past so ReturnDue < now
|
|
||||||
DateTime borrowedPast = DateTime.UtcNow.Date.AddDays(-60);
|
|
||||||
Borrow br = Team2.Team2.AddBorrowedBookRecord(conn, book.Id, user.Id, borrowedPast);
|
|
||||||
if (br == null) throw new Exception("Failed to create overdue borrow");
|
|
||||||
List<BookDto> stolenAll = Team4.Team4.GetStolenBooks(conn);
|
|
||||||
if (stolenAll == null || stolenAll.Count == 0) throw new Exception("Expected stolen books to include the overdue borrow");
|
|
||||||
List<BookDto> stolenByUser = Team4.Team4.GetStolenBooksByUser(conn, user);
|
|
||||||
if (stolenByUser == null || stolenByUser.Count == 0) throw new Exception("Expected stolen books by user");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_StolenBooks_None_ReturnsEmpty()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
List<BookDto> stolenAll = Team4.Team4.GetStolenBooks(conn);
|
|
||||||
if (stolenAll == null) throw new Exception("Expected empty list, got null");
|
|
||||||
if (stolenAll.Count != 0) throw new Exception("Expected no stolen books initially");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_GetAuthorById_Success_And_NotFound()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
AuthorDto a = EnsureAuthor(conn, "Lookup", "Author", 1970, 1, 1);
|
|
||||||
AuthorDto ok = Team4.Team4.GetAuthorById(conn, a.Id);
|
|
||||||
if (ok == null || ok.Id != a.Id) throw new Exception("Expected author lookup success");
|
|
||||||
AuthorDto missing = Team4.Team4.GetAuthorById(conn, 999999);
|
|
||||||
if (missing != null) throw new Exception("Expected null for missing author");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_Team4_Methods_Throw_On_ClosedConnection()
|
|
||||||
{
|
|
||||||
SqliteConnection conn = new SqliteConnection("Data Source=:memory:");
|
|
||||||
conn.Open();
|
|
||||||
Database.Database.CreateDatabaseQuery(conn);
|
|
||||||
conn.Close();
|
|
||||||
bool threw = false;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
List<BookDto> _ = Team4.Team4.GetBooksByName(conn, "Anything");
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
threw = true;
|
|
||||||
}
|
|
||||||
if (!threw) throw new Exception("Expected Team4.GetBooksByName to throw on closed connection");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_Team4_All_Methods_Throw_On_ClosedConnection()
|
|
||||||
{
|
|
||||||
SqliteConnection conn = new SqliteConnection("Data Source=:memory:");
|
|
||||||
conn.Open();
|
|
||||||
Database.Database.CreateDatabaseQuery(conn);
|
|
||||||
conn.Close();
|
|
||||||
string fail(string method) { return $"Expected {method} to throw on closed connection"; }
|
|
||||||
try { Team4.Team4.GetBooksByAuthor(conn, new AuthorDto { Id = 1, Name = "", Surname = "", DateOfBirth = new DateTime(2000, 1, 1) }); throw new Exception(fail("GetBooksByAuthor")); } catch (Exception) { }
|
|
||||||
try { Team4.Team4.GetBooksByAvailableBooks(conn, 1); throw new Exception(fail("GetBooksByAvailableBooks")); } catch (Exception) { }
|
|
||||||
try { Team4.Team4.GetStolenBooks(conn); throw new Exception(fail("GetStolenBooks")); } catch (Exception) { }
|
|
||||||
try { Team4.Team4.GetStolenBooksByUser(conn, new UserDto { Id = 1, Name = "", Surname = "" }); throw new Exception(fail("GetStolenBooksByUser")); } catch (Exception) { }
|
|
||||||
try { Team4.Team4.GetAuthorById(conn, 1); throw new Exception(fail("GetAuthorById")); } catch (Exception) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_Team4_NotImplemented_Methods_Throw()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
bool threw1 = false;
|
|
||||||
try { Team4.Team4.GetBooksBy(conn); } catch (NotImplementedException) { threw1 = true; }
|
|
||||||
if (!threw1) throw new Exception("Expected NotImplementedException from GetBooksBy");
|
|
||||||
bool threw2 = false;
|
|
||||||
try { Team4.Team4.GetBorrowLogBy(conn); } catch (NotImplementedException) { threw2 = true; }
|
|
||||||
if (!threw2) throw new Exception("Expected NotImplementedException from GetBorrowLogBy");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Team3 - Edit operations
|
|
||||||
private static void Test_EditAuthor_Success_And_NotFound()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
AuthorDto a = EnsureAuthor(conn, "Old", "Name", 1985, 2, 2);
|
|
||||||
a.Name = "New";
|
|
||||||
a.Surname = "Surname";
|
|
||||||
AuthorDto? updated = EditRecords.EditAuthor(conn, a);
|
|
||||||
if (updated == null || updated.Name != "New" || updated.Surname != "Surname") throw new Exception("EditAuthor failed to update");
|
|
||||||
AuthorDto? notFound = EditRecords.EditAuthor(conn, new AuthorDto { Id = 999999, Name = "X", Surname = "Y", DateOfBirth = new DateTime(1990, 1, 1) });
|
|
||||||
if (notFound != null) throw new Exception("Expected null for non-existing author");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_EditPublisher_Success_And_NotFound()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
Publisher p = EnsurePublisher(conn, "OldPub", "UK");
|
|
||||||
p.Name = "NewPub";
|
|
||||||
p.State = "CZ";
|
|
||||||
Publisher? updated = EditRecords.EditPublisher(conn, p);
|
|
||||||
if (updated == null || updated.Name != "NewPub" || updated.State != "CZ") throw new Exception("EditPublisher failed to update");
|
|
||||||
Publisher? notFound = EditRecords.EditPublisher(conn, new Publisher { Id = 999999, Name = "X", State = "Y" });
|
|
||||||
if (notFound != null) throw new Exception("Expected null for non-existing publisher");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_EditUser_Success_And_NotFound()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
UserDto u = EnsureUser(conn, "Carl", "Jr");
|
|
||||||
u.Name = "Carlos";
|
|
||||||
u.Surname = "Senior";
|
|
||||||
UserDto? updated = EditRecords.EditUser(conn, u);
|
|
||||||
if (updated == null || updated.Name != "Carlos" || updated.Surname != "Senior") throw new Exception("EditUser failed to update");
|
|
||||||
UserDto? notFound = EditRecords.EditUser(conn, new UserDto { Id = 999999, Name = "X", Surname = "Y" });
|
|
||||||
if (notFound != null) throw new Exception("Expected null for non-existing user");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Test_EditBook_Success_And_Failures()
|
|
||||||
{
|
|
||||||
using (SqliteConnection conn = NewMemoryConnection())
|
|
||||||
{
|
|
||||||
// Seed original
|
|
||||||
AuthorDto a1 = EnsureAuthor(conn, "A", "One", 1970, 1, 1);
|
|
||||||
Publisher p1 = EnsurePublisher(conn, "Pub1", "US");
|
|
||||||
BookDto b = Team2.Team2.AddBook(conn, "Original", a1.Id, p1.Id, 1999, 1, 1);
|
|
||||||
if (b == null) throw new Exception("Seeding book failed");
|
|
||||||
// Prepare updates
|
|
||||||
AuthorDto a2 = EnsureAuthor(conn, "A", "Two", 1975, 1, 1);
|
|
||||||
Publisher p2 = EnsurePublisher(conn, "Pub2", "DE");
|
|
||||||
b.Name = "Updated";
|
|
||||||
b.Author = a2;
|
|
||||||
b.Publisher = p2;
|
|
||||||
b.YearOfRelease = 2000;
|
|
||||||
b.Total = 5;
|
|
||||||
BookDto? updated = EditRecords.EditBook(conn, b);
|
|
||||||
if (updated == null || updated.Name != "Updated" || updated.Author.Id != a2.Id || updated.Publisher.Id != p2.Id) throw new Exception("EditBook failed to update");
|
|
||||||
// Not found
|
|
||||||
BookDto? notFound = EditRecords.EditBook(conn, new BookDto { Id = 999999, Name = "X", YearOfRelease = 2000, Total = 1, Author = a2, Publisher = p2 });
|
|
||||||
if (notFound != null) throw new Exception("Expected null for non-existing book");
|
|
||||||
// Invalid author
|
|
||||||
BookDto invalidAuthor = new BookDto { Id = b.Id, Name = "X", YearOfRelease = 2001, Total = 1, Author = new AuthorDto { Id = 999999, Name = "Na", Surname = "Na", DateOfBirth = new DateTime(1970, 1, 1) }, Publisher = p2 };
|
|
||||||
if (EditRecords.EditBook(conn, invalidAuthor) != null) throw new Exception("Expected null when editing with non-existing author");
|
|
||||||
// Invalid publisher
|
|
||||||
BookDto invalidPublisher = new BookDto { Id = b.Id, Name = "X", YearOfRelease = 2001, Total = 1, Author = a2, Publisher = new Publisher { Id = 999999, Name = "Na", State = "Na" } };
|
|
||||||
if (EditRecords.EditBook(conn, invalidPublisher) != null) throw new Exception("Expected null when editing with non-existing publisher");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
36
src/team1.cs
36
src/team1.cs
@ -1,36 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.Data.Sqlite;
|
|
||||||
|
|
||||||
namespace Team1
|
|
||||||
{
|
|
||||||
class Library
|
|
||||||
{
|
|
||||||
private SqliteConnection connection;
|
|
||||||
public Library(SqliteConnection connection)
|
|
||||||
{
|
|
||||||
this.connection = connection;
|
|
||||||
}
|
|
||||||
public static void AddAuthor(string name, string lastName, DateTime dateOfBirth, SqliteConnection connection)
|
|
||||||
{
|
|
||||||
string sql = @"INSERT INTO Authors (Name, Surname, DateOfBirth) VALUES (@name, @lastName, @dateOfBirth)";
|
|
||||||
using (var com = new SqliteCommand(sql, connection))
|
|
||||||
{
|
|
||||||
com.Parameters.AddWithValue("@name", name);
|
|
||||||
com.Parameters.AddWithValue("@lastName", lastName);
|
|
||||||
com.Parameters.AddWithValue("@dateOfBirth", dateOfBirth);
|
|
||||||
com.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AddPublisher(string name, string state, SqliteConnection connection)
|
|
||||||
{
|
|
||||||
string sql = @"INSERT INTO Publishers (Name, State) VALUES (@name, @state)";
|
|
||||||
using (var com = new SqliteCommand(sql, connection))
|
|
||||||
{
|
|
||||||
com.Parameters.AddWithValue("@name", name);
|
|
||||||
com.Parameters.AddWithValue("@state", state);
|
|
||||||
com.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
265
src/team2.cs
265
src/team2.cs
@ -1,265 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.Data.Sqlite;
|
|
||||||
using Database.Dto;
|
|
||||||
|
|
||||||
namespace Team2
|
|
||||||
{
|
|
||||||
public static class Team2
|
|
||||||
{
|
|
||||||
public static AuthorDto AddAuthor(SqliteConnection connection, string name, string surname, DateTime dateOfBirth)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var dob = dateOfBirth.ToString("yyyy-MM-dd");
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = "INSERT OR IGNORE INTO Authors (Name, Surname, DateOfBirth) VALUES (@name, @surname, @dob);";
|
|
||||||
cmd.Parameters.AddWithValue("@name", name);
|
|
||||||
cmd.Parameters.AddWithValue("@surname", surname);
|
|
||||||
cmd.Parameters.AddWithValue("@dob", dob);
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = "SELECT ID, Name, Surname, DateOfBirth FROM Authors WHERE Name = @name AND Surname = @surname AND DateOfBirth = @dob LIMIT 1;";
|
|
||||||
cmd.Parameters.AddWithValue("@name", name);
|
|
||||||
cmd.Parameters.AddWithValue("@surname", surname);
|
|
||||||
cmd.Parameters.AddWithValue("@dob", dob);
|
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!reader.Read()) return null;
|
|
||||||
var a = new AuthorDto
|
|
||||||
{
|
|
||||||
Id = reader.IsDBNull(0) ? 0 : reader.GetInt32(0),
|
|
||||||
Name = reader.IsDBNull(1) ? "" : reader.GetString(1),
|
|
||||||
Surname = reader.IsDBNull(2) ? "" : reader.GetString(2),
|
|
||||||
DateOfBirth = reader.IsDBNull(3) ? DateTime.MinValue : reader.GetDateTime(3)
|
|
||||||
};
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Publisher AddPublisher(SqliteConnection connection, string name, string state)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = "INSERT OR IGNORE INTO Publisher (Name, State) VALUES (@name, @state);";
|
|
||||||
cmd.Parameters.AddWithValue("@name", name);
|
|
||||||
cmd.Parameters.AddWithValue("@state", state);
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = "SELECT ID, Name, State FROM Publisher WHERE Name = @name AND State = @state LIMIT 1;";
|
|
||||||
cmd.Parameters.AddWithValue("@name", name);
|
|
||||||
cmd.Parameters.AddWithValue("@state", state);
|
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!reader.Read()) return null;
|
|
||||||
return new Publisher
|
|
||||||
{
|
|
||||||
Id = reader.IsDBNull(0) ? 0 : reader.GetInt32(0),
|
|
||||||
Name = reader.IsDBNull(1) ? "" : reader.GetString(1),
|
|
||||||
State = reader.IsDBNull(2) ? "" : reader.GetString(2)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BookDto AddBook(SqliteConnection connection, string name, int authorId, int publisherId, int year, int total, int available)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// check author
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = "SELECT 1 FROM Authors WHERE ID = @Aid;";
|
|
||||||
cmd.Parameters.AddWithValue("@Aid", authorId);
|
|
||||||
using (var r = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!r.HasRows) return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check publisher
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = "SELECT 1 FROM Publisher WHERE ID = @Pid;";
|
|
||||||
cmd.Parameters.AddWithValue("@Pid", publisherId);
|
|
||||||
using (var r = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!r.HasRows) return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = @"INSERT OR IGNORE INTO Books (Name, AuthorID, PublisherID, YearOfRelease, Total, Available)
|
|
||||||
VALUES (@name, @author, @publisher, @year, @total, @available);";
|
|
||||||
cmd.Parameters.AddWithValue("@name", name);
|
|
||||||
cmd.Parameters.AddWithValue("@author", authorId);
|
|
||||||
cmd.Parameters.AddWithValue("@publisher", publisherId);
|
|
||||||
cmd.Parameters.AddWithValue("@year", year);
|
|
||||||
cmd.Parameters.AddWithValue("@total", total);
|
|
||||||
cmd.Parameters.AddWithValue("@available", available);
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = @"SELECT ID, Name, AuthorID, PublisherID, YearOfRelease, Total, Available
|
|
||||||
FROM Books
|
|
||||||
WHERE Name = @name AND AuthorID = @author AND PublisherID = @publisher AND YearOfRelease = @year
|
|
||||||
LIMIT 1;";
|
|
||||||
cmd.Parameters.AddWithValue("@name", name);
|
|
||||||
cmd.Parameters.AddWithValue("@author", authorId);
|
|
||||||
cmd.Parameters.AddWithValue("@publisher", publisherId);
|
|
||||||
cmd.Parameters.AddWithValue("@year", year);
|
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!reader.Read()) return null;
|
|
||||||
return new BookDto
|
|
||||||
{
|
|
||||||
Id = reader.IsDBNull(0) ? 0 : reader.GetInt32(0),
|
|
||||||
Name = reader.IsDBNull(1) ? "" : reader.GetString(1),
|
|
||||||
YearOfRelease = reader.IsDBNull(4) ? 0 : reader.GetInt32(4),
|
|
||||||
Total = reader.IsDBNull(5) ? 0 : reader.GetInt32(5),
|
|
||||||
Author = new AuthorDto { Id = reader.IsDBNull(2) ? 0 : reader.GetInt32(2) },
|
|
||||||
Publisher = new Publisher { Id = reader.IsDBNull(3) ? 0 : reader.GetInt32(3) }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static UserDto AddUser(SqliteConnection connection, string name, string surname)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = "INSERT OR IGNORE INTO Users (Name, Surname) VALUES (@name, @surname);";
|
|
||||||
cmd.Parameters.AddWithValue("@name", name);
|
|
||||||
cmd.Parameters.AddWithValue("@surname", surname);
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = "SELECT ID, Name, Surname FROM Users WHERE Name = @name AND Surname = @surname LIMIT 1;";
|
|
||||||
cmd.Parameters.AddWithValue("@name", name);
|
|
||||||
cmd.Parameters.AddWithValue("@surname", surname);
|
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!reader.Read()) return null;
|
|
||||||
return new UserDto
|
|
||||||
{
|
|
||||||
Id = reader.IsDBNull(0) ? 0 : reader.GetInt32(0),
|
|
||||||
Name = reader.IsDBNull(1) ? "" : reader.GetString(1),
|
|
||||||
Surname = reader.IsDBNull(2) ? "" : reader.GetString(2)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Borrow AddBorrowedBookRecord(SqliteConnection connection, int bookId, int userId, DateTime borrowedDate, int days = 30)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var borrowed = borrowedDate.ToString("yyyy-MM-dd");
|
|
||||||
var due = borrowedDate.AddDays(days).ToString("yyyy-MM-dd");
|
|
||||||
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = "SELECT 1 FROM Users WHERE ID = @Uid;";
|
|
||||||
cmd.Parameters.AddWithValue("@Uid", userId);
|
|
||||||
using (var r = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!r.HasRows) return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = "SELECT 1 FROM Books WHERE ID = @Bid;";
|
|
||||||
cmd.Parameters.AddWithValue("@Bid", bookId);
|
|
||||||
using (var r = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!r.HasRows) return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = @"INSERT OR IGNORE INTO Borrows (DateOfBorrow, ReturnDue, UserID, BookID)
|
|
||||||
VALUES (@borrowed, @due, @user, @book);";
|
|
||||||
cmd.Parameters.AddWithValue("@borrowed", borrowed);
|
|
||||||
cmd.Parameters.AddWithValue("@due", due);
|
|
||||||
cmd.Parameters.AddWithValue("@user", userId);
|
|
||||||
cmd.Parameters.AddWithValue("@book", bookId);
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var cmd = connection.CreateCommand())
|
|
||||||
{
|
|
||||||
cmd.CommandText = @"SELECT ID, DateOfBorrow, ReturnDue, DateOfReturn, UserID, BookID
|
|
||||||
FROM Borrows
|
|
||||||
WHERE DateOfBorrow = @borrowed AND ReturnDue = @due AND UserID = @user AND BookID = @book
|
|
||||||
LIMIT 1;";
|
|
||||||
cmd.Parameters.AddWithValue("@borrowed", borrowed);
|
|
||||||
cmd.Parameters.AddWithValue("@due", due);
|
|
||||||
cmd.Parameters.AddWithValue("@user", userId);
|
|
||||||
cmd.Parameters.AddWithValue("@book", bookId);
|
|
||||||
|
|
||||||
using (var reader = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!reader.Read()) return null;
|
|
||||||
var b = new Borrow
|
|
||||||
{
|
|
||||||
Id = reader.IsDBNull(0) ? 0 : reader.GetInt32(0),
|
|
||||||
DateOfBorrow = reader.IsDBNull(1) ? DateTime.MinValue : reader.GetDateTime(1),
|
|
||||||
ReturnDue = reader.IsDBNull(2) ? DateTime.MinValue : reader.GetDateTime(2),
|
|
||||||
DateOfReturn = reader.IsDBNull(3) ? DateTime.MinValue : reader.GetDateTime(3),
|
|
||||||
User = new UserDto { Id = reader.IsDBNull(4) ? 0 : reader.GetInt32(4) },
|
|
||||||
Book = new BookDto { Id = reader.IsDBNull(5) ? 0 : reader.GetInt32(5) }
|
|
||||||
};
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
286
src/team3.cs
286
src/team3.cs
@ -1,286 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.Data.Sqlite;
|
|
||||||
using Database.Dto;
|
|
||||||
|
|
||||||
namespace Team3
|
|
||||||
{
|
|
||||||
class EditRecords
|
|
||||||
{
|
|
||||||
public static AuthorDto? EditAuthor(SqliteConnection connection, AuthorDto author)
|
|
||||||
{
|
|
||||||
using (var command = new SqliteCommand())
|
|
||||||
{
|
|
||||||
command.Connection = connection;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Check if author exists
|
|
||||||
command.CommandText = "SELECT 1 FROM Authors WHERE ID = @id;";
|
|
||||||
command.Parameters.AddWithValue("@id", author.Id);
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!reader.HasRows)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Author with ID {author.Id} does not exist.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update author
|
|
||||||
command.CommandText = @"UPDATE Authors
|
|
||||||
SET Name = @name, Surname = @surname, DateOfBirth = @dob
|
|
||||||
WHERE ID = @id;";
|
|
||||||
command.Parameters.Clear();
|
|
||||||
command.Parameters.AddWithValue("@name", author.Name);
|
|
||||||
command.Parameters.AddWithValue("@surname", author.Surname);
|
|
||||||
command.Parameters.AddWithValue("@dob", author.DateOfBirth.ToString("yyyy-MM-dd"));
|
|
||||||
command.Parameters.AddWithValue("@id", author.Id);
|
|
||||||
command.ExecuteNonQuery();
|
|
||||||
|
|
||||||
// Retrieve updated author
|
|
||||||
command.CommandText = "SELECT ID, Name, Surname, DateOfBirth FROM Authors WHERE ID = @id;";
|
|
||||||
command.Parameters.Clear();
|
|
||||||
command.Parameters.AddWithValue("@id", author.Id);
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (reader.Read())
|
|
||||||
{
|
|
||||||
var updatedAuthor = new AuthorDto
|
|
||||||
{
|
|
||||||
Id = reader.GetInt32(0),
|
|
||||||
Name = reader.GetString(1),
|
|
||||||
Surname = reader.GetString(2),
|
|
||||||
DateOfBirth = DateTime.Parse(reader.GetString(3))
|
|
||||||
};
|
|
||||||
Console.WriteLine("Author updated successfully.");
|
|
||||||
return updatedAuthor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"EditAuthor failed: {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Publisher? EditPublisher(SqliteConnection connection, Publisher publisher)
|
|
||||||
{
|
|
||||||
using (var command = new SqliteCommand())
|
|
||||||
{
|
|
||||||
command.Connection = connection;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Check if publisher exists
|
|
||||||
command.CommandText = "SELECT 1 FROM Publisher WHERE ID = @id;";
|
|
||||||
command.Parameters.AddWithValue("@id", publisher.Id);
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!reader.HasRows)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Publisher with ID {publisher.Id} does not exist.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update publisher
|
|
||||||
command.CommandText = @"UPDATE Publisher
|
|
||||||
SET Name = @name, State = @state
|
|
||||||
WHERE ID = @id;";
|
|
||||||
command.Parameters.Clear();
|
|
||||||
command.Parameters.AddWithValue("@name", publisher.Name);
|
|
||||||
command.Parameters.AddWithValue("@state", publisher.State);
|
|
||||||
command.Parameters.AddWithValue("@id", publisher.Id);
|
|
||||||
command.ExecuteNonQuery();
|
|
||||||
|
|
||||||
// Retrieve updated publisher
|
|
||||||
command.CommandText = "SELECT ID, Name, State FROM Publisher WHERE ID = @id;";
|
|
||||||
command.Parameters.Clear();
|
|
||||||
command.Parameters.AddWithValue("@id", publisher.Id);
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (reader.Read())
|
|
||||||
{
|
|
||||||
var updatedPublisher = new Publisher
|
|
||||||
{
|
|
||||||
Id = reader.GetInt32(0),
|
|
||||||
Name = reader.GetString(1),
|
|
||||||
State = reader.GetString(2)
|
|
||||||
};
|
|
||||||
Console.WriteLine("Publisher updated successfully.");
|
|
||||||
return updatedPublisher;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"EditPublisher failed: {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BookDto? EditBook(SqliteConnection connection, BookDto book)
|
|
||||||
{
|
|
||||||
using (var command = new SqliteCommand())
|
|
||||||
{
|
|
||||||
command.Connection = connection;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Check if book exists
|
|
||||||
command.CommandText = "SELECT 1 FROM Books WHERE ID = @id;";
|
|
||||||
command.Parameters.AddWithValue("@id", book.Id);
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!reader.HasRows)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Book with ID {book.Id} does not exist.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if author exists
|
|
||||||
command.CommandText = "SELECT 1 FROM Authors WHERE ID = @aid;";
|
|
||||||
command.Parameters.Clear();
|
|
||||||
command.Parameters.AddWithValue("@aid", book.Author.Id);
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!reader.HasRows)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Author with ID {book.Author.Id} does not exist.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if publisher exists
|
|
||||||
command.CommandText = "SELECT 1 FROM Publisher WHERE ID = @pid;";
|
|
||||||
command.Parameters.Clear();
|
|
||||||
command.Parameters.AddWithValue("@pid", book.Publisher.Id);
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!reader.HasRows)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Publisher with ID {book.Publisher.Id} does not exist.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update book
|
|
||||||
command.CommandText = @"UPDATE Books
|
|
||||||
SET Name = @name, AuthorID = @author, PublisherID = @publisher,
|
|
||||||
YearOfRelease = @year, Total = @total
|
|
||||||
WHERE ID = @id;";
|
|
||||||
command.Parameters.Clear();
|
|
||||||
command.Parameters.AddWithValue("@name", book.Name);
|
|
||||||
command.Parameters.AddWithValue("@author", book.Author.Id);
|
|
||||||
command.Parameters.AddWithValue("@publisher", book.Publisher.Id);
|
|
||||||
command.Parameters.AddWithValue("@year", book.YearOfRelease);
|
|
||||||
command.Parameters.AddWithValue("@total", book.Total);
|
|
||||||
command.Parameters.AddWithValue("@id", book.Id);
|
|
||||||
command.ExecuteNonQuery();
|
|
||||||
|
|
||||||
// Retrieve updated book with joins
|
|
||||||
command.CommandText = @"SELECT b.ID, b.Name, b.YearOfRelease, b.Total,
|
|
||||||
a.ID, a.Name, a.Surname, a.DateOfBirth,
|
|
||||||
p.ID, p.Name, p.State
|
|
||||||
FROM Books b
|
|
||||||
JOIN Authors a ON b.AuthorID = a.ID
|
|
||||||
JOIN Publisher p ON b.PublisherID = p.ID
|
|
||||||
WHERE b.ID = @id;";
|
|
||||||
command.Parameters.Clear();
|
|
||||||
command.Parameters.AddWithValue("@id", book.Id);
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (reader.Read())
|
|
||||||
{
|
|
||||||
var updatedBook = new BookDto
|
|
||||||
{
|
|
||||||
Id = reader.GetInt32(0),
|
|
||||||
Name = reader.GetString(1),
|
|
||||||
YearOfRelease = reader.GetInt32(2),
|
|
||||||
Total = reader.GetInt32(3),
|
|
||||||
Author = new AuthorDto
|
|
||||||
{
|
|
||||||
Id = reader.GetInt32(4),
|
|
||||||
Name = reader.GetString(5),
|
|
||||||
Surname = reader.GetString(6),
|
|
||||||
DateOfBirth = DateTime.Parse(reader.GetString(7))
|
|
||||||
},
|
|
||||||
Publisher = new Publisher
|
|
||||||
{
|
|
||||||
Id = reader.GetInt32(8),
|
|
||||||
Name = reader.GetString(9),
|
|
||||||
State = reader.GetString(10)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Console.WriteLine("Book updated successfully.");
|
|
||||||
return updatedBook;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"EditBook failed: {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static UserDto? EditUser(SqliteConnection connection, UserDto user)
|
|
||||||
{
|
|
||||||
using (var command = new SqliteCommand())
|
|
||||||
{
|
|
||||||
command.Connection = connection;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Check if user exists
|
|
||||||
command.CommandText = "SELECT 1 FROM Users WHERE ID = @id;";
|
|
||||||
command.Parameters.AddWithValue("@id", user.Id);
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (!reader.HasRows)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"User with ID {user.Id} does not exist.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update user
|
|
||||||
command.CommandText = @"UPDATE Users
|
|
||||||
SET Name = @name, Surname = @surname
|
|
||||||
WHERE ID = @id;";
|
|
||||||
command.Parameters.Clear();
|
|
||||||
command.Parameters.AddWithValue("@name", user.Name);
|
|
||||||
command.Parameters.AddWithValue("@surname", user.Surname);
|
|
||||||
command.Parameters.AddWithValue("@id", user.Id);
|
|
||||||
command.ExecuteNonQuery();
|
|
||||||
|
|
||||||
// Retrieve updated user
|
|
||||||
command.CommandText = "SELECT ID, Name, Surname FROM Users WHERE ID = @id;";
|
|
||||||
command.Parameters.Clear();
|
|
||||||
command.Parameters.AddWithValue("@id", user.Id);
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (reader.Read())
|
|
||||||
{
|
|
||||||
var updatedUser = new UserDto
|
|
||||||
{
|
|
||||||
Id = reader.GetInt32(0),
|
|
||||||
Name = reader.GetString(1),
|
|
||||||
Surname = reader.GetString(2)
|
|
||||||
};
|
|
||||||
Console.WriteLine("User updated successfully.");
|
|
||||||
return updatedUser;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"EditUser failed: {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
334
src/team4.cs
334
src/team4.cs
@ -1,334 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.Data.Sqlite;
|
|
||||||
using Database.Dto;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Team4
|
|
||||||
{
|
|
||||||
public class Team4
|
|
||||||
{
|
|
||||||
public static List<BookDto> GetBooksByName(SqliteConnection conn, string name)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var command = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
command.CommandText = @"
|
|
||||||
SELECT book.ID, book.Name, book.YearOfRelease, book.Total,
|
|
||||||
author.ID, author.Name, author.Surname, author.DateOfBirth,
|
|
||||||
publisher.ID, publisher.Name, publisher.State
|
|
||||||
FROM Books book
|
|
||||||
LEFT JOIN Authors author ON book.AuthorID = author.ID
|
|
||||||
LEFT JOIN Publisher publisher ON book.PublisherID = publisher.ID
|
|
||||||
WHERE book.Name = @name;";
|
|
||||||
command.Parameters.AddWithValue("@name", name);
|
|
||||||
|
|
||||||
var books = new List<BookDto>();
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
var book = new BookDto
|
|
||||||
{
|
|
||||||
Id = reader.GetInt32(0),
|
|
||||||
Name = reader.GetString(1),
|
|
||||||
YearOfRelease = reader.IsDBNull(2) ? 0 : reader.GetInt32(2),
|
|
||||||
Total = reader.IsDBNull(3) ? 0 : reader.GetInt32(3),
|
|
||||||
Author = new AuthorDto
|
|
||||||
{
|
|
||||||
Id = reader.IsDBNull(4) ? 0 : reader.GetInt32(4),
|
|
||||||
Name = reader.IsDBNull(5) ? "" : reader.GetString(5),
|
|
||||||
Surname = reader.IsDBNull(6) ? "" : reader.GetString(6),
|
|
||||||
DateOfBirth = reader.IsDBNull(7) ? DateTime.MinValue : reader.GetDateTime(7)
|
|
||||||
},
|
|
||||||
Publisher = new Publisher
|
|
||||||
{
|
|
||||||
Id = reader.IsDBNull(8) ? 0 : reader.GetInt32(8),
|
|
||||||
Name = reader.IsDBNull(9) ? "" : reader.GetString(9),
|
|
||||||
State = reader.IsDBNull(10) ? "" : reader.GetString(10)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
books.Add(book);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return books;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Error in GetBooksByName: {ex.Message}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static List<BookDto> GetBooksByAuthor(SqliteConnection conn, AuthorDto author)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var command = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
command.CommandText = @"
|
|
||||||
SELECT book.ID, book.Name, book.YearOfRelease, book.Total,
|
|
||||||
publisher.ID, publisher.Name, publisher.State
|
|
||||||
FROM Books book
|
|
||||||
LEFT JOIN Publisher publisher ON book.PublisherID = publisher.ID
|
|
||||||
WHERE book.AuthorID = @id;";
|
|
||||||
command.Parameters.AddWithValue("@id", author.Id);
|
|
||||||
|
|
||||||
var books = new List<BookDto>();
|
|
||||||
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
books.Add(new BookDto
|
|
||||||
{
|
|
||||||
Id = reader.GetInt32(0),
|
|
||||||
Name = reader.GetString(1),
|
|
||||||
YearOfRelease = reader.IsDBNull(2) ? 0 : reader.GetInt32(2),
|
|
||||||
Total = reader.IsDBNull(3) ? 0 : reader.GetInt32(3),
|
|
||||||
Author = author,
|
|
||||||
Publisher = new Publisher
|
|
||||||
{
|
|
||||||
Id = reader.IsDBNull(4) ? 0 : reader.GetInt32(4),
|
|
||||||
Name = reader.IsDBNull(5) ? "" : reader.GetString(5),
|
|
||||||
State = reader.IsDBNull(6) ? "" : reader.GetString(6)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return books;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Error in GetBooksByAuthor: {ex.Message}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<BookDto> GetBooksByAvailableBooks(SqliteConnection conn, int minStock = 1)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var command = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
command.CommandText = @"
|
|
||||||
SELECT book.ID, book.Name, book.YearOfRelease, book.Total
|
|
||||||
FROM Books book
|
|
||||||
WHERE book.Total >= @min;";
|
|
||||||
command.Parameters.AddWithValue("@min", minStock);
|
|
||||||
|
|
||||||
var books = new List<BookDto>();
|
|
||||||
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
books.Add(new BookDto
|
|
||||||
{
|
|
||||||
Id = reader.GetInt32(0),
|
|
||||||
Name = reader.GetString(1),
|
|
||||||
YearOfRelease = reader.IsDBNull(2) ? 0 : reader.GetInt32(2),
|
|
||||||
Total = reader.IsDBNull(3) ? 0 : reader.GetInt32(3)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return books;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Error in GetBooksByAvailableBooks: {ex.Message}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<BookDto> GetStolenBooks(SqliteConnection conn)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var command = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
command.CommandText = @"
|
|
||||||
SELECT book.ID, book.Name, book.YearOfRelease, book.Total
|
|
||||||
FROM Borrows borrow
|
|
||||||
INNER JOIN Books book ON borrow.BookID = book.ID
|
|
||||||
WHERE borrow.DateOfReturn IS NULL AND borrow.ReturnDue < DATE('now');";
|
|
||||||
|
|
||||||
var books = new List<BookDto>();
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
books.Add(new BookDto
|
|
||||||
{
|
|
||||||
Id = reader.GetInt32(0),
|
|
||||||
Name = reader.GetString(1),
|
|
||||||
YearOfRelease = reader.IsDBNull(2) ? 0 : reader.GetInt32(2),
|
|
||||||
Total = reader.IsDBNull(3) ? 0 : reader.GetInt32(3)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return books;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Error in GetStolenBooks: {ex.Message}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<BookDto> GetStolenBooksByUser(SqliteConnection conn, UserDto user)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var command = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
command.CommandText = @"
|
|
||||||
SELECT book.ID, book.Name, book.YearOfRelease, book.Total
|
|
||||||
FROM Borrows borrow
|
|
||||||
INNER JOIN Books book ON borrow.BookID = book.ID
|
|
||||||
WHERE borrow.UserID = @uid AND borrow.DateOfReturn IS NULL AND borrow.ReturnDue < DATE('now');";
|
|
||||||
command.Parameters.AddWithValue("@uid", user.Id);
|
|
||||||
|
|
||||||
var books = new List<BookDto>();
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
books.Add(new BookDto
|
|
||||||
{
|
|
||||||
Id = reader.GetInt32(0),
|
|
||||||
Name = reader.GetString(1),
|
|
||||||
YearOfRelease = reader.IsDBNull(2) ? 0 : reader.GetInt32(2),
|
|
||||||
Total = reader.IsDBNull(3) ? 0 : reader.GetInt32(3)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return books;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Error in GetStolenBooksByUser: {ex.Message}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AuthorDto GetAuthorById(SqliteConnection conn, int authorID)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var command = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
command.CommandText = @"
|
|
||||||
SELECT *
|
|
||||||
FROM Authors author
|
|
||||||
WHERE author.ID = @aid;";
|
|
||||||
command.Parameters.AddWithValue("@aid", authorID);
|
|
||||||
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
return new AuthorDto
|
|
||||||
{
|
|
||||||
Id = reader.GetInt32(0),
|
|
||||||
Name = reader.GetString(1),
|
|
||||||
Surname = reader.GetString(2),
|
|
||||||
DateOfBirth = reader.GetDateTime(3)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Error in GetAuthorById: {ex.Message}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static List<Dictionary<int, string[]>> GetAuthorNameId(SqliteConnection conn)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var command = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
command.CommandText = @"
|
|
||||||
SELECT author.ID, author.Name, author.Surname
|
|
||||||
FROM Authors author";
|
|
||||||
|
|
||||||
var authors = new List<Dictionary<int, string[]>>();
|
|
||||||
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
int id = reader.GetInt32(0);
|
|
||||||
string name = reader.IsDBNull(1) ? "" : reader.GetString(1);
|
|
||||||
string surname = reader.IsDBNull(2) ? "" : reader.GetString(2);
|
|
||||||
|
|
||||||
authors.Add(new Dictionary<int, string[]>
|
|
||||||
{
|
|
||||||
{ id, new[] { name, surname } }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return authors;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Error in GetAuthorNameId: {ex.Message}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Dictionary<int, string>> GetPublisherNameId(SqliteConnection conn)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var command = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
command.CommandText = @"
|
|
||||||
SELECT publisher.ID, publisher.Name
|
|
||||||
FROM Publisher publisher";
|
|
||||||
|
|
||||||
var publishers = new List<Dictionary<int, string>>();
|
|
||||||
|
|
||||||
using (var reader = command.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
int id = reader.GetInt32(0);
|
|
||||||
string name = reader.IsDBNull(1) ? "" : reader.GetString(1);
|
|
||||||
|
|
||||||
publishers.Add(new Dictionary<int, string>
|
|
||||||
{
|
|
||||||
{ id, name }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return publishers;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Error in GetAuthorNameId: {ex.Message}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void GetBooksBy(SqliteConnection conn)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void GetBorrowLogBy(SqliteConnection conn)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user