Added code for Person / Address

This commit is contained in:
2021-03-07 23:39:37 +01:00
parent 00b407f790
commit b4baefd68f
19 changed files with 1094 additions and 26 deletions

View File

@ -9,10 +9,10 @@ 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 Street { get; set; }
public string Street2 { get; set; }
public int Zipcode { get; set; }
public string Destination { get; set; }
public string Nation { get; set; }
}
}

View File

@ -12,9 +12,11 @@ namespace DataDomain
public string FirstName { get; set; }
public string LastName { get; set; }
public string NickName { get; set; }
public DateTime? Born { get; set; }
public String Born { get; set; }
public string Comments { get; set; }
public int HomeAddress { get; set; }
public int InvoiceAddress { get; set; }
public int ClearingNo { get; set; }
public long AccountNo { get; set; }
}
}

View File

@ -0,0 +1,151 @@
// <auto-generated />
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("20210307212939_ChangedFormat_Person_Address")]
partial class ChangedFormat_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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Destination")
.HasColumnType("TEXT");
b.Property<string>("Nation")
.HasColumnType("TEXT");
b.Property<string>("Street")
.HasColumnType("TEXT");
b.Property<string>("Street2")
.HasColumnType("TEXT");
b.Property<int>("Zipcode")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Addresses");
});
modelBuilder.Entity("DataDomain.Person", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("AccountNo")
.HasColumnType("INTEGER");
b.Property<string>("Born")
.HasColumnType("TEXT");
b.Property<int>("ClearingNo")
.HasColumnType("INTEGER");
b.Property<string>("Comments")
.HasColumnType("TEXT");
b.Property<string>("FirstName")
.HasColumnType("TEXT");
b.Property<int>("HomeAddress")
.HasColumnType("INTEGER");
b.Property<int>("InvoiceAddress")
.HasColumnType("INTEGER");
b.Property<string>("LastName")
.HasColumnType("TEXT");
b.Property<string>("NickName")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Persons");
});
modelBuilder.Entity("DataDomain.PersonStock", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Comment")
.HasColumnType("TEXT");
b.Property<int>("PersonId")
.HasColumnType("INTEGER");
b.Property<int>("StockId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("PersonStocks");
});
modelBuilder.Entity("DataDomain.StockMember", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("ActAmount")
.HasColumnType("INTEGER");
b.Property<DateTime?>("ActDate")
.HasColumnType("TEXT");
b.Property<decimal>("ActValue")
.HasColumnType("TEXT");
b.Property<DateTime>("BuyDate")
.HasColumnType("TEXT");
b.Property<decimal>("BuyValue")
.HasColumnType("TEXT");
b.Property<string>("Comment")
.HasColumnType("TEXT");
b.Property<long>("PostAmount")
.HasColumnType("INTEGER");
b.Property<DateTime?>("SoldDate")
.HasColumnType("TEXT");
b.Property<decimal?>("SoldValue")
.HasColumnType("TEXT");
b.Property<string>("StockExtId")
.HasColumnType("TEXT");
b.Property<string>("StockId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Stocks");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,75 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace DatamodelLibrary.Migrations
{
public partial class ChangedFormat_Person_Address : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "PostOrt",
table: "Addresses",
newName: "Street2");
migrationBuilder.RenameColumn(
name: "PostNr",
table: "Addresses",
newName: "Zipcode");
migrationBuilder.RenameColumn(
name: "Gata2",
table: "Addresses",
newName: "Street");
migrationBuilder.RenameColumn(
name: "Gata",
table: "Addresses",
newName: "Destination");
migrationBuilder.AddColumn<long>(
name: "AccountNo",
table: "Persons",
type: "INTEGER",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddColumn<int>(
name: "ClearingNo",
table: "Persons",
type: "INTEGER",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AccountNo",
table: "Persons");
migrationBuilder.DropColumn(
name: "ClearingNo",
table: "Persons");
migrationBuilder.RenameColumn(
name: "Zipcode",
table: "Addresses",
newName: "PostNr");
migrationBuilder.RenameColumn(
name: "Street2",
table: "Addresses",
newName: "PostOrt");
migrationBuilder.RenameColumn(
name: "Street",
table: "Addresses",
newName: "Gata2");
migrationBuilder.RenameColumn(
name: "Destination",
table: "Addresses",
newName: "Gata");
}
}
}

