Added the new modify record form, can only pull in the Projections table and parse it. Fixed a bug in the modify record form where the first row would be marked as pending edit due to not checking the beginning cell variable correctly.
This commit is contained in:
@@ -15,7 +15,7 @@ namespace AdvertsingProfitControl
|
||||
_oleDbConnection.ConnectionString = connectionString;
|
||||
}
|
||||
|
||||
#region New Code
|
||||
#region New Code
|
||||
|
||||
/// <summary>
|
||||
/// Inserts new records into the specified sales table.
|
||||
@@ -1134,6 +1134,61 @@ namespace AdvertsingProfitControl
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool NormalizeApcTables(int dateId)
|
||||
{
|
||||
var successful = false;
|
||||
var oleDbCommand = new OleDbCommand
|
||||
{
|
||||
CommandText = "SELECT COUNT(*) FROM Projections WHERE FK_DateID = ?",
|
||||
Connection = _oleDbConnection
|
||||
};
|
||||
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
|
||||
OleDbTransaction oleDbTransaction = null;
|
||||
try
|
||||
{
|
||||
_oleDbConnection.Open();
|
||||
oleDbTransaction = _oleDbConnection.BeginTransaction();
|
||||
oleDbCommand.Transaction = oleDbTransaction;
|
||||
var projectionsRowCount = 0;
|
||||
var inventoryRowCount = 0;
|
||||
var actualSalesRowCount = 0;
|
||||
var reader = oleDbCommand.ExecuteReader();
|
||||
while (reader != null && reader.Read())
|
||||
{
|
||||
projectionsRowCount = int.Parse(reader[0].ToString());
|
||||
}
|
||||
|
||||
oleDbCommand.CommandText = "SELECT COUNT(*) FROM Inventory WHERE FK_DateID = ?";
|
||||
reader = oleDbCommand.ExecuteReader();
|
||||
while (reader != null && reader.Read())
|
||||
{
|
||||
inventoryRowCount = int.Parse(reader[0].ToString());
|
||||
}
|
||||
|
||||
oleDbCommand.CommandText = "SELECT COUNT(*) FROM ActualSales WHERE FK_DateID = ?";
|
||||
reader = oleDbCommand.ExecuteReader();
|
||||
while (reader != null && reader.Read())
|
||||
{
|
||||
actualSalesRowCount = int.Parse(reader[0].ToString());
|
||||
}
|
||||
//
|
||||
if (projectionsRowCount != inventoryRowCount)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
catch (OleDbException e)
|
||||
{
|
||||
_logConsole.WriteToLog(FrmLogConsole.Level.Error, e.Message);
|
||||
oleDbTransaction?.Rollback();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_oleDbConnection.Close();
|
||||
}
|
||||
return successful;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the invoice record with the specified internal ID number.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user