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
+15 -5
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);
@@ -846,8 +857,7 @@ namespace AdvertsingProfitControl
case 5:
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);