Error trying to create a new transaction

Discussions related to custom development with Select.
Post Reply
Brian.Snavely
Posts: 18
Joined: Tue Jan 29, 2013 12:06 pm

Error trying to create a new transaction

Post by Brian.Snavely »

I am trying to create a transaction, but the NewTransaction method fails when I run it.

Is there something I am missing to get the new transaction function to work?

ILedgersManager ledgersManager = sps.GetService<ILedgersManager>();
ILedgerInfo ledgerInfo = ledgersManager.Ledgers.Where(i => i.Name == textBox2.Text).Single();

ITransactionsManager txMgr = sps.GetService<ITransactionsManager>();
ITransaction tx = txMgr.NewTransaction<ITransaction>(ledgerInfo);

The exception that is thrown says "Operation is not valid due to the state of the current object"
sindrapal
Posts: 42
Joined: Tue Oct 14, 2008 9:21 am

Re: Error trying to create a new transaction

Post by sindrapal »

Brain,

Please use a specific Transaction type for the type argument.

ITransactionsManager txMgr = sps.GetService<ITransactionsManager>();
ITransaction tx = txMgr.NewTransaction<IReceiptTransaction>(ledgerInfo);
Brian.Snavely
Posts: 18
Joined: Tue Jan 29, 2013 12:06 pm

Re: Error trying to create a new transaction

Post by Brian.Snavely »

Thanks. Now the issue I am having is trying to set the Payor/Payee of the transactions. I do not see a property for Payor in the transaction object, nor do I see a Get/Set Property method.

Is there some sort of extended properties object that I need to call?
Brian.Snavely
Posts: 18
Joined: Tue Jan 29, 2013 12:06 pm

Re: Error trying to create a new transaction

Post by Brian.Snavely »

Disregard. I see that the Name property is associated to the payor.
Post Reply