Lots of work on Account Plan; Mono test required

This commit is contained in:
Rick Falkvinge
2014-09-26 10:57:33 +02:00
parent 5176e66782
commit 7f9469bbfa
16 changed files with 278 additions and 23 deletions
+11
View File
@@ -49,6 +49,9 @@ namespace Swarmops.Database
}
/// <summary>
/// The actual revision of the database (as told by the database).
/// </summary>
public static int DbVersion
{
get
@@ -67,6 +70,14 @@ namespace Swarmops.Database
}
}
/// <summary>
/// This is the IN-CODE revision of the database. The version we expect to be running against.
/// </summary>
public static int DbVersionExpected
{
get { return 2; }
}
[Obsolete ("Do not use. Use SwarmDb.GetDatabaseForReading(), ...ForWriting() or ...ForAdmin().", true)]
public static SwarmDb GetDatabase()
+128
View File
@@ -679,6 +679,134 @@ namespace Swarmops.Database
}
}
public void SetFinancialAccountClosedYear(int financialAccountId, int closedYear)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command = GetDbCommand("SetFinancialAccountClosedYear", connection);
command.CommandType = CommandType.StoredProcedure;
AddParameterWithName(command, "financialAccountId", financialAccountId);
AddParameterWithName(command, "closedYear", closedYear);
command.ExecuteNonQuery();
}
}
public void SetFinancialAccountParent(int financialAccountId, int parentFinancialAccountId)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command = GetDbCommand("SetFinancialAccountParent", connection);
command.CommandType = CommandType.StoredProcedure;
AddParameterWithName(command, "financialAccountId", financialAccountId);
AddParameterWithName(command, "parentFinancialAccountId", parentFinancialAccountId);
command.ExecuteNonQuery();
}
}
public void SetFinancialAccountActive(int financialAccountId, bool active)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command = GetDbCommand("SetFinancialAccountActive", connection);
command.CommandType = CommandType.StoredProcedure;
AddParameterWithName(command, "financialAccountId", financialAccountId);
AddParameterWithName(command, "active", active);
command.ExecuteNonQuery();
}
}
public void SetFinancialAccountExpensable(int financialAccountId, bool expensable)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command = GetDbCommand("SetFinancialAccountExpensable", connection);
command.CommandType = CommandType.StoredProcedure;
AddParameterWithName(command, "financialAccountId", financialAccountId);
AddParameterWithName(command, "expensable", expensable);
command.ExecuteNonQuery();
}
}
public void SetFinancialAccountOpen(int financialAccountId, bool open)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command = GetDbCommand("SetFinancialAccountOpen", connection);
command.CommandType = CommandType.StoredProcedure;
AddParameterWithName(command, "financialAccountId", financialAccountId);
AddParameterWithName(command, "open", open);
command.ExecuteNonQuery();
}
}
public void SetFinancialAccountAdministrative(int financialAccountId, bool administrative)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command = GetDbCommand("SetFinancialAccountOpen", connection);
command.CommandType = CommandType.StoredProcedure;
AddParameterWithName(command, "financialAccountId", financialAccountId);
AddParameterWithName(command, "administrative", administrative);
command.ExecuteNonQuery();
}
}
public void SetFinancialAccountLinkBackward(int financialAccountId, int linkBackward)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command = GetDbCommand("SetFinancialAccountOwner", connection);
command.CommandType = CommandType.StoredProcedure;
AddParameterWithName(command, "financialAccountId", financialAccountId);
AddParameterWithName(command, "linkBackward", linkBackward);
command.ExecuteNonQuery();
}
}
public void SetFinancialAccountLinkForward(int financialAccountId, int linkForward)
{
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command = GetDbCommand("SetFinancialAccountOwner", connection);
command.CommandType = CommandType.StoredProcedure;
AddParameterWithName(command, "financialAccountId", financialAccountId);
AddParameterWithName(command, "linkForward", linkForward);
command.ExecuteNonQuery();
}
}
public void SetFinancialAccountOwner(int financialAccountId, int ownerPersonId)
{
using (DbConnection connection = GetMySqlDbConnection())
+2
View File
@@ -0,0 +1,2 @@
0001 - Initial baseline, Rick Falkvinge
0002 - Added functions for account plan maintenance and back/forward links to FinancialAccounts, Rick Falkvinge