Completely removed all the old database interaction code, save the database converter form. Updated the formatting in the weekly and taxable areas on the modify record form. Re-enabled holiday checking on the main form.
This commit is contained in:
@@ -122,10 +122,9 @@ namespace AdvertsingProfitControl
|
||||
var actualSales = ReturnActualSales(oldDateId);
|
||||
var invoices = ReturnInvoiceTable(oldDateId);
|
||||
var weeklySales = ReturnWeeklySalesFromDateId(oldDateId);
|
||||
var dbR = new DatabaseReader();
|
||||
var taxable = dbR.ReturnTaxableFromDateId(oldDateId, _connectionString);
|
||||
var taxable = ReturnTaxableFromDateId(oldDateId, _connectionString);
|
||||
var comment = GetComments(oldDateId);
|
||||
var costs = dbR.ReturnCostAnalysis(oldDateId, _connectionString);
|
||||
var costs = ReturnCostAnalysis(oldDateId, _connectionString);
|
||||
MassiveWriteFunction(date.ToString(), projectionsTable, inventoryTable, actualSales, invoices, weeklySales, taxable, costs, comment);
|
||||
}
|
||||
}
|
||||
@@ -710,5 +709,56 @@ namespace AdvertsingProfitControl
|
||||
|
||||
return dataTable;
|
||||
}
|
||||
|
||||
public DataTable ReturnTaxableFromDateId(int dateId, string connectionString)
|
||||
{
|
||||
var dataTable = new DataTable();
|
||||
var oleDbCommand = new OleDbCommand
|
||||
{
|
||||
CommandText = "SELECT Taxable.ID, Taxable.Sunday, Taxable.Monday, Taxable.Tuesday, Taxable.Wednesday, Taxable.Thursday, Taxable.Friday, Taxable.Saturday, Taxable.Total FROM Taxable WHERE FK_DateID = ?"
|
||||
};
|
||||
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
|
||||
var connection = new OleDbConnection(connectionString);
|
||||
oleDbCommand.Connection = connection;
|
||||
using (connection)
|
||||
{
|
||||
using (oleDbCommand)
|
||||
{
|
||||
connection.Open();
|
||||
using (var dataAdapter = new OleDbDataAdapter(oleDbCommand))
|
||||
{
|
||||
dataAdapter.Fill(dataTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dataTable;
|
||||
}
|
||||
|
||||
public DataTable ReturnCostAnalysis(int dateId, string connectionString)
|
||||
{
|
||||
var dataTable = new DataTable();
|
||||
var oleDbCommand = new OleDbCommand
|
||||
{
|
||||
CommandText = "SELECT CostOfSalesAnalysis.ID, CostOfSalesAnalysis.SalesPerManHour, CostOfSalesAnalysis.SalaryPercentage, CostOfSalesAnalysis.SalaryDollars, CostOfSalesAnalysis.Supplies FROM CostOfSalesAnalysis WHERE FK_DateID = ?"
|
||||
};
|
||||
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
|
||||
var connection = new OleDbConnection(connectionString);
|
||||
oleDbCommand.Connection = connection;
|
||||
|
||||
using (connection)
|
||||
{
|
||||
using (oleDbCommand)
|
||||
{
|
||||
connection.Open();
|
||||
using (var dataAdapter = new OleDbDataAdapter(oleDbCommand))
|
||||
{
|
||||
dataAdapter.Fill(dataTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dataTable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user