Extra utility-page created , putting all stockgroups in place
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
{
|
||||
"BrowserType": "chrome",
|
||||
"Headless" : true,
|
||||
"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" ],
|
||||
@ -16,5 +16,6 @@
|
||||
"NGM Equity",
|
||||
"beQuoted",
|
||||
"Nordic SME"
|
||||
]
|
||||
],
|
||||
"ZNotFoundStocks": [ "Pfizer" ]
|
||||
}
|
||||
@ -18,18 +18,22 @@ namespace StockInfoCore
|
||||
{
|
||||
private readonly TestSettings _testSettings;
|
||||
private readonly IStockScrapePage _stockScrapePage;
|
||||
private readonly IStockRepository _stockRepository;
|
||||
|
||||
public frmUtilities(TestSettings testSettings,IStockScrapePage stockScrapePage)
|
||||
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)
|
||||
{
|
||||
@ -42,13 +46,36 @@ namespace StockInfoCore
|
||||
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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user