Latest sold info implemented

This commit is contained in:
2021-05-14 00:10:55 +02:00
parent f0b3b3d264
commit 27db60bbb2
5 changed files with 110 additions and 6 deletions

View File

@ -1,4 +1,5 @@
using DataDomain;
using StockDAL.Interface;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -14,12 +15,15 @@ namespace StockInfoCore
public partial class frmRegisterStock : Form
{
Color hdr = Color.Red;
private readonly IStockRepository _stockRepository;
public Dictionary<string, DiTraderStockRow> Stocks { get; set; }
public List<StockMember> RegisteredStocks { get; set; } = new List<StockMember>();
public frmRegisterStock()
public frmRegisterStock(IStockRepository stockRepository)
{
InitializeComponent();
_stockRepository = stockRepository;
}
private void LoadStockCombo()
@ -50,6 +54,12 @@ namespace StockInfoCore
txtStockExtId.Text = stockChosen.StockName;
txtActValue.Text = stockChosen.LatestPrice.ToString();
txtActDate.Text = (DateTime.Today + stockChosen.TimeOfDay).ToString();
var stockSold = _stockRepository.LatestSell(stockChosen.StockName.Trim());
if (stockSold != null)
{
txtLatestSoldDate.Text = stockSold.LatestSoldDate.Value.ToString();
txtLatestSoldPrice.Text = stockSold.SoldStockPrice.ToString();
}
}
private void btnSaveStock_Click(object sender, EventArgs e)