C# 클래스 BudgetAnalyser.Engine.Services.TransactionManagerService

상속: ITransactionManagerService, ISupportsModelPersistence
파일 보기 프로젝트 열기: Benrnz/BudgetAnalyser 1 사용 예제들

공개 메소드들

메소드 설명
ClearBucketAndTextFilters ( ) : ObservableCollection

Clears the bucket and text filters.

Close ( ) : void

Closes the currently loaded file. No warnings will be raised if there is unsaved data.

CreateAsync ( ApplicationDatabase applicationDatabase ) : System.Threading.Tasks.Task

Create a new StatementModel.

DetectDuplicateTransactions ( ) : string

Detects duplicate transactions in the current StatementModel and returns a summary string for displaying in the UI. Each individual duplicate transactions will be flagged by the Transaction.IsSuspectedDuplicate property.

FilterByBucket ( string bucketCode ) : ObservableCollection

Returns a filtered list of Transactions by bucket code.

FilterBySearchText ( string searchText ) : ObservableCollection

Returns a filtered list of Transactions using the provided search text. All following transaction fields are searched: Description, Reference1, Reference2, Reference3.

FilterTransactions ( GlobalFilterCriteria criteria ) : void

Filters the transactions using the filter object provided.

FilterableBuckets ( ) : IEnumerable

Provides a list of buckets for display purposes for filtering the transactions shown. This list will include a blank item to represent no filtering, and a [Uncategorised] to represent a filter to show only transactions with no bucket allocation.

ImportAndMergeBankStatementAsync ( string storageKey, Account account ) : System.Threading.Tasks.Task

Imports a bank's transaction extract and merges it with the currently loaded Budget Analyser Statement. This method should not be used without a StatementModel loaded. It is recommended to follow this up with ValidateWithCurrentBudgetsAsync.

Initialise ( StatementApplicationState stateData ) : void

Parses and loads the persisted state data from the provided object.

LoadAsync ( ApplicationDatabase applicationDatabase ) : System.Threading.Tasks.Task

Loads a data source with the provided database reference data asynchronously.

PopulateGroupByBucketCollection ( bool groupByBucket ) : IEnumerable

Populates a collection grouped by bucket with date sorted transactions contained in each group.

PreparePersistentStateData ( ) : StatementApplicationState

Prepares the persistent state data to save to storage.

RemoveTransaction ( BudgetAnalyser.Engine.Statement.Transaction transactionToRemove ) : void

Removes the provided transaction from the currently loaded Budget Analyser Statement.

SaveAsync ( ApplicationDatabase applicationDatabase ) : System.Threading.Tasks.Task

Saves the application database asynchronously. This may be called using a background worker thread.

SavePreview ( ) : void

Called before Save is called. This will be called on the UI Thread. Objects can optionally add some context data that will be passed to the SaveAsync method call. This can be used to finalise any edits or prompt the user for closing data, ie, a "what-did-you-change" comment; this can't be done during save as it may not be called using the UI Thread.

SplitTransaction ( BudgetAnalyser.Engine.Statement.Transaction originalTransaction, decimal splinterAmount1, decimal splinterAmount2, BudgetBucket splinterBucket1, BudgetBucket splinterBucket2 ) : void

Splits the provided transaction into two. The provided transactions is removed, and two new transactions are created. Both transactions must add up to the existing transaction amount.