View File

@ -22,21 +22,21 @@ namespace DatamodelLibrary.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Gata")
.HasColumnType("TEXT");
b.Property<string>("Gata2")
b.Property<string>("Destination")
.HasColumnType("TEXT");
b.Property<string>("Nation")
.HasColumnType("TEXT");
b.Property<int>("PostNr")
.HasColumnType("INTEGER");
b.Property<string>("PostOrt")
b.Property<string>("Street")
.HasColumnType("TEXT");
b.Property<string>("Street2")
.HasColumnType("TEXT");
b.Property<int>("Zipcode")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Addresses");
@ -48,9 +48,15 @@ namespace DatamodelLibrary.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime?>("Born")
b.Property<long>("AccountNo")
.HasColumnType("INTEGER");
b.Property<string>("Born")
.HasColumnType("TEXT");
b.Property<int>("ClearingNo")
.HasColumnType("INTEGER");
b.Property<string>("Comments")
.HasColumnType("TEXT");

View File

@ -0,0 +1,23 @@
using DataDomain;
using DatamodelLibrary;
using StockDAL.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StockDAL
{
public class AddressRepository : IAddressRepository
{
public Address GetAddressById(int AddressId)
{
using var context = new StockContext();
var entity = (from adr in context.Addresses
where adr.Id == AddressId
select adr).FirstOrDefault();
return entity;
}
}
}

View File

@ -0,0 +1,23 @@
using DataDomain;
using DatamodelLibrary;
using StockDAL.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StockDAL
{
public class PersonRepository : IPersonRepository
{
public Person GetPersonById(int personId)
{
using var context = new StockContext();
var entity = (from prs in context.Persons
where prs.Id == personId
select prs).FirstOrDefault();
return entity;
}
}
}

View File

@ -0,0 +1,14 @@
using DataDomain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StockDAL.Interface
{
public interface IAddressRepository
{
Address GetAddressById(int AddressId);
}
}

View File

@ -0,0 +1,14 @@
using DataDomain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StockDAL.Interface
{
public interface IPersonRepository
{
Person GetPersonById(int personId);
}
}

View File

@ -24,7 +24,7 @@ namespace StockInfo
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Container = Configure();
Application.Run(new frmInitial( Container.Resolve<IStockRepository>(), Container.Resolve<IStockMarketRepository>()));
Application.Run(new frmInitial( Container.Resolve<IStockRepository>(), Container.Resolve<IStockMarketRepository>(), Container.Resolve<IPersonRepository>(), Container.Resolve<IAddressRepository>()));
}
static IContainer Configure()
@ -32,6 +32,8 @@ namespace StockInfo
var builder = new ContainerBuilder();
builder.RegisterType<StockRepository>().As<IStockRepository>();
builder.RegisterType<StockMarketRepository>().As<IStockMarketRepository>();
builder.RegisterType<PersonRepository>().As<IPersonRepository>();
builder.RegisterType<AddressRepository>().As<IAddressRepository>();
builder.RegisterType<frmInitial>();
return builder.Build();
}

Binary file not shown.

View File

