C# Class Rock.ExtensionMethods

Rock Lava related extensions
Afficher le fichier Open project: SparkDevNetwork/Rock

Méthodes publiques

Méthode Description
Age ( this start ) : int

Returns the age at the current date.

EndOfWeek ( this dt, DayOfWeek startOfWeek ) : System.DateTime

Returns the date of the last day of the week for the specified date/time For example, if Monday is considered the start of the week: "2015-05-13" would return "2015-05-17" from http://stackoverflow.com/a/38064/1755417

GetColumnByHeaderText ( this dataControlFieldCollection, string headerText ) : DataControlField

Gets the grid column that matches the header text.

HasMergeFields ( this content ) : bool

Determines whether the string potentially has merge fields in it. NOTE: Might return true even though it doesn't really have merge fields, but something like looks like it. For example '{56408602-5E41-4D66-98C7-BD361CD93AED}'

ResolveClientIds ( this content, string clientId ) : string

Resolve any client ids in the string. This is used with Lava when writing out postback commands.

ResolveMergeFields ( this content, object>.IDictionary mergeObjects, Person currentPersonOverride ) : string

Use DotLiquid to resolve any merge codes within the content using the values in the mergeObjects.

ResolveMergeFields ( this content, object>.IDictionary mergeObjects, Person currentPersonOverride, string enabledLavaCommands ) : string

Resolves the merge fields.

ResolveMergeFields ( this content, object>.IDictionary mergeObjects, bool encodeStrings = false, bool throwExceptionOnErrors = false ) : string

Use DotLiquid to resolve any merge codes within the content using the values in the mergeObjects.

ResolveMergeFields ( this content, object>.IDictionary mergeObjects, string enabledLavaCommands, bool encodeStrings = false, bool throwExceptionOnErrors = false ) : string

Resolves the merge fields.

StartOfWeek ( this dt, DayOfWeek startOfWeek ) : System.DateTime

Returns the date of the start of the week for the specified date/time For example, if Monday is considered the start of the week: "2015-05-13" would return "2015-05-11" from http://stackoverflow.com/a/38064/1755417

SundayDate ( this dt, DayOfWeek startOfWeek = DayOfWeek.Monday ) : System.DateTime

Sundays the date.

ToElapsedString ( this dateTime, bool condensed = false, bool includeTime = true ) : string

Returns a friendly elapsed time string.

ToJavascriptMilliseconds ( this dateTime ) : long

Converts the date to an Epoch of milliseconds since 1970/1/1.

ToMonthDayString ( this dateTime ) : string

Converts the date to a string containing month and day values ( culture-specific ).

ToRelativeDateString ( this dateTime, int maxDays = null ) : string

Returns a string in FB style relative format (x seconds ago, x minutes ago, about an hour ago, etc.). or if max days has already passed in FB datetime format (February 13 at 11:28am or November 5, 2011 at 1:57pm).

ToTimeString ( this timespan ) : string

Returns a TimeSpan as h:mm AM/PM (culture invariant) Examples: 1:45 PM, 12:01 AM

TotalMonths ( this end, System.DateTime start ) : int

The total months.

TotalYears ( this end, System.DateTime start ) : int

The total years.

Update ( object>.this dictionary, string key, object value ) : void

Adds a new key/value to dictionary or if key already exists will update existing value.

lavaDebugInfo ( this lavaObject, RockContext rockContext = null, string preText = "", string postText = "" ) : string

Returns an html representation of object that is available to lava.

Private Methods

Méthode Description
EncodeStringTransformer ( object s ) : object

Html Encodes string values that are processed by a lava filter

LiquidizeChildren ( this myObject, int levelsDeep, RockContext rockContext = null, Dictionary entityHistory = null, string parentElement = "" ) : object

Liquidizes the child properties of an object for displaying debug information about fields available for lava templates

formatLavaDebugInfo ( object liquidizedObject, int levelsDeep, string parents = "" ) : string

Method Details

Age() public static méthode

Returns the age at the current date.
public static Age ( this start ) : int
start this
Résultat int

EndOfWeek() public static méthode

Returns the date of the last day of the week for the specified date/time For example, if Monday is considered the start of the week: "2015-05-13" would return "2015-05-17" from http://stackoverflow.com/a/38064/1755417
public static EndOfWeek ( this dt, DayOfWeek startOfWeek ) : System.DateTime
dt this The dt.
startOfWeek DayOfWeek The start of week.
Résultat System.DateTime

GetColumnByHeaderText() public static méthode

Gets the grid column that matches the header text.
public static GetColumnByHeaderText ( this dataControlFieldCollection, string headerText ) : DataControlField
dataControlFieldCollection this The data control field collection.
headerText string The header text.
Résultat DataControlField

HasMergeFields() public static méthode

Determines whether the string potentially has merge fields in it. NOTE: Might return true even though it doesn't really have merge fields, but something like looks like it. For example '{56408602-5E41-4D66-98C7-BD361CD93AED}'
public static HasMergeFields ( this content ) : bool
content this The content.
Résultat bool

