New Utility Window. scraping of StockGroups, and coupled Stocks, Show in listview on UtilityWindow
This commit is contained in:
@ -11,5 +11,6 @@ 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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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(500);
|
||||||
|
chooseList.SelectDropDownByText(listText);
|
||||||
|
Thread.Sleep(3000);
|
||||||
|
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();
|
||||||
|
|||||||
@ -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,17 @@
|
|||||||
"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"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
13
StockInfoCore/frmInitial.Designer.cs
generated
13
StockInfoCore/frmInitial.Designer.cs
generated
@ -51,6 +51,7 @@ namespace StockInfoCore
|
|||||||
this.cmbOwners = new System.Windows.Forms.ComboBox();
|
this.cmbOwners = new System.Windows.Forms.ComboBox();
|
||||||
this.pbInitial = new System.Windows.Forms.ProgressBar();
|
this.pbInitial = new System.Windows.Forms.ProgressBar();
|
||||||
this.tmrProgBar = new System.Windows.Forms.Timer(this.components);
|
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();
|
||||||
@ -264,11 +265,22 @@ namespace StockInfoCore
|
|||||||
this.tmrProgBar.Interval = 250;
|
this.tmrProgBar.Interval = 250;
|
||||||
this.tmrProgBar.Tick += new System.EventHandler(this.tmrProgBar_Tick);
|
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.pbInitial);
|
||||||
this.Controls.Add(this.gpOwners);
|
this.Controls.Add(this.gpOwners);
|
||||||
this.Controls.Add(this.lblStockRows);
|
this.Controls.Add(this.lblStockRows);
|
||||||
@ -316,6 +328,7 @@ namespace StockInfoCore
|
|||||||
private System.Windows.Forms.Button btnBackupAll;
|
private System.Windows.Forms.Button btnBackupAll;
|
||||||
private ProgressBar pbInitial;
|
private ProgressBar pbInitial;
|
||||||
private System.Windows.Forms.Timer tmrProgBar;
|
private System.Windows.Forms.Timer tmrProgBar;
|
||||||
|
private Button btnUtils;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,7 @@ 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;
|
int progressValue = 0;
|
||||||
|
|
||||||
@ -55,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();
|
||||||
@ -74,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)
|
||||||
@ -326,5 +329,10 @@ namespace StockInfoCore
|
|||||||
pbInitial.Visible = false;
|
pbInitial.Visible = false;
|
||||||
progressValue = 0;
|
progressValue = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnUtils_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_utilities.ShowDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
111
StockInfoCore/frmUtilities.Designer.cs
generated
Normal file
111
StockInfoCore/frmUtilities.Designer.cs
generated
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
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.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
56
StockInfoCore/frmUtilities.cs
Normal file
56
StockInfoCore/frmUtilities.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
public frmUtilities(TestSettings testSettings,IStockScrapePage stockScrapePage)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_testSettings = testSettings;
|
||||||
|
_stockScrapePage = stockScrapePage;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnReadStockLists_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var groupNames = _testSettings.StockGroups;
|
||||||
|
var groupStockList = new List<StockGroupModel>();
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(var group in groupStockList)
|
||||||
|
{
|
||||||
|
var x = lvStockGroups.Items.Add(group.Id.ToString());
|
||||||
|
x.SubItems.Add(group.StockGroup.ToString());
|
||||||
|
x.SubItems.Add(group.StockName.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
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