@ -46,9 +46,14 @@ namespace StockInfo
this.sfdSaver = new System.Windows.Forms.SaveFileDialog();
this.ofdOpener = new System.Windows.Forms.OpenFileDialog();
this.lblStockRows = new System.Windows.Forms.Label();
this.gpOwners = new System.Windows.Forms.GroupBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.btnEditPerson = new System.Windows.Forms.Button();
this.btnConnShares = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.gB1.SuspendLayout();
this.gbStockMgmnt.SuspendLayout();
this.gpOwners.SuspendLayout();
this.SuspendLayout();
//
// dataGridView
@ -221,11 +226,54 @@ namespace StockInfo
this.lblStockRows.Size = new System.Drawing.Size(0, 15);
this.lblStockRows.TabIndex = 9;
//
// gpOwners
//
this.gpOwners.Controls.Add(this.btnConnShares);
this.gpOwners.Controls.Add(this.btnEditPerson);
this.gpOwners.Controls.Add(this.comboBox1);
this.gpOwners.Location = new System.Drawing.Point(589, 385);
this.gpOwners.Name = "gpOwners";
this.gpOwners.Size = new System.Drawing.Size(252, 141);
this.gpOwners.TabIndex = 10;
this.gpOwners.TabStop = false;
this.gpOwners.Text = "ShareOwners";
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(6, 33);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(152, 23);
this.comboBox1.TabIndex = 0;
//
// btnEditPerson
//
this.btnEditPerson.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnEditPerson.Location = new System.Drawing.Point(6, 82);
this.btnEditPerson.Name = "btnEditPerson";
this.btnEditPerson.Size = new System.Drawing.Size(108, 23);
this.btnEditPerson.TabIndex = 3;
this.btnEditPerson.Text = "Add/Edit Person";
this.btnEditPerson.UseVisualStyleBackColor = true;
this.btnEditPerson.Click += new System.EventHandler(this.btnEditPerson_Click);
//
// btnConnShares
//
this.btnConnShares.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnConnShares.Location = new System.Drawing.Point(120, 82);
this.btnConnShares.Name = "btnConnShares";
this.btnConnShares.Size = new System.Drawing.Size(108, 23);
this.btnConnShares.TabIndex = 4;
this.btnConnShares.Text = "Connect Shares";
this.btnConnShares.UseVisualStyleBackColor = true;
this.btnConnShares.Click += new System.EventHandler(this.btnConnShares_Click);
//
// frmInitial
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(853, 538);
this.Controls.Add(this.gpOwners);
this.Controls.Add(this.lblStockRows);
this.Controls.Add(this.gbStockMgmnt);
this.Controls.Add(this.chbShowBrowser);
@ -244,6 +292,7 @@ namespace StockInfo
this.gB1.ResumeLayout(false);
this.gB1.PerformLayout();
this.gbStockMgmnt.ResumeLayout(false);
this.gpOwners.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@ -268,6 +317,10 @@ namespace StockInfo
private System.Windows.Forms.SaveFileDialog sfdSaver;
private System.Windows.Forms.OpenFileDialog ofdOpener;
private System.Windows.Forms.Label lblStockRows;
private System.Windows.Forms.GroupBox gpOwners;
private System.Windows.Forms.Button btnConnShares;
private System.Windows.Forms.Button btnEditPerson;
private System.Windows.Forms.ComboBox comboBox1;
}
}

View File

@ -19,16 +19,24 @@ namespace StockInfo
{
private readonly IStockRepository _stockRepository;
private readonly IStockMarketRepository _stockMarketRepository;
private readonly IPersonRepository _personRepository;
private readonly IAddressRepository _addressRepository;
private frmRegisterStock regWindow;
private frmMyStocks stockWindow;
private frmSelling sellWindow;
private frmPerson personWindow;
public frmInitial(IStockRepository stockMemberRepository, IStockMarketRepository stockMarketRepository)
public frmInitial(
IStockRepository stockMemberRepository,
IStockMarketRepository stockMarketRepository,
IPersonRepository personRepository,
IAddressRepository addressRepository)
{
InitializeComponent();
_stockRepository = stockMemberRepository;
_stockMarketRepository = stockMarketRepository;
_personRepository = personRepository;
_addressRepository = addressRepository;
}
private void Form1_Load(object sender, EventArgs e)
@ -100,15 +108,7 @@ namespace StockInfo
stockWindow.ShowDialog();
}
private void btnStockSale_Click(object sender, EventArgs e)
{
Cursor.Current = Cursors.WaitCursor;
sellWindow = new frmSelling(_stockRepository);
Cursor.Current = DefaultCursor;
sellWindow.ShowDialog();
ReloadData();
}
private void chkEnableBackRes_CheckedChanged(object sender, EventArgs e)
{
@ -156,5 +156,27 @@ namespace StockInfo
{
Button1reload();
}
private void btnStockSale_Click(object sender, EventArgs e)
{
Cursor.Current = Cursors.WaitCursor;
sellWindow = new frmSelling(_stockRepository);
Cursor.Current = DefaultCursor;
sellWindow.ShowDialog();
ReloadData();
}
private void btnEditPerson_Click(object sender, EventArgs e)
{
Cursor.Current = Cursors.WaitCursor;
personWindow = new frmPerson(_personRepository, _addressRepository);
Cursor.Current = DefaultCursor;
personWindow.ShowDialog();
}
private void btnConnShares_Click(object sender, EventArgs e)
{
}
}
}

