Prepared for stock edit function + corrected bug , "not possible to buy new stock"!

This commit is contained in:
2021-05-24 22:49:23 +02:00
parent 27db60bbb2
commit 6c32c38296
3 changed files with 31 additions and 2 deletions

View File

@ -35,6 +35,7 @@ namespace StockInfoCore
private readonly frmPersonShareConnect _personShareConnect;
private readonly frmBackup _backupWindow;
bool loading = false;
//private frmRegisterStock regWindow;
//private frmMyStocks stockWindow;
//private frmSelling sellWindow;
@ -88,10 +89,12 @@ namespace StockInfoCore
private void ReloadData()
{
loading = true;
var allStocks = _stockRepository.GetAllStocks();
dataGridView.DataSource = allStocks;
// SaveStocks(allStocks);
lblTotalRecords.Text = $"Total records: {dataGridView.RowCount}";
loading = false;
}
@ -264,5 +267,15 @@ namespace StockInfoCore
// backupWindow = new frmBackup(_backupRepository, _backupRoutines);
_backupWindow.ShowDialog();
}
private void dataGridView_SelectionChanged(object sender, EventArgs e)
{
if (!loading)
{
//MessageBox.Show($"{((DataGridView)sender).SelectedRows.ToString()} eventargs = {e.ToString()}" );
int id = Convert.ToInt32(dataGridView.Rows[dataGridView.CurrentRow.Index].Cells[0].Value);
MessageBox.Show($"Vald rads id = {id}");
}
}
}
}