diff --git a/DataDomain/Address.cs b/DataDomain/Address.cs index dce8591..72c3865 100644 --- a/DataDomain/Address.cs +++ b/DataDomain/Address.cs @@ -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; } } } diff --git a/DataDomain/Person.cs b/DataDomain/Person.cs index 1b7068d..f291288 100644 --- a/DataDomain/Person.cs +++ b/DataDomain/Person.cs @@ -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; } } } diff --git a/DatamodelLibrary/Migrations/20210307212939_ChangedFormat_Person_Address.Designer.cs b/DatamodelLibrary/Migrations/20210307212939_ChangedFormat_Person_Address.Designer.cs new file mode 100644 index 0000000..352329a --- /dev/null +++ b/DatamodelLibrary/Migrations/20210307212939_ChangedFormat_Person_Address.Designer.cs @@ -0,0 +1,151 @@ +// +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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Destination") + .HasColumnType("TEXT"); + + b.Property("Nation") + .HasColumnType("TEXT"); + + b.Property("Street") + .HasColumnType("TEXT"); + + b.Property("Street2") + .HasColumnType("TEXT"); + + b.Property("Zipcode") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Addresses"); + }); + + modelBuilder.Entity("DataDomain.Person", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AccountNo") + .HasColumnType("INTEGER"); + + b.Property("Born") + .HasColumnType("TEXT"); + + b.Property("ClearingNo") + .HasColumnType("INTEGER"); + + 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.PersonStock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Comment") + .HasColumnType("TEXT"); + + b.Property("PersonId") + .HasColumnType("INTEGER"); + + b.Property("StockId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("PersonStocks"); + }); + + 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/20210307212939_ChangedFormat_Person_Address.cs b/DatamodelLibrary/Migrations/20210307212939_ChangedFormat_Person_Address.cs new file mode 100644 index 0000000..949c9ca --- /dev/null +++ b/DatamodelLibrary/Migrations/20210307212939_ChangedFormat_Person_Address.cs @@ -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( + name: "AccountNo", + table: "Persons", + type: "INTEGER", + nullable: false, + defaultValue: 0L); + + migrationBuilder.AddColumn( + 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"); + } + } +} diff --git a/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs b/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs index e1d24c0..9e5046e 100644 --- a/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs +++ b/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs @@ -22,21 +22,21 @@ namespace DatamodelLibrary.Migrations .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); - b.Property("Gata") - .HasColumnType("TEXT"); - - b.Property("Gata2") + b.Property("Destination") .HasColumnType("TEXT"); b.Property("Nation") .HasColumnType("TEXT"); - b.Property("PostNr") - .HasColumnType("INTEGER"); - - b.Property("PostOrt") + b.Property("Street") .HasColumnType("TEXT"); + b.Property("Street2") + .HasColumnType("TEXT"); + + b.Property("Zipcode") + .HasColumnType("INTEGER"); + b.HasKey("Id"); b.ToTable("Addresses"); @@ -48,9 +48,15 @@ namespace DatamodelLibrary.Migrations .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); - b.Property("Born") + b.Property("AccountNo") + .HasColumnType("INTEGER"); + + b.Property("Born") .HasColumnType("TEXT"); + b.Property("ClearingNo") + .HasColumnType("INTEGER"); + b.Property("Comments") .HasColumnType("TEXT"); diff --git a/StockDAL/AddressRepository.cs b/StockDAL/AddressRepository.cs new file mode 100644 index 0000000..5e4b9ac --- /dev/null +++ b/StockDAL/AddressRepository.cs @@ -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; + } + } +} diff --git a/StockDAL/PersonRepository.cs b/StockDAL/PersonRepository.cs new file mode 100644 index 0000000..acea091 --- /dev/null +++ b/StockDAL/PersonRepository.cs @@ -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; + } + } +} diff --git a/StockDal.Interface/IAddressRepository.cs b/StockDal.Interface/IAddressRepository.cs new file mode 100644 index 0000000..f9bef5e --- /dev/null +++ b/StockDal.Interface/IAddressRepository.cs @@ -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); + } +} diff --git a/StockDal.Interface/IPersonRepository.cs b/StockDal.Interface/IPersonRepository.cs new file mode 100644 index 0000000..2f895bd --- /dev/null +++ b/StockDal.Interface/IPersonRepository.cs @@ -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); + } +} diff --git a/StockInfo/Program.cs b/StockInfo/Program.cs index 2e30d09..0e027d6 100644 --- a/StockInfo/Program.cs +++ b/StockInfo/Program.cs @@ -24,7 +24,7 @@ namespace StockInfo Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Container = Configure(); - Application.Run(new frmInitial( Container.Resolve(), Container.Resolve())); + Application.Run(new frmInitial( Container.Resolve(), Container.Resolve(), Container.Resolve(), Container.Resolve())); } static IContainer Configure() @@ -32,6 +32,8 @@ namespace StockInfo var builder = new ContainerBuilder(); builder.RegisterType().As(); builder.RegisterType().As(); + builder.RegisterType().As(); + builder.RegisterType().As(); builder.RegisterType(); return builder.Build(); } diff --git a/StockInfo/Stocks.db b/StockInfo/Stocks.db index c9f46db..c9189fa 100644 Binary files a/StockInfo/Stocks.db and b/StockInfo/Stocks.db differ diff --git a/StockInfo/frmInitial.Designer.cs b/StockInfo/frmInitial.Designer.cs index 95a485e..8ca45a5 100644 --- a/StockInfo/frmInitial.Designer.cs +++ b/StockInfo/frmInitial.Designer.cs @@ -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; } } diff --git a/StockInfo/frmInitial.cs b/StockInfo/frmInitial.cs index f223ce6..35fe90e 100644 --- a/StockInfo/frmInitial.cs +++ b/StockInfo/frmInitial.cs @@ -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) + { + + } } } diff --git a/StockInfo/frmPerson.Designer.cs b/StockInfo/frmPerson.Designer.cs new file mode 100644 index 0000000..238ece8 --- /dev/null +++ b/StockInfo/frmPerson.Designer.cs @@ -0,0 +1,358 @@ + +namespace StockInfo +{ + partial class frmPerson + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/StockInfo/frmPerson.cs b/StockInfo/frmPerson.cs new file mode 100644 index 0000000..880a2bc --- /dev/null +++ b/StockInfo/frmPerson.cs @@ -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 = ""; + } + } +} diff --git a/StockInfo/frmPerson.resx b/StockInfo/frmPerson.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/StockInfo/frmPerson.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/StockInfo/frmPersonShareConnect.Designer.cs b/StockInfo/frmPersonShareConnect.Designer.cs new file mode 100644 index 0000000..22120a9 --- /dev/null +++ b/StockInfo/frmPersonShareConnect.Designer.cs @@ -0,0 +1,40 @@ + +namespace StockInfo +{ + partial class frmPersonShareConnect + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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 + } +} \ No newline at end of file diff --git a/StockInfo/frmPersonShareConnect.cs b/StockInfo/frmPersonShareConnect.cs new file mode 100644 index 0000000..4cc7a95 --- /dev/null +++ b/StockInfo/frmPersonShareConnect.cs @@ -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(); + } + } +} diff --git a/StockInfo/frmPersonShareConnect.resx b/StockInfo/frmPersonShareConnect.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/StockInfo/frmPersonShareConnect.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file