C# Class Fluqi.Helpers.Utils

Set of helper methods for accomplishing various things.
Afficher le fichier Open project: toepoke/Fluqi

Méthodes publiques

Méthode Description
AddQuotesToJQueryDate ( string dateValue ) : bool

Works out what type of date value or object is being passed in (i.e. is a string date like "01/01/2000", a numerical date value like "3" for 3 days, or a relative date specification like "+1w -1d" where some of them need quotes, but other don't.

InDoubleQuotes ( string value ) : string

Surrounds the value in double quote marks.

InSingleQuotes ( string value ) : string

Surrounds the value in single quote marks.

IsBool ( string value ) : bool

Establishes if the given value is a numeric value or not (note +10 and -10 are considered numeric too).

IsEmptyQuotes ( string value ) : bool

Establishes if the given value is merely a set of empty quotes (either "" or '').

IsJSON ( string value ) : bool

Establishes whether the given value is considered to be a JSON string

To determine this we simply look for the presence of "{", "}", "," or ":"

IsNullEmptyOrDefault ( List values, List defaultValues ) : bool

Establishes if the given value is null, empty or the same as the default. We look at the default value because if we're rendering the default we don't need to output the setting (as it's the default for the jQuery UI control) and thus we can reduce the JavaScript needed to initialise the control (which can be fairly big if you've got 20+ options (never mind readability!))

IsNullEmptyOrDefault ( string value, string defaultValue ) : bool

Establishes if the given value is null, empty or the same as the default. We look at the default value because if we're rendering the default we don't need to output the setting (as it's the default for the jQuery UI control) and thus we can reduce the JavaScript needed to initialise the control (which can be fairly big if you've got 20+ options (never mind readability!))

IsNumeric ( string value ) : bool

Establishes if the given value is a numeric value or not (note +10 and -10 are considered numeric too).

IsQuoted ( string value ) : bool

Simple query method to work out if a given string has any quotation ('") marks at the start of end of the string

IsRelativeDateSpec ( string value ) : bool

Establishes whether the given value is considered to be a string representing a relative date. Some jQuery UI controls (mainly DatePicker) allow you to specify a relate date, "+10d" is "10 days in the future" and "-1m" is "one month in the past"

IsSelector ( string value ) : bool

Establishes whether the given value is considered to be a [jQuery] selector string

TrimQuotes ( string value ) : string

Simply removes any quotations marks at the start/end of a given string. This is usually so we can remove any added by the user and add our own (otherwise we could add a second set of quotes that aren't required.

Private Methods

Méthode Description
Quote ( string value, bool doubleQuote ) : string

Surrounds the value in double quote marks.

Method Details

AddQuotesToJQueryDate() public static méthode

Works out what type of date value or object is being passed in (i.e. is a string date like "01/01/2000", a numerical date value like "3" for 3 days, or a relative date specification like "+1w -1d" where some of them need quotes, but other don't.
public static AddQuotesToJQueryDate ( string dateValue ) : bool
dateValue string Value to be queried
Résultat bool

InDoubleQuotes() public static méthode

Surrounds the value in double quote marks.
public static InDoubleQuotes ( string value ) : string
value string String to be quoted
Résultat string

InSingleQuotes() public static méthode

Surrounds the value in single quote marks.
public static InSingleQuotes ( string value ) : string
value string String to be quoted
Résultat string

IsBool() public static méthode

Establishes if the given value is a numeric value or not (note +10 and -10 are considered numeric too).
public static IsBool ( string value ) : bool
value string Value to query
Résultat bool

IsEmptyQuotes() public static méthode

Establishes if the given value is merely a set of empty quotes (either "" or '').
public static IsEmptyQuotes ( string value ) : bool
value string String to check
Résultat bool

IsJSON() public static méthode

Establishes whether the given value is considered to be a JSON string
To determine this we simply look for the presence of "{", "}", "," or ":"
public static IsJSON ( string value ) : bool
value string Value to be queried
Résultat bool

IsNullEmptyOrDefault() public static méthode

Establishes if the given value is null, empty or the same as the default. We look at the default value because if we're rendering the default we don't need to output the setting (as it's the default for the jQuery UI control) and thus we can reduce the JavaScript needed to initialise the control (which can be fairly big if you've got 20+ options (never mind readability!))
public static IsNullEmptyOrDefault ( List values, List defaultValues ) : bool
values List Options being set
defaultValues List Defaults for the option
Résultat bool

IsNullEmptyOrDefault() public static méthode

Establishes if the given value is null, empty or the same as the default. We look at the default value because if we're rendering the default we don't need to output the setting (as it's the default for the jQuery UI control) and thus we can reduce the JavaScript needed to initialise the control (which can be fairly big if you've got 20+ options (never mind readability!))
public static IsNullEmptyOrDefault ( string value, string defaultValue ) : bool
value string Options being set
defaultValue string Default for the option
Résultat bool

IsNumeric() public static méthode

Establishes if the given value is a numeric value or not (note +10 and -10 are considered numeric too).
public static IsNumeric ( string value ) : bool
value string Value to query
Résultat bool

IsQuoted() public static méthode

Simple query method to work out if a given string has any quotation ('") marks at the start of end of the string
public static IsQuoted ( string value ) : bool
value string
Résultat bool

IsRelativeDateSpec() public static méthode

Establishes whether the given value is considered to be a string representing a relative date. Some jQuery UI controls (mainly DatePicker) allow you to specify a relate date, "+10d" is "10 days in the future" and "-1m" is "one month in the past"
public static IsRelativeDateSpec ( string value ) : bool
value string Value to be queried
Résultat bool

IsSelector() public static méthode

Establishes whether the given value is considered to be a [jQuery] selector string
public static IsSelector ( string value ) : bool
value string Value to be queried
Résultat bool

TrimQuotes() public static méthode

Simply removes any quotations marks at the start/end of a given string. This is usually so we can remove any added by the user and add our own (otherwise we could add a second set of quotes that aren't required.
public static TrimQuotes ( string value ) : string
value string
Résultat string