Initial COmmit

This commit is contained in:
Husky
2020-02-12 13:12:55 +01:00
commit 2f508df281
18 changed files with 638 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
/.vs/*
/KanSan/bin/Debug/*
/KanSan/obj/Debug/*
/KanSan/obj/*

25
KanSan.sln Normal file
View File

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29728.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KanSan", "KanSan\KanSan.csproj", "{B73CD234-11F8-4FC9-BAC1-AA3DF3D7AB6A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B73CD234-11F8-4FC9-BAC1-AA3DF3D7AB6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B73CD234-11F8-4FC9-BAC1-AA3DF3D7AB6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B73CD234-11F8-4FC9-BAC1-AA3DF3D7AB6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B73CD234-11F8-4FC9-BAC1-AA3DF3D7AB6A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BA021C9A-6B88-4B87-8189-93AC075F3D8F}
EndGlobalSection
EndGlobal

9
KanSan/App.xaml Normal file
View File

@@ -0,0 +1,9 @@
<Application x:Class="KanSan.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:KanSan"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

17
KanSan/App.xaml.cs Normal file
View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace KanSan
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

10
KanSan/AssemblyInfo.cs Normal file
View File

@@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

13
KanSan/Baustelle.cs Normal file
View File

@@ -0,0 +1,13 @@
using System;
namespace KanSan
{
public class Baustelle
{
public Guid BaustelleID { get; set; }
public Kunden Kunde { get; } = new Kunden();
public string Ort { get; set; }
public string Strasse { get; set; }
}
}

56
KanSan/KanSan.csproj Normal file
View File

@@ -0,0 +1,56 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ilmerge" Version="3.0.29" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.1.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="Syncfusion.DocIO.Base">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Syncfusion\Essential Studio\WPF\17.4.0.39\Assemblies\4.6\Syncfusion.DocIO.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.DocIO.Wpf">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Syncfusion\Essential Studio\WPF\17.4.0.39\Assemblies\4.6\Syncfusion.DocIO.WPF.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.DocToPDFConverter.Base">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Syncfusion\Essential Studio\WPF\17.4.0.39\Assemblies\4.6\Syncfusion.DocToPDFConverter.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Grid.Wpf">
<HintPath>..\..\..\..\..\..\Program Files (x86)\syncfusion\essential studio\wpf\17.4.0.39\assemblies\4.6\syncfusion.grid.wpf.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.GridCommon.Wpf">
<HintPath>..\..\..\..\..\..\Program Files (x86)\syncfusion\essential studio\wpf\17.4.0.39\assemblies\4.6\Syncfusion.GridCommon.Wpf.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Linq.Base">
<HintPath>..\..\..\..\..\..\Program Files (x86)\syncfusion\essential studio\wpf\17.4.0.39\assemblies\4.6\Syncfusion.Linq.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Shared.Wpf">
<HintPath>..\..\..\..\..\..\Program Files (x86)\syncfusion\essential studio\wpf\17.4.0.39\assemblies\4.6\Syncfusion.Shared.Wpf.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.XlsIO.Base">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Syncfusion\Essential Studio\WPF\17.4.0.39\Assemblies\4.6\Syncfusion.XlsIO.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.XlsIO.Wpf">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Syncfusion\Essential Studio\WPF\17.4.0.39\Assemblies\4.6\Syncfusion.XlsIO.WPF.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Update="kanSan.db">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

14
KanSan/KanSan.csproj.user Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<ItemGroup>
<ApplicationDefinition Update="App.xaml">
<SubType>Designer</SubType>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<Page Update="MainWindow.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>

14
KanSan/Kunden.cs Normal file
View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
namespace KanSan
{
public class Kunden
{
public Guid KundenID { get; set; }
public string Vorname { get; set; }
public string Nachname { get; set; }
public List<Baustelle> Baustellen { get; } = new List<Baustelle>();
}
}

View File

@@ -0,0 +1,9 @@
namespace KanSan
{
public class LeistungsverzeichnisBaustelle
{
public int LeistungsverzeichnisBaustelleID { get; set; }
public Baustelle Baustelle { get; set; }
public Leistungsverzeichniss Leistungsverzeichniss { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System;
namespace KanSan
{
public class Leistungsverzeichniss
{
public Guid LeistungsverzeichnissID { get; set; }
public string Position { get; set; }
public string PositionBeschreibung { get; set; }
public string PositionEinheit { get; set; }
public decimal PositionEinheitspreis { get; set; }
}
}

16
KanSan/MainWindow.xaml Normal file
View File

@@ -0,0 +1,16 @@
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:KanSan"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf" x:Class="KanSan.MainWindow"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<syncfusion:GridControl HorizontalAlignment="Left" Height="100" Margin="252,147,0,0" VerticalAlignment="Top" Width="469"/>
<Button Content="Button" HorizontalAlignment="Left" Height="30" Margin="153,217,0,0" VerticalAlignment="Top" Width="31" Click="Button_Click"/>
</Grid>
</Window>

39
KanSan/MainWindow.xaml.cs Normal file
View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace KanSan
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
List<Baustelle> baustellen;
using (KanSanContext ksc = new KanSanContext())
{
baustellen = ksc.Baustellen.ToList();
}
Debugger.Break();
}
}
}

View File

@@ -0,0 +1,124 @@
// <auto-generated />
using System;
using KanSan;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace KanSan.Migrations
{
[DbContext(typeof(KanSanContext))]
[Migration("20200212120350_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.1");
modelBuilder.Entity("KanSan.Baustelle", b =>
{
b.Property<Guid>("BaustelleID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid?>("KundenID")
.HasColumnType("TEXT");
b.Property<string>("Ort")
.HasColumnType("TEXT");
b.Property<string>("Strasse")
.HasColumnType("TEXT");
b.HasKey("BaustelleID");
b.HasIndex("KundenID");
b.ToTable("Baustellen");
});
modelBuilder.Entity("KanSan.Kunden", b =>
{
b.Property<Guid>("KundenID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Nachname")
.HasColumnType("TEXT");
b.Property<string>("Vorname")
.HasColumnType("TEXT");
b.HasKey("KundenID");
b.ToTable("Kunden");
});
modelBuilder.Entity("KanSan.LeistungsverzeichnisBaustelle", b =>
{
b.Property<int>("LeistungsverzeichnisBaustelleID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<Guid?>("BaustelleID")
.HasColumnType("TEXT");
b.Property<Guid?>("LeistungsverzeichnissID")
.HasColumnType("TEXT");
b.HasKey("LeistungsverzeichnisBaustelleID");
b.HasIndex("BaustelleID");
b.HasIndex("LeistungsverzeichnissID");
b.ToTable("leistungsverzeichnisBaustelle");
});
modelBuilder.Entity("KanSan.Leistungsverzeichniss", b =>
{
b.Property<Guid>("LeistungsverzeichnissID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Position")
.HasColumnType("TEXT");
b.Property<string>("PositionBeschreibung")
.HasColumnType("TEXT");
b.Property<string>("PositionEinheit")
.HasColumnType("TEXT");
b.Property<decimal>("PositionEinheitspreis")
.HasColumnType("TEXT");
b.HasKey("LeistungsverzeichnissID");
b.ToTable("Leistungsverzeichnisses");
});
modelBuilder.Entity("KanSan.Baustelle", b =>
{
b.HasOne("KanSan.Kunden", null)
.WithMany("Baustellen")
.HasForeignKey("KundenID");
});
modelBuilder.Entity("KanSan.LeistungsverzeichnisBaustelle", b =>
{
b.HasOne("KanSan.Baustelle", "Baustelle")
.WithMany()
.HasForeignKey("BaustelleID");
b.HasOne("KanSan.Leistungsverzeichniss", "Leistungsverzeichniss")
.WithMany()
.HasForeignKey("LeistungsverzeichnissID");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,115 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace KanSan.Migrations
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Kunden",
columns: table => new
{
KundenID = table.Column<Guid>(nullable: false),
Vorname = table.Column<string>(nullable: true),
Nachname = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Kunden", x => x.KundenID);
});
migrationBuilder.CreateTable(
name: "Leistungsverzeichnisses",
columns: table => new
{
LeistungsverzeichnissID = table.Column<Guid>(nullable: false),
Position = table.Column<string>(nullable: true),
PositionBeschreibung = table.Column<string>(nullable: true),
PositionEinheit = table.Column<string>(nullable: true),
PositionEinheitspreis = table.Column<decimal>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Leistungsverzeichnisses", x => x.LeistungsverzeichnissID);
});
migrationBuilder.CreateTable(
name: "Baustellen",
columns: table => new
{
BaustelleID = table.Column<Guid>(nullable: false),
Ort = table.Column<string>(nullable: true),
Strasse = table.Column<string>(nullable: true),
KundenID = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Baustellen", x => x.BaustelleID);
table.ForeignKey(
name: "FK_Baustellen_Kunden_KundenID",
column: x => x.KundenID,
principalTable: "Kunden",
principalColumn: "KundenID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "leistungsverzeichnisBaustelle",
columns: table => new
{
LeistungsverzeichnisBaustelleID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
BaustelleID = table.Column<Guid>(nullable: true),
LeistungsverzeichnissID = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_leistungsverzeichnisBaustelle", x => x.LeistungsverzeichnisBaustelleID);
table.ForeignKey(
name: "FK_leistungsverzeichnisBaustelle_Baustellen_BaustelleID",
column: x => x.BaustelleID,
principalTable: "Baustellen",
principalColumn: "BaustelleID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_leistungsverzeichnisBaustelle_Leistungsverzeichnisses_LeistungsverzeichnissID",
column: x => x.LeistungsverzeichnissID,
principalTable: "Leistungsverzeichnisses",
principalColumn: "LeistungsverzeichnissID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_Baustellen_KundenID",
table: "Baustellen",
column: "KundenID");
migrationBuilder.CreateIndex(
name: "IX_leistungsverzeichnisBaustelle_BaustelleID",
table: "leistungsverzeichnisBaustelle",
column: "BaustelleID");
migrationBuilder.CreateIndex(
name: "IX_leistungsverzeichnisBaustelle_LeistungsverzeichnissID",
table: "leistungsverzeichnisBaustelle",
column: "LeistungsverzeichnissID");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "leistungsverzeichnisBaustelle");
migrationBuilder.DropTable(
name: "Baustellen");
migrationBuilder.DropTable(
name: "Leistungsverzeichnisses");
migrationBuilder.DropTable(
name: "Kunden");
}
}
}

View File

@@ -0,0 +1,122 @@
// <auto-generated />
using System;
using KanSan;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace KanSan.Migrations
{
[DbContext(typeof(KanSanContext))]
partial class KanSanContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.1");
modelBuilder.Entity("KanSan.Baustelle", b =>
{
b.Property<Guid>("BaustelleID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid?>("KundenID")
.HasColumnType("TEXT");
b.Property<string>("Ort")
.HasColumnType("TEXT");
b.Property<string>("Strasse")
.HasColumnType("TEXT");
b.HasKey("BaustelleID");
b.HasIndex("KundenID");
b.ToTable("Baustellen");
});
modelBuilder.Entity("KanSan.Kunden", b =>
{
b.Property<Guid>("KundenID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Nachname")
.HasColumnType("TEXT");
b.Property<string>("Vorname")
.HasColumnType("TEXT");
b.HasKey("KundenID");
b.ToTable("Kunden");
});
modelBuilder.Entity("KanSan.LeistungsverzeichnisBaustelle", b =>
{
b.Property<int>("LeistungsverzeichnisBaustelleID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<Guid?>("BaustelleID")
.HasColumnType("TEXT");
b.Property<Guid?>("LeistungsverzeichnissID")
.HasColumnType("TEXT");
b.HasKey("LeistungsverzeichnisBaustelleID");
b.HasIndex("BaustelleID");
b.HasIndex("LeistungsverzeichnissID");
b.ToTable("leistungsverzeichnisBaustelle");
});
modelBuilder.Entity("KanSan.Leistungsverzeichniss", b =>
{
b.Property<Guid>("LeistungsverzeichnissID")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Position")
.HasColumnType("TEXT");
b.Property<string>("PositionBeschreibung")
.HasColumnType("TEXT");
b.Property<string>("PositionEinheit")
.HasColumnType("TEXT");
b.Property<decimal>("PositionEinheitspreis")
.HasColumnType("TEXT");
b.HasKey("LeistungsverzeichnissID");
b.ToTable("Leistungsverzeichnisses");
});
modelBuilder.Entity("KanSan.Baustelle", b =>
{
b.HasOne("KanSan.Kunden", null)
.WithMany("Baustellen")
.HasForeignKey("KundenID");
});
modelBuilder.Entity("KanSan.LeistungsverzeichnisBaustelle", b =>
{
b.HasOne("KanSan.Baustelle", "Baustelle")
.WithMany()
.HasForeignKey("BaustelleID");
b.HasOne("KanSan.Leistungsverzeichniss", "Leistungsverzeichniss")
.WithMany()
.HasForeignKey("LeistungsverzeichnissID");
});
#pragma warning restore 612, 618
}
}
}

38
KanSan/Model.cs Normal file
View File

@@ -0,0 +1,38 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Text;
namespace KanSan
{
public class KanSanContext : DbContext
{
public DbSet<Kunden> Kunden { get; set; }
public DbSet<Leistungsverzeichniss> Leistungsverzeichnisses { get; set; }
public DbSet<LeistungsverzeichnisBaustelle> leistungsverzeichnisBaustelle { get; set; }
public DbSet<Baustelle> Baustellen { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
options.UseSqlite("Data Source=kanSan.db");
//options.UseNpgsql("Host=localhost;Database=kanSan;Username=user;Password=pass");
}
/*
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<LeistungsverzeichnisBaustelle>(eb =>
{
eb.HasNoKey();
});
}
*/
}
class Model
{
}
}

BIN
KanSan/kanSan.db Normal file

Binary file not shown.