This commit is contained in:
2022-07-11 00:25:59 +00:00
parent 480a4d93de
commit 826acdd570
5 changed files with 21 additions and 7 deletions

View File

@@ -1,9 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using static AyaNovaQBI.util;
namespace AyaNovaQBI
{
@@ -19,16 +21,25 @@ namespace AyaNovaQBI
private void FixInvoiceProblems_Load(object sender, EventArgs e)
{
grid.DataSource = MisMatches;
BindDataSource();
btnOK.Text = util.AyaTranslations["OK"];
}
private void BindDataSource()
{
var bindingList = new BindingList<util.MisMatch>(MisMatches);
var source = new BindingSource(bindingList, null);
grid.DataSource = source;
}
private void btnOK_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
Close();
}
TODO: Test each possible route through this below before moving on to invoice testing
private async void grid_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
var senderGrid = (DataGridView)sender;
@@ -107,13 +118,13 @@ namespace AyaNovaQBI
}
//remove the object from the grid as it's now dealt with
MisMatches.RemoveAt(e.RowIndex);
ChangesMade = true;
//If all done then close up
if (MisMatches.Count == 0)
Close();
else
grid.DataSource = MisMatches;//rebind to refresh the grid
}
catch (Exception ex)
{
@@ -255,13 +266,15 @@ namespace AyaNovaQBI
REMOVEITEMS:
//remove the object from the grid as it's now dealt with
// grid.Rows.RemoveAt(e.RowIndex);
//grid.DataSource = typeof(List<util.MisMatch>);
MisMatches.RemoveAt(e.RowIndex);
BindDataSource();
ChangesMade = true;
//If all done then close up
if (MisMatches.Count == 0)
Close();
else
grid.DataSource = MisMatches;//rebind to refresh the grid
}
catch (Exception ex)