C# Class PaulStovell.TrialBalance.DomainModel.Balance

A special type used to indicate an accounting balance.
Inheritance: IFormattable
Show file Open project: PaulStovell/trial-balance Class Usage Examples

Public Methods

Method Description
Balance ( ) : System

Constructor.

Balance ( decimal value, BalanceType type ) : System

Constructor.

Credit ( decimal value ) : Balance

Credits this balance by a given amount, resulting in a new balance.

Debit ( decimal value ) : Balance

Debits this balance by a given amount, resulting in a new balance.

Equals ( object obj ) : bool

Checks if this object and another object are equal.

GetHashCode ( ) : int

Gets a hash code for this balance.

Parse ( string balanceText ) : Balance

Parses a Balance given a string and the type of balance expected.

Parse ( string balanceText, BalanceType expectedBalanceType ) : Balance

Parses a Balance given a string and the type of balance expected.

ToString ( ) : string

Gets a string representation of the current balance.

ToString ( string format, IFormatProvider formatProvider ) : string

Gets a string representation of the current balance.

TryParse ( string balanceText, Balance &resultBalance ) : bool

Attempts to parse a Balance given a string.

TryParse ( string balanceText, BalanceType expectedBalanceType, Balance &resultBalance ) : bool

Attempts to parse a Balance given a string and the type of balance expected.

operator ( ) : Balance

Adds two balances.

operator ( ) : bool

Not equals operator.

Method Details

Balance() public method

Constructor.
public Balance ( ) : System
return System

Balance() public method

Constructor.
public Balance ( decimal value, BalanceType type ) : System
value decimal The value of the balance.
type BalanceType The type of balance.
return System

Credit() public method

Credits this balance by a given amount, resulting in a new balance.
public Credit ( decimal value ) : Balance
value decimal The value to credit this balance.
return Balance

Debit() public method

Debits this balance by a given amount, resulting in a new balance.
public Debit ( decimal value ) : Balance
value decimal The value to debit this balance.
return Balance

Equals() public method

Checks if this object and another object are equal.
public Equals ( object obj ) : bool
obj object The other object to check.
return bool

GetHashCode() public method

Gets a hash code for this balance.
public GetHashCode ( ) : int
return int

Parse() public static method

Parses a Balance given a string and the type of balance expected.
public static Parse ( string balanceText ) : Balance
balanceText string The text to attempt to parse.
return Balance

Parse() public static method

Parses a Balance given a string and the type of balance expected.
public static Parse ( string balanceText, BalanceType expectedBalanceType ) : Balance
balanceText string The text to attempt to parse.
expectedBalanceType BalanceType The type of balance expected. If null, 'CR' or 'DR' must be specified in the balance text.
return Balance

ToString() public method

Gets a string representation of the current balance.
public ToString ( ) : string
return string

ToString() public method

Gets a string representation of the current balance.
public ToString ( string format, IFormatProvider formatProvider ) : string
format string A format specification.
formatProvider IFormatProvider An IFormatProvider that supplies culture specific formatting information.
return string

TryParse() public static method

Attempts to parse a Balance given a string.
public static TryParse ( string balanceText, Balance &resultBalance ) : bool
balanceText string The text to attempt to parse.
resultBalance Balance If parsing is sucessful, this will contain the parsed balance.
return bool

TryParse() public static method

Attempts to parse a Balance given a string and the type of balance expected.
public static TryParse ( string balanceText, BalanceType expectedBalanceType, Balance &resultBalance ) : bool
balanceText string The text to attempt to parse.
expectedBalanceType BalanceType The type of balance expected. If null, 'CR' or 'DR' must be specified in the balance text.
resultBalance Balance If parsing is sucessful, this will contain the parsed balance.
return bool

operator() public static method

Adds two balances.
public static operator ( ) : Balance
return Balance

operator() public static method

Not equals operator.
public static operator ( ) : bool
return bool