Fixed a bug in the row parsing engine related to ad special rows. Move all data from the old format to the new format. Updated the main form's UI.
This commit is contained in:
@@ -477,27 +477,35 @@ namespace AdvertsingProfitControl
|
||||
oleDbCommand.Parameters.AddWithValue("ID", int.Parse(table.Rows[i].Cells[(int)InvoiceTableColumns.Id].EditedFormattedValue.ToString()));
|
||||
oleDbCommand.ExecuteNonQuery();
|
||||
oleDbCommand.Parameters.Clear();
|
||||
rowsAdded.Add(i);
|
||||
}
|
||||
//Row index is only used to keep track of what row failed to update.
|
||||
lastRowProcessed = i + 1;
|
||||
}
|
||||
oleDbTransaction.Commit();
|
||||
foreach (DataGridViewRow row in table.Rows)
|
||||
//Spin through the collection and update the affected rows.
|
||||
foreach (var rowIndex in rowsAdded)
|
||||
{
|
||||
if(row.IsNewRow) continue;
|
||||
if (!rowsAdded.Contains(row.Index)) continue;
|
||||
var supplierId = RetrieveSupplierId(row.Cells[(int)InvoiceTableColumns.Supplier].EditedFormattedValue.ToString());
|
||||
var invoiceIdNumber =
|
||||
RetrieveInvoiceId(
|
||||
row.Cells[(int)InvoiceTableColumns.InvoiceDate].EditedFormattedValue
|
||||
.ToString(),
|
||||
long.Parse(
|
||||
row.Cells[(int)InvoiceTableColumns.InvoiceNumber].EditedFormattedValue
|
||||
.ToString()), supplierId, dateId);
|
||||
row.Cells[(int)InvoiceTableColumns.Id].Value = invoiceIdNumber;
|
||||
row.Cells[(int)InvoiceTableColumns.IsDirty].Value = false;
|
||||
row.HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
||||
//Only reset the IsDirty value to false since the updates when through.
|
||||
table.Rows[rowIndex].Cells[(int)InvoiceTableColumns.IsDirty].Value = false;
|
||||
table.Rows[rowIndex].HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
||||
}
|
||||
//foreach (DataGridViewRow row in table.Rows)
|
||||
//{
|
||||
// if(row.IsNewRow) continue;
|
||||
// if (!rowsAdded.Contains(row.Index)) continue;
|
||||
// var supplierId = RetrieveSupplierId(row.Cells[(int)InvoiceTableColumns.Supplier].EditedFormattedValue.ToString());
|
||||
// var invoiceIdNumber =
|
||||
// RetrieveInvoiceId(
|
||||
// row.Cells[(int)InvoiceTableColumns.InvoiceDate].EditedFormattedValue
|
||||
// .ToString(),
|
||||
// long.Parse(
|
||||
// row.Cells[(int)InvoiceTableColumns.InvoiceNumber].EditedFormattedValue
|
||||
// .ToString()), supplierId, dateId);
|
||||
// row.Cells[(int)InvoiceTableColumns.Id].Value = invoiceIdNumber;
|
||||
// row.Cells[(int)InvoiceTableColumns.IsDirty].Value = false;
|
||||
// row.HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
||||
//}
|
||||
table.RefreshEdit();
|
||||
//Set the status.
|
||||
status.SetStatus(WritingOperationStatus.InsertionSuccessful);
|
||||
|
||||
Reference in New Issue
Block a user