Running against Northwind and StockDB
This commit is contained in:
@ -14,16 +14,35 @@ namespace RepositoryPattern
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
IProductRepository _productRepository;
|
||||
public Form1(IProductRepository productRepository)
|
||||
private readonly IStockMemberRepository _stockMemberRepository;
|
||||
|
||||
public Form1(IProductRepository productRepository,IStockMemberRepository stockMemberRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_productRepository = productRepository;
|
||||
_stockMemberRepository = stockMemberRepository;
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
dataGridView.DataSource = _productRepository.GetProducts();
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
private void ReloadData()
|
||||
{
|
||||
if (rdbNorth.Checked)
|
||||
{
|
||||
dataGridView.DataSource = _productRepository.GetProducts(); }
|
||||
else if(rdbStock.Checked)
|
||||
{
|
||||
dataGridView.DataSource = _stockMemberRepository.GetStocks();
|
||||
}
|
||||
lblTotalRecords.Text = $"Total records: {dataGridView.RowCount}";
|
||||
}
|
||||
|
||||
private void btnReload_Click(object sender, EventArgs e)
|
||||
{
|
||||
ReloadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user