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:
Binary file not shown.
@@ -63,7 +63,7 @@ namespace AdvertsingProfitControl
|
|||||||
//The start by checking the previous row's status.
|
//The start by checking the previous row's status.
|
||||||
rowStatus = parser.GetRowAttribute(dataGridView.Rows[i - 1]);
|
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 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.
|
//Clear the previous row of its attributes.
|
||||||
dataGridView.Rows[i - 1].Cells[isHeaderColumn].Value = false;
|
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].Cells[isDirtyColumn].Value = true;
|
||||||
dataGridView.Rows[i - 1].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
dataGridView.Rows[i - 1].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
||||||
dataGridView.Rows[i - 1].DefaultCellStyle.BackColor = Color.White;
|
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.
|
//Set the current row as a header row.
|
||||||
dataGridView.Rows[i].Cells[isHeaderColumn].Value = true;
|
dataGridView.Rows[i].Cells[isHeaderColumn].Value = true;
|
||||||
dataGridView.Rows[i].Cells[isMemberColumn].Value = false;
|
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[isHeaderColumn].Value = false;
|
||||||
dataGridView.Rows[i - 1].Cells[isMemberColumn].Value = false;
|
dataGridView.Rows[i - 1].Cells[isMemberColumn].Value = false;
|
||||||
dataGridView.Rows[i - 1].DefaultCellStyle.BackColor = Color.White;
|
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[isHeaderColumn].Value = false;
|
||||||
dataGridView.Rows[i].Cells[isMemberColumn].Value = false;
|
dataGridView.Rows[i].Cells[isMemberColumn].Value = false;
|
||||||
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.White;
|
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 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.
|
//Set the current row as a member row.
|
||||||
dataGridView.Rows[i].Cells[isHeaderColumn].Value = false;
|
dataGridView.Rows[i].Cells[isHeaderColumn].Value = false;
|
||||||
dataGridView.Rows[i].Cells[isMemberColumn].Value = true;
|
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).
|
//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)
|
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.
|
//Clear the current row of its attributes.
|
||||||
dataGridView.Rows[i].Cells[isHeaderColumn].Value = false;
|
dataGridView.Rows[i].Cells[isHeaderColumn].Value = false;
|
||||||
dataGridView.Rows[i].Cells[isMemberColumn].Value = false;
|
dataGridView.Rows[i].Cells[isMemberColumn].Value = false;
|
||||||
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.White;
|
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.
|
//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.
|
//Set the previous row as a header row.
|
||||||
dataGridView.Rows[i - 1].Cells[isHeaderColumn].Value = true;
|
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.
|
//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].Cells[isDirtyColumn].Value = true;
|
||||||
dataGridView.Rows[i - 1].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
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.
|
//Set the current row as a member row.
|
||||||
dataGridView.Rows[i].Cells[isHeaderColumn].Value = false;
|
dataGridView.Rows[i].Cells[isHeaderColumn].Value = false;
|
||||||
dataGridView.Rows[i].Cells[isMemberColumn].Value = true;
|
dataGridView.Rows[i].Cells[isMemberColumn].Value = true;
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ namespace AdvertsingProfitControl
|
|||||||
oleDbTransaction.Commit();
|
oleDbTransaction.Commit();
|
||||||
foreach (DataRow row in table.Rows)
|
foreach (DataRow row in table.Rows)
|
||||||
{
|
{
|
||||||
var rowId = RetrieveRowId(table.TableName, int.Parse(row[4].ToString()), int.Parse(row[8].ToString()), int.Parse(row[7].ToString()));
|
var rowId = int.Parse(row[0].ToString());
|
||||||
if (int.Parse(row[7].ToString()) != 0)
|
if (int.Parse(row[7].ToString()) != 0)
|
||||||
{
|
{
|
||||||
//Account for the ad special row.
|
//Account for the ad special row.
|
||||||
@@ -408,7 +408,6 @@ namespace AdvertsingProfitControl
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public DbTableWriterStatus ProccessInvoiceTable(DataGridView table, int dateId, string connectionString)
|
public DbTableWriterStatus ProccessInvoiceTable(DataGridView table, int dateId, string connectionString)
|
||||||
{
|
{
|
||||||
var status = new DbTableWriterStatus();
|
var status = new DbTableWriterStatus();
|
||||||
|
|||||||
@@ -683,12 +683,23 @@ namespace AdvertsingProfitControl
|
|||||||
//Reset the gAdSpecialIndex to -1.
|
//Reset the gAdSpecialIndex to -1.
|
||||||
_adSpecialIndex = -1;
|
_adSpecialIndex = -1;
|
||||||
e.Cancel = true; //Prevent the new row from being removed.
|
e.Cancel = true; //Prevent the new row from being removed.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Mark all rows under the row that just got deleted as dirty.
|
||||||
|
for (var index = currentRowIndex; currentRowIndex < dataGridView.Rows.Count; index++)
|
||||||
|
{
|
||||||
|
projectionsDataGridView.Rows[index].Cells[(int)SalesTableColumns.IsDirty].Value = true;
|
||||||
|
projectionsDataGridView.Rows[index].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
||||||
|
inventoryDataGridView.Rows[index].Cells[(int)InventoryTableColumns.IsDirty].Value = true;
|
||||||
|
inventoryDataGridView.Rows[index].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
||||||
|
actualSalesDataGridView.Rows[index].Cells[(int)SalesTableColumns.IsDirty].Value = true;
|
||||||
|
actualSalesDataGridView.Rows[index].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChangeAutoCompleteListOnKeyCombo(object sender, KeyEventArgs e)
|
private void ChangeAutoCompleteListOnKeyCombo(object sender, KeyEventArgs e)
|
||||||
|
|||||||
@@ -719,12 +719,25 @@ namespace AdvertsingProfitControl
|
|||||||
//Reset the gAdSpecialIndex to -1.
|
//Reset the gAdSpecialIndex to -1.
|
||||||
_adSpecialIndex = -1;
|
_adSpecialIndex = -1;
|
||||||
e.Cancel = true; //Prevent the new row from being removed.
|
e.Cancel = true; //Prevent the new row from being removed.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Mark all rows under the row that just got deleted as dirty.
|
||||||
|
for (var index = currentRowIndex; index < dataGridView.Rows.Count; index++)
|
||||||
|
{
|
||||||
|
if (index == _adSpecialIndex + 1) continue;
|
||||||
|
if (projectionsDataGridView.Rows[index].IsNewRow) continue;
|
||||||
|
projectionsDataGridView.Rows[index].Cells[(int) SalesTableColumns.IsDirty].Value = true;
|
||||||
|
projectionsDataGridView.Rows[index].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
||||||
|
inventoryDataGridView.Rows[index].Cells[(int) InventoryTableColumns.IsDirty].Value = true;
|
||||||
|
inventoryDataGridView.Rows[index].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
||||||
|
actualSalesDataGridView.Rows[index].Cells[(int) SalesTableColumns.IsDirty].Value = true;
|
||||||
|
actualSalesDataGridView.Rows[index].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChangeAutoCompleteListOnKeyCombo(object sender, KeyEventArgs e)
|
private void ChangeAutoCompleteListOnKeyCombo(object sender, KeyEventArgs e)
|
||||||
@@ -2583,8 +2596,8 @@ namespace AdvertsingProfitControl
|
|||||||
//Check the attribute cell.
|
//Check the attribute cell.
|
||||||
if (cellIndex == 6)
|
if (cellIndex == 6)
|
||||||
{
|
{
|
||||||
var isHeaderCell = new DataGridViewCheckBoxCell(false);
|
var isHeaderCell = new DataGridViewCheckBoxCell();
|
||||||
var isMemberCell = new DataGridViewCheckBoxCell(false);
|
var isMemberCell = new DataGridViewCheckBoxCell();
|
||||||
var rowAttribute = int.Parse(inventoryTable.Rows[rowIndex].ItemArray[cellIndex].ToString());
|
var rowAttribute = int.Parse(inventoryTable.Rows[rowIndex].ItemArray[cellIndex].ToString());
|
||||||
switch (rowAttribute)
|
switch (rowAttribute)
|
||||||
{
|
{
|
||||||
@@ -2598,6 +2611,10 @@ namespace AdvertsingProfitControl
|
|||||||
isMemberCell.Value = true;
|
isMemberCell.Value = true;
|
||||||
newRow.DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
|
newRow.DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
isHeaderCell.Value = false;
|
||||||
|
isMemberCell.Value = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
newRow.Cells.Add(isHeaderCell);
|
newRow.Cells.Add(isHeaderCell);
|
||||||
newRow.Cells.Add(isMemberCell);
|
newRow.Cells.Add(isMemberCell);
|
||||||
@@ -2683,8 +2700,8 @@ namespace AdvertsingProfitControl
|
|||||||
//Check the attribute cell.
|
//Check the attribute cell.
|
||||||
if (cellIndex == 8)
|
if (cellIndex == 8)
|
||||||
{
|
{
|
||||||
var isHeaderCell = new DataGridViewCheckBoxCell(false);
|
var isHeaderCell = new DataGridViewCheckBoxCell();
|
||||||
var isMemberCell = new DataGridViewCheckBoxCell(false);
|
var isMemberCell = new DataGridViewCheckBoxCell();
|
||||||
var rowAttribute = int.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString());
|
var rowAttribute = int.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString());
|
||||||
switch (rowAttribute)
|
switch (rowAttribute)
|
||||||
{
|
{
|
||||||
@@ -2698,6 +2715,10 @@ namespace AdvertsingProfitControl
|
|||||||
isMemberCell.Value = true;
|
isMemberCell.Value = true;
|
||||||
newRow.DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
|
newRow.DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
isHeaderCell.Value = false;
|
||||||
|
isMemberCell.Value = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
newRow.Cells.Add(isHeaderCell);
|
newRow.Cells.Add(isHeaderCell);
|
||||||
newRow.Cells.Add(isMemberCell);
|
newRow.Cells.Add(isMemberCell);
|
||||||
@@ -3103,6 +3124,7 @@ namespace AdvertsingProfitControl
|
|||||||
MessageBox.Show(@"Failed to get the date ID number.", @"Invalid ID Number", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(@"Failed to get the date ID number.", @"Invalid ID Number", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (displayInformation) informationLabel.Text = "";
|
||||||
//Create the database interaction objects.
|
//Create the database interaction objects.
|
||||||
var dbT = new DatabaseTracker();
|
var dbT = new DatabaseTracker();
|
||||||
var dbW = new DatabaseWriter(dbT.DatabaseConnectionString);
|
var dbW = new DatabaseWriter(dbT.DatabaseConnectionString);
|
||||||
@@ -3151,6 +3173,80 @@ namespace AdvertsingProfitControl
|
|||||||
{
|
{
|
||||||
errorLabel.Text += @"Failed to process projections." + Environment.NewLine;
|
errorLabel.Text += @"Failed to process projections." + Environment.NewLine;
|
||||||
}
|
}
|
||||||
|
DataTable inventoryNewTable;
|
||||||
|
DataTable inventoryUpdateTable;
|
||||||
|
var inventoryTrimmingStatus = ConstructCleanedInventoryTable(dateId, out inventoryNewTable, out inventoryUpdateTable);
|
||||||
|
if (inventoryTrimmingStatus != TrimmingOperationResult.NoChangesRequired && inventoryTrimmingStatus != TrimmingOperationResult.FailedToTrim)
|
||||||
|
{
|
||||||
|
if (inventoryNewTable.Rows.Count > 0)
|
||||||
|
{
|
||||||
|
var writerResult = dbW.InsertIntoInventoryTable(inventoryNewTable, dbT.DatabaseConnectionString);
|
||||||
|
if (writerResult.GetWritingOperationStatus() != WritingOperationStatus.Failed)
|
||||||
|
{
|
||||||
|
//Spin through the collection and update the affected rows.
|
||||||
|
foreach (var rowIndex in writerResult.GetRowCollection())
|
||||||
|
{
|
||||||
|
//Only reset the IsDirty value to false since the updates when through.
|
||||||
|
inventoryDataGridView.Rows[rowIndex.Key - 1].Cells[(int)InventoryTableColumns.Id].Value = rowIndex.Value;
|
||||||
|
inventoryDataGridView.Rows[rowIndex.Key - 1].Cells[(int)InventoryTableColumns.IsDirty].Value = false;
|
||||||
|
inventoryDataGridView.Rows[rowIndex.Key - 1].HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Next check to see if the update table has anything.
|
||||||
|
if (inventoryUpdateTable.Rows.Count > 0)
|
||||||
|
{
|
||||||
|
var writerResult = dbW.UpdateInventoryTable(inventoryUpdateTable, dbT.DatabaseConnectionString);
|
||||||
|
if (writerResult.GetWritingOperationStatus() != WritingOperationStatus.Failed)
|
||||||
|
{
|
||||||
|
//Spin through the collection and update the affected rows.
|
||||||
|
foreach (var rowIndex in writerResult.GetRowCollection())
|
||||||
|
{
|
||||||
|
//Only reset the IsDirty value to false since the updates when through.
|
||||||
|
inventoryDataGridView.Rows[rowIndex.Key - 1].Cells[(int)InventoryTableColumns.IsDirty].Value = false;
|
||||||
|
inventoryDataGridView.Rows[rowIndex.Key - 1].HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (displayInformation) informationLabel.Text += @"Successfully saved inventory." + Environment.NewLine;
|
||||||
|
}
|
||||||
|
DataTable actualSalesNewTable;
|
||||||
|
DataTable actualSalesUpdateTable;
|
||||||
|
var actualSalesTrimmingStatus = ConstructCleanedSalesTable("ActualSales", dateId, out actualSalesNewTable, out actualSalesUpdateTable);
|
||||||
|
if (actualSalesTrimmingStatus != TrimmingOperationResult.NoChangesRequired && actualSalesTrimmingStatus != TrimmingOperationResult.FailedToTrim)
|
||||||
|
{
|
||||||
|
//Check to see if the insert table has any items.
|
||||||
|
if (actualSalesNewTable.Rows.Count > 0)
|
||||||
|
{
|
||||||
|
var writerResult = dbW.InsertIntoSalesTable(actualSalesNewTable, dbT.DatabaseConnectionString);
|
||||||
|
if (writerResult.GetWritingOperationStatus() != WritingOperationStatus.Failed)
|
||||||
|
{
|
||||||
|
//Spin through the collection and update the affected rows.
|
||||||
|
foreach (var rowIndex in writerResult.GetRowCollection())
|
||||||
|
{
|
||||||
|
actualSalesDataGridView.Rows[rowIndex.Key - 1].Cells[(int)SalesTableColumns.Id].Value = rowIndex.Value;
|
||||||
|
actualSalesDataGridView.Rows[rowIndex.Key - 1].Cells[(int)SalesTableColumns.IsDirty].Value = false;
|
||||||
|
actualSalesDataGridView.Rows[rowIndex.Key - 1].HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Next check to see if the update table has anything.
|
||||||
|
if (actualSalesUpdateTable.Rows.Count > 0)
|
||||||
|
{
|
||||||
|
var writerResult = dbW.UpdateSalesTable(actualSalesUpdateTable, dbT.DatabaseConnectionString);
|
||||||
|
if (writerResult.GetWritingOperationStatus() != WritingOperationStatus.Failed)
|
||||||
|
{
|
||||||
|
//Spin through the collection and update the affected rows.
|
||||||
|
foreach (var rowIndex in writerResult.GetRowCollection())
|
||||||
|
{
|
||||||
|
//Only reset the IsDirty value to false since the updates when through.
|
||||||
|
actualSalesDataGridView.Rows[rowIndex.Key - 1].Cells[(int)SalesTableColumns.IsDirty].Value = false;
|
||||||
|
actualSalesDataGridView.Rows[rowIndex.Key - 1].HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (displayInformation) informationLabel.Text += @"Successfully saved actual sales." + Environment.NewLine;
|
||||||
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3242,7 +3338,7 @@ namespace AdvertsingProfitControl
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//Check to see if the row is dirty.
|
//Check to see if the row is dirty.
|
||||||
if (!(bool)row.Cells[(int)SalesTableColumns.IsDirty].Value)
|
if (!(bool)row.Cells[(int)SalesTableColumns.IsDirty].EditedFormattedValue)
|
||||||
{
|
{
|
||||||
//If it is not then continue on to the next row.
|
//If it is not then continue on to the next row.
|
||||||
continue;
|
continue;
|
||||||
@@ -3268,11 +3364,11 @@ namespace AdvertsingProfitControl
|
|||||||
}
|
}
|
||||||
//Determine the row's attribute.
|
//Determine the row's attribute.
|
||||||
var rowAttribute = 0; //Zero (0) means no grouping, its not a header nor a member.
|
var rowAttribute = 0; //Zero (0) means no grouping, its not a header nor a member.
|
||||||
if ((bool)row.Cells[(int)SalesTableColumns.IsHeaderRow].Value && !(bool)row.Cells[(int)SalesTableColumns.IsMemberRow].Value)
|
if ((bool)row.Cells[(int)SalesTableColumns.IsHeaderRow].EditedFormattedValue && !(bool)row.Cells[(int)SalesTableColumns.IsMemberRow].EditedFormattedValue)
|
||||||
{
|
{
|
||||||
rowAttribute = 1;
|
rowAttribute = 1;
|
||||||
}
|
}
|
||||||
else if ((bool)row.Cells[(int)SalesTableColumns.IsMemberRow].Value && !(bool)row.Cells[(int)SalesTableColumns.IsHeaderRow].Value)
|
else if ((bool)row.Cells[(int)SalesTableColumns.IsMemberRow].EditedFormattedValue && !(bool)row.Cells[(int)SalesTableColumns.IsHeaderRow].EditedFormattedValue)
|
||||||
{
|
{
|
||||||
rowAttribute = 2;
|
rowAttribute = 2;
|
||||||
}
|
}
|
||||||
@@ -3399,7 +3495,7 @@ namespace AdvertsingProfitControl
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//Check to see if the row is dirty.
|
//Check to see if the row is dirty.
|
||||||
if (!(bool)row.Cells[(int)InventoryTableColumns.IsDirty].Value)
|
if (!(bool)row.Cells[(int)InventoryTableColumns.IsDirty].EditedFormattedValue)
|
||||||
{
|
{
|
||||||
//If it is not then continue on to the next row.
|
//If it is not then continue on to the next row.
|
||||||
continue;
|
continue;
|
||||||
@@ -3424,11 +3520,11 @@ namespace AdvertsingProfitControl
|
|||||||
}
|
}
|
||||||
//Determine the row's attribute.
|
//Determine the row's attribute.
|
||||||
var rowAttribute = 0; //Zero (0) means no grouping, its not a header nor a member.
|
var rowAttribute = 0; //Zero (0) means no grouping, its not a header nor a member.
|
||||||
if ((bool)row.Cells[(int)InventoryTableColumns.IsHeaderRow].Value && !(bool)row.Cells[(int)InventoryTableColumns.IsMemberRow].Value)
|
if ((bool)row.Cells[(int)InventoryTableColumns.IsHeaderRow].EditedFormattedValue && !(bool)row.Cells[(int)InventoryTableColumns.IsMemberRow].EditedFormattedValue)
|
||||||
{
|
{
|
||||||
rowAttribute = 1;
|
rowAttribute = 1;
|
||||||
}
|
}
|
||||||
else if ((bool)row.Cells[(int)InventoryTableColumns.IsMemberRow].Value && !(bool)row.Cells[(int)InventoryTableColumns.IsHeaderRow].Value)
|
else if ((bool)row.Cells[(int)InventoryTableColumns.IsMemberRow].EditedFormattedValue && !(bool)row.Cells[(int)InventoryTableColumns.IsHeaderRow].EditedFormattedValue)
|
||||||
{
|
{
|
||||||
rowAttribute = 2;
|
rowAttribute = 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||||
</dsig:Transforms>
|
</dsig:Transforms>
|
||||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||||
<dsig:DigestValue>b7XWNTKdLoveai+Ezig6qhdfRQNnqDFOegZLHdvzxx0=</dsig:DigestValue>
|
<dsig:DigestValue>opU00zIbvKlwE9ETDbcBw3wn43DC9oTiG2Ds1yBbqBA=</dsig:DigestValue>
|
||||||
</hash>
|
</hash>
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -43,14 +43,14 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="3613184">
|
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="3616256">
|
||||||
<assemblyIdentity name="AdvertsingProfitControl" version="0.9.5.2" language="neutral" processorArchitecture="amd64" />
|
<assemblyIdentity name="AdvertsingProfitControl" version="0.9.5.2" language="neutral" processorArchitecture="amd64" />
|
||||||
<hash>
|
<hash>
|
||||||
<dsig:Transforms>
|
<dsig:Transforms>
|
||||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||||
</dsig:Transforms>
|
</dsig:Transforms>
|
||||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||||
<dsig:DigestValue>JdsSdLXGV6xF3G52D7+6tloy6VbDDJnLshBRhBOm3iQ=</dsig:DigestValue>
|
<dsig:DigestValue>T8dp3gOWrMgWFpeIbwYfpgMQxCEBFP64iXUiGpV4wto=</dsig:DigestValue>
|
||||||
</hash>
|
</hash>
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
Reference in New Issue
Block a user