Added a temporary form to convert the old database format. Updated the row parsing engine to handle ad special rows more effectively. Fixed a few bugs with the parsing engine not flagging member rows as dirty. Upped the character limit of the ad item and supplier columns.

This commit is contained in:
2017-01-22 20:46:07 -06:00
parent ac16bbc05c
commit 9f045175ed
13 changed files with 872 additions and 24 deletions
@@ -208,6 +208,11 @@ namespace AdvertsingProfitControl
else if (rowStatus == RowAttribute.HeaderRow && !(bool)dataGridView.Rows[i - 1].Cells[isHeaderColumn].EditedFormattedValue)
{
//Set the previous row as a header row.
if (!(bool)dataGridView.Rows[i - 1].Cells[isMemberColumn].EditedFormattedValue)
{
dataGridView.Rows[i - 1].Cells[isDirtyColumn].Value = true;
dataGridView.Rows[i - 1].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
}
dataGridView.Rows[i - 1].Cells[isHeaderColumn].Value = true;
dataGridView.Rows[i - 1].Cells[isMemberColumn].Value = false;
dataGridView.Rows[i - 1].DefaultCellStyle.BackColor = Color.LightGray;
@@ -215,7 +220,7 @@ namespace AdvertsingProfitControl
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)
if (!(bool)dataGridView.Rows[i].Cells[isMemberColumn].EditedFormattedValue)
{
dataGridView.Rows[i].Cells[isDirtyColumn].Value = true;
dataGridView.Rows[i].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
@@ -253,6 +258,40 @@ namespace AdvertsingProfitControl
dataGridView.Rows[0].DefaultCellStyle.BackColor = Color.White;
}
}
else if (rowStatus == RowAttribute.AdSpecialRow)
{
if(i == 0) return;
//Get the previous row's attribute.
rowStatus = parser.GetRowAttribute(dataGridView.Rows[i - 1]);
if (rowStatus == RowAttribute.HeaderRow)
{
//Check to see if the previous row sees itself as a header row, if so mark it dirty.
if (!(bool)dataGridView.Rows[i - 1].Cells[isHeaderColumn].EditedFormattedValue)
{
dataGridView.Rows[i - 1].Cells[isDirtyColumn].Value = true;
dataGridView.Rows[i - 1].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
}
//Clear its color coding.
dataGridView.Rows[i - 1].Cells[isHeaderColumn].Value = false;
dataGridView.Rows[i - 1].Cells[isMemberColumn].Value = false;
dataGridView.Rows[i - 1].DefaultCellStyle.BackColor = Color.White;
}
//Next get the status of the next row.
rowStatus = parser.GetRowAttribute(dataGridView.Rows[i + 1]);
if (rowStatus == RowAttribute.MemberRow)
{
//Check to see if the next row thinks it is a member row.
if (!(bool)dataGridView.Rows[i + 1].Cells[isMemberColumn].EditedFormattedValue)
{
dataGridView.Rows[i + 1].Cells[isDirtyColumn].Value = true;
dataGridView.Rows[i + 1].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
}
//Clear its color coding.
dataGridView.Rows[i + 1].Cells[isMemberColumn].Value = false;
dataGridView.Rows[i + 1].Cells[isHeaderColumn].Value = false;
dataGridView.Rows[i + 1].DefaultCellStyle.BackColor = Color.White;
}
}
}
}