C# Class BudgetAnalyser.Engine.Budget.InMemoryBudgetBucketRepository

Inheritance: IBudgetBucketRepository
Mostra file Open project: Benrnz/BudgetAnalyser Class Usage Examples

Public Methods

Method Description
CreateNewFixedBudgetProject ( string bucketCode, string description, decimal fixedBudgetAmount ) : FixedBudgetProjectBucket

Creates the new fixed budget project.

GetByCode ( string code ) : BudgetBucket

Gets a bucket by its code.

GetOrCreateNew ( string code, Func factory ) : BudgetBucket

Gets the bucket by its code or creates a new one if not found.

InMemoryBudgetBucketRepository ( BudgetBucket>.[ mapper ) : System

Initializes a new instance of the InMemoryBudgetBucketRepository class.

Initialise ( IEnumerable buckets ) : void

Initialises the buckets from the provided data. Used by persistence.

IsValidCode ( string code ) : bool

Determines whether the bucket code is registered in this repository.

RemoveFixedBudgetProject ( FixedBudgetProjectBucket projectBucket ) : void

Removes the fixed budget project bucket permanently

Protected Methods

Method Description
AddBucket ( [ bucket ) : void

Adds the bucket.

InitialiseMandatorySpecialBuckets ( ) : void

Initialises the mandatory special buckets.

Private Methods

Method Description
ContainsKeyInternal ( string code ) : bool

Method Details

AddBucket() protected method

Adds the bucket.
protected AddBucket ( [ bucket ) : void
bucket [
return void

CreateNewFixedBudgetProject() public method

Creates the new fixed budget project.
/// /// The fixed budget amount must be greater than zero. /// or /// A new fixed budget project bucket cannot be created, because the code + bucketCode + already exists. ///
public CreateNewFixedBudgetProject ( string bucketCode, string description, decimal fixedBudgetAmount ) : FixedBudgetProjectBucket
bucketCode string The bucket code.
description string The description.
fixedBudgetAmount decimal The fixed budget amount.
return FixedBudgetProjectBucket

GetByCode() public method

Gets a bucket by its code.
public GetByCode ( string code ) : BudgetBucket
code string The code, also used as a key and must be unique.
return BudgetBucket

GetOrCreateNew() public method

Gets the bucket by its code or creates a new one if not found.
///
public GetOrCreateNew ( string code, Func factory ) : BudgetBucket
code string The code, also used as a key and must be unique.
factory Func The factory to create the new bucket if not already registered.
return BudgetBucket

InMemoryBudgetBucketRepository() public method

Initializes a new instance of the InMemoryBudgetBucketRepository class.
///
public InMemoryBudgetBucketRepository ( BudgetBucket>.[ mapper ) : System
mapper BudgetBucket>.[
return System

Initialise() public method

Initialises the buckets from the provided data. Used by persistence.
public Initialise ( IEnumerable buckets ) : void
buckets IEnumerable
return void

InitialiseMandatorySpecialBuckets() protected method

Initialises the mandatory special buckets.
protected InitialiseMandatorySpecialBuckets ( ) : void
return void

IsValidCode() public method

Determines whether the bucket code is registered in this repository.
public IsValidCode ( string code ) : bool
code string The code, also used as a key and must be unique.
return bool

RemoveFixedBudgetProject() public method

Removes the fixed budget project bucket permanently
public RemoveFixedBudgetProject ( FixedBudgetProjectBucket projectBucket ) : void
projectBucket FixedBudgetProjectBucket The project bucket to remove.
return void