Add and modify forms texted with real data. Fixed a few crash bugs and precision errors. Fixed the Actual Sales table in Access was missing a row. Add sample data to the database.

This commit is contained in:
2017-01-21 23:20:59 -06:00
parent e7d719b1ba
commit ac16bbc05c
9 changed files with 83 additions and 34 deletions
Binary file not shown.
Binary file not shown.
@@ -214,7 +214,6 @@
<DesignTime>True</DesignTime>
</Compile>
<None Include="AdvertsingProfitControl_TemporaryKey.pfx" />
<None Include="APCDatabase.bak" />
<None Include="app.manifest" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
+4 -4
View File
@@ -153,10 +153,10 @@ namespace AdvertsingProfitControl
//11:FK_DateID
oleDbCommand.Parameters.AddWithValue("Sold", salesTable.Rows[i][1]);
oleDbCommand.Parameters.AddWithValue("SalesPrice", salesTable.Rows[i][2]);
oleDbCommand.Parameters.AddWithValue("TotalSales", int.Parse(salesTable.Rows[i][3].ToString()));
oleDbCommand.Parameters.AddWithValue("Cost", int.Parse(salesTable.Rows[i][4].ToString()));
oleDbCommand.Parameters.AddWithValue("ProfitReturn", int.Parse(salesTable.Rows[i][5].ToString()));
oleDbCommand.Parameters.AddWithValue("TotalProfitReturn", int.Parse(salesTable.Rows[i][6].ToString()));
oleDbCommand.Parameters.AddWithValue("TotalSales", double.Parse(salesTable.Rows[i][3].ToString()));
oleDbCommand.Parameters.AddWithValue("Cost", double.Parse(salesTable.Rows[i][4].ToString()));
oleDbCommand.Parameters.AddWithValue("ProfitReturn", double.Parse(salesTable.Rows[i][5].ToString()));
oleDbCommand.Parameters.AddWithValue("TotalProfitReturn", double.Parse(salesTable.Rows[i][6].ToString()));
oleDbCommand.Parameters.AddWithValue("FK_AdItemID", int.Parse(salesTable.Rows[i][7].ToString()));
oleDbCommand.Parameters.AddWithValue("RowAttribute", int.Parse(salesTable.Rows[i][8].ToString()));
oleDbCommand.Parameters.AddWithValue("adSpecialID", int.Parse(salesTable.Rows[i][9].ToString()));
+14 -4
View File
@@ -29,9 +29,9 @@ namespace AdvertsingProfitControl
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
monthCalendar.BoldedDates = databaseReader.RetrieveDates(databaseTracker.DatabaseConnectionString).ToArray();
RowParsing.AdSpecialGroups.AddRange(databaseReader.ReturnGroupNameList(databaseTracker.DatabaseConnectionString));
ConstructApcDataGridViews();
ConstructInvoicesDataGridView();
RowParsing.AdSpecialGroups.AddRange(databaseReader.ReturnGroupNameList(databaseTracker.DatabaseConnectionString));
var date = databaseReader.RetrieveMostRecentDate(databaseTracker.DatabaseConnectionString);
monthCalendar.SelectionStart = date;
_currentActiveDate = date;
@@ -360,6 +360,16 @@ namespace AdvertsingProfitControl
{
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
if (monthCalendar.BoldedDates.Length == 0)
{
//The database is most likely empty so halt everything.
dateTimeGroupBox.Text = @"The database appears to be empty.";
modifyRecordMainMenu.Enabled = false;
modifyRecordMainMenu.ToolTipText = @"There are no records to modify.";
return;
}
modifyRecordMainMenu.Enabled = true;
modifyRecordMainMenu.ToolTipText = @"";
var dateId = databaseReader.RetrieveDateIdByDateString(date.ToString("d"),
databaseTracker.DatabaseConnectionString);
if (dateId == 0)
@@ -836,9 +846,10 @@ namespace AdvertsingProfitControl
continue;
//Apply formatting to the only cells that will have currency values in them.
case 4:
var netAmountAtCost = double.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString()).ToString("N2");
if (netAmountAtCost != "0.00")
var netAmountAtCost = double.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString());
if (netAmountAtCost.ToString("N2") != "0.00")
{
_totalInvoicePurchases += netAmountAtCost;
cell.Value = netAmountAtCost;
}
row.Cells.Add(cell);
@@ -847,7 +858,6 @@ namespace AdvertsingProfitControl
var netAmoundExtendedRetail = double.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString());
if (netAmoundExtendedRetail.ToString("N2") != "0.00")
{
_totalInvoicePurchases += netAmoundExtendedRetail;
cell.Value = netAmoundExtendedRetail.ToString("N2");
}
row.Cells.Add(cell);
+35 -12
View File
@@ -1048,6 +1048,18 @@ namespace AdvertsingProfitControl
rowContents[i] = projectionsDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString();
}
break;
case (int)SalesTableColumns.ProfitReturn:
//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() == "")
{
rowContents[i] = "";
}
//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();
}
break;
case (int)SalesTableColumns.IsDirty:
rowContents[i] = true;
break;
@@ -1576,6 +1588,9 @@ namespace AdvertsingProfitControl
case (int)SalesTableColumns.Cost:
rowContents[i] = actualSalesDataGridView.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;
break;
@@ -1731,7 +1746,7 @@ namespace AdvertsingProfitControl
};
if (name.Contains("ID"))
{
//column.Visible = false;
column.Visible = false;
}
projectionsDataGridView.Columns.Add(column);
}
@@ -1742,7 +1757,7 @@ namespace AdvertsingProfitControl
Name = name,
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(bool),
//Visible = false,
Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
projectionsDataGridView.Columns.Add(column);
@@ -1761,6 +1776,10 @@ namespace AdvertsingProfitControl
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
};
if (name.Contains("ID"))
{
column.Visible = false;
}
inventoryDataGridView.Columns.Add(column);
}
else
@@ -1770,7 +1789,7 @@ namespace AdvertsingProfitControl
Name = name,
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(bool),
//Visible = false,
Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
inventoryDataGridView.Columns.Add(column);
@@ -1789,6 +1808,10 @@ namespace AdvertsingProfitControl
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
};
if (name.Contains("ID"))
{
column.Visible = false;
}
actualSalesDataGridView.Columns.Add(column);
}
else
@@ -1798,7 +1821,7 @@ namespace AdvertsingProfitControl
Name = name,
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(bool),
//Visible = false,
Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
actualSalesDataGridView.Columns.Add(column);
@@ -1827,7 +1850,7 @@ namespace AdvertsingProfitControl
};
if (name.Contains("ID"))
{
//column.Visible = false;
column.Visible = false;
}
invoicesDataGridView.Columns.Add(column);
}
@@ -1837,7 +1860,7 @@ namespace AdvertsingProfitControl
{
Name = name,
ValueType = typeof(bool),
//Visible = false,
Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
invoicesDataGridView.Columns.Add(column);
@@ -2450,7 +2473,7 @@ namespace AdvertsingProfitControl
continue;
}
//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.
continue;
@@ -2476,11 +2499,11 @@ namespace AdvertsingProfitControl
}
//Determine the row's attribute.
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;
}
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;
}
@@ -2607,7 +2630,7 @@ namespace AdvertsingProfitControl
continue;
}
//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.
continue;
@@ -2632,11 +2655,11 @@ namespace AdvertsingProfitControl
}
//Determine the row's attribute.
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;
}
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;
}
+14 -6
View File
@@ -1779,7 +1779,7 @@ namespace AdvertsingProfitControl
};
if (name.Contains("ID"))
{
//column.Visible = false;
column.Visible = false;
}
projectionsDataGridView.Columns.Add(column);
}
@@ -1790,7 +1790,7 @@ namespace AdvertsingProfitControl
Name = name,
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(bool),
//Visible = false,
Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
projectionsDataGridView.Columns.Add(column);
@@ -1809,6 +1809,10 @@ namespace AdvertsingProfitControl
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
};
if (name.Contains("ID"))
{
column.Visible = false;
}
inventoryDataGridView.Columns.Add(column);
}
else
@@ -1818,7 +1822,7 @@ namespace AdvertsingProfitControl
Name = name,
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(bool),
//Visible = false,
Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
inventoryDataGridView.Columns.Add(column);
@@ -1837,6 +1841,10 @@ namespace AdvertsingProfitControl
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
};
if (name.Contains("ID"))
{
column.Visible = false;
}
actualSalesDataGridView.Columns.Add(column);
}
else
@@ -1846,7 +1854,7 @@ namespace AdvertsingProfitControl
Name = name,
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(bool),
//Visible = false,
Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
actualSalesDataGridView.Columns.Add(column);
@@ -3245,7 +3253,7 @@ namespace AdvertsingProfitControl
}
if (displayInformation) informationLabel.Text += @"Successfully saved inventory." + Environment.NewLine;
}
else if (projectionsTrimmingStatus == TrimmingOperationResult.NoChangesRequired)
else if (inventoryTrimmingStatus == TrimmingOperationResult.NoChangesRequired)
{
if (displayInformation) informationLabel.Text += @"No changes to inventory detected." + Environment.NewLine;
}
@@ -3298,7 +3306,7 @@ namespace AdvertsingProfitControl
}
if (displayInformation) informationLabel.Text += @"Successfully saved actual sales." + Environment.NewLine;
}
else if (projectionsTrimmingStatus == TrimmingOperationResult.NoChangesRequired)
else if (actualSalesTrimmingStatus == TrimmingOperationResult.NoChangesRequired)
{
if (displayInformation) informationLabel.Text += @"No changes to actual sales detected." + Environment.NewLine;
}
@@ -7,14 +7,14 @@
<framework targetVersion="4.5" profile="Full" supportedRuntime="4.0.30319" />
</compatibleFrameworks>
<dependency>
<dependentAssembly dependencyType="install" codebase="AdvertsingProfitControl.exe.manifest" size="7096">
<dependentAssembly dependencyType="install" codebase="AdvertsingProfitControl.exe.manifest" size="7492">
<assemblyIdentity name="AdvertsingProfitControl.exe" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="amd64" type="win32" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>KVKYbzq19q7ADJ+LPTGDgJAvr64l2Kmoa+3avj6GEKs=</dsig:DigestValue>
<dsig:DigestValue>4D9q8qCwiqDGT3of5bXJu3aFzAW8154WMEsO9/5DONI=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
@@ -43,14 +43,14 @@
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="3625472">
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="3626496">
<assemblyIdentity name="AdvertsingProfitControl" version="0.9.5.2" language="neutral" processorArchitecture="amd64" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>4RF9KpTz/tkh9aGV9uAdFH9h8OP+W7p1PkgSLnYAU7o=</dsig:DigestValue>
<dsig:DigestValue>IDxVw5Mjas8mXXn3h6ET9uRIbyaYf3MJ7XGeYh9OL1Y=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
@@ -87,13 +87,22 @@
<dsig:DigestValue>e48EkTyChGHXYJETENSLw7RKQ1LZ5ZDUghEtiv5DmqY=</dsig:DigestValue>
</hash>
</file>
<file name="APCDatabase.accdb" size="2932736">
<file name="APCDatabase.accdb" size="851968">
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>BhxzzAVktfxM46PKaURg6/dVO+AoTuOm4bm2CLmjz1A=</dsig:DigestValue>
<dsig:DigestValue>nsG4CuZailUF1ECpDsxZlFsXSEJmyBXTAvuId+rQuQ8=</dsig:DigestValue>
</hash>
</file>
<file name="APCTemplate.accdb" size="819200">
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>HWMXjUaEQtZd0vBm2k4ValXtZwmVzcqV0rERViSzOOc=</dsig:DigestValue>
</hash>
</file>
<file name="Stretched Logo Collection.ico" size="370070">