C# Class Ctc.Ods.Utility

Contains a collections of useful methods/properties/objects.
Show file Open project: BellevueCollege/CtcApi

Public Methods

Method Description
CircularDigitSum ( ushort value, short adder ) : ushort

Performs addition on a single-digit value, wrapping around the boundries

THIS MEMBER DOES NOT YET HAVE UNIT TESTS At the moment, this method only supports an adder value of 1 or -1.

This method was originally created to support YearQuarter calculations.

DigitToChar ( ushort value ) : char

Converts a single digit to a value

THIS MEMBER DOES NOT YET HAVE UNIT TESTS

This method was originally created to support YearQuarter calculations.

GetApiSettings ( ) : ApiSettings

GetApplicationVersion ( Assembly dll, string format = null ) : string

Retrieve a dll's Version, with formatting if supplied

THIS MEMBER DOES NOT YET HAVE UNIT TESTS

GetHpTime ( System.TimeSpan timeSpan ) : System.DateTime

Creates a DateTime object which conforms to HP fields - which only contain meaningful time information.

THIS MEMBER DOES NOT YET HAVE UNIT TESTS

IsAlphaNumeric ( string strValue ) : bool

Identifies whether or not the supplied value contains letters and/or numbers

THIS MEMBER DOES NOT YET HAVE UNIT TESTS

IsNumber ( string str ) : bool

Identifies whether the specified String can be converted to a number

THIS MEMBER DOES NOT YET HAVE UNIT TESTS

SafeConvertToBool ( string value ) : bool

Safely converts a value to a

Unlike the standard Boolean conversion methods, SafeConvertToBool will silentsly return false if it encounters an error during the conversion attempt.

TitleCase ( string str ) : string

Capitalizes the first letter of each word in a String

THIS MEMBER DOES NOT YET HAVE UNIT TESTS This method utilizes code taken from this forum post.

TrimCommonCourseChar ( string courseSubject ) : string

Removes the ApiSettings.RegexPatterns.CommonCourseChar from the end of a string.

Private Methods

Method Description
ReplaceIfPresent ( string &buffer, string token, int component ) : void

Method Details

CircularDigitSum() public static method

Performs addition on a single-digit value, wrapping around the boundries
THIS MEMBER DOES NOT YET HAVE UNIT TESTS At the moment, this method only supports an adder value of 1 or -1.

This method was originally created to support YearQuarter calculations.

public static CircularDigitSum ( ushort value, short adder ) : ushort
value ushort A single digit unsigned number
adder short How much to add to
return ushort

DigitToChar() public static method

Converts a single digit to a value
THIS MEMBER DOES NOT YET HAVE UNIT TESTS

This method was originally created to support YearQuarter calculations.

public static DigitToChar ( ushort value ) : char
value ushort A single digit unsigned number
return char

GetApiSettings() public static method

public static GetApiSettings ( ) : ApiSettings
return Ctc.Ods.Config.ApiSettings

GetApplicationVersion() public static method

Retrieve a dll's Version, with formatting if supplied
THIS MEMBER DOES NOT YET HAVE UNIT TESTS
public static GetApplicationVersion ( Assembly dll, string format = null ) : string
dll System.Reflection.Assembly
format string /// A simple template. The following token placeholders are recognized: /// /// /// Token /// Replaced with /// /// /// {MAJOR} /// /// /// /// {MINOR} /// /// /// /// {REVISION} /// /// /// /// {BUILD} /// /// /// ///
return string

GetHpTime() public static method

Creates a DateTime object which conforms to HP fields - which only contain meaningful time information.
THIS MEMBER DOES NOT YET HAVE UNIT TESTS
public static GetHpTime ( System.TimeSpan timeSpan ) : System.DateTime
timeSpan System.TimeSpan
return System.DateTime

IsAlphaNumeric() public static method

Identifies whether or not the supplied value contains letters and/or numbers
THIS MEMBER DOES NOT YET HAVE UNIT TESTS
public static IsAlphaNumeric ( string strValue ) : bool
strValue string The value to check.
return bool

IsNumber() public static method

Identifies whether the specified String can be converted to a number
THIS MEMBER DOES NOT YET HAVE UNIT TESTS
public static IsNumber ( string str ) : bool
str string
return bool

SafeConvertToBool() public static method

Safely converts a value to a
Unlike the standard Boolean conversion methods, SafeConvertToBool will silentsly return false if it encounters an error during the conversion attempt.
public static SafeConvertToBool ( string value ) : bool
value string The value to attempt to convert
return bool

TitleCase() public static method

Capitalizes the first letter of each word in a String
THIS MEMBER DOES NOT YET HAVE UNIT TESTS This method utilizes code taken from this forum post.
public static TitleCase ( string str ) : string
str string
return string

TrimCommonCourseChar() public static method

Removes the ApiSettings.RegexPatterns.CommonCourseChar from the end of a string.
public static TrimCommonCourseChar ( string courseSubject ) : string
courseSubject string
return string