C# Класс Rock.ExtensionMethods

Rock Lava related extensions
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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

Описание методов

Age() публичный статический Метод

Returns the age at the current date.
public static Age ( this start ) : int
start this
Результат int

EndOfWeek() публичный статический Метод

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.
Результат System.DateTime

GetColumnByHeaderText() публичный статический Метод

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.
Результат DataControlField

HasMergeFields() публичный статический Метод

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.
Результат bool

ResolveClientIds() публичный статический Метод

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.
Результат string

ResolveMergeFields() публичный статический Метод

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.
Результат string

ResolveMergeFields() публичный статический Метод

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.
Результат string

ResolveMergeFields() публичный статический Метод

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].
Результат string

ResolveMergeFields() публичный статический Метод

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].
Результат string

StartOfWeek() публичный статический Метод

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.
Результат System.DateTime

SundayDate() публичный статический Метод

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.
Результат System.DateTime

ToElapsedString() публичный статический Метод

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].
Результат string

ToJavascriptMilliseconds() публичный статический Метод

Converts the date to an Epoch of milliseconds since 1970/1/1.
public static ToJavascriptMilliseconds ( this dateTime ) : long
dateTime this The date time.
Результат long

ToMonthDayString() публичный статический Метод

Converts the date to a string containing month and day values ( culture-specific ).
public static ToMonthDayString ( this dateTime ) : string
dateTime this The date time.
Результат string

ToRelativeDateString() публичный статический Метод

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)
Результат string

ToTimeString() публичный статический Метод

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.
Результат string

TotalMonths() публичный статический Метод

The total months.
public static TotalMonths ( this end, System.DateTime start ) : int
end this The end.
start System.DateTime The start.
Результат int

TotalYears() публичный статический Метод

The total years.
public static TotalYears ( this end, System.DateTime start ) : int
end this The end.
start System.DateTime The start.
Результат int

Update() публичный статический Метод

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.
Результат void

lavaDebugInfo() публичный статический Метод

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.
Результат string