Compare commits
10 Commits
40d869b5de
...
0ec700b5ed
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ec700b5ed | |||
| 0cb51d70cb | |||
| 6e2eb207a3 | |||
| 13f4613fb8 | |||
| 0d8a745430 | |||
| a9cd3630a0 | |||
| eb65cead16 | |||
| e6121da2ca | |||
| 95a9537af9 | |||
| d8f6ce4650 |
@ -135,6 +135,8 @@ namespace BrowserHelper.Extensions
|
|||||||
int rowIndex = 0;
|
int rowIndex = 0;
|
||||||
//GlobalStopwatch.PrintSecs("Before scraplooping");
|
//GlobalStopwatch.PrintSecs("Before scraplooping");
|
||||||
foreach (var row in rows)
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var element = row.FindElement(By.XPath(".//td"));
|
var element = row.FindElement(By.XPath(".//td"));
|
||||||
if (!shareSet.Contains(element.Text)) { }
|
if (!shareSet.Contains(element.Text)) { }
|
||||||
@ -155,6 +157,10 @@ namespace BrowserHelper.Extensions
|
|||||||
shareSet.Remove(element.Text);
|
shareSet.Remove(element.Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
//if (antal < 1) break;
|
//if (antal < 1) break;
|
||||||
if (shareSet.Count < 1) break;
|
if (shareSet.Count < 1) break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,5 +11,8 @@ namespace BrowserHelper.Settings
|
|||||||
public int TimeoutInterval { get; set; }
|
public int TimeoutInterval { get; set; }
|
||||||
public string[] StockWishes { get; set; }
|
public string[] StockWishes { get; set; }
|
||||||
public string[] StocWishCols { get; set; }
|
public string[] StocWishCols { get; set; }
|
||||||
|
public string[] StockGroups { get; set; }
|
||||||
|
public string[] ZNotFoundStocks { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\BrowserHelper\BrowserHelper.csproj" />
|
||||||
<ProjectReference Include="..\DataDomain\DataDomain.csproj" />
|
<ProjectReference Include="..\DataDomain\DataDomain.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
using DataDomain;
|
using BrowserHelper.Settings;
|
||||||
|
using DataDomain;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -10,6 +12,7 @@ namespace DatamodelLibrary
|
|||||||
{
|
{
|
||||||
public class StockContext : DbContext
|
public class StockContext : DbContext
|
||||||
{
|
{
|
||||||
|
|
||||||
public DbSet<StockMember> Stocks { get; set; }
|
public DbSet<StockMember> Stocks { get; set; }
|
||||||
public DbSet<Person> Persons { get; set; }
|
public DbSet<Person> Persons { get; set; }
|
||||||
public DbSet<Address> Addresses { get; set; }
|
public DbSet<Address> Addresses { get; set; }
|
||||||
@ -17,7 +20,9 @@ namespace DatamodelLibrary
|
|||||||
public DbSet<BackupRegister> BackupRegings { get; set; }
|
public DbSet<BackupRegister> BackupRegings { get; set; }
|
||||||
public DbSet<StockGroupModel> StockGroups { get; set; }
|
public DbSet<StockGroupModel> StockGroups { get; set; }
|
||||||
|
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||||
|
//=> options.UseSqlite("Data Source=C:\\Aktier\\net6.0-windows\\NewData\\Stocks.db");
|
||||||
=> options.UseSqlite(@"Data Source=.\Stocks.db");
|
=> options.UseSqlite(@"Data Source=.\Stocks.db");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -145,6 +145,83 @@ namespace StockDal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task LoadStockMarketListAsync(int persId)
|
||||||
|
{
|
||||||
|
StockMarketList = new Dictionary<string, DiTraderStockRow>();
|
||||||
|
DumpObjects = new List<DiTraderStockRow>();
|
||||||
|
var groupedStocks = persId == 0 ? _stockRepository.GetStocksGroupedAllPersons()
|
||||||
|
: _stockRepository.GetStocksGroupedPerPerson(persId);
|
||||||
|
|
||||||
|
//var tasks = new List<Task<List<DiTraderStockRow>>>();
|
||||||
|
|
||||||
|
var lastGroup = string.Empty;
|
||||||
|
var stockList = new List<string>();
|
||||||
|
foreach (var groupedStock in groupedStocks)
|
||||||
|
{
|
||||||
|
if (groupedStock.StockGroup != lastGroup)
|
||||||
|
{
|
||||||
|
if (lastGroup != string.Empty)
|
||||||
|
{
|
||||||
|
_testSettings.StockWishes = stockList.ToArray();
|
||||||
|
if (lastGroup == "ZNotFound")
|
||||||
|
foreach (var stk in stockList)
|
||||||
|
{
|
||||||
|
//saveStockData(new List<DiTraderStockRow>(_scrapePage.SearchStockAndCollect(stk.Substring(0, 4))));
|
||||||
|
//tasks.Add( Task.Run(() => new List<DiTraderStockRow>(_scrapePage.SearchStockAndCollect(stk.Substring(0, 4)))));
|
||||||
|
saveStockData(await Task.Run(() => new List<DiTraderStockRow>(_scrapePage.SearchStockAndCollect(stk.Substring(0, 4)))));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//saveStockData(_scrapePage.GetMyStockStatus(lastGroup));
|
||||||
|
//tasks.Add(Task.Run(() => _scrapePage.GetMyStockStatus(lastGroup)));
|
||||||
|
saveStockData(await Task.Run(() => _scrapePage.GetMyStockStatus(lastGroup)));
|
||||||
|
}
|
||||||
|
stockList.Clear();
|
||||||
|
lastGroup = groupedStock.StockGroup;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lastGroup = groupedStock.StockGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
stockList.Add(groupedStock.StockId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stockList.Add(groupedStock.StockId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stockList.Count > 0)
|
||||||
|
{
|
||||||
|
_testSettings.StockWishes = stockList.ToArray();
|
||||||
|
if (lastGroup == "ZNotFound")
|
||||||
|
foreach (var stk in stockList)
|
||||||
|
{
|
||||||
|
//saveStockData(new List<DiTraderStockRow>(_scrapePage.SearchStockAndCollect(stk.Substring(0, 4))));
|
||||||
|
//tasks.Add(Task.Run(() => new List<DiTraderStockRow>(_scrapePage.SearchStockAndCollect(stk.Substring(0, 4)))));
|
||||||
|
saveStockData(await Task.Run(() => new List<DiTraderStockRow>(_scrapePage.SearchStockAndCollect(stk.Substring(0, 4)))));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
//saveStockData(_scrapePage.GetMyStockStatus(lastGroup));
|
||||||
|
//tasks.Add(Task.Run(() => _scrapePage.GetMyStockStatus(lastGroup)));
|
||||||
|
saveStockData(await Task.Run(() => _scrapePage.GetMyStockStatus(lastGroup)));
|
||||||
|
stockList.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//var results = await Task.WhenAll(tasks);
|
||||||
|
//foreach(var result in results)
|
||||||
|
//{
|
||||||
|
// saveStockData(result);
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (DumpObjects.Any())
|
||||||
|
{
|
||||||
|
SaveLogging();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public DiTraderStockRow LoadStockMarketStockData(string searchedStock)
|
public DiTraderStockRow LoadStockMarketStockData(string searchedStock)
|
||||||
{
|
{
|
||||||
var groupedStocks = _stockRepository.GetGroupedStock(searchedStock);
|
var groupedStocks = _stockRepository.GetGroupedStock(searchedStock);
|
||||||
|
|||||||
@ -11,6 +11,7 @@ namespace StockDAL
|
|||||||
{
|
{
|
||||||
public class StockRepository : IStockRepository
|
public class StockRepository : IStockRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
public void SaveStockMember(StockMember stockMember)
|
public void SaveStockMember(StockMember stockMember)
|
||||||
{
|
{
|
||||||
using (var context = new StockContext())
|
using (var context = new StockContext())
|
||||||
@ -104,13 +105,19 @@ namespace StockDAL
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IEnumerable<StockMember> GetAllRemainingStocks()
|
public IEnumerable<StockMember> GetAllRemainingStocks(int personId = 0)
|
||||||
{
|
{
|
||||||
using var context = new StockContext();
|
using var context = new StockContext();
|
||||||
var output = (from stk in context.Stocks
|
var output = personId == 0
|
||||||
|
? (from stk in context.Stocks
|
||||||
where stk.SoldDate == null || stk.ActAmount > 0
|
where stk.SoldDate == null || stk.ActAmount > 0
|
||||||
|
select stk).ToList()
|
||||||
|
: (from stk in context.Stocks
|
||||||
|
join prs in context.PersonStocks on stk.Id equals prs.StockId
|
||||||
|
where (stk.SoldDate == null || stk.ActAmount > 0) && prs.PersonId == personId
|
||||||
select stk).ToList();
|
select stk).ToList();
|
||||||
return output;
|
return output;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveAllStocks()
|
public void RemoveAllStocks()
|
||||||
@ -169,6 +176,25 @@ namespace StockDAL
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool EmptyStockGroups()
|
||||||
|
{
|
||||||
|
using var context = new StockContext();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var groupRows = from g in context.StockGroups
|
||||||
|
select g;
|
||||||
|
foreach (var row in groupRows)
|
||||||
|
{
|
||||||
|
context.StockGroups.Remove(row);
|
||||||
|
}
|
||||||
|
context.SaveChanges();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public StockGroupModel SaveStockGroup(StockGroupModel stockGroup)
|
public StockGroupModel SaveStockGroup(StockGroupModel stockGroup)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -88,6 +88,24 @@ namespace StockDAL
|
|||||||
File.WriteAllText($"Aktier_{listText}.txt", result);
|
File.WriteAllText($"Aktier_{listText}.txt", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<StockGroupModel> GetGroupStocksList(string listText,int startNo=0)
|
||||||
|
{
|
||||||
|
var resList = new List<StockGroupModel>();
|
||||||
|
var nr = startNo;
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
chooseList.SelectDropDownByText(listText);
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
var stocklist = tblList.ReadHandledStock();
|
||||||
|
foreach (var stock in stocklist)
|
||||||
|
{
|
||||||
|
resList.Add(new StockGroupModel { Id = ++nr, StockGroup = listText, StockName = stock.ColumnValue });
|
||||||
|
//result += $"{listText}: {stock.ColumnValue} {System.Environment.NewLine}";
|
||||||
|
}
|
||||||
|
//File.WriteAllText($"Aktier_{listText}.txt", result);
|
||||||
|
return resList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//public void CreateProduct()
|
//public void CreateProduct()
|
||||||
//{
|
//{
|
||||||
// lnkProduct.Click();
|
// lnkProduct.Click();
|
||||||
|
|||||||
@ -16,6 +16,7 @@ namespace StockDal.Interface
|
|||||||
|
|
||||||
void LoadStockMarketList(int persId);
|
void LoadStockMarketList(int persId);
|
||||||
//void LoadStockMarketList(int persId, bool viewBrowser);
|
//void LoadStockMarketList(int persId, bool viewBrowser);
|
||||||
|
Task LoadStockMarketListAsync(int persId);
|
||||||
DiTraderStockRow LoadStockMarketStockData(string searchedStock);
|
DiTraderStockRow LoadStockMarketStockData(string searchedStock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,8 @@ namespace StockDAL.Interface
|
|||||||
{
|
{
|
||||||
public interface IStockRepository
|
public interface IStockRepository
|
||||||
{
|
{
|
||||||
IEnumerable<StockMember> GetAllRemainingStocks();
|
// IEnumerable<StockMember> GetAllRemainingStocks();
|
||||||
|
IEnumerable<StockMember> GetAllRemainingStocks(int personId = 0);
|
||||||
IEnumerable<StockMember> GetAllStocks();
|
IEnumerable<StockMember> GetAllStocks();
|
||||||
StockMember GetStockMember(int stockMemberId);
|
StockMember GetStockMember(int stockMemberId);
|
||||||
void InsertMany(List<StockMember> stockMembers);
|
void InsertMany(List<StockMember> stockMembers);
|
||||||
@ -24,5 +25,6 @@ namespace StockDAL.Interface
|
|||||||
List<string> GetStockNames();
|
List<string> GetStockNames();
|
||||||
IEnumerable<StockGrpPers> GetGroupedStock(string stock);
|
IEnumerable<StockGrpPers> GetGroupedStock(string stock);
|
||||||
StockGroupModel SaveStockGroup(StockGroupModel stockGroup);
|
StockGroupModel SaveStockGroup(StockGroupModel stockGroup);
|
||||||
|
bool EmptyStockGroups();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ namespace StockDAL.Interface
|
|||||||
List<DiTraderStockRow> SearchStockAndCollect(string stockName);
|
List<DiTraderStockRow> SearchStockAndCollect(string stockName);
|
||||||
void GetStocksPerList(string listText);
|
void GetStocksPerList(string listText);
|
||||||
void PerformClickOnSpecialValue(string name, string operation);
|
void PerformClickOnSpecialValue(string name, string operation);
|
||||||
|
List<StockGroupModel> GetGroupStocksList(string listText, int startNo = 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,6 +42,7 @@ namespace StockInfoCore
|
|||||||
services.AddTransient<frmSelling>();
|
services.AddTransient<frmSelling>();
|
||||||
services.AddTransient<frmPerson>();
|
services.AddTransient<frmPerson>();
|
||||||
services.AddTransient<frmPersonShareConnect>();
|
services.AddTransient<frmPersonShareConnect>();
|
||||||
|
services.AddTransient<frmUtilities>();
|
||||||
|
|
||||||
services.AddTransient<frmInitial>();
|
services.AddTransient<frmInitial>();
|
||||||
return services;
|
return services;
|
||||||
|
|||||||
@ -4,5 +4,18 @@
|
|||||||
"ApplicationUrl": "https://finansportalen.millistream.com/shares.php",
|
"ApplicationUrl": "https://finansportalen.millistream.com/shares.php",
|
||||||
"TimeoutInterval": 30,
|
"TimeoutInterval": 30,
|
||||||
"StockWishes": [ "Arion Bank SDB", "Boliden", "Ericsson A", "Getinge B", "Investor A", "SAS", "Securitas B", "SSAB A", "Handelsbanken A", "Swedbank A" ],
|
"StockWishes": [ "Arion Bank SDB", "Boliden", "Ericsson A", "Getinge B", "Investor A", "SAS", "Securitas B", "SSAB A", "Handelsbanken A", "Swedbank A" ],
|
||||||
"StocWishCols": ["Aktie","Senast","Tid"]
|
"StocWishCols": [ "Aktie", "Senast", "Tid" ],
|
||||||
|
"StockGroups": [
|
||||||
|
"OMX Stockholm Large Cap",
|
||||||
|
"OMX Stockholm Mid Cap",
|
||||||
|
"OMX Stockholm Small Cap",
|
||||||
|
"Börshandlade fonder (ETF)",
|
||||||
|
"Spotlight Next",
|
||||||
|
"Spotlight",
|
||||||
|
"OMX Stockholm First North",
|
||||||
|
"NGM Equity",
|
||||||
|
"beQuoted",
|
||||||
|
"Nordic SME"
|
||||||
|
],
|
||||||
|
"ZNotFoundStocks": [ "Pfizer" ]
|
||||||
}
|
}
|
||||||
39
StockInfoCore/frmInitial.Designer.cs
generated
39
StockInfoCore/frmInitial.Designer.cs
generated
@ -29,6 +29,7 @@ namespace StockInfoCore
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||||
this.lblTotalRecords = new System.Windows.Forms.Label();
|
this.lblTotalRecords = new System.Windows.Forms.Label();
|
||||||
this.gB1 = new System.Windows.Forms.GroupBox();
|
this.gB1 = new System.Windows.Forms.GroupBox();
|
||||||
@ -48,6 +49,9 @@ namespace StockInfoCore
|
|||||||
this.btnConnShares = new System.Windows.Forms.Button();
|
this.btnConnShares = new System.Windows.Forms.Button();
|
||||||
this.btnEditPerson = new System.Windows.Forms.Button();
|
this.btnEditPerson = new System.Windows.Forms.Button();
|
||||||
this.cmbOwners = new System.Windows.Forms.ComboBox();
|
this.cmbOwners = new System.Windows.Forms.ComboBox();
|
||||||
|
this.pbInitial = new System.Windows.Forms.ProgressBar();
|
||||||
|
this.tmrProgBar = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.btnUtils = new System.Windows.Forms.Button();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||||
this.gB1.SuspendLayout();
|
this.gB1.SuspendLayout();
|
||||||
this.gbStockMgmnt.SuspendLayout();
|
this.gbStockMgmnt.SuspendLayout();
|
||||||
@ -60,11 +64,11 @@ namespace StockInfoCore
|
|||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 16);
|
this.dataGridView.Location = new System.Drawing.Point(12, 21);
|
||||||
this.dataGridView.MultiSelect = false;
|
this.dataGridView.MultiSelect = false;
|
||||||
this.dataGridView.Name = "dataGridView";
|
this.dataGridView.Name = "dataGridView";
|
||||||
this.dataGridView.RowTemplate.Height = 25;
|
this.dataGridView.RowTemplate.Height = 25;
|
||||||
this.dataGridView.Size = new System.Drawing.Size(871, 360);
|
this.dataGridView.Size = new System.Drawing.Size(871, 355);
|
||||||
this.dataGridView.TabIndex = 0;
|
this.dataGridView.TabIndex = 0;
|
||||||
this.dataGridView.SelectionChanged += new System.EventHandler(this.dataGridView_SelectionChanged);
|
this.dataGridView.SelectionChanged += new System.EventHandler(this.dataGridView_SelectionChanged);
|
||||||
//
|
//
|
||||||
@ -243,15 +247,41 @@ namespace StockInfoCore
|
|||||||
this.cmbOwners.FormattingEnabled = true;
|
this.cmbOwners.FormattingEnabled = true;
|
||||||
this.cmbOwners.Location = new System.Drawing.Point(6, 33);
|
this.cmbOwners.Location = new System.Drawing.Point(6, 33);
|
||||||
this.cmbOwners.Name = "cmbOwners";
|
this.cmbOwners.Name = "cmbOwners";
|
||||||
this.cmbOwners.Size = new System.Drawing.Size(152, 23);
|
this.cmbOwners.Size = new System.Drawing.Size(222, 23);
|
||||||
this.cmbOwners.TabIndex = 0;
|
this.cmbOwners.TabIndex = 0;
|
||||||
this.cmbOwners.SelectedIndexChanged += new System.EventHandler(this.cmbOwners_SelectedIndexChanged);
|
this.cmbOwners.SelectedIndexChanged += new System.EventHandler(this.cmbOwners_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
|
// pbInitial
|
||||||
|
//
|
||||||
|
this.pbInitial.ForeColor = System.Drawing.Color.Tomato;
|
||||||
|
this.pbInitial.Location = new System.Drawing.Point(131, 5);
|
||||||
|
this.pbInitial.Name = "pbInitial";
|
||||||
|
this.pbInitial.Size = new System.Drawing.Size(646, 10);
|
||||||
|
this.pbInitial.TabIndex = 11;
|
||||||
|
this.pbInitial.Visible = false;
|
||||||
|
//
|
||||||
|
// tmrProgBar
|
||||||
|
//
|
||||||
|
this.tmrProgBar.Interval = 250;
|
||||||
|
this.tmrProgBar.Tick += new System.EventHandler(this.tmrProgBar_Tick);
|
||||||
|
//
|
||||||
|
// btnUtils
|
||||||
|
//
|
||||||
|
this.btnUtils.Location = new System.Drawing.Point(18, 421);
|
||||||
|
this.btnUtils.Name = "btnUtils";
|
||||||
|
this.btnUtils.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.btnUtils.TabIndex = 12;
|
||||||
|
this.btnUtils.Text = "Utilities";
|
||||||
|
this.btnUtils.UseVisualStyleBackColor = true;
|
||||||
|
this.btnUtils.Click += new System.EventHandler(this.btnUtils_Click);
|
||||||
|
//
|
||||||
// frmInitial
|
// frmInitial
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(895, 538);
|
this.ClientSize = new System.Drawing.Size(895, 538);
|
||||||
|
this.Controls.Add(this.btnUtils);
|
||||||
|
this.Controls.Add(this.pbInitial);
|
||||||
this.Controls.Add(this.gpOwners);
|
this.Controls.Add(this.gpOwners);
|
||||||
this.Controls.Add(this.lblStockRows);
|
this.Controls.Add(this.lblStockRows);
|
||||||
this.Controls.Add(this.gbStockMgmnt);
|
this.Controls.Add(this.gbStockMgmnt);
|
||||||
@ -296,6 +326,9 @@ namespace StockInfoCore
|
|||||||
private System.Windows.Forms.Button btnEditPerson;
|
private System.Windows.Forms.Button btnEditPerson;
|
||||||
private System.Windows.Forms.ComboBox cmbOwners;
|
private System.Windows.Forms.ComboBox cmbOwners;
|
||||||
private System.Windows.Forms.Button btnBackupAll;
|
private System.Windows.Forms.Button btnBackupAll;
|
||||||
|
private ProgressBar pbInitial;
|
||||||
|
private System.Windows.Forms.Timer tmrProgBar;
|
||||||
|
private Button btnUtils;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,9 @@ namespace StockInfoCore
|
|||||||
private readonly frmPersonShareConnect _personShareConnect;
|
private readonly frmPersonShareConnect _personShareConnect;
|
||||||
private readonly frmBackup _backupWindow;
|
private readonly frmBackup _backupWindow;
|
||||||
private readonly frmEditStock _editStock;
|
private readonly frmEditStock _editStock;
|
||||||
|
private readonly frmUtilities _utilities;
|
||||||
bool loading = false;
|
bool loading = false;
|
||||||
|
int progressValue = 0;
|
||||||
|
|
||||||
public int SelectedPersonId { get; set; } = 0;
|
public int SelectedPersonId { get; set; } = 0;
|
||||||
|
|
||||||
@ -54,7 +56,8 @@ namespace StockInfoCore
|
|||||||
frmPerson personWindow,
|
frmPerson personWindow,
|
||||||
frmPersonShareConnect personShareConnect,
|
frmPersonShareConnect personShareConnect,
|
||||||
frmBackup backupWindow,
|
frmBackup backupWindow,
|
||||||
frmEditStock editStock
|
frmEditStock editStock,
|
||||||
|
frmUtilities utilities
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -73,6 +76,7 @@ namespace StockInfoCore
|
|||||||
_personShareConnect = personShareConnect;
|
_personShareConnect = personShareConnect;
|
||||||
_backupWindow = backupWindow;
|
_backupWindow = backupWindow;
|
||||||
_editStock = editStock;
|
_editStock = editStock;
|
||||||
|
_utilities = utilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Form1_Load(object sender, EventArgs e)
|
private void Form1_Load(object sender, EventArgs e)
|
||||||
@ -83,14 +87,13 @@ namespace StockInfoCore
|
|||||||
btnBackupAll.Enabled = false;
|
btnBackupAll.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReloadData(bool upd = false)
|
private async Task ReloadData(bool upd = false)
|
||||||
{
|
{
|
||||||
loading = true;
|
loading = true;
|
||||||
var allStocks = _stockRepository.GetAllStocks();
|
var allStocks = _stockRepository.GetAllStocks();
|
||||||
if (upd)
|
if (upd)
|
||||||
{
|
{
|
||||||
_stockMarketRepository.LoadStockMarketList(SelectedPersonId);
|
await _stockMarketRepository.LoadStockMarketListAsync(SelectedPersonId);
|
||||||
|
|
||||||
allStocks.ToList().ForEach(SM => SM.ActValue = UpdateOnlyNonZeroAmount(SM).ActValue);
|
allStocks.ToList().ForEach(SM => SM.ActValue = UpdateOnlyNonZeroAmount(SM).ActValue);
|
||||||
}
|
}
|
||||||
dataGridView.DataSource = allStocks;
|
dataGridView.DataSource = allStocks;
|
||||||
@ -103,24 +106,31 @@ namespace StockInfoCore
|
|||||||
{
|
{
|
||||||
var output = new StockMember();
|
var output = new StockMember();
|
||||||
if (sMember.ActAmount > 0)
|
if (sMember.ActAmount > 0)
|
||||||
|
{
|
||||||
|
if (_stockMarketRepository.StockMarketList.ContainsKey(sMember.StockId))
|
||||||
{
|
{
|
||||||
sMember.ActValue = _stockMarketRepository.StockMarketList[sMember.StockId].LatestPrice;
|
sMember.ActValue = _stockMarketRepository.StockMarketList[sMember.StockId].LatestPrice;
|
||||||
|
_stockRepository.UpdateActualPrice(sMember.Id, sMember.ActValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
output = sMember;
|
output = sMember;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void btnReload_Click(object sender, EventArgs e)
|
private async void btnReload_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Cursor = Cursors.WaitCursor;
|
StartProgressTicking(350);
|
||||||
ReloadData(true);
|
await ReloadData(true);
|
||||||
Cursor=Cursors.Default;
|
StopProgressTicking();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frmInitial_FormClosing(object sender, FormClosingEventArgs e)
|
private void frmInitial_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
MessageBox.Show("B y e B y e !!");
|
if (DialogResult.OK != MessageBox.Show("B y e B y e !!", "Should we close ?", MessageBoxButtons.OKCancel))
|
||||||
|
{
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnStockReg_Click(object sender, EventArgs e)
|
private void btnStockReg_Click(object sender, EventArgs e)
|
||||||
@ -138,7 +148,7 @@ namespace StockInfoCore
|
|||||||
ReloadData();
|
ReloadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnValueView_Click(object sender, EventArgs e)
|
private async void btnValueView_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//if(!GlobalStopwatch.IsRunning && GlobalStopwatch.EllapsedMillis>0)
|
//if(!GlobalStopwatch.IsRunning && GlobalStopwatch.EllapsedMillis>0)
|
||||||
// GlobalStopwatch.Restart();
|
// GlobalStopwatch.Restart();
|
||||||
@ -150,14 +160,14 @@ namespace StockInfoCore
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
StartProgressTicking();
|
||||||
var person = _personRepository.GetPersonById(SelectedPersonId);
|
var person = _personRepository.GetPersonById(SelectedPersonId);
|
||||||
Cursor.Current = Cursors.WaitCursor;
|
|
||||||
|
|
||||||
_stockMarketRepository.LoadStockMarketList(SelectedPersonId);
|
await _stockMarketRepository.LoadStockMarketListAsync(SelectedPersonId);
|
||||||
|
StopProgressTicking();
|
||||||
_stockWindow.ConnectedPerson = person;
|
_stockWindow.ConnectedPerson = person;
|
||||||
_stockWindow.Stocks = _stockMarketRepository.StockMarketList;
|
_stockWindow.Stocks = _stockMarketRepository.StockMarketList;
|
||||||
|
|
||||||
Cursor.Current = DefaultCursor;
|
|
||||||
//GlobalStopwatch.Stop();
|
//GlobalStopwatch.Stop();
|
||||||
//GlobalStopwatch.PrintSecs("Before Show Stockwindow");
|
//GlobalStopwatch.PrintSecs("Before Show Stockwindow");
|
||||||
_stockWindow.ShowDialog();
|
_stockWindow.ShowDialog();
|
||||||
@ -213,7 +223,16 @@ namespace StockInfoCore
|
|||||||
|
|
||||||
private void btnStockSale_Click(object sender, EventArgs e)
|
private void btnStockSale_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (SelectedPersonId == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Ingen person vald ({SelectedPersonId})");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_sellWindow.selectedPersonId = SelectedPersonId;
|
||||||
_sellWindow.ShowDialog();
|
_sellWindow.ShowDialog();
|
||||||
|
}
|
||||||
ReloadData();
|
ReloadData();
|
||||||
}
|
}
|
||||||
private void btnEditPerson_Click(object sender, EventArgs e)
|
private void btnEditPerson_Click(object sender, EventArgs e)
|
||||||
@ -283,5 +302,37 @@ namespace StockInfoCore
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void tmrProgBar_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
pbInitial.Value = progressValue;
|
||||||
|
if (progressValue < 100)
|
||||||
|
progressValue += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartProgressTicking(int intervall = 250)
|
||||||
|
{
|
||||||
|
pbInitial.Enabled = true;
|
||||||
|
pbInitial.Minimum = 0;
|
||||||
|
pbInitial.Maximum = 100;
|
||||||
|
pbInitial.Value = 0;
|
||||||
|
pbInitial.Visible = true;
|
||||||
|
tmrProgBar.Interval = intervall;
|
||||||
|
tmrProgBar.Enabled = true;
|
||||||
|
tmrProgBar.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopProgressTicking()
|
||||||
|
{
|
||||||
|
tmrProgBar.Stop();
|
||||||
|
tmrProgBar.Enabled = false;
|
||||||
|
pbInitial.Visible = false;
|
||||||
|
progressValue = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnUtils_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_utilities.ShowDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,10 @@
|
|||||||
<metadata name="ofdOpener.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="ofdOpener.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>114, 17</value>
|
<value>114, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="tmrProgBar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>225, 17</value>
|
||||||
|
</metadata>
|
||||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>27</value>
|
<value>75</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
</root>
|
</root>
|
||||||
70
StockInfoCore/frmMyStocks.Designer.cs
generated
70
StockInfoCore/frmMyStocks.Designer.cs
generated
@ -59,6 +59,9 @@ namespace StockInfoCore
|
|||||||
this.label7 = new System.Windows.Forms.Label();
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
this.txtTotalPlus = new System.Windows.Forms.TextBox();
|
this.txtTotalPlus = new System.Windows.Forms.TextBox();
|
||||||
this.lblOwnerName = new System.Windows.Forms.Label();
|
this.lblOwnerName = new System.Windows.Forms.Label();
|
||||||
|
this.txtSummaValue = new System.Windows.Forms.TextBox();
|
||||||
|
this.label8 = new System.Windows.Forms.Label();
|
||||||
|
this.label9 = new System.Windows.Forms.Label();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -84,7 +87,7 @@ namespace StockInfoCore
|
|||||||
this.lvMyStocks.Location = new System.Drawing.Point(14, 43);
|
this.lvMyStocks.Location = new System.Drawing.Point(14, 43);
|
||||||
this.lvMyStocks.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.lvMyStocks.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.lvMyStocks.Name = "lvMyStocks";
|
this.lvMyStocks.Name = "lvMyStocks";
|
||||||
this.lvMyStocks.Size = new System.Drawing.Size(1191, 369);
|
this.lvMyStocks.Size = new System.Drawing.Size(1191, 371);
|
||||||
this.lvMyStocks.TabIndex = 0;
|
this.lvMyStocks.TabIndex = 0;
|
||||||
this.lvMyStocks.UseCompatibleStateImageBehavior = false;
|
this.lvMyStocks.UseCompatibleStateImageBehavior = false;
|
||||||
this.lvMyStocks.View = System.Windows.Forms.View.Details;
|
this.lvMyStocks.View = System.Windows.Forms.View.Details;
|
||||||
@ -158,7 +161,7 @@ namespace StockInfoCore
|
|||||||
// txtBuyTotal
|
// txtBuyTotal
|
||||||
//
|
//
|
||||||
this.txtBuyTotal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.txtBuyTotal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.txtBuyTotal.Location = new System.Drawing.Point(186, 428);
|
this.txtBuyTotal.Location = new System.Drawing.Point(186, 430);
|
||||||
this.txtBuyTotal.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtBuyTotal.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtBuyTotal.Name = "txtBuyTotal";
|
this.txtBuyTotal.Name = "txtBuyTotal";
|
||||||
this.txtBuyTotal.ReadOnly = true;
|
this.txtBuyTotal.ReadOnly = true;
|
||||||
@ -170,7 +173,7 @@ namespace StockInfoCore
|
|||||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.label1.AutoSize = true;
|
this.label1.AutoSize = true;
|
||||||
this.label1.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.label1.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.label1.Location = new System.Drawing.Point(64, 425);
|
this.label1.Location = new System.Drawing.Point(64, 427);
|
||||||
this.label1.Name = "label1";
|
this.label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(101, 21);
|
this.label1.Size = new System.Drawing.Size(101, 21);
|
||||||
this.label1.TabIndex = 2;
|
this.label1.TabIndex = 2;
|
||||||
@ -181,7 +184,7 @@ namespace StockInfoCore
|
|||||||
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.label2.AutoSize = true;
|
this.label2.AutoSize = true;
|
||||||
this.label2.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.label2.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.label2.Location = new System.Drawing.Point(338, 430);
|
this.label2.Location = new System.Drawing.Point(338, 432);
|
||||||
this.label2.Name = "label2";
|
this.label2.Name = "label2";
|
||||||
this.label2.Size = new System.Drawing.Size(55, 21);
|
this.label2.Size = new System.Drawing.Size(55, 21);
|
||||||
this.label2.TabIndex = 4;
|
this.label2.TabIndex = 4;
|
||||||
@ -191,7 +194,7 @@ namespace StockInfoCore
|
|||||||
//
|
//
|
||||||
this.txtTotDiff.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.txtTotDiff.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.txtTotDiff.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
this.txtTotDiff.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||||
this.txtTotDiff.Location = new System.Drawing.Point(439, 422);
|
this.txtTotDiff.Location = new System.Drawing.Point(439, 424);
|
||||||
this.txtTotDiff.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtTotDiff.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtTotDiff.Name = "txtTotDiff";
|
this.txtTotDiff.Name = "txtTotDiff";
|
||||||
this.txtTotDiff.ReadOnly = true;
|
this.txtTotDiff.ReadOnly = true;
|
||||||
@ -203,7 +206,7 @@ namespace StockInfoCore
|
|||||||
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.label3.AutoSize = true;
|
this.label3.AutoSize = true;
|
||||||
this.label3.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.label3.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.label3.Location = new System.Drawing.Point(582, 425);
|
this.label3.Location = new System.Drawing.Point(582, 427);
|
||||||
this.label3.Name = "label3";
|
this.label3.Name = "label3";
|
||||||
this.label3.Size = new System.Drawing.Size(105, 21);
|
this.label3.Size = new System.Drawing.Size(105, 21);
|
||||||
this.label3.TabIndex = 6;
|
this.label3.TabIndex = 6;
|
||||||
@ -212,7 +215,7 @@ namespace StockInfoCore
|
|||||||
// txtCurrValue
|
// txtCurrValue
|
||||||
//
|
//
|
||||||
this.txtCurrValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.txtCurrValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.txtCurrValue.Location = new System.Drawing.Point(709, 428);
|
this.txtCurrValue.Location = new System.Drawing.Point(709, 430);
|
||||||
this.txtCurrValue.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtCurrValue.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtCurrValue.Name = "txtCurrValue";
|
this.txtCurrValue.Name = "txtCurrValue";
|
||||||
this.txtCurrValue.ReadOnly = true;
|
this.txtCurrValue.ReadOnly = true;
|
||||||
@ -241,7 +244,7 @@ namespace StockInfoCore
|
|||||||
this.lbUpdateTimes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.lbUpdateTimes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.lbUpdateTimes.FormattingEnabled = true;
|
this.lbUpdateTimes.FormattingEnabled = true;
|
||||||
this.lbUpdateTimes.ItemHeight = 20;
|
this.lbUpdateTimes.ItemHeight = 20;
|
||||||
this.lbUpdateTimes.Location = new System.Drawing.Point(16, 500);
|
this.lbUpdateTimes.Location = new System.Drawing.Point(16, 502);
|
||||||
this.lbUpdateTimes.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.lbUpdateTimes.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.lbUpdateTimes.Name = "lbUpdateTimes";
|
this.lbUpdateTimes.Name = "lbUpdateTimes";
|
||||||
this.lbUpdateTimes.Size = new System.Drawing.Size(164, 124);
|
this.lbUpdateTimes.Size = new System.Drawing.Size(164, 124);
|
||||||
@ -251,7 +254,7 @@ namespace StockInfoCore
|
|||||||
//
|
//
|
||||||
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.label4.AutoSize = true;
|
this.label4.AutoSize = true;
|
||||||
this.label4.Location = new System.Drawing.Point(14, 472);
|
this.label4.Location = new System.Drawing.Point(14, 474);
|
||||||
this.label4.Name = "label4";
|
this.label4.Name = "label4";
|
||||||
this.label4.Size = new System.Drawing.Size(97, 20);
|
this.label4.Size = new System.Drawing.Size(97, 20);
|
||||||
this.label4.TabIndex = 9;
|
this.label4.TabIndex = 9;
|
||||||
@ -260,7 +263,7 @@ namespace StockInfoCore
|
|||||||
// numericUpDown1
|
// numericUpDown1
|
||||||
//
|
//
|
||||||
this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.numericUpDown1.Location = new System.Drawing.Point(186, 593);
|
this.numericUpDown1.Location = new System.Drawing.Point(186, 595);
|
||||||
this.numericUpDown1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.numericUpDown1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.numericUpDown1.Name = "numericUpDown1";
|
this.numericUpDown1.Name = "numericUpDown1";
|
||||||
this.numericUpDown1.Size = new System.Drawing.Size(119, 27);
|
this.numericUpDown1.Size = new System.Drawing.Size(119, 27);
|
||||||
@ -271,7 +274,7 @@ namespace StockInfoCore
|
|||||||
//
|
//
|
||||||
this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.label5.AutoSize = true;
|
this.label5.AutoSize = true;
|
||||||
this.label5.Location = new System.Drawing.Point(186, 569);
|
this.label5.Location = new System.Drawing.Point(186, 571);
|
||||||
this.label5.Name = "label5";
|
this.label5.Name = "label5";
|
||||||
this.label5.Size = new System.Drawing.Size(132, 20);
|
this.label5.Size = new System.Drawing.Size(132, 20);
|
||||||
this.label5.TabIndex = 11;
|
this.label5.TabIndex = 11;
|
||||||
@ -282,7 +285,7 @@ namespace StockInfoCore
|
|||||||
this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.label6.AutoSize = true;
|
this.label6.AutoSize = true;
|
||||||
this.label6.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.label6.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.label6.Location = new System.Drawing.Point(208, 457);
|
this.label6.Location = new System.Drawing.Point(208, 459);
|
||||||
this.label6.Name = "label6";
|
this.label6.Name = "label6";
|
||||||
this.label6.Size = new System.Drawing.Size(89, 21);
|
this.label6.Size = new System.Drawing.Size(89, 21);
|
||||||
this.label6.TabIndex = 13;
|
this.label6.TabIndex = 13;
|
||||||
@ -293,7 +296,7 @@ namespace StockInfoCore
|
|||||||
this.txtTotalMinus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.txtTotalMinus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.txtTotalMinus.BackColor = System.Drawing.Color.Pink;
|
this.txtTotalMinus.BackColor = System.Drawing.Color.Pink;
|
||||||
this.txtTotalMinus.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
this.txtTotalMinus.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||||
this.txtTotalMinus.Location = new System.Drawing.Point(312, 455);
|
this.txtTotalMinus.Location = new System.Drawing.Point(312, 457);
|
||||||
this.txtTotalMinus.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtTotalMinus.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtTotalMinus.Name = "txtTotalMinus";
|
this.txtTotalMinus.Name = "txtTotalMinus";
|
||||||
this.txtTotalMinus.ReadOnly = true;
|
this.txtTotalMinus.ReadOnly = true;
|
||||||
@ -305,7 +308,7 @@ namespace StockInfoCore
|
|||||||
this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.label7.AutoSize = true;
|
this.label7.AutoSize = true;
|
||||||
this.label7.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.label7.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.label7.Location = new System.Drawing.Point(478, 459);
|
this.label7.Location = new System.Drawing.Point(478, 461);
|
||||||
this.label7.Name = "label7";
|
this.label7.Name = "label7";
|
||||||
this.label7.Size = new System.Drawing.Size(75, 21);
|
this.label7.Size = new System.Drawing.Size(75, 21);
|
||||||
this.label7.TabIndex = 15;
|
this.label7.TabIndex = 15;
|
||||||
@ -316,7 +319,7 @@ namespace StockInfoCore
|
|||||||
this.txtTotalPlus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.txtTotalPlus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.txtTotalPlus.BackColor = System.Drawing.Color.LightGreen;
|
this.txtTotalPlus.BackColor = System.Drawing.Color.LightGreen;
|
||||||
this.txtTotalPlus.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
this.txtTotalPlus.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||||
this.txtTotalPlus.Location = new System.Drawing.Point(573, 455);
|
this.txtTotalPlus.Location = new System.Drawing.Point(573, 457);
|
||||||
this.txtTotalPlus.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.txtTotalPlus.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.txtTotalPlus.Name = "txtTotalPlus";
|
this.txtTotalPlus.Name = "txtTotalPlus";
|
||||||
this.txtTotalPlus.ReadOnly = true;
|
this.txtTotalPlus.ReadOnly = true;
|
||||||
@ -332,11 +335,43 @@ namespace StockInfoCore
|
|||||||
this.lblOwnerName.TabIndex = 16;
|
this.lblOwnerName.TabIndex = 16;
|
||||||
this.lblOwnerName.Text = "Portfölj Ägare Namn";
|
this.lblOwnerName.Text = "Portfölj Ägare Namn";
|
||||||
//
|
//
|
||||||
|
// label8
|
||||||
|
//
|
||||||
|
this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.label8.AutoSize = true;
|
||||||
|
this.label8.Location = new System.Drawing.Point(842, 433);
|
||||||
|
this.label8.Name = "label8";
|
||||||
|
this.label8.Size = new System.Drawing.Size(14, 20);
|
||||||
|
this.label8.TabIndex = 18;
|
||||||
|
this.label8.Text = "("; //
|
||||||
|
// txtSummaValue
|
||||||
|
//
|
||||||
|
this.txtSummaValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.txtSummaValue.Location = new System.Drawing.Point(862, 430);
|
||||||
|
this.txtSummaValue.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.txtSummaValue.Name = "txtSummaValue";
|
||||||
|
this.txtSummaValue.ReadOnly = true;
|
||||||
|
this.txtSummaValue.Size = new System.Drawing.Size(114, 27);
|
||||||
|
this.txtSummaValue.TabIndex = 17;
|
||||||
|
//
|
||||||
|
// label9
|
||||||
|
//
|
||||||
|
this.label9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.label9.AutoSize = true;
|
||||||
|
this.label9.Location = new System.Drawing.Point(982, 433);
|
||||||
|
this.label9.Name = "label9";
|
||||||
|
this.label9.Size = new System.Drawing.Size(14, 20);
|
||||||
|
this.label9.TabIndex = 19;
|
||||||
|
this.label9.Text = ")";
|
||||||
|
//
|
||||||
// frmMyStocks
|
// frmMyStocks
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1217, 651);
|
this.ClientSize = new System.Drawing.Size(1217, 653);
|
||||||
|
this.Controls.Add(this.label9);
|
||||||
|
this.Controls.Add(this.label8);
|
||||||
|
this.Controls.Add(this.txtSummaValue);
|
||||||
this.Controls.Add(this.lblOwnerName);
|
this.Controls.Add(this.lblOwnerName);
|
||||||
this.Controls.Add(this.label7);
|
this.Controls.Add(this.label7);
|
||||||
this.Controls.Add(this.txtTotalPlus);
|
this.Controls.Add(this.txtTotalPlus);
|
||||||
@ -396,5 +431,8 @@ namespace StockInfoCore
|
|||||||
private System.Windows.Forms.Label label7;
|
private System.Windows.Forms.Label label7;
|
||||||
private System.Windows.Forms.TextBox txtTotalPlus;
|
private System.Windows.Forms.TextBox txtTotalPlus;
|
||||||
private Label lblOwnerName;
|
private Label lblOwnerName;
|
||||||
|
private TextBox txtSummaValue;
|
||||||
|
private Label label8;
|
||||||
|
private Label label9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,6 +27,8 @@ namespace StockInfoCore
|
|||||||
public decimal TotalPlus { get; set; }
|
public decimal TotalPlus { get; set; }
|
||||||
public decimal TotalMinus { get; set; }
|
public decimal TotalMinus { get; set; }
|
||||||
|
|
||||||
|
public decimal ExtraValueSum { get; set; }
|
||||||
|
|
||||||
public Dictionary<string, DiTraderStockRow> Stocks { get; set; }
|
public Dictionary<string, DiTraderStockRow> Stocks { get; set; }
|
||||||
public IEnumerable<StockMember> CurrentStocks { get; set; }
|
public IEnumerable<StockMember> CurrentStocks { get; set; }
|
||||||
public Person ConnectedPerson { get; set; }
|
public Person ConnectedPerson { get; set; }
|
||||||
@ -54,6 +56,7 @@ namespace StockInfoCore
|
|||||||
CurrentSum = 0m;
|
CurrentSum = 0m;
|
||||||
TotalMinus = 0m;
|
TotalMinus = 0m;
|
||||||
TotalPlus = 0m;
|
TotalPlus = 0m;
|
||||||
|
ExtraValueSum = 0m;
|
||||||
var tmpStocks = new List<StockMember>();
|
var tmpStocks = new List<StockMember>();
|
||||||
var personStocks = new List<StockMember>();
|
var personStocks = new List<StockMember>();
|
||||||
//Update all handled shares
|
//Update all handled shares
|
||||||
@ -96,8 +99,10 @@ namespace StockInfoCore
|
|||||||
txtTotalMinus.Refresh();
|
txtTotalMinus.Refresh();
|
||||||
txtTotalPlus.Text = TotalPlus.ToString();
|
txtTotalPlus.Text = TotalPlus.ToString();
|
||||||
txtTotalPlus.Refresh();
|
txtTotalPlus.Refresh();
|
||||||
|
txtSummaValue.Text = ExtraValueSum.ToString();
|
||||||
lbUpdateTimes.Items.Add($"{DateTime.Now.ToLongTimeString()} - {txtTotDiff.Text.Substring(0, txtTotDiff.Text.Length - 2)}");
|
txtSummaValue.Refresh();
|
||||||
|
//lbUpdateTimes.Items.Add($"{DateTime.Now.ToLongTimeString()} - {txtTotDiff.Text.Substring(0, txtTotDiff.Text.Length - 2)}");
|
||||||
|
lbUpdateTimes.Items.Add($"{DateTime.Now.ToLongTimeString()} - {ExtraValueSum}");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,9 +139,11 @@ namespace StockInfoCore
|
|||||||
var actValue = currStock.PostAmount * currStock.ActValue;
|
var actValue = currStock.PostAmount * currStock.ActValue;
|
||||||
var diffValue = actValue - buyValue;
|
var diffValue = actValue - buyValue;
|
||||||
var diffproc = diffValue / buyValue * 100;
|
var diffproc = diffValue / buyValue * 100;
|
||||||
|
var extraVal = currStock.ActAmount * currStock.ActValue;
|
||||||
BoughtSum += buyValue;
|
BoughtSum += buyValue;
|
||||||
TotalDiff += diffValue;
|
TotalDiff += diffValue;
|
||||||
CurrentSum += actValue;
|
CurrentSum += actValue;
|
||||||
|
ExtraValueSum += extraVal;
|
||||||
if (diffValue < 0)
|
if (diffValue < 0)
|
||||||
{
|
{
|
||||||
TotalMinus += diffValue;
|
TotalMinus += diffValue;
|
||||||
|
|||||||
@ -14,6 +14,7 @@ namespace StockInfoCore
|
|||||||
private readonly IStockRepository _stockRepository;
|
private readonly IStockRepository _stockRepository;
|
||||||
private List<StockMember> remainingStocks = new();
|
private List<StockMember> remainingStocks = new();
|
||||||
public StockMember stkMemSelected { get; set; } = null;
|
public StockMember stkMemSelected { get; set; } = null;
|
||||||
|
public int selectedPersonId { get; set; }
|
||||||
|
|
||||||
public frmSelling(IStockRepository stockRepository)
|
public frmSelling(IStockRepository stockRepository)
|
||||||
{
|
{
|
||||||
@ -31,7 +32,9 @@ namespace StockInfoCore
|
|||||||
|
|
||||||
private void ReloadRemainingStocks()
|
private void ReloadRemainingStocks()
|
||||||
{
|
{
|
||||||
remainingStocks = _stockRepository.GetAllRemainingStocks().ToList();
|
if (selectedPersonId == 0) return;
|
||||||
|
lvSellCandidates.Items.Clear();
|
||||||
|
remainingStocks = _stockRepository.GetAllRemainingStocks(selectedPersonId).ToList();
|
||||||
foreach (var stock in remainingStocks)
|
foreach (var stock in remainingStocks)
|
||||||
{
|
{
|
||||||
var lvRow = lvSellCandidates.Items.Add(stock.StockId);
|
var lvRow = lvSellCandidates.Items.Add(stock.StockId);
|
||||||
|
|||||||
112
StockInfoCore/frmUtilities.Designer.cs
generated
Normal file
112
StockInfoCore/frmUtilities.Designer.cs
generated
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
namespace StockInfoCore
|
||||||
|
{
|
||||||
|
partial class frmUtilities
|
||||||
|
{
|
||||||
|
/// <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.lblUtilityHeader = new System.Windows.Forms.Label();
|
||||||
|
this.btnReadStockLists = new System.Windows.Forms.Button();
|
||||||
|
this.lvStockGroups = new System.Windows.Forms.ListView();
|
||||||
|
this.ch1 = new System.Windows.Forms.ColumnHeader();
|
||||||
|
this.ch2 = new System.Windows.Forms.ColumnHeader();
|
||||||
|
this.ch3 = new System.Windows.Forms.ColumnHeader();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// lblUtilityHeader
|
||||||
|
//
|
||||||
|
this.lblUtilityHeader.AutoSize = true;
|
||||||
|
this.lblUtilityHeader.Font = new System.Drawing.Font("Segoe UI", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.lblUtilityHeader.Location = new System.Drawing.Point(19, 12);
|
||||||
|
this.lblUtilityHeader.Name = "lblUtilityHeader";
|
||||||
|
this.lblUtilityHeader.Size = new System.Drawing.Size(86, 28);
|
||||||
|
this.lblUtilityHeader.TabIndex = 0;
|
||||||
|
this.lblUtilityHeader.Text = "Utilities";
|
||||||
|
this.lblUtilityHeader.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
|
||||||
|
//
|
||||||
|
// btnReadStockLists
|
||||||
|
//
|
||||||
|
this.btnReadStockLists.Location = new System.Drawing.Point(28, 64);
|
||||||
|
this.btnReadStockLists.Name = "btnReadStockLists";
|
||||||
|
this.btnReadStockLists.Size = new System.Drawing.Size(134, 23);
|
||||||
|
this.btnReadStockLists.TabIndex = 1;
|
||||||
|
this.btnReadStockLists.Text = "List Stocks By Group";
|
||||||
|
this.btnReadStockLists.UseVisualStyleBackColor = true;
|
||||||
|
this.btnReadStockLists.Click += new System.EventHandler(this.btnReadStockLists_Click);
|
||||||
|
//
|
||||||
|
// lvStockGroups
|
||||||
|
//
|
||||||
|
this.lvStockGroups.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||||
|
this.ch1,
|
||||||
|
this.ch2,
|
||||||
|
this.ch3});
|
||||||
|
this.lvStockGroups.Location = new System.Drawing.Point(174, 69);
|
||||||
|
this.lvStockGroups.Name = "lvStockGroups";
|
||||||
|
this.lvStockGroups.Size = new System.Drawing.Size(397, 214);
|
||||||
|
this.lvStockGroups.TabIndex = 2;
|
||||||
|
this.lvStockGroups.UseCompatibleStateImageBehavior = false;
|
||||||
|
this.lvStockGroups.View = System.Windows.Forms.View.Details;
|
||||||
|
//
|
||||||
|
// ch1
|
||||||
|
//
|
||||||
|
this.ch1.Text = "Id";
|
||||||
|
//
|
||||||
|
// ch2
|
||||||
|
//
|
||||||
|
this.ch2.Text = "StockGroup";
|
||||||
|
this.ch2.Width = 150;
|
||||||
|
//
|
||||||
|
// ch3
|
||||||
|
//
|
||||||
|
this.ch3.Text = "StockName";
|
||||||
|
this.ch3.Width = 200;
|
||||||
|
//
|
||||||
|
// frmUtilities
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(583, 503);
|
||||||
|
this.Controls.Add(this.lvStockGroups);
|
||||||
|
this.Controls.Add(this.btnReadStockLists);
|
||||||
|
this.Controls.Add(this.lblUtilityHeader);
|
||||||
|
this.Name = "frmUtilities";
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
this.Text = "Utilities";
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label lblUtilityHeader;
|
||||||
|
private Button btnReadStockLists;
|
||||||
|
private ListView lvStockGroups;
|
||||||
|
private ColumnHeader ch1;
|
||||||
|
private ColumnHeader ch2;
|
||||||
|
private ColumnHeader ch3;
|
||||||
|
}
|
||||||
|
}
|
||||||
83
StockInfoCore/frmUtilities.cs
Normal file
83
StockInfoCore/frmUtilities.cs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
using BrowserHelper.Settings;
|
||||||
|
using DataDomain;
|
||||||
|
using StockDal.Interface;
|
||||||
|
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 StockInfoCore
|
||||||
|
{
|
||||||
|
public partial class frmUtilities : Form
|
||||||
|
{
|
||||||
|
private readonly TestSettings _testSettings;
|
||||||
|
private readonly IStockScrapePage _stockScrapePage;
|
||||||
|
private readonly IStockRepository _stockRepository;
|
||||||
|
|
||||||
|
public frmUtilities(TestSettings testSettings,IStockScrapePage stockScrapePage,IStockRepository stockRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_testSettings = testSettings;
|
||||||
|
_stockScrapePage = stockScrapePage;
|
||||||
|
_stockRepository = stockRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnReadStockLists_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Cursor = Cursors.WaitCursor;
|
||||||
|
var groupNames = _testSettings.StockGroups;
|
||||||
|
var groupStockList = new List<StockGroupModel>();
|
||||||
|
var znotfounds = _testSettings.ZNotFoundStocks;
|
||||||
|
var rowNr = 0;
|
||||||
|
foreach (var group in groupNames)
|
||||||
|
{
|
||||||
|
var biggest = groupStockList.Count>0?
|
||||||
|
groupStockList.Aggregate((g1, g2) => g1.Id > g2.Id ? g1 : g2)
|
||||||
|
:null;
|
||||||
|
if(biggest != null)
|
||||||
|
groupStockList.AddRange(_stockScrapePage.GetGroupStocksList(group,biggest.Id));
|
||||||
|
else
|
||||||
|
groupStockList.AddRange(_stockScrapePage.GetGroupStocksList(group));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(groupStockList.Count > 0)
|
||||||
|
{
|
||||||
|
lvStockGroups.Items.Clear();
|
||||||
|
|
||||||
|
if(! _stockRepository.EmptyStockGroups())
|
||||||
|
{
|
||||||
|
MessageBox.Show("Misslyckat borttag av StockGroups!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(var group in groupStockList)
|
||||||
|
{
|
||||||
|
_stockRepository.SaveStockGroup(group);
|
||||||
|
var x = lvStockGroups.Items.Add(group.Id.ToString());
|
||||||
|
x.SubItems.Add(group.StockGroup.ToString());
|
||||||
|
x.SubItems.Add(group.StockName.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(var stk in znotfounds)
|
||||||
|
{
|
||||||
|
var item = _stockRepository.SaveStockGroup(new StockGroupModel { StockGroup = "ZNotFound", StockName = stk });
|
||||||
|
var x = lvStockGroups.Items.Add(item.Id.ToString());
|
||||||
|
x.SubItems.Add(item.StockGroup.ToString());
|
||||||
|
x.SubItems.Add(item.StockName.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
Cursor = Cursors.Default;
|
||||||
|
|
||||||
|
|
||||||
|
lvStockGroups.Refresh();
|
||||||
|
//_stockScrapePage.GetStocksPerList("OMX Stockholm Large Cap");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
60
StockInfoCore/frmUtilities.resx
Normal file
60
StockInfoCore/frmUtilities.resx
Normal 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>
|
||||||
Reference in New Issue
Block a user