Updated the main form with a slightly new look. Finished all the code for the main for to pull in all the data from the database and perform calculations on it. Currently can only load the most recent date. Added detection for holidays in the weekly and taxable lists.
This commit is contained in:
@@ -164,27 +164,27 @@ namespace AdvertsingProfitControl
|
||||
var databaseTracker = new DatabaseTracker();
|
||||
var dataBaseReader = new DatabaseReader();
|
||||
|
||||
string dateId;
|
||||
int dateId;
|
||||
|
||||
//Check to see if a parameter has been passed.
|
||||
if (dateString == "")
|
||||
{
|
||||
//IF non were, then grab the most recent date ID from the database and use that.
|
||||
dateId = dataBaseReader.RetrieveMostRecentDateId(databaseTracker.DatabaseConnectionString);
|
||||
_console.WriteToLog(FrmLogConsole.Level.Info, dateId != "0" ? "Most recent date ID is " + dateId : "Most recent date ID is unavailable.");
|
||||
_console.WriteToLog(FrmLogConsole.Level.Info, dateId != 0 ? "Most recent date ID is " + dateId : "Most recent date ID is unavailable.");
|
||||
}
|
||||
else
|
||||
{
|
||||
//ELSE IF one was passed, then use it's ID to build the tables.
|
||||
dateId = dataBaseReader.RetrieveDateIdByDateString(dateString, databaseTracker.DatabaseConnectionString).ToString();
|
||||
_console.WriteToLog(FrmLogConsole.Level.Info, dateId != "0" ? "Date ID for " + dateString + " is resolved to have the ID of " + dateId + "." : "The date " + dateString + " could not be found in the database.");
|
||||
if (dateId == "0")
|
||||
dateId = dataBaseReader.RetrieveDateIdByDateString(dateString, databaseTracker.DatabaseConnectionString);
|
||||
_console.WriteToLog(FrmLogConsole.Level.Info, dateId != 0 ? "Date ID for " + dateString + " is resolved to have the ID of " + dateId + "." : "The date " + dateString + " could not be found in the database.");
|
||||
if (dateId == 0)
|
||||
{
|
||||
_gDateStringCollection.Remove(dateString);
|
||||
}
|
||||
}
|
||||
//Now check to make sure there were no errors grabbing the ID, IF there were return.
|
||||
if (dateId == "0") return;
|
||||
if (dateId == 0) return;
|
||||
//Clear all DataGridViews since the date supplied is valid and in the database.
|
||||
projectionsDataGridView.DataSource = null;
|
||||
inventoryDataGridView.DataSource = null;
|
||||
@@ -198,7 +198,7 @@ namespace AdvertsingProfitControl
|
||||
suppliersDataGridView.DataSource = dataBaseReader.ReturnInvoiceTable(dateId, databaseTracker.DatabaseConnectionString);
|
||||
weeklySalesDataGridView.DataSource = dataBaseReader.ReturnWeeklySalesFromDateId(dateId, databaseTracker.DatabaseConnectionString);
|
||||
|
||||
commentsTextBox.Text = dataBaseReader.RetrieveComments(dateId, databaseTracker.DatabaseConnectionString);
|
||||
commentsTextBox.Text = dataBaseReader.RetrieveComments(dateId, databaseTracker.DatabaseConnectionString)[1];
|
||||
if (commentsTextBox.Text.StartsWith("No comments"))
|
||||
{
|
||||
commentsTextBox.Enabled = false;
|
||||
|
||||
Reference in New Issue
Block a user