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

View File

@@ -150,6 +150,7 @@
this.Controls.Add(this.lblTitle); this.Controls.Add(this.lblTitle);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "FixPriceDifference"; this.Name = "FixPriceDifference";
this.ShowInTaskbar = false;
this.Text = "Resolve AyaNova object price"; this.Text = "Resolve AyaNova object price";
this.Load += new System.EventHandler(this.SetQBClass_load); this.Load += new System.EventHandler(this.SetQBClass_load);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);

View File

@@ -17,7 +17,7 @@ namespace AyaNovaQBI
{ {
get get
{ {
return ((DataRowView)cbQBItems.SelectedItem).Row[0].ToString(); return ((DataRowView)cbQBItems.SelectedItem).Row[1].ToString();
} }
} }
@@ -25,7 +25,7 @@ namespace AyaNovaQBI
{ {
get get
{ {
return ((DataRowView)cbQBItems.SelectedItem).Row[1].ToString(); return ((DataRowView)cbQBItems.SelectedItem).Row[0].ToString();
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 30 KiB