diff --git a/DataDomain/Address.cs b/DataDomain/Address.cs new file mode 100644 index 0000000..dce8591 --- /dev/null +++ b/DataDomain/Address.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataDomain +{ + public class Address + { + public int Id { get; set; } + public string Gata { get; set; } + public string Gata2 { get; set; } + public int PostNr { get; set; } + public string PostOrt { get; set; } + public string Nation { get; set; } + } +} diff --git a/DataDomain/Person.cs b/DataDomain/Person.cs index 39cf4ca..1b7068d 100644 --- a/DataDomain/Person.cs +++ b/DataDomain/Person.cs @@ -13,5 +13,8 @@ namespace DataDomain public string LastName { get; set; } public string NickName { get; set; } public DateTime? Born { get; set; } + public string Comments { get; set; } + public int HomeAddress { get; set; } + public int InvoiceAddress { get; set; } } } diff --git a/DatamodelLibrary/Migrations/20210306151633_completion_person_address.Designer.cs b/DatamodelLibrary/Migrations/20210306151633_completion_person_address.Designer.cs new file mode 100644 index 0000000..5192534 --- /dev/null +++ b/DatamodelLibrary/Migrations/20210306151633_completion_person_address.Designer.cs @@ -0,0 +1,125 @@ +// +using System; +using DatamodelLibrary; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace DatamodelLibrary.Migrations +{ + [DbContext(typeof(StockContext))] + [Migration("20210306151633_completion_person_address")] + partial class completion_person_address + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.3"); + + modelBuilder.Entity("DataDomain.Address", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Gata") + .HasColumnType("TEXT"); + + b.Property("Gata2") + .HasColumnType("TEXT"); + + b.Property("Nation") + .HasColumnType("TEXT"); + + b.Property("PostNr") + .HasColumnType("INTEGER"); + + b.Property("PostOrt") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Addresses"); + }); + + modelBuilder.Entity("DataDomain.Person", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Born") + .HasColumnType("TEXT"); + + b.Property("Comments") + .HasColumnType("TEXT"); + + b.Property("FirstName") + .HasColumnType("TEXT"); + + b.Property("HomeAddress") + .HasColumnType("INTEGER"); + + b.Property("InvoiceAddress") + .HasColumnType("INTEGER"); + + b.Property("LastName") + .HasColumnType("TEXT"); + + b.Property("NickName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("DataDomain.StockMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ActAmount") + .HasColumnType("INTEGER"); + + b.Property("ActDate") + .HasColumnType("TEXT"); + + b.Property("ActValue") + .HasColumnType("TEXT"); + + b.Property("BuyDate") + .HasColumnType("TEXT"); + + b.Property("BuyValue") + .HasColumnType("TEXT"); + + b.Property("Comment") + .HasColumnType("TEXT"); + + b.Property("PostAmount") + .HasColumnType("INTEGER"); + + b.Property("SoldDate") + .HasColumnType("TEXT"); + + b.Property("SoldValue") + .HasColumnType("TEXT"); + + b.Property("StockExtId") + .HasColumnType("TEXT"); + + b.Property("StockId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Stocks"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DatamodelLibrary/Migrations/20210306151633_completion_person_address.cs b/DatamodelLibrary/Migrations/20210306151633_completion_person_address.cs new file mode 100644 index 0000000..2078fb3 --- /dev/null +++ b/DatamodelLibrary/Migrations/20210306151633_completion_person_address.cs @@ -0,0 +1,65 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace DatamodelLibrary.Migrations +{ + public partial class completion_person_address : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Comments", + table: "Persons", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "HomeAddress", + table: "Persons", + type: "INTEGER", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "InvoiceAddress", + table: "Persons", + type: "INTEGER", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateTable( + name: "Addresses", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Gata = table.Column(type: "TEXT", nullable: true), + Gata2 = table.Column(type: "TEXT", nullable: true), + PostNr = table.Column(type: "INTEGER", nullable: false), + PostOrt = table.Column(type: "TEXT", nullable: true), + Nation = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Addresses", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Addresses"); + + migrationBuilder.DropColumn( + name: "Comments", + table: "Persons"); + + migrationBuilder.DropColumn( + name: "HomeAddress", + table: "Persons"); + + migrationBuilder.DropColumn( + name: "InvoiceAddress", + table: "Persons"); + } + } +} diff --git a/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs b/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs index 0e83c2c..e7f4a1b 100644 --- a/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs +++ b/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs @@ -16,6 +16,32 @@ namespace DatamodelLibrary.Migrations modelBuilder .HasAnnotation("ProductVersion", "5.0.3"); + modelBuilder.Entity("DataDomain.Address", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Gata") + .HasColumnType("TEXT"); + + b.Property("Gata2") + .HasColumnType("TEXT"); + + b.Property("Nation") + .HasColumnType("TEXT"); + + b.Property("PostNr") + .HasColumnType("INTEGER"); + + b.Property("PostOrt") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Addresses"); + }); + modelBuilder.Entity("DataDomain.Person", b => { b.Property("Id") @@ -25,9 +51,18 @@ namespace DatamodelLibrary.Migrations b.Property("Born") .HasColumnType("TEXT"); + b.Property("Comments") + .HasColumnType("TEXT"); + b.Property("FirstName") .HasColumnType("TEXT"); + b.Property("HomeAddress") + .HasColumnType("INTEGER"); + + b.Property("InvoiceAddress") + .HasColumnType("INTEGER"); + b.Property("LastName") .HasColumnType("TEXT"); diff --git a/DatamodelLibrary/StockContext.cs b/DatamodelLibrary/StockContext.cs index 3ad6722..608a832 100644 --- a/DatamodelLibrary/StockContext.cs +++ b/DatamodelLibrary/StockContext.cs @@ -12,6 +12,7 @@ namespace DatamodelLibrary { public DbSet Stocks { get; set; } public DbSet Persons { get; set; } + public DbSet
Addresses { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder options) => options.UseSqlite("Data Source=Stocks.db"); diff --git a/StockInfo/Stocks.db b/StockInfo/Stocks.db index d777e28..e2c50ea 100644 Binary files a/StockInfo/Stocks.db and b/StockInfo/Stocks.db differ