Fixed a bug on the modify record form where updating an existing row's ad item wouldn't mark the other APC tables as dirty.
This commit is contained in:
Binary file not shown.
+11
-1
@@ -85,6 +85,7 @@
|
|||||||
this.taxableDataGridView = new System.Windows.Forms.DataGridView();
|
this.taxableDataGridView = new System.Windows.Forms.DataGridView();
|
||||||
this.debugTabPage = new System.Windows.Forms.TabPage();
|
this.debugTabPage = new System.Windows.Forms.TabPage();
|
||||||
this.monthCalendar = new System.Windows.Forms.MonthCalendar();
|
this.monthCalendar = new System.Windows.Forms.MonthCalendar();
|
||||||
|
this.newModifyRecordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.mainTableLayoutPanel.SuspendLayout();
|
this.mainTableLayoutPanel.SuspendLayout();
|
||||||
this.mainMenu.SuspendLayout();
|
this.mainMenu.SuspendLayout();
|
||||||
this.commentMainTableLayoutPanel.SuspendLayout();
|
this.commentMainTableLayoutPanel.SuspendLayout();
|
||||||
@@ -164,7 +165,8 @@
|
|||||||
this.addRecordsToolStripMenuItem,
|
this.addRecordsToolStripMenuItem,
|
||||||
this.modifyRecordMainMenu,
|
this.modifyRecordMainMenu,
|
||||||
this.deleteRecordsMainMenu,
|
this.deleteRecordsMainMenu,
|
||||||
this.newFormTestToolStripMenuItem});
|
this.newFormTestToolStripMenuItem,
|
||||||
|
this.newModifyRecordToolStripMenuItem});
|
||||||
this.recordsToolStripMenuItem.Name = "recordsToolStripMenuItem";
|
this.recordsToolStripMenuItem.Name = "recordsToolStripMenuItem";
|
||||||
this.recordsToolStripMenuItem.Size = new System.Drawing.Size(98, 35);
|
this.recordsToolStripMenuItem.Size = new System.Drawing.Size(98, 35);
|
||||||
this.recordsToolStripMenuItem.Text = "&Records";
|
this.recordsToolStripMenuItem.Text = "&Records";
|
||||||
@@ -760,6 +762,13 @@
|
|||||||
this.monthCalendar.TabIndex = 0;
|
this.monthCalendar.TabIndex = 0;
|
||||||
this.monthCalendar.TabStop = false;
|
this.monthCalendar.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// newModifyRecordToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.newModifyRecordToolStripMenuItem.Name = "newModifyRecordToolStripMenuItem";
|
||||||
|
this.newModifyRecordToolStripMenuItem.Size = new System.Drawing.Size(323, 34);
|
||||||
|
this.newModifyRecordToolStripMenuItem.Text = "New Modify Record";
|
||||||
|
this.newModifyRecordToolStripMenuItem.Click += new System.EventHandler(this.newModifyRecordToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// FrmMain
|
// FrmMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(168F, 168F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(168F, 168F);
|
||||||
@@ -865,6 +874,7 @@
|
|||||||
private System.Windows.Forms.DataGridView taxableDataGridView;
|
private System.Windows.Forms.DataGridView taxableDataGridView;
|
||||||
private System.Windows.Forms.TabPage debugTabPage;
|
private System.Windows.Forms.TabPage debugTabPage;
|
||||||
private System.Windows.Forms.MonthCalendar monthCalendar;
|
private System.Windows.Forms.MonthCalendar monthCalendar;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem newModifyRecordToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -647,14 +647,11 @@ namespace AdvertsingProfitControl
|
|||||||
|
|
||||||
private void modifyRecordMainMenu_Click(object sender, EventArgs e)
|
private void modifyRecordMainMenu_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//var modifyForm = new FrmModifyRecord();
|
var modifyForm = new FrmModifyRecord();
|
||||||
//modifyForm.ShowDialog();
|
modifyForm.ShowDialog();
|
||||||
//BuildAndFillDataGridTables();
|
//BuildAndFillDataGridTables();
|
||||||
//CalculateProfitAnalysis();
|
//CalculateProfitAnalysis();
|
||||||
//CalculateGrossProfit();
|
//CalculateGrossProfit();
|
||||||
var date = DateTime.Parse(monthComboBox.SelectedItem + @"/" + dayComboBox.SelectedItem + @"/" + yearComboBox.SelectedItem);
|
|
||||||
var form = new NewModifyRecord(date);
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void manageItemsToolsMainMenu_Click(object sender, EventArgs e)
|
private void manageItemsToolsMainMenu_Click(object sender, EventArgs e)
|
||||||
@@ -761,6 +758,13 @@ namespace AdvertsingProfitControl
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void newModifyRecordToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var date = DateTime.Parse(monthComboBox.SelectedItem + @"/" + dayComboBox.SelectedItem + @"/" + yearComboBox.SelectedItem);
|
||||||
|
var form = new NewModifyRecord(date);
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//http://stackoverflow.com/questions/487661/how-do-i-suspend-painting-for-a-control-and-its-children
|
//http://stackoverflow.com/questions/487661/how-do-i-suspend-painting-for-a-control-and-its-children
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ namespace AdvertsingProfitControl
|
|||||||
invoicesDataGridView.Rows.Add(row.ItemArray);
|
invoicesDataGridView.Rows.Add(row.ItemArray);
|
||||||
}
|
}
|
||||||
inventoryDataGridView.Columns.Remove("RowAttribute");
|
inventoryDataGridView.Columns.Remove("RowAttribute");
|
||||||
inventoryDataGridView.Columns.Remove("FK_GroupID");
|
//inventoryDataGridView.Columns.Remove("FK_GroupID");
|
||||||
|
|
||||||
var weeklySalesTable = databaseReader.ReturnWeeklySalesFromDateId(dateId,
|
var weeklySalesTable = databaseReader.ReturnWeeklySalesFromDateId(dateId,
|
||||||
databaseTracker.DatabaseConnectionString);
|
databaseTracker.DatabaseConnectionString);
|
||||||
@@ -563,7 +563,7 @@ namespace AdvertsingProfitControl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dataGridView.Columns.Remove("RowAttribute");
|
dataGridView.Columns.Remove("RowAttribute");
|
||||||
dataGridView.Columns.Remove("Fk_GroupID");
|
//dataGridView.Columns.Remove("FK_AdSpecialName");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BuildDataGridViewInventoryTable(DataTable dataTable, DataGridView dataGridView)
|
private void BuildDataGridViewInventoryTable(DataTable dataTable, DataGridView dataGridView)
|
||||||
|
|||||||
@@ -1027,7 +1027,11 @@ namespace AdvertsingProfitControl
|
|||||||
{
|
{
|
||||||
var adItemText = projectionsDataGridView.Rows[e.RowIndex].Cells[adItemIndex].EditedFormattedValue.ToString();
|
var adItemText = projectionsDataGridView.Rows[e.RowIndex].Cells[adItemIndex].EditedFormattedValue.ToString();
|
||||||
actualSalesDataGridView.Rows[e.RowIndex].Cells[adItemIndex].Value = adItemText;
|
actualSalesDataGridView.Rows[e.RowIndex].Cells[adItemIndex].Value = adItemText;
|
||||||
|
actualSalesDataGridView.Rows[e.RowIndex].Cells[(int) SalesTableColumns.IsDirty].Value = true;
|
||||||
|
actualSalesDataGridView.Rows[e.RowIndex].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
||||||
inventoryDataGridView.Rows[e.RowIndex].Cells[adItemIndex].Value = adItemText;
|
inventoryDataGridView.Rows[e.RowIndex].Cells[adItemIndex].Value = adItemText;
|
||||||
|
inventoryDataGridView.Rows[e.RowIndex].Cells[(int) InventoryTableColumns.IsDirty].Value = true;
|
||||||
|
inventoryDataGridView.Rows[e.RowIndex].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
||||||
projectionsDataGridView.RefreshEdit();
|
projectionsDataGridView.RefreshEdit();
|
||||||
//Remove the last ad item from the UsedAdItem array, the new one will be added in the OnRowLeave event handler.
|
//Remove the last ad item from the UsedAdItem array, the new one will be added in the OnRowLeave event handler.
|
||||||
if (_adSpecialIndex == -1 || e.RowIndex < _adSpecialIndex)
|
if (_adSpecialIndex == -1 || e.RowIndex < _adSpecialIndex)
|
||||||
@@ -1385,7 +1389,11 @@ namespace AdvertsingProfitControl
|
|||||||
{
|
{
|
||||||
var adItemText = inventoryDataGridView.Rows[e.RowIndex].Cells[adItemIndex].EditedFormattedValue.ToString();
|
var adItemText = inventoryDataGridView.Rows[e.RowIndex].Cells[adItemIndex].EditedFormattedValue.ToString();
|
||||||
projectionsDataGridView.Rows[e.RowIndex].Cells[adItemIndex].Value = adItemText;
|
projectionsDataGridView.Rows[e.RowIndex].Cells[adItemIndex].Value = adItemText;
|
||||||
|
projectionsDataGridView.Rows[e.RowIndex].Cells[(int) SalesTableColumns.IsDirty].Value = true;
|
||||||
|
projectionsDataGridView.Rows[e.RowIndex].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
||||||
actualSalesDataGridView.Rows[e.RowIndex].Cells[adItemIndex].Value = adItemText;
|
actualSalesDataGridView.Rows[e.RowIndex].Cells[adItemIndex].Value = adItemText;
|
||||||
|
actualSalesDataGridView.Rows[e.RowIndex].Cells[(int) SalesTableColumns.IsDirty].Value = true;
|
||||||
|
actualSalesDataGridView.Rows[e.RowIndex].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
||||||
//inventoryDataGridView.RefreshEdit();
|
//inventoryDataGridView.RefreshEdit();
|
||||||
//Remove the last ad item from the UsedAdItem array, the new one will be added in the OnRowLeave event handler.
|
//Remove the last ad item from the UsedAdItem array, the new one will be added in the OnRowLeave event handler.
|
||||||
if (_adSpecialIndex == -1 || e.RowIndex < _adSpecialIndex)
|
if (_adSpecialIndex == -1 || e.RowIndex < _adSpecialIndex)
|
||||||
@@ -1542,7 +1550,11 @@ namespace AdvertsingProfitControl
|
|||||||
{
|
{
|
||||||
var adItemText = actualSalesDataGridView.Rows[e.RowIndex].Cells[adItemIndex].EditedFormattedValue.ToString();
|
var adItemText = actualSalesDataGridView.Rows[e.RowIndex].Cells[adItemIndex].EditedFormattedValue.ToString();
|
||||||
projectionsDataGridView.Rows[e.RowIndex].Cells[adItemIndex].Value = adItemText;
|
projectionsDataGridView.Rows[e.RowIndex].Cells[adItemIndex].Value = adItemText;
|
||||||
|
projectionsDataGridView.Rows[e.RowIndex].Cells[(int) SalesTableColumns.IsDirty].Value = true;
|
||||||
|
projectionsDataGridView.Rows[e.RowIndex].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
||||||
inventoryDataGridView.Rows[e.RowIndex].Cells[adItemIndex].Value = adItemText;
|
inventoryDataGridView.Rows[e.RowIndex].Cells[adItemIndex].Value = adItemText;
|
||||||
|
inventoryDataGridView.Rows[e.RowIndex].Cells[(int) InventoryTableColumns.IsDirty].Value = true;
|
||||||
|
inventoryDataGridView.Rows[e.RowIndex].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
|
||||||
//projectionsDataGridView.RefreshEdit();
|
//projectionsDataGridView.RefreshEdit();
|
||||||
//Remove the last ad item from the UsedAdItem array, the new one will be added in the OnRowLeave event handler.
|
//Remove the last ad item from the UsedAdItem array, the new one will be added in the OnRowLeave event handler.
|
||||||
if (_adSpecialIndex == -1 || e.RowIndex < _adSpecialIndex)
|
if (_adSpecialIndex == -1 || e.RowIndex < _adSpecialIndex)
|
||||||
@@ -2127,15 +2139,27 @@ namespace AdvertsingProfitControl
|
|||||||
var projections = databaseReader.ReturnProjectionsTable(dateId, databaseTracker.DatabaseConnectionString);
|
var projections = databaseReader.ReturnProjectionsTable(dateId, databaseTracker.DatabaseConnectionString);
|
||||||
var inventory = databaseReader.ReturnInventoryTable(dateId, databaseTracker.DatabaseConnectionString);
|
var inventory = databaseReader.ReturnInventoryTable(dateId, databaseTracker.DatabaseConnectionString);
|
||||||
var actualSales = databaseReader.ReturnActualSales(dateId, databaseTracker.DatabaseConnectionString);
|
var actualSales = databaseReader.ReturnActualSales(dateId, databaseTracker.DatabaseConnectionString);
|
||||||
LoadApcTables(projections, inventory, actualSales);
|
LoadProjectionsTable(projections);
|
||||||
|
LoadInventory(inventory);
|
||||||
|
LoadActualSales(actualSales);
|
||||||
var invoices = databaseReader.ReturnInvoiceTable(dateId, databaseTracker.DatabaseConnectionString);
|
var invoices = databaseReader.ReturnInvoiceTable(dateId, databaseTracker.DatabaseConnectionString);
|
||||||
|
|
||||||
|
//Re-enable the events
|
||||||
projectionsDataGridView.CellEnter += StoreBeginningCellValue;
|
projectionsDataGridView.CellEnter += StoreBeginningCellValue;
|
||||||
projectionsDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
projectionsDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
||||||
projectionsDataGridView.CellValidating += ValidateSalesDataGridViewCellContents;
|
projectionsDataGridView.CellValidating += ValidateSalesDataGridViewCellContents;
|
||||||
projectionsDataGridView.RowValidating += ValidateProjectedRow;
|
projectionsDataGridView.RowValidating += ValidateProjectedRow;
|
||||||
|
inventoryDataGridView.CellEnter += StoreBeginningCellValue;
|
||||||
|
inventoryDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
||||||
|
inventoryDataGridView.CellValidating += ValidateInventoryCellContents;
|
||||||
|
inventoryDataGridView.RowValidating += ValidateInventoryRow;
|
||||||
|
actualSalesDataGridView.CellEnter += StoreBeginningCellValue;
|
||||||
|
actualSalesDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
||||||
|
actualSalesDataGridView.CellValidating += ValidateSalesDataGridViewCellContents;
|
||||||
|
actualSalesDataGridView.RowValidating += ValidateActualSalesRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadApcTables(DataTable projections, DataTable inventory, DataTable actualSales)
|
private void LoadProjectionsTable(DataTable projections)
|
||||||
{
|
{
|
||||||
//Assuming all the tables are correctly aligned.
|
//Assuming all the tables are correctly aligned.
|
||||||
//Disable the relevant events in the DataGridViews
|
//Disable the relevant events in the DataGridViews
|
||||||
@@ -2144,17 +2168,17 @@ namespace AdvertsingProfitControl
|
|||||||
projectionsDataGridView.CellValidating -= ValidateSalesDataGridViewCellContents;
|
projectionsDataGridView.CellValidating -= ValidateSalesDataGridViewCellContents;
|
||||||
projectionsDataGridView.RowValidating -= ValidateProjectedRow;
|
projectionsDataGridView.RowValidating -= ValidateProjectedRow;
|
||||||
|
|
||||||
for(var i = 0; i < projections.Rows.Count; i++)
|
for(var rowIndex = 0; rowIndex < projections.Rows.Count; rowIndex++)
|
||||||
{
|
{
|
||||||
var newRow = new DataGridViewRow();
|
var newRow = new DataGridViewRow();
|
||||||
for (var cellIndex = 0; cellIndex < projections.Rows[i].ItemArray.Length; cellIndex++)
|
for (var cellIndex = 0; cellIndex < projections.Rows[rowIndex].ItemArray.Length; cellIndex++)
|
||||||
{
|
{
|
||||||
//ID and Ad Item.
|
//ID and Ad Item.
|
||||||
if (cellIndex <= 1)
|
if (cellIndex <= 1)
|
||||||
{
|
{
|
||||||
var cell = new DataGridViewTextBoxCell
|
var cell = new DataGridViewTextBoxCell
|
||||||
{
|
{
|
||||||
Value = projections.Rows[i].ItemArray[cellIndex].ToString()
|
Value = projections.Rows[rowIndex].ItemArray[cellIndex].ToString()
|
||||||
};
|
};
|
||||||
newRow.Cells.Add(cell);
|
newRow.Cells.Add(cell);
|
||||||
continue;
|
continue;
|
||||||
@@ -2162,14 +2186,14 @@ namespace AdvertsingProfitControl
|
|||||||
//Everything in between the ad item cell and the row attribute cells.
|
//Everything in between the ad item cell and the row attribute cells.
|
||||||
if (cellIndex > 1 && cellIndex <= 7)
|
if (cellIndex > 1 && cellIndex <= 7)
|
||||||
{
|
{
|
||||||
if (projections.Rows[i].ItemArray[cellIndex].ToString() == "0")
|
if (projections.Rows[rowIndex].ItemArray[cellIndex].ToString() == "0")
|
||||||
{
|
{
|
||||||
var cell = new DataGridViewTextBoxCell {Value = ""};
|
var cell = new DataGridViewTextBoxCell {Value = ""};
|
||||||
newRow.Cells.Add(cell);
|
newRow.Cells.Add(cell);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var cell = new DataGridViewTextBoxCell { Value = projections.Rows[i].ItemArray[cellIndex].ToString() };
|
var cell = new DataGridViewTextBoxCell { Value = projections.Rows[rowIndex].ItemArray[cellIndex].ToString() };
|
||||||
newRow.Cells.Add(cell);
|
newRow.Cells.Add(cell);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@@ -2179,7 +2203,7 @@ namespace AdvertsingProfitControl
|
|||||||
{
|
{
|
||||||
var isHeaderCell = new DataGridViewCheckBoxCell(false);
|
var isHeaderCell = new DataGridViewCheckBoxCell(false);
|
||||||
var isMemberCell = new DataGridViewCheckBoxCell(false);
|
var isMemberCell = new DataGridViewCheckBoxCell(false);
|
||||||
var rowAttribute = int.Parse(projections.Rows[i].ItemArray[cellIndex].ToString());
|
var rowAttribute = int.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString());
|
||||||
switch (rowAttribute)
|
switch (rowAttribute)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
@@ -2200,25 +2224,198 @@ namespace AdvertsingProfitControl
|
|||||||
//Check the group it is part of if any.
|
//Check the group it is part of if any.
|
||||||
if (cellIndex == 9)
|
if (cellIndex == 9)
|
||||||
{
|
{
|
||||||
if (projections.Rows[i].ItemArray[cellIndex].ToString() != "0" && _adSpecialIndex == -1)
|
if (projections.Rows[rowIndex].ItemArray[cellIndex].ToString() != "0" && _adSpecialIndex == -1)
|
||||||
{
|
{
|
||||||
var databaseTracker = new DatabaseTracker();
|
var databaseTracker = new DatabaseTracker();
|
||||||
var databaseReader = new DatabaseReader();
|
var databaseReader = new DatabaseReader();
|
||||||
var groupName =
|
var groupName =
|
||||||
databaseReader.ReturnGroupNameFromGroupId(
|
databaseReader.ReturnGroupNameFromGroupId(
|
||||||
projections.Rows[i].ItemArray[cellIndex].ToString(),
|
projections.Rows[rowIndex].ItemArray[cellIndex].ToString(),
|
||||||
databaseTracker.DatabaseConnectionString);
|
databaseTracker.DatabaseConnectionString);
|
||||||
var adSpecialRow = new DataGridViewRow();
|
var adSpecialRow = new DataGridViewRow();
|
||||||
projectionsDataGridView.Rows.Add(adSpecialRow);
|
projectionsDataGridView.Rows.Add(adSpecialRow);
|
||||||
projectionsDataGridView.Rows[i].Cells[1].Value = groupName;
|
projectionsDataGridView.Rows[rowIndex].Cells[1].Value = groupName;
|
||||||
projectionsDataGridView.Rows[i].DefaultCellStyle.BackColor = ApplicationColors.AdSpecial;
|
projectionsDataGridView.Rows[rowIndex].DefaultCellStyle.BackColor = ApplicationColors.AdSpecial;
|
||||||
_adSpecialIndex = i;
|
_adSpecialIndex = rowIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
projectionsDataGridView.Rows.Add(newRow);
|
projectionsDataGridView.Rows.Add(newRow);
|
||||||
}
|
}
|
||||||
//Re-enable the events
|
}
|
||||||
|
|
||||||
|
private void LoadInventory(DataTable inventoryTable)
|
||||||
|
{
|
||||||
|
//Assuming all the tables are correctly aligned.
|
||||||
|
//Disable the relevant events in the DataGridViews
|
||||||
|
inventoryDataGridView.CellEnter -= StoreBeginningCellValue;
|
||||||
|
inventoryDataGridView.RowLeave -= UpdateUsedAdItemCollectionOnRowLeave;
|
||||||
|
inventoryDataGridView.CellValidating -= ValidateInventoryCellContents;
|
||||||
|
inventoryDataGridView.RowValidating -= ValidateInventoryRow;
|
||||||
|
//Create a local ad special index since Projections should have filled the ad special index in for the class.
|
||||||
|
var adSpecialIndex = -1;
|
||||||
|
|
||||||
|
for (var rowIndex = 0; rowIndex < inventoryTable.Rows.Count; rowIndex++)
|
||||||
|
{
|
||||||
|
var newRow = new DataGridViewRow();
|
||||||
|
for (var cellIndex = 0; cellIndex < inventoryTable.Rows[rowIndex].ItemArray.Length; cellIndex++)
|
||||||
|
{
|
||||||
|
//ID and Ad Item.
|
||||||
|
if (cellIndex <= 1)
|
||||||
|
{
|
||||||
|
var cell = new DataGridViewTextBoxCell
|
||||||
|
{
|
||||||
|
Value = inventoryTable.Rows[rowIndex].ItemArray[cellIndex].ToString()
|
||||||
|
};
|
||||||
|
newRow.Cells.Add(cell);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//Everything in between the ad item cell and the row attribute cells.
|
||||||
|
if (cellIndex > 1 && cellIndex <= 5)
|
||||||
|
{
|
||||||
|
if (inventoryTable.Rows[rowIndex].ItemArray[cellIndex].ToString() == "0")
|
||||||
|
{
|
||||||
|
var cell = new DataGridViewTextBoxCell { Value = "" };
|
||||||
|
newRow.Cells.Add(cell);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var cell = new DataGridViewTextBoxCell { Value = inventoryTable.Rows[rowIndex].ItemArray[cellIndex].ToString() };
|
||||||
|
newRow.Cells.Add(cell);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//Check the attribute cell.
|
||||||
|
if (cellIndex == 6)
|
||||||
|
{
|
||||||
|
var isHeaderCell = new DataGridViewCheckBoxCell(false);
|
||||||
|
var isMemberCell = new DataGridViewCheckBoxCell(false);
|
||||||
|
var rowAttribute = int.Parse(inventoryTable.Rows[rowIndex].ItemArray[cellIndex].ToString());
|
||||||
|
switch (rowAttribute)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
//Header row
|
||||||
|
isHeaderCell.Value = true;
|
||||||
|
newRow.DefaultCellStyle.BackColor = ApplicationColors.HeaderRow;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
//Member Row
|
||||||
|
isMemberCell.Value = true;
|
||||||
|
newRow.DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
newRow.Cells.Add(isHeaderCell);
|
||||||
|
newRow.Cells.Add(isMemberCell);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//Check the group it is part of if any.
|
||||||
|
if (cellIndex == 7)
|
||||||
|
{
|
||||||
|
if (inventoryTable.Rows[rowIndex].ItemArray[cellIndex].ToString() != "0" && adSpecialIndex == -1)
|
||||||
|
{
|
||||||
|
var databaseTracker = new DatabaseTracker();
|
||||||
|
var databaseReader = new DatabaseReader();
|
||||||
|
var groupName =
|
||||||
|
databaseReader.ReturnGroupNameFromGroupId(
|
||||||
|
inventoryTable.Rows[rowIndex].ItemArray[cellIndex].ToString(),
|
||||||
|
databaseTracker.DatabaseConnectionString);
|
||||||
|
var adSpecialRow = new DataGridViewRow();
|
||||||
|
inventoryDataGridView.Rows.Add(adSpecialRow);
|
||||||
|
inventoryDataGridView.Rows[rowIndex].Cells[1].Value = groupName;
|
||||||
|
inventoryDataGridView.Rows[rowIndex].DefaultCellStyle.BackColor = ApplicationColors.AdSpecial;
|
||||||
|
adSpecialIndex = rowIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inventoryDataGridView.Rows.Add(newRow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadActualSales(DataTable actualSales)
|
||||||
|
{
|
||||||
|
//Assuming all the tables are correctly aligned.
|
||||||
|
//Disable the relevant events in the DataGridViews
|
||||||
|
actualSalesDataGridView.CellEnter -= StoreBeginningCellValue;
|
||||||
|
actualSalesDataGridView.RowLeave -= UpdateUsedAdItemCollectionOnRowLeave;
|
||||||
|
actualSalesDataGridView.CellValidating -= ValidateSalesDataGridViewCellContents;
|
||||||
|
actualSalesDataGridView.RowValidating -= ValidateActualSalesRow;
|
||||||
|
//Create a local ad special index since Projections should have filled the ad special index in for the class.
|
||||||
|
var adSpecialIndex = -1;
|
||||||
|
|
||||||
|
for (var rowIndex = 0; rowIndex < actualSales.Rows.Count; rowIndex++)
|
||||||
|
{
|
||||||
|
var newRow = new DataGridViewRow();
|
||||||
|
for (var cellIndex = 0; cellIndex < actualSales.Rows[rowIndex].ItemArray.Length; cellIndex++)
|
||||||
|
{
|
||||||
|
//ID and Ad Item.
|
||||||
|
if (cellIndex <= 1)
|
||||||
|
{
|
||||||
|
var cell = new DataGridViewTextBoxCell
|
||||||
|
{
|
||||||
|
Value = actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString()
|
||||||
|
};
|
||||||
|
newRow.Cells.Add(cell);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//Everything in between the ad item cell and the row attribute cells.
|
||||||
|
if (cellIndex > 1 && cellIndex <= 7)
|
||||||
|
{
|
||||||
|
if (actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() == "0")
|
||||||
|
{
|
||||||
|
var cell = new DataGridViewTextBoxCell { Value = "" };
|
||||||
|
newRow.Cells.Add(cell);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var cell = new DataGridViewTextBoxCell { Value = actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() };
|
||||||
|
newRow.Cells.Add(cell);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//Check the attribute cell.
|
||||||
|
if (cellIndex == 8)
|
||||||
|
{
|
||||||
|
var isHeaderCell = new DataGridViewCheckBoxCell(false);
|
||||||
|
var isMemberCell = new DataGridViewCheckBoxCell(false);
|
||||||
|
var rowAttribute = int.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString());
|
||||||
|
switch (rowAttribute)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
//Header row
|
||||||
|
isHeaderCell.Value = true;
|
||||||
|
newRow.DefaultCellStyle.BackColor = ApplicationColors.HeaderRow;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
//Member Row
|
||||||
|
isMemberCell.Value = true;
|
||||||
|
newRow.DefaultCellStyle.BackColor = ApplicationColors.MemberRow;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
newRow.Cells.Add(isHeaderCell);
|
||||||
|
newRow.Cells.Add(isMemberCell);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//Check the group it is part of if any.
|
||||||
|
if (cellIndex == 9)
|
||||||
|
{
|
||||||
|
if (actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() != "0" && adSpecialIndex == -1)
|
||||||
|
{
|
||||||
|
var databaseTracker = new DatabaseTracker();
|
||||||
|
var databaseReader = new DatabaseReader();
|
||||||
|
var groupName =
|
||||||
|
databaseReader.ReturnGroupNameFromGroupId(
|
||||||
|
actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString(),
|
||||||
|
databaseTracker.DatabaseConnectionString);
|
||||||
|
var adSpecialRow = new DataGridViewRow();
|
||||||
|
actualSalesDataGridView.Rows.Add(adSpecialRow);
|
||||||
|
actualSalesDataGridView.Rows[rowIndex].Cells[1].Value = groupName;
|
||||||
|
actualSalesDataGridView.Rows[rowIndex].DefaultCellStyle.BackColor = ApplicationColors.AdSpecial;
|
||||||
|
adSpecialIndex = rowIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
actualSalesDataGridView.Rows.Add(newRow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NormalizeApcTables(DataTable projetions, DataTable inventory, DataTable actualSales, string dateId)
|
private void NormalizeApcTables(DataTable projetions, DataTable inventory, DataTable actualSales, string dateId)
|
||||||
|
|||||||
@@ -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>BL2VwteFPdU1C5eFgLcNJB6t71bYUCKbAJpayKyfE2c=</dsig:DigestValue>
|
<dsig:DigestValue>hjoJ6F3S2mx0T7+16nfA9mg2vO2CJ4FO+GQ/EyPYf58=</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="3592192">
|
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="3594752">
|
||||||
<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>E5XDgx2BUQtUy2BTSxYDHOSv9/kMPusOEpgSdyhYHzk=</dsig:DigestValue>
|
<dsig:DigestValue>vZ/15zn6UnQyxvEn4XYMV+E1MUxIXiQdJmnSal6RNFc=</dsig:DigestValue>
|
||||||
</hash>
|
</hash>
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -93,7 +93,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>UQFU3HlwUiJQK2YXuAkDK9mSdSFJnVT3pbRsOpcjnAg=</dsig:DigestValue>
|
<dsig:DigestValue>ZGKhdhvn6U66O06l/eGiap8UW45ciijpPInT3o/xuMc=</dsig:DigestValue>
|
||||||
</hash>
|
</hash>
|
||||||
</file>
|
</file>
|
||||||
<file name="Stretched Logo Collection.ico" size="370070">
|
<file name="Stretched Logo Collection.ico" size="370070">
|
||||||
|
|||||||
Reference in New Issue
Block a user