Fetching "Stocks per group and person" implemented , Portfolioowner on Stockpage

This commit is contained in:
2022-02-02 20:09:43 +01:00
parent 6e7091416d
commit b776847980
16 changed files with 106 additions and 25 deletions

View File

@ -8,6 +8,20 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<None Remove="appsettings.json" />
<None Remove="Stocks.db" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Stocks.db">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.6">
<PrivateAssets>all</PrivateAssets>
@ -33,11 +47,5 @@
<SubType>Form</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="Stocks.db">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -1,4 +1,5 @@
using BrowserHelper.Driver;
using BrowserHelper.Extensions;
using Microsoft.Extensions.DependencyInjection;
using SqliteBackups;
using SqliteBackups.Interfaces;
@ -20,6 +21,7 @@ namespace StockInfoCore
{
public static IServiceCollection AddDIInfo(this IServiceCollection services)
{
services.UseWebDriverInitializer();
services.AddTransient<IBackupRepository, BackupRepository>();
services.AddTransient<IBackupRoutines, BackupRoutines>();

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,8 @@
{
"BrowserType": "chrome",
"Headless" : true,
"ApplicationUrl": "https://finansportalen.millistream.com/shares.php",
"TimeoutInterval": 30,
"StockWishes": [ "Arion Bank SDB", "Boliden", "Ericsson A", "Getinge B", "Investor A", "SAS", "Securitas B", "SSAB A", "Handelsbanken A", "Swedbank A" ],
"StocWishCols": ["Aktie","Senast","Tid"]
}

View File

@ -105,7 +105,7 @@ namespace StockInfoCore
private void btnTestScrapFunction_Click(object sender, EventArgs e)
{
_stockMarketRepository.LoadStockMarketList(chbShowBrowser.Checked);
_stockMarketRepository.LoadStockMarketList(SelectedPersonId, chbShowBrowser.Checked);
var stocklist = _stockMarketRepository.StockMarketList;
lblStockRows.Text = stocklist.Count().ToString();
btnReloadShares.Enabled = true;
@ -121,7 +121,7 @@ namespace StockInfoCore
private void Button1reload()
{
lblStockRows.Text = "";
_stockMarketRepository.RefreshMarketList();
_stockMarketRepository.RefreshMarketList(SelectedPersonId);
var stocklist = _stockMarketRepository.StockMarketList;
lblStockRows.Text = stocklist.Count().ToString();
}
@ -129,7 +129,7 @@ namespace StockInfoCore
private void btnStockReg_Click(object sender, EventArgs e)
{
Cursor.Current = Cursors.WaitCursor;
_stockMarketRepository.LoadStockMarketList();
_stockMarketRepository.LoadStockMarketList(SelectedPersonId);
_regWindow.Stocks = _stockMarketRepository.StockMarketList;
Cursor.Current = DefaultCursor;
_regWindow.ShowDialog();
@ -149,9 +149,11 @@ namespace StockInfoCore
{
var person = _personRepository.GetPersonById(SelectedPersonId);
Cursor.Current = Cursors.WaitCursor;
_stockMarketRepository.LoadStockMarketList();
_stockMarketRepository.LoadStockMarketList(SelectedPersonId);
_stockWindow.ConnectedPerson = person;
_stockWindow.Stocks = _stockMarketRepository.StockMarketList;
Cursor.Current = DefaultCursor;
_stockWindow.ShowDialog();
}

View File

@ -58,6 +58,7 @@ namespace StockInfoCore
this.txtTotalMinus = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.txtTotalPlus = new System.Windows.Forms.TextBox();
this.lblOwnerName = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.SuspendLayout();
//
@ -80,7 +81,6 @@ namespace StockInfoCore
this.columnHeader9,
this.columnHeader10});
this.lvMyStocks.GridLines = true;
this.lvMyStocks.HideSelection = false;
this.lvMyStocks.Location = new System.Drawing.Point(14, 43);
this.lvMyStocks.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.lvMyStocks.Name = "lvMyStocks";
@ -323,11 +323,21 @@ namespace StockInfoCore
this.txtTotalPlus.Size = new System.Drawing.Size(114, 33);
this.txtTotalPlus.TabIndex = 14;
//
// lblOwnerName
//
this.lblOwnerName.AutoSize = true;
this.lblOwnerName.Location = new System.Drawing.Point(424, 10);
this.lblOwnerName.Name = "lblOwnerName";
this.lblOwnerName.Size = new System.Drawing.Size(145, 20);
this.lblOwnerName.TabIndex = 16;
this.lblOwnerName.Text = "Portfölj Ägare Namn";
//
// frmMyStocks
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1217, 651);
this.Controls.Add(this.lblOwnerName);
this.Controls.Add(this.label7);
this.Controls.Add(this.txtTotalPlus);
this.Controls.Add(this.label6);
@ -385,5 +395,6 @@ namespace StockInfoCore
private System.Windows.Forms.TextBox txtTotalMinus;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox txtTotalPlus;
private Label lblOwnerName;
}
}

View File

@ -71,6 +71,7 @@ namespace StockInfoCore
AddItemToListView(stk);
}
lblOwnerName.Text = $"* {ConnectedPerson.FirstName} {ConnectedPerson.LastName} *";
txtBuyTotal.Text = BoughtSum.ToString();
txtBuyTotal.Refresh();
txtCurrValue.Text = CurrentSum.ToString();
@ -96,7 +97,7 @@ namespace StockInfoCore
private void TotalReload()
{
_stockMarketRepository.LoadStockMarketList();
_stockMarketRepository.LoadStockMarketList(ConnectedPerson.Id);
Stocks = _stockMarketRepository.StockMarketList;
ReloadData();
// lbUpdateTimes.Items.Add($"{DateTime.Now.ToLongTimeString()} - {txtTotDiff.Text.Substring(0, txtTotDiff.Text.Length-2)}");

View File

@ -57,4 +57,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>