ResolveClientIds() public static méthode

Resolve any client ids in the string. This is used with Lava when writing out postback commands.
public static ResolveClientIds ( this content, string clientId ) : string
content this The content.
clientId string The client identifier.
Résultat string

ResolveMergeFields() public static méthode

Use DotLiquid to resolve any merge codes within the content using the values in the mergeObjects.
public static ResolveMergeFields ( this content, object>.IDictionary mergeObjects, Person currentPersonOverride ) : string
content this The content.
mergeObjects object>.IDictionary The merge objects.
currentPersonOverride Person The current person override.
Résultat string

ResolveMergeFields() public static méthode

Resolves the merge fields.
public static ResolveMergeFields ( this content, object>.IDictionary mergeObjects, Person currentPersonOverride, string enabledLavaCommands ) : string
content this The content.
mergeObjects object>.IDictionary The merge objects.
currentPersonOverride Person The current person override.
enabledLavaCommands string The enabled lava commands.
Résultat string

ResolveMergeFields() public static méthode

Use DotLiquid to resolve any merge codes within the content using the values in the mergeObjects.
public static ResolveMergeFields ( this content, object>.IDictionary mergeObjects, bool encodeStrings = false, bool throwExceptionOnErrors = false ) : string
content this The content.
mergeObjects object>.IDictionary The merge objects.
encodeStrings bool if set to true, string values will be XML Encoded. For example, if you are creating an XML doc (not HTML), you probably want to set this to true.
throwExceptionOnErrors bool if set to true [throw exception on errors].
Résultat string

ResolveMergeFields() public static méthode

Resolves the merge fields.
public static ResolveMergeFields ( this content, object>.IDictionary mergeObjects, string enabledLavaCommands, bool encodeStrings = false, bool throwExceptionOnErrors = false ) : string
content this The content.
mergeObjects object>.IDictionary The merge objects.
enabledLavaCommands string The enabled lava commands.
encodeStrings bool if set to true [encode strings].
throwExceptionOnErrors bool if set to true [throw exception on errors].
Résultat string

StartOfWeek() public static méthode

Returns the date of the start of the week for the specified date/time For example, if Monday is considered the start of the week: "2015-05-13" would return "2015-05-11" from http://stackoverflow.com/a/38064/1755417
public static StartOfWeek ( this dt, DayOfWeek startOfWeek ) : System.DateTime
dt this The dt.
startOfWeek DayOfWeek The start of week.
Résultat System.DateTime

SundayDate() public static méthode

Sundays the date.
public static SundayDate ( this dt, DayOfWeek startOfWeek = DayOfWeek.Monday ) : System.DateTime
dt this The date to check.
startOfWeek DayOfWeek The start of week.
Résultat System.DateTime

ToElapsedString() public static méthode

Returns a friendly elapsed time string.
public static ToElapsedString ( this dateTime, bool condensed = false, bool includeTime = true ) : string
dateTime this The date time.
condensed bool if set to true [condensed].
includeTime bool if set to true [include time].
Résultat string

ToJavascriptMilliseconds() public static méthode

Converts the date to an Epoch of milliseconds since 1970/1/1.
public static ToJavascriptMilliseconds ( this dateTime ) : long
dateTime this The date time.
Résultat long

ToMonthDayString() public static méthode

Converts the date to a string containing month and day values ( culture-specific ).
public static ToMonthDayString ( this dateTime ) : string
dateTime this The date time.
Résultat string

ToRelativeDateString() public static méthode

Returns a string in FB style relative format (x seconds ago, x minutes ago, about an hour ago, etc.). or if max days has already passed in FB datetime format (February 13 at 11:28am or November 5, 2011 at 1:57pm).
public static ToRelativeDateString ( this dateTime, int maxDays = null ) : string
dateTime this the datetime to convert to relative time.
maxDays int maximum number of days before formatting in FB date-time format (ex. November 5, 2011 at 1:57pm)
Résultat string

ToTimeString() public static méthode

Returns a TimeSpan as h:mm AM/PM (culture invariant) Examples: 1:45 PM, 12:01 AM
public static ToTimeString ( this timespan ) : string
timespan this The timespan.
Résultat string

TotalMonths() public static méthode

The total months.
public static TotalMonths ( this end, System.DateTime start ) : int
end this The end.
start System.DateTime The start.
Résultat int

TotalYears() public static méthode

The total years.
public static TotalYears ( this end, System.DateTime start ) : int
end this The end.
start System.DateTime The start.
Résultat int

Update() public static méthode

Adds a new key/value to dictionary or if key already exists will update existing value.
public static Update ( object>.this dictionary, string key, object value ) : void
dictionary object>.this The dictionary.
key string The key.
value object The value.
Résultat void

lavaDebugInfo() public static méthode

Returns an html representation of object that is available to lava.
public static lavaDebugInfo ( this lavaObject, RockContext rockContext = null, string preText = "", string postText = "" ) : string
lavaObject this The liquid object.
rockContext RockContext The rock context.
preText string The pre text.
postText string The post text.
Résultat string