TransactionManagerService ( [ bucketRepository, [ statementRepository, [ logger, [ monitorableDependencies ) : System

Initializes a new instance of the TransactionManagerService class.

ValidateModel ( StringBuilder messages ) : bool

Validates the model owned by the service.

ValidateWithCurrentBudgetsAsync ( BudgetCollection budgets = null ) : Task

Validates the currently loaded StatementModel against the provided budgets and ensures all buckets used by the transactions exist in the budgets. This is performed asynchronously. This method can be called when a budget is loaded or changed or when a new Budget Analyser Statement is loaded.

비공개 메소드들

메소드 설명
MatchTransactionText ( BudgetAnalyser.Engine.Statement.Transaction t, string textFilter ) : bool
NewDataAvailable ( ) : void
ResetTransactionsCollection ( ) : void

메소드 상세

ClearBucketAndTextFilters() 공개 메소드

Clears the bucket and text filters.
public ClearBucketAndTextFilters ( ) : ObservableCollection
리턴 ObservableCollection

Close() 공개 메소드

Closes the currently loaded file. No warnings will be raised if there is unsaved data.
public Close ( ) : void
리턴 void

CreateAsync() 공개 메소드

Create a new StatementModel.
public CreateAsync ( ApplicationDatabase applicationDatabase ) : System.Threading.Tasks.Task
applicationDatabase BudgetAnalyser.Engine.Persistence.ApplicationDatabase
리턴 System.Threading.Tasks.Task

DetectDuplicateTransactions() 공개 메소드

Detects duplicate transactions in the current StatementModel and returns a summary string for displaying in the UI. Each individual duplicate transactions will be flagged by the Transaction.IsSuspectedDuplicate property.
public DetectDuplicateTransactions ( ) : string
리턴 string

FilterByBucket() 공개 메소드

Returns a filtered list of Transactions by bucket code.
public FilterByBucket ( string bucketCode ) : ObservableCollection
bucketCode string /// The bucket code as text. This can be null or return all, and /// to /// only return transactions without a bucket classification. ///
리턴 ObservableCollection

FilterBySearchText() 공개 메소드

Returns a filtered list of Transactions using the provided search text. All following transaction fields are searched: Description, Reference1, Reference2, Reference3.
public FilterBySearchText ( string searchText ) : ObservableCollection
searchText string The search text. Minimum 3 characters.
리턴 ObservableCollection

FilterTransactions() 공개 메소드

Filters the transactions using the filter object provided.
public FilterTransactions ( GlobalFilterCriteria criteria ) : void
criteria GlobalFilterCriteria
리턴 void

FilterableBuckets() 공개 메소드

Provides a list of buckets for display purposes for filtering the transactions shown. This list will include a blank item to represent no filtering, and a [Uncategorised] to represent a filter to show only transactions with no bucket allocation.
public FilterableBuckets ( ) : IEnumerable
리턴 IEnumerable

ImportAndMergeBankStatementAsync() 공개 메소드

Imports a bank's transaction extract and merges it with the currently loaded Budget Analyser Statement. This method should not be used without a StatementModel loaded. It is recommended to follow this up with ValidateWithCurrentBudgetsAsync.
/// /// There are no transactions loaded, you must first load an existing /// file or create a new one. ///
public ImportAndMergeBankStatementAsync ( string storageKey, Account account ) : System.Threading.Tasks.Task
storageKey string
account BudgetAnalyser.Engine.BankAccount.Account
리턴 System.Threading.Tasks.Task

Initialise() 공개 메소드

Parses and loads the persisted state data from the provided object.
public Initialise ( StatementApplicationState stateData ) : void
stateData BudgetAnalyser.Engine.Statement.StatementApplicationState The state data loaded from persistent storage.
리턴 void

LoadAsync() 공개 메소드

Loads a data source with the provided database reference data asynchronously.
Statement Model data is corrupt and has been tampered with. Unable to load.
public LoadAsync ( ApplicationDatabase applicationDatabase ) : System.Threading.Tasks.Task
applicationDatabase BudgetAnalyser.Engine.Persistence.ApplicationDatabase
리턴 System.Threading.Tasks.Task

PopulateGroupByBucketCollection() 공개 메소드

Populates a collection grouped by bucket with date sorted transactions contained in each group.
public PopulateGroupByBucketCollection ( bool groupByBucket ) : IEnumerable
groupByBucket bool True if the UI is currently showing the transactions grouped by bucket, false if not.
리턴 IEnumerable

PreparePersistentStateData() 공개 메소드

Prepares the persistent state data to save to storage.
public PreparePersistentStateData ( ) : StatementApplicationState
리턴 BudgetAnalyser.Engine.Statement.StatementApplicationState

RemoveTransaction() 공개 메소드

Removes the provided transaction from the currently loaded Budget Analyser Statement.
public RemoveTransaction ( BudgetAnalyser.Engine.Statement.Transaction transactionToRemove ) : void
transactionToRemove BudgetAnalyser.Engine.Statement.Transaction The transaction to remove.
리턴 void

SaveAsync() 공개 메소드

Saves the application database asynchronously. This may be called using a background worker thread.
/// Unable to save transactions at this time, some data is invalid. + /// messages ///
public SaveAsync ( ApplicationDatabase applicationDatabase ) : System.Threading.Tasks.Task
applicationDatabase BudgetAnalyser.Engine.Persistence.ApplicationDatabase
리턴 System.Threading.Tasks.Task

SavePreview() 공개 메소드

Called before Save is called. This will be called on the UI Thread. Objects can optionally add some context data that will be passed to the SaveAsync method call. This can be used to finalise any edits or prompt the user for closing data, ie, a "what-did-you-change" comment; this can't be done during save as it may not be called using the UI Thread.
public SavePreview ( ) : void
리턴 void

SplitTransaction() 공개 메소드

Splits the provided transaction into two. The provided transactions is removed, and two new transactions are created. Both transactions must add up to the existing transaction amount.
///
public SplitTransaction ( BudgetAnalyser.Engine.Statement.Transaction originalTransaction, decimal splinterAmount1, decimal splinterAmount2, BudgetBucket splinterBucket1, BudgetBucket splinterBucket2 ) : void
originalTransaction BudgetAnalyser.Engine.Statement.Transaction
splinterAmount1 decimal
splinterAmount2 decimal
splinterBucket1 BudgetAnalyser.Engine.Budget.BudgetBucket
splinterBucket2 BudgetAnalyser.Engine.Budget.BudgetBucket
리턴 void

TransactionManagerService() 공개 메소드

Initializes a new instance of the TransactionManagerService class.
///
public TransactionManagerService ( [ bucketRepository, [ statementRepository, [ logger, [ monitorableDependencies ) : System
bucketRepository [ The bucket repository.
statementRepository [ The statement repository.
logger [ The logger.
monitorableDependencies [ The dependency monitor manager
리턴 System

ValidateModel() 공개 메소드

Validates the model owned by the service.
public ValidateModel ( StringBuilder messages ) : bool
messages StringBuilder
리턴 bool

ValidateWithCurrentBudgetsAsync() 공개 메소드

Validates the currently loaded StatementModel against the provided budgets and ensures all buckets used by the transactions exist in the budgets. This is performed asynchronously. This method can be called when a budget is loaded or changed or when a new Budget Analyser Statement is loaded.
public ValidateWithCurrentBudgetsAsync ( BudgetCollection budgets = null ) : Task
budgets BudgetCollection /// The current budgets. This must be provided at least once. It can be omitted when /// calling this method after the statement model has changed if the budget was previously provided. ///
리턴 Task