Fixed more bugs with the parsing engine, a crash bug in the update inventory method, and a crash bug in the trimming operations. Deleting a row now marks all rows under it as dirty.

This commit is contained in:
2017-01-21 01:39:28 -06:00
parent ab00ad2598
commit 12239bce23
7 changed files with 172 additions and 21 deletions
@@ -63,7 +63,7 @@ namespace AdvertsingProfitControl
//The start by checking the previous row's status.
rowStatus = parser.GetRowAttribute(dataGridView.Rows[i - 1]);
//IF the previous row is a header row AND has color coding saying it is a group header, then clear the previous row's color and apply it to this row (i).
if (rowStatus == RowAttribute.HeaderRow && (bool)dataGridView.Rows[i - 1].Cells[isHeaderColumn].Value)
if (rowStatus == RowAttribute.HeaderRow && (bool)dataGridView.Rows[i - 1].Cells[isHeaderColumn].EditedFormattedValue)
{
//Clear the previous row of its attributes.
dataGridView.Rows[i - 1].Cells[isHeaderColumn].Value = false;
@@ -72,6 +72,16 @@ namespace AdvertsingProfitControl
dataGridView.Rows[i - 1].Cells[isDirtyColumn].Value = true;
dataGridView.Rows[i - 1].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
dataGridView.Rows[i - 1].DefaultCellStyle.BackColor = Color.White;
//Check the next row to see if its a member row before declaring the current row a header row.
rowStatus = parser.GetRowAttribute(dataGridView.Rows[i + 1]);
if (rowStatus != RowAttribute.MemberRow)
{
//Clear the coloring from the current row.
dataGridView.Rows[i].Cells[isHeaderColumn].Value = true;
dataGridView.Rows[i].Cells[isMemberColumn].Value = false;
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.White;
return;
}
//Set the current row as a header row.
dataGridView.Rows[i].Cells[isHeaderColumn].Value = true;
dataGridView.Rows[i].Cells[isMemberColumn].Value = false;
@@ -122,15 +132,26 @@ namespace AdvertsingProfitControl
dataGridView.Rows[i - 1].Cells[isHeaderColumn].Value = false;
dataGridView.Rows[i - 1].Cells[isMemberColumn].Value = false;
dataGridView.Rows[i - 1].DefaultCellStyle.BackColor = Color.White;
//Clear the current row of its attributes.
//Check for changes in the current row.
if ((bool) dataGridView.Rows[i].Cells[isMemberColumn].EditedFormattedValue)
{
dataGridView.Rows[i].Cells[isDirtyColumn].Value = true;
dataGridView.Rows[i].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
}
//Clear the current row of its attributes.
dataGridView.Rows[i].Cells[isHeaderColumn].Value = false;
dataGridView.Rows[i].Cells[isMemberColumn].Value = false;
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.White;
return;
}
//IF the previous row is a member row AND it also has color coding suggesting that it is a member of a group, then add the current row (i) as well.
if (rowStatus == RowAttribute.MemberRow && (bool)dataGridView.Rows[i - 1].Cells[isMemberColumn].Value)
else if (rowStatus == RowAttribute.MemberRow && (bool)dataGridView.Rows[i - 1].Cells[isMemberColumn].EditedFormattedValue)
{
//Check for changes in the current row.
if (!(bool)dataGridView.Rows[i].Cells[isMemberColumn].EditedFormattedValue)
{
dataGridView.Rows[i].Cells[isDirtyColumn].Value = true;
dataGridView.Rows[i].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
}
//Set the current row as a member row.
dataGridView.Rows[i].Cells[isHeaderColumn].Value = false;
dataGridView.Rows[i].Cells[isMemberColumn].Value = true;
@@ -139,14 +160,19 @@ namespace AdvertsingProfitControl
//IF the previous row is simply a member row with no coloring at all, then remove the coloring from the current row (i).
else if (rowStatus == RowAttribute.MemberRow || rowStatus == RowAttribute.AdSpecialRow)
{
//Check for changes in the current row.
if ((bool)dataGridView.Rows[i].Cells[isMemberColumn].EditedFormattedValue)
{
dataGridView.Rows[i].Cells[isDirtyColumn].Value = true;
dataGridView.Rows[i].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
}
//Clear the current row of its attributes.
dataGridView.Rows[i].Cells[isHeaderColumn].Value = false;
dataGridView.Rows[i].Cells[isMemberColumn].Value = false;
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.White;
return;
}
//IF the previous row is a header row, then color it as a group header and color the current row as a member of said group.
else if (rowStatus == RowAttribute.HeaderRow && !(bool)dataGridView.Rows[i - 1].Cells[isHeaderColumn].Value)
else if (rowStatus == RowAttribute.HeaderRow && !(bool)dataGridView.Rows[i - 1].Cells[isHeaderColumn].EditedFormattedValue)
{
//Set the previous row as a header row.
dataGridView.Rows[i - 1].Cells[isHeaderColumn].Value = true;
@@ -155,6 +181,25 @@ namespace AdvertsingProfitControl
//This condition means the user created a group so the newly made header row will need to be updated in the database as well.
dataGridView.Rows[i - 1].Cells[isDirtyColumn].Value = true;
dataGridView.Rows[i - 1].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
//Check for changes in the current row.
if ((bool)dataGridView.Rows[i].Cells[isMemberColumn].EditedFormattedValue)
{
dataGridView.Rows[i].Cells[isDirtyColumn].Value = true;
dataGridView.Rows[i].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
}
//Set the current row as a member row.
dataGridView.Rows[i].Cells[isHeaderColumn].Value = false;
dataGridView.Rows[i].Cells[isMemberColumn].Value = true;
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
else if (rowStatus == RowAttribute.HeaderRow)
{
//Check for changes in the current row.
if (!(bool)dataGridView.Rows[i].Cells[isMemberColumn].EditedFormattedValue)
{
dataGridView.Rows[i].Cells[isDirtyColumn].Value = true;
dataGridView.Rows[i].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
}
//Set the current row as a member row.
dataGridView.Rows[i].Cells[isHeaderColumn].Value = false;
dataGridView.Rows[i].Cells[isMemberColumn].Value = true;