From ab00ad25985e3ba4634a7a2d22499d6946dc17ea Mon Sep 17 00:00:00 2001 From: Garritt McCune Date: Fri, 20 Jan 2017 23:51:33 -0600 Subject: [PATCH] Quick crash bug fix with the row parsing engine where an existing, unchanged, header row is marked as dirty by the engine. --- .../AdvertisingProfitControlTableHelper.cs | 2 +- AdvertsingProfitControl/NewModifyRecord.cs | 36 ++++++++----------- ...AdvertsingProfitControl.vshost.application | 2 +- ...dvertsingProfitControl.vshost.exe.manifest | 4 +-- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/AdvertsingProfitControl/AdvertisingProfitControlTableHelper.cs b/AdvertsingProfitControl/AdvertisingProfitControlTableHelper.cs index f434fee..43fc6b4 100644 --- a/AdvertsingProfitControl/AdvertisingProfitControlTableHelper.cs +++ b/AdvertsingProfitControl/AdvertisingProfitControlTableHelper.cs @@ -146,7 +146,7 @@ namespace AdvertsingProfitControl 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) + else if (rowStatus == RowAttribute.HeaderRow && !(bool)dataGridView.Rows[i - 1].Cells[isHeaderColumn].Value) { //Set the previous row as a header row. dataGridView.Rows[i - 1].Cells[isHeaderColumn].Value = true; diff --git a/AdvertsingProfitControl/NewModifyRecord.cs b/AdvertsingProfitControl/NewModifyRecord.cs index e96ab76..50d0c2d 100644 --- a/AdvertsingProfitControl/NewModifyRecord.cs +++ b/AdvertsingProfitControl/NewModifyRecord.cs @@ -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); diff --git a/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.application b/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.application index f57c758..57deb74 100644 --- a/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.application +++ b/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.application @@ -14,7 +14,7 @@ - 7F/RAhUMV4Hdn8Z9v/Nt+yIctA8A8oX18FGf/FPA/ic= + b7XWNTKdLoveai+Ezig6qhdfRQNnqDFOegZLHdvzxx0= diff --git a/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.exe.manifest b/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.exe.manifest index 839738e..4690085 100644 --- a/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.exe.manifest +++ b/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.exe.manifest @@ -43,14 +43,14 @@ - + - 9SCbSUpZiztSoLlr90+nJ7hNTimDeyfaAkBthVk+33U= + JdsSdLXGV6xF3G52D7+6tloy6VbDDJnLshBRhBOm3iQ=