358
StockInfo/frmPerson.Designer.cs generated Normal file
View File

@ -0,0 +1,358 @@

namespace StockInfo
{
partial class frmPerson
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.txtFirstName = new System.Windows.Forms.TextBox();
this.txtComment = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.txtPersonNr = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtNickName = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.txtLastName = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.gbAddress = new System.Windows.Forms.GroupBox();
this.txtNation = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.txtZipCode = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.txtStreet2 = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.txtStreet = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.rdbInvoiceAddr = new System.Windows.Forms.RadioButton();
this.rdbHome = new System.Windows.Forms.RadioButton();
this.txtClearingNo = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.txtAccountNr = new System.Windows.Forms.TextBox();
this.btnAddSave = new System.Windows.Forms.Button();
this.btnClose = new System.Windows.Forms.Button();
this.txtDestination = new System.Windows.Forms.TextBox();
this.gbAddress.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 49);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 15);
this.label1.TabIndex = 0;
this.label1.Text = "First Name";
//
// txtFirstName
//
this.txtFirstName.Location = new System.Drawing.Point(113, 46);
this.txtFirstName.Name = "txtFirstName";
this.txtFirstName.Size = new System.Drawing.Size(188, 23);
this.txtFirstName.TabIndex = 1;
//
// txtComment
//
this.txtComment.Location = new System.Drawing.Point(113, 162);
this.txtComment.Name = "txtComment";
this.txtComment.Size = new System.Drawing.Size(188, 23);
this.txtComment.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(13, 165);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(61, 15);
this.label2.TabIndex = 2;
this.label2.Text = "Comment";
//
// txtPersonNr
//
this.txtPersonNr.Location = new System.Drawing.Point(113, 133);
this.txtPersonNr.Name = "txtPersonNr";
this.txtPersonNr.Size = new System.Drawing.Size(188, 23);
this.txtPersonNr.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(13, 136);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 15);
this.label3.TabIndex = 4;
this.label3.Text = "PersonNr";
//
// txtNickName
//
this.txtNickName.Location = new System.Drawing.Point(113, 104);
this.txtNickName.Name = "txtNickName";
this.txtNickName.Size = new System.Drawing.Size(188, 23);
this.txtNickName.TabIndex = 7;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(13, 104);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(63, 15);
this.label4.TabIndex = 6;
this.label4.Text = "NickName";
//
// txtLastName
//
this.txtLastName.Location = new System.Drawing.Point(113, 75);
this.txtLastName.Name = "txtLastName";
this.txtLastName.Size = new System.Drawing.Size(188, 23);
this.txtLastName.TabIndex = 9;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(13, 78);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(63, 15);
this.label5.TabIndex = 8;
this.label5.Text = "Last Name";
//
// gbAddress
//
this.gbAddress.Controls.Add(this.txtDestination);
this.gbAddress.Controls.Add(this.txtNation);
this.gbAddress.Controls.Add(this.label10);
this.gbAddress.Controls.Add(this.txtZipCode);
this.gbAddress.Controls.Add(this.label9);
this.gbAddress.Controls.Add(this.txtStreet2);
this.gbAddress.Controls.Add(this.label8);
this.gbAddress.Controls.Add(this.txtStreet);
this.gbAddress.Controls.Add(this.label7);
this.gbAddress.Controls.Add(this.rdbInvoiceAddr);
this.gbAddress.Controls.Add(this.rdbHome);
this.gbAddress.Location = new System.Drawing.Point(13, 221);
this.gbAddress.Name = "gbAddress";
this.gbAddress.Size = new System.Drawing.Size(300, 177);
this.gbAddress.TabIndex = 10;
this.gbAddress.TabStop = false;
this.gbAddress.Text = "Addresses";
//
// txtNation
//
this.txtNation.Location = new System.Drawing.Point(84, 135);
this.txtNation.Name = "txtNation";
this.txtNation.Size = new System.Drawing.Size(210, 23);
this.txtNation.TabIndex = 9;
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(6, 138);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(43, 15);
this.label10.TabIndex = 8;
this.label10.Text = "Nation";
//
// txtZipCode
//
this.txtZipCode.Location = new System.Drawing.Point(84, 106);
this.txtZipCode.Name = "txtZipCode";
this.txtZipCode.Size = new System.Drawing.Size(58, 23);
this.txtZipCode.TabIndex = 7;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(6, 109);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(58, 15);
this.label9.TabIndex = 6;
this.label9.Text = "Zip / Dest";
//
// txtStreet2
//
this.txtStreet2.Location = new System.Drawing.Point(84, 77);
this.txtStreet2.Name = "txtStreet2";
this.txtStreet2.Size = new System.Drawing.Size(210, 23);
this.txtStreet2.TabIndex = 5;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(6, 80);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(46, 15);
this.label8.TabIndex = 4;
this.label8.Text = "Street 2";
//
// txtStreet
//
this.txtStreet.Location = new System.Drawing.Point(84, 48);
this.txtStreet.Name = "txtStreet";
this.txtStreet.Size = new System.Drawing.Size(210, 23);
this.txtStreet.TabIndex = 3;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(6, 51);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(37, 15);
this.label7.TabIndex = 2;
this.label7.Text = "Street";
//
// rdbInvoiceAddr
//
this.rdbInvoiceAddr.AutoSize = true;
this.rdbInvoiceAddr.Location = new System.Drawing.Point(116, 23);
this.rdbInvoiceAddr.Name = "rdbInvoiceAddr";
this.rdbInvoiceAddr.Size = new System.Drawing.Size(108, 19);
this.rdbInvoiceAddr.TabIndex = 1;
this.rdbInvoiceAddr.Text = "Invoice Address";
this.rdbInvoiceAddr.UseVisualStyleBackColor = true;
//
// rdbHome
//
this.rdbHome.AutoSize = true;
this.rdbHome.Checked = true;
this.rdbHome.Location = new System.Drawing.Point(7, 23);
this.rdbHome.Name = "rdbHome";
this.rdbHome.Size = new System.Drawing.Size(103, 19);
this.rdbHome.TabIndex = 0;
this.rdbHome.TabStop = true;
this.rdbHome.Text = "Home Address";
this.rdbHome.UseVisualStyleBackColor = true;
//
// txtClearingNo
//
this.txtClearingNo.Location = new System.Drawing.Point(113, 191);
this.txtClearingNo.Name = "txtClearingNo";
this.txtClearingNo.Size = new System.Drawing.Size(42, 23);
this.txtClearingNo.TabIndex = 12;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(13, 194);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(52, 15);
this.label6.TabIndex = 11;
this.label6.Text = "Account";
//
// txtAccountNr
//
this.txtAccountNr.Location = new System.Drawing.Point(161, 191);
this.txtAccountNr.Name = "txtAccountNr";
this.txtAccountNr.Size = new System.Drawing.Size(152, 23);
this.txtAccountNr.TabIndex = 13;
//
// btnAddSave
//
this.btnAddSave.Location = new System.Drawing.Point(319, 355);
this.btnAddSave.Name = "btnAddSave";
this.btnAddSave.Size = new System.Drawing.Size(107, 23);
this.btnAddSave.TabIndex = 14;
this.btnAddSave.Text = "Add/Save Owner";
this.btnAddSave.UseVisualStyleBackColor = true;
this.btnAddSave.Click += new System.EventHandler(this.btnAddSave_Click);
//
// btnClose
//
this.btnClose.Location = new System.Drawing.Point(432, 355);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(75, 23);
this.btnClose.TabIndex = 15;
this.btnClose.Text = "Close";
this.btnClose.UseVisualStyleBackColor = true;
//
// txtDestination
//
this.txtDestination.Location = new System.Drawing.Point(148, 106);
this.txtDestination.Name = "txtDestination";
this.txtDestination.Size = new System.Drawing.Size(146, 23);
this.txtDestination.TabIndex = 10;
//
// frmPerson
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(534, 419);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.btnAddSave);
this.Controls.Add(this.txtAccountNr);
this.Controls.Add(this.txtClearingNo);
this.Controls.Add(this.label6);
this.Controls.Add(this.gbAddress);
this.Controls.Add(this.txtLastName);
this.Controls.Add(this.label5);
this.Controls.Add(this.txtNickName);
this.Controls.Add(this.label4);
this.Controls.Add(this.txtPersonNr);
this.Controls.Add(this.label3);
this.Controls.Add(this.txtComment);
this.Controls.Add(this.label2);
this.Controls.Add(this.txtFirstName);
this.Controls.Add(this.label1);
this.Name = "frmPerson";
this.Text = "frmPerson";
this.Load += new System.EventHandler(this.frmPerson_Load);
this.gbAddress.ResumeLayout(false);
this.gbAddress.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtFirstName;
private System.Windows.Forms.TextBox txtComment;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtPersonNr;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtNickName;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtLastName;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.GroupBox gbAddress;
private System.Windows.Forms.RadioButton rdbInvoiceAddr;
private System.Windows.Forms.RadioButton rdbHome;
private System.Windows.Forms.TextBox txtClearingNo;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox txtAccountNr;
private System.Windows.Forms.TextBox txtNation;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox txtZipCode;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox txtStreet2;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox txtStreet;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Button btnAddSave;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.TextBox txtDestination;
}
}

85
StockInfo/frmPerson.cs Normal file
View File

@ -0,0 +1,85 @@
using DataDomain;
using StockDAL.Interface;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace StockInfo
{
public partial class frmPerson : Form
{
private readonly IPersonRepository _personRepository;
private readonly IAddressRepository _addressRepository;
public frmPerson(IPersonRepository personRepository, IAddressRepository addressRepository)
{
InitializeComponent();
_personRepository = personRepository;
_addressRepository = addressRepository;
}
public int PersonId { get; set; }
public int HomeAddressId { get; set; }
public int InvoiceAddressId { get; set; }
private void btnAddSave_Click(object sender, EventArgs e)
{
}
private void frmPerson_Load(object sender, EventArgs e)
{
var person = _personRepository.GetPersonById(PersonId);
initializeAllFields();
if (person != null)
{
HomeAddressId = person.HomeAddress;
InvoiceAddressId = person.InvoiceAddress;
fillFieldsFromPerson(person);
}
}
private void fillFieldsFromPerson(Person person)
{
txtFirstName.Text = person.FirstName;
txtLastName.Text = person.LastName;
txtNickName.Text = person.NickName;
txtPersonNr.Text = person.Born;
txtComment.Text = person.Comments;
txtClearingNo.Text = person.ClearingNo.ToString();
txtAccountNr.Text = person.AccountNo.ToString();
var address = _addressRepository.GetAddressById(HomeAddressId);
if (address != null)
{
txtStreet.Text = address.Street;
txtStreet2.Text = address.Street2;
txtZipCode.Text = address.Zipcode.ToString();
txtDestination.Text = address.Destination;
txtNation.Text = address.Nation;
}
}
private void initializeAllFields()
{
txtFirstName.Text = "";
txtLastName.Text = "";
txtNickName.Text = "";
txtPersonNr.Text = "";
txtComment.Text = "";
txtClearingNo.Text = "";
txtAccountNr.Text = "";
txtStreet.Text = "";
txtStreet2.Text = "";
txtZipCode.Text = "";
txtDestination.Text = "";
txtNation.Text = "";
}
}
}

60
StockInfo/frmPerson.resx Normal file
View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,40 @@

namespace StockInfo
{
partial class frmPersonShareConnect
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "frmPersonShareConnect";
}
#endregion
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace StockInfo
{
public partial class frmPersonShareConnect : Form
{
public frmPersonShareConnect()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>