Removed a few unused columns and flags that didn't help improve the performance of the form or just made its code more cluttered. Created a separate method to handle calling the database writing code for the Sales Tables.

This commit is contained in:
2016-11-11 15:21:04 -06:00
parent 9105429fcb
commit 35e90a6f86
11 changed files with 81 additions and 251 deletions
@@ -19,23 +19,19 @@ namespace AdvertsingProfitControl
var parser = new RowParsing();
int isHeaderColumn;
int isMemberColumn;
int adSpecialColumn;
if (dataGridView.Columns.Count == Enum.GetNames(typeof(SalesTableColumns)).Length)
{
isHeaderColumn = (int) SalesTableColumns.IsHeaderRow;
isMemberColumn = (int) SalesTableColumns.IsMemberRow;
adSpecialColumn = (int) SalesTableColumns.IsAdSpecialRow;
}
else
{
isHeaderColumn = (int)InventoryTableColumns.IsHeaderRow;
isMemberColumn = (int)InventoryTableColumns.IsMemberRow;
adSpecialColumn = (int) InventoryTableColumns.IsAdSpecialRow;
}
//If the current row is an Ad Special Row, the color code it and return as nothing further needs to be done.
if (parser.CheckForGroupKeyWord(dataGridView.Rows[startingIndex].Cells[(int) SalesTableColumns.AdItem].EditedFormattedValue.ToString()) != "NoGroupFound")
{
dataGridView.Rows[startingIndex].Cells[adSpecialColumn].Value = true;
dataGridView.Rows[startingIndex].DefaultCellStyle.BackColor = Color.Silver;
return;
}
@@ -266,10 +262,7 @@ namespace AdvertsingProfitControl
TotalProfitReturn = 7,
IsHeaderRow = 8,
IsMemberRow = 9,
IsAdSpecialRow = 10,
IsAdSpecialMember = 11,
IsDirty = 12,
IsInDatabase = 13
IsDirty = 10,
}
public enum InventoryTableColumns
@@ -282,10 +275,7 @@ namespace AdvertsingProfitControl
EndingInventory = 5,
IsHeaderRow = 6,
IsMemberRow = 7,
IsAdSpecialRow = 8,
IsAdSpecialMember = 9,
IsDirty = 10,
IsInDatabase = 11
IsDirty = 8,
}
public enum InvoiceTableColumns