Added "expensable" field to FinancialAccount

This commit is contained in:
Rick Falkvinge
2013-09-23 17:28:22 +00:00
parent 5d99fb0133
commit 5ff5a64787
2 changed files with 10 additions and 4 deletions
@@ -7,7 +7,7 @@ namespace Swarmops.Basic.Types.Financial
{
public BasicFinancialAccount (int financialAccountId, string name, FinancialAccountType accountType,
int organizationId, int parentFinancialAccountId, int ownerPersonId,
int dimension, bool open, int openedYear, int closedYear)
int dimension, bool open, int openedYear, int closedYear, bool expensable)
{
this.FinancialAccountId = financialAccountId;
this.Name = name;
@@ -19,10 +19,11 @@ namespace Swarmops.Basic.Types.Financial
this.Open = open;
this.OpenedYear = openedYear;
this.ClosedYear = closedYear;
this.Expensable = expensable;
}
public BasicFinancialAccount (BasicFinancialAccount original) :
this(original.Identity, original.Name, original.AccountType, original.OrganizationId, original.ParentFinancialAccountId, original.OwnerPersonId, original.Dimension, original.Open, original.OpenedYear, original.ClosedYear)
this(original.Identity, original.Name, original.AccountType, original.OrganizationId, original.ParentFinancialAccountId, original.OwnerPersonId, original.Dimension, original.Open, original.OpenedYear, original.ClosedYear, original.Expensable)
{
// Empty copy constructor
}
@@ -38,6 +39,7 @@ namespace Swarmops.Basic.Types.Financial
public bool Open { get; protected set; }
public int OpenedYear { get; protected set; }
public int ClosedYear { get; protected set; }
public bool Expensable { get; protected set; }
#region IHasIdentity Members
+6 -2
View File
@@ -15,7 +15,8 @@ namespace Swarmops.Database
{
private const string financialAccountFieldSequence =
" FinancialAccountId,Name,OrganizationId,AccountType,ParentFinancialAccountId," + // 0-4
" OwnerPersonId,Dimension,Open,OpenedYear,ClosedYear " + // 5-9
" OwnerPersonId,Dimension,Open,OpenedYear,ClosedYear, " + // 5-9
" Expensable " // 10
" FROM FinancialAccounts ";
public int CreateFinancialAccount(int pOrganizationId, string pName, FinancialAccountType pAccountType, int pParentFinancialAccountId)
@@ -462,6 +463,8 @@ namespace Swarmops.Database
{
connection.Open();
// TODO: Must limit this to dimension 1
string commandString = "select FinancialTransactions.FinancialTransactionId, " +
"FinancialTransactions.OrganizationId, FinancialTransactions.DateTime, " +
"FinancialTransactions.Comment, FinancialTransactions.ImportHash, " +
@@ -708,8 +711,9 @@ namespace Swarmops.Database
bool open = reader.GetBoolean(7);
int openedYear = reader.GetInt32(8);
int closedYear = reader.GetInt32(9);
bool expensable = reader.GetBoolean(10);
return new BasicFinancialAccount(accountId, name, accountType, organizationId, parentFinancialAccountId, ownerPersonId, dimension, open, openedYear, closedYear);
return new BasicFinancialAccount(accountId, name, accountType, organizationId, parentFinancialAccountId, ownerPersonId, dimension, open, openedYear, closedYear, expensable);
}
private BasicFinancialAccountRow ReadFinancialAccountRowFromDataReader (DbDataReader reader)