flyttat kolumner, infört prisdiff

This commit is contained in:
2021-02-10 07:41:45 +01:00
parent d3b28ae51a
commit 2017f004d3
2 changed files with 19 additions and 9 deletions

View File

@ -33,11 +33,11 @@ namespace RepositoryPattern
this.lvMyStocks = new System.Windows.Forms.ListView(); this.lvMyStocks = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader(); this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader(); this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.columnHeader7 = new System.Windows.Forms.ColumnHeader();
this.columnHeader3 = new System.Windows.Forms.ColumnHeader(); this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
this.columnHeader4 = new System.Windows.Forms.ColumnHeader(); this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
this.columnHeader5 = new System.Windows.Forms.ColumnHeader(); this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
this.columnHeader6 = new System.Windows.Forms.ColumnHeader(); this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
this.columnHeader7 = new System.Windows.Forms.ColumnHeader();
this.columnHeader8 = new System.Windows.Forms.ColumnHeader(); this.columnHeader8 = new System.Windows.Forms.ColumnHeader();
this.columnHeader9 = new System.Windows.Forms.ColumnHeader(); this.columnHeader9 = new System.Windows.Forms.ColumnHeader();
this.columnHeader10 = new System.Windows.Forms.ColumnHeader(); this.columnHeader10 = new System.Windows.Forms.ColumnHeader();
@ -51,6 +51,7 @@ namespace RepositoryPattern
this.chkAutoReload = new System.Windows.Forms.CheckBox(); this.chkAutoReload = new System.Windows.Forms.CheckBox();
this.lbUpdateTimes = new System.Windows.Forms.ListBox(); this.lbUpdateTimes = new System.Windows.Forms.ListBox();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.columnHeader11 = new System.Windows.Forms.ColumnHeader();
this.SuspendLayout(); this.SuspendLayout();
// //
// lvMyStocks // lvMyStocks
@ -61,11 +62,12 @@ namespace RepositoryPattern
this.lvMyStocks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.lvMyStocks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1, this.columnHeader1,
this.columnHeader2, this.columnHeader2,
this.columnHeader7,
this.columnHeader11,
this.columnHeader3, this.columnHeader3,
this.columnHeader4, this.columnHeader4,
this.columnHeader5, this.columnHeader5,
this.columnHeader6, this.columnHeader6,
this.columnHeader7,
this.columnHeader8, this.columnHeader8,
this.columnHeader9, this.columnHeader9,
this.columnHeader10}); this.columnHeader10});
@ -91,6 +93,12 @@ namespace RepositoryPattern
this.columnHeader2.Text = "Buy Price"; this.columnHeader2.Text = "Buy Price";
this.columnHeader2.Width = 80; this.columnHeader2.Width = 80;
// //
// columnHeader7
//
this.columnHeader7.Name = "columnHeader7";
this.columnHeader7.Text = "Market price";
this.columnHeader7.Width = 80;
//
// columnHeader3 // columnHeader3
// //
this.columnHeader3.Name = "columnHeader3"; this.columnHeader3.Name = "columnHeader3";
@ -114,12 +122,6 @@ namespace RepositoryPattern
this.columnHeader6.Text = "Value diff %"; this.columnHeader6.Text = "Value diff %";
this.columnHeader6.Width = 80; this.columnHeader6.Width = 80;
// //
// columnHeader7
//
this.columnHeader7.Name = "columnHeader7";
this.columnHeader7.Text = "Market price";
this.columnHeader7.Width = 80;
//
// columnHeader8 // columnHeader8
// //
this.columnHeader8.Name = "columnHeader8"; this.columnHeader8.Name = "columnHeader8";
@ -225,6 +227,11 @@ namespace RepositoryPattern
this.label4.TabIndex = 9; this.label4.TabIndex = 9;
this.label4.Text = "LatestUpdate"; this.label4.Text = "LatestUpdate";
// //
// columnHeader11
//
this.columnHeader11.Name = "columnHeader11";
this.columnHeader11.Text = "Price Diff";
//
// frmMyStocks // frmMyStocks
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@ -272,5 +279,6 @@ namespace RepositoryPattern
private System.Windows.Forms.CheckBox chkAutoReload; private System.Windows.Forms.CheckBox chkAutoReload;
private System.Windows.Forms.ListBox lbUpdateTimes; private System.Windows.Forms.ListBox lbUpdateTimes;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.ColumnHeader columnHeader11;
} }
} }

View File

@ -79,6 +79,9 @@ namespace RepositoryPattern
{ {
var lv = lvMyStocks.Items.Add(currStock.StockId); var lv = lvMyStocks.Items.Add(currStock.StockId);
lv.SubItems.Add(currStock.BuyValue.ToString()); lv.SubItems.Add(currStock.BuyValue.ToString());
lv.SubItems.Add(currStock.ActValue.ToString());
var priceDiff = currStock.ActValue - currStock.BuyValue;
lv.SubItems.Add(priceDiff.ToString());
lv.SubItems.Add(currStock.PostAmount.ToString()); lv.SubItems.Add(currStock.PostAmount.ToString());
lv.SubItems.Add(currStock.BuyDate.ToString()); lv.SubItems.Add(currStock.BuyDate.ToString());
var buyValue = currStock.PostAmount * currStock.BuyValue; var buyValue = currStock.PostAmount * currStock.BuyValue;
@ -90,7 +93,6 @@ namespace RepositoryPattern
CurrentSum += actValue; CurrentSum += actValue;
var lvs = lv.SubItems.Add(diffValue.ToString()); var lvs = lv.SubItems.Add(diffValue.ToString());
lv.SubItems.Add(Math.Round(diffproc,2).ToString()); lv.SubItems.Add(Math.Round(diffproc,2).ToString());
lv.SubItems.Add(currStock.ActValue.ToString());
lv.SubItems.Add(currStock.ActDate.ToString()); lv.SubItems.Add(currStock.ActDate.ToString());
lv.SubItems.Add(actValue.ToString()); lv.SubItems.Add(actValue.ToString());
var owned = (DateTime.Today - currStock.BuyDate).TotalDays; var owned = (DateTime.Today - currStock.BuyDate).TotalDays;