Quick crash bug fix with the row parsing engine where an existing, unchanged, header row is marked as dirty by the engine.

This commit is contained in:
2017-01-20 23:51:33 -06:00
parent 43bf07c212
commit ab00ad2598
4 changed files with 18 additions and 26 deletions
+14 -22
View File
@@ -1063,28 +1063,13 @@ namespace AdvertsingProfitControl
rowContents[i] = projectionsDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString();
break;
case (int)SalesTableColumns.SalePrice:
//IF the Sale Price cell is empty then place 0.00 into the array as a place holder value (assuming this row is a HeaderRow).
if (projectionsDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString() == string.Empty)
{
rowContents[i] = string.Empty;
}
//ELSE place the value from the Projections table into the array, since Sale Price can be determined before actual data is used.
else
{
rowContents[i] = projectionsDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString();
}
rowContents[i] = projectionsDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString();
break;
case (int)SalesTableColumns.Cost:
//IF the Cost cell is empty then place 0.00 into the array as a place holder value (assuming this row is a HeaderRow).
if (projectionsDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString() == string.Empty)
{
rowContents[i] = string.Empty;
}
//ELSE place the value from the Projections table into the array, since Cost can be determined before actual data is used.
else
{
rowContents[i] = projectionsDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString();
}
rowContents[i] = projectionsDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString();
break;
case (int)SalesTableColumns.ProfitReturn:
rowContents[i] = projectionsDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString();
break;
case (int)SalesTableColumns.IsDirty:
rowContents[i] = true;
@@ -1623,6 +1608,9 @@ namespace AdvertsingProfitControl
case (int)SalesTableColumns.Cost:
rowContents[i] = actualSalesDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString();
break;
case (int)SalesTableColumns.ProfitReturn:
rowContents[i] = actualSalesDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString();
break;
case (int)SalesTableColumns.IsDirty:
rowContents[i] = true;
break;
@@ -2477,8 +2465,8 @@ namespace AdvertsingProfitControl
//Check the attribute cell.
if (cellIndex == 8)
{
var isHeaderCell = new DataGridViewCheckBoxCell(false);
var isMemberCell = new DataGridViewCheckBoxCell(false);
var isHeaderCell = new DataGridViewCheckBoxCell();
var isMemberCell = new DataGridViewCheckBoxCell();
var rowAttribute = int.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString());
switch (rowAttribute)
{
@@ -2492,6 +2480,10 @@ namespace AdvertsingProfitControl
isMemberCell.Value = true;
newRow.DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
break;
default:
isHeaderCell.Value = false;
isMemberCell.Value = false;
break;
}
newRow.Cells.Add(isHeaderCell);
newRow.Cells.Add(isMemberCell);