Helper Class |
public class Helper
The Helper type exposes the following members.
| Name | Description | |
|---|---|---|
| AddAttribute | Returns an HTML attribute string (name='value') if the value is not empty, otherwise an empty string | |
| AddCTE | Merge a CTE (Common Table Expression 'WITH' clause) into an existing CTE clause | |
| AddEmailAddresses(InternetAddressList, String) | Add email address to a InternetAddressList | |
| AddEmailAddresses(MailAddressCollection, String) | Add email address to a MailAddressCollection | |
| AddIfNotEmpty | Returns prefix + input + suffix if the input string is not empty, otherwise an empty string | |
| AddIfNotNull | Returns prefix + input + suffix if the input object is not null or empty, otherwise an empty string | |
| AddNotEmpty | Returns separator + input if the input string is not empty, otherwise an empty string | |
| AddNotEmpty2 | Returns input + separator if the input string is not empty, otherwise an empty string | |
| AddValue(String, String, String) | Append a value to a string, adding the separator first if the string is not empty | |
| AddValue(StringBuilder, String, String) | Append a value to a StringBuilder, adding the separator first if the builder is not empty | |
| AreEqualToSecond | Returns true if the two dates differ by less than one second | |
| ArePropertiesIdentical | Returns true if all writable property values of the two objects are identical (compared as strings) | |
| CleanFileName | Remove invalid file name and path characters from a string | |
| ClearAllLINQKeywords | Replace all Seal enum keywords (enum filters and values) in a LINQ script by 'null' | |
| ClearAllSQLKeywords | Replace all Seal keywords (enum filters, enum values, common restrictions and values) in a SQL statement by neutral values (e.g. common restrictions by '1=1') | |
| ClearSQLKeywords | Replace all occurrences of a keyword expression (keyword followed by a name and a closing '}') in a SQL statement by a given value | |
| Clone | Clone an object using XML serialization | |
| CompareTrim | Compare two strings ignoring leading and trailing spaces (null and empty strings are considered equal) | |
| ConcatCellValues | Concatenate the display values of result cells using the given separator | |
| ConvertDateTimeStandardFormat | Convert a DateTimeStandardFormat to its .NET format string (e.g. 'd') | |
| ConvertNumericStandardFormat | Convert a NumericStandardFormat to its .NET format string (e.g. 'N2') | |
| CopyProperties | Copy the public property values from a source object to a destination object of the same type. Properties with XmlIgnore or listed in skipNames are skipped. | |
| CopyPropertiesDifferentObjects | Copy the properties having the same name from a source object to a destination object of a different type | |
| CopyPropertiesFromReference | Copy the property values of a reference object to a destination object for the properties still having their default value | |
| DatabaseToNetTypeConverter | Convert a database column type value (OLE DB type number or type name) to a ColumnType | |
| DbConnectionFromConnectionString | Create a DbConnection from a connection type and a connection string | |
| DBNameToDisplayName | Convert a database object name to a display name (split camel case, replace underscores with spaces, capitalize the first letter) | |
| DisplayDataTable | Write the content of a DataTable to the debug output | |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) | |
| ExecutePrePostSQL | Parse a SQL statement through the Razor engine and execute it on the connection (used for Pre and Post SQL statements) | |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) | |
| FindReplacePattern | If the source contains the pattern at the given index, append the replacement to the result, advance the index and return true | |
| FirstNotEmpty | Returns the first string that is not null or empty, or an empty string if none | |
| FormatMessage | Prefix a message with the current date and time | |
| FromTimeSpan | Convert a TimeSpan to a translated display string (e.g. '2 hours'), or a default value if empty | |
| GetApplicationDirectory | Returns the directory of the current application executable | |
| GetDatabaseType | Determine the DatabaseType from a connection string | |
| GetDataTable | Load a DataTable from a SQL statement executed on a database connection | |
| GetEmailAddresses | Add email address to a MailAddressCollection | |
| GetEnumDescription(Object) | Returns the Description attribute text of an enum value, or the value name if no description is defined | |
| GetEnumDescription(Type, Object) | Returns the Description attribute text of an enum value, or the value name if no description is defined | |
| GetEnumFromDescriptionT | Returns the enum value having the given Description attribute text (or value name), or the default value if not found | |
| GetExceptionMessage | Build a readable error message from a Razor template compilation exception | |
| GetHashCode | Serves as the default hash function. (Inherited from Object) | |
| GetLicense | Decrypt a license text and extract its generation date, version, serial number, name and type | |
| GetLicenseText | Read and check a license file, returning a text describing the license (empty if no file or invalid file) | |
| GetMongoConnectionString | Replace the %USER% and %PASSWORD% keywords in a Mongo DB connection string | |
| GetMySQLConnectionString | Add 'UID' and 'PWD' to a MySQL connection string if they are not already set | |
| GetOdbcConnectionString | Add 'UID' and 'PWD' to an ODBC connection string if they are not already set | |
| GetOleDbConnectionString | Add 'User ID' and 'Password' to an OLE DB connection string if they are not already set | |
| GetPropertyValue | Returns the value of a public instance property of an object by name, or null if the property does not exist | |
| GetSQLKeywordNames | Returns the names used with a given keyword in a SQL statement (text between the keyword and the closing '}') | |
| GetStaticPropertyValue | Returns the value of a public static property of a type by name, or null if the property does not exist | |
| GetStringList | Returns the list of non-empty lines contained in a string | |
| GetSystemDriverList | Returns the list of ODBC driver names installed on the machine (read from the registry) | |
| GetType | Gets the Type of the current instance. (Inherited from Object) | |
| GetUniqueName | Returns a name not present in the given list, appending a number to the name if necessary | |
| GetUniqueNameCaseInsensitive | Returns a name not present in the given list (case insensitive comparison), appending a number to the name if necessary | |
| GetVals | Array of string from a value having CR/LF | |
| HasTimeFormat | Returns true if the date/time format contains a time component | |
| HtmlGetFilePath | Returns a file path as an HTML encoded 'file:///' URL | |
| HtmlMakeImageSrcData | Returns the content of an image file as a base64 data URI to be used in an HTML img src attribute | |
| IfNullOrEmpty | Returns the default value if the input string is null or empty, otherwise the input | |
| IsMachineAdministrator | Returns true if the current Windows user is an administrator of the machine | |
| IsMatchWildcard | Returns true if the input matches the pattern, where '*' is a wildcard | |
| IsPasswordComplex | Check if a password is complex enough (at least 8 characters, one uppercase letter, one digit, and one special character) | |
| IsValidOS | Returns true if the operating system major version is 6 or greater (Windows Vista/Server 2008 or later) | |
| MaskEmail | Masks an email address using standard masking Shows first 1-2 and last 1 character of local part Example: john.doe@example.com → jo****e@example.com | |
| MaskPhoneNumber | Mask a phone number to show only the last 4 digits, replacing the rest with asterisks. | |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) | |
| NetTypeConverter | Convert a .NET type to a ColumnType (Text, DateTime or Numeric) | |
| NewGUID | Returns a new GUID as a string without dashes | |
| ODBCToNetTypeConverter | Convert an ODBC type name to a ColumnType, returning Text on error | |
| OdbcTypeConverter | Convert an ODBC type name (e.g. 'varchar', 'datetime') to a ColumnType | |
| OleDbToNetTypeConverter | Convert an OleDbType to the corresponding .NET Type | |
| QuoteDouble | Returns the input string enclosed in double quotes, doubling any embedded double quote | |
| QuoteSingle | Returns the input string enclosed in single quotes, doubling any embedded single quote | |
| RemoveHTMLTags | Removes HTML tags and non-breaking space entities from a string | |
| RemoveWhitespace | Removes all white-space characters from the input string | |
| Serialize | Serialize an object to an XML file | |
| SetPropertyValue | Set a property value on an object by name from a string (enum, boolean, integer and string properties are supported) | |
| ToDateFnsFormat | Converts a .NET date/time format pattern to a date-fns format string | |
| ToDateTime | Convert an objet to a datetime, handling DBNull value | |
| ToDouble | Convert an objet to a double, handling DBNull value | |
| ToFlatpickrFormat | Converts a .NET date/time format pattern to a Flatpickr format string. Flatpickr uses its own single-letter tokens (e.g. minutes = 'i', month = 'm'/'n', AM/PM = 'K'), so every token is mapped explicitly. Milliseconds/timezone/era have no Flatpickr token and are dropped. | |
| ToHtml | HTML-encode a string, converting new lines to br tags | |
| ToHtmlNoBr | HTML-encode a string for single-line contexts: new lines are converted to spaces instead of br tags | |
| ToJS(Boolean) | Convert a boolean to its JavaScript literal ('true' or 'false') | |
| ToJS(String) | Encode a string to be used in JavaScript | |
| ToMomentJSFormat | Converts a .NET date/time format pattern to a Moment.js format string | |
| ToString | Returns a string that represents the current object. (Inherited from Object) | |
| ToString(Object) | Convert an objet to a string, handling DBNull value | |
| ToTimeSpan | Parse a translated display string (e.g. '2 hours') into a TimeSpan | |
| ValidateNumeric | Try to parse a string as a double, swapping ',' and '.' decimal separators if the first parse fails | |
| WriteDailyLog | Append a message to a daily log file in the logs folder, purging log files older than logDays days | |
| WriteEventLogEntry | Write an exception message to the Windows Event Log | |
| WriteLogEntry | Write a message to the daily log file and to the Windows Event Log | |
| WriteLogEntryScheduler | Write a message to the scheduler daily log file and to the Windows Event Log | |
| WriteLogException | Log an exception (message and stack trace) to the daily events log file and to the Windows Event Log |
| Name | Description | |
|---|---|---|
| DailyLogEvents | Prefix of the daily log files for events | |
| DailyLogExecutions | Prefix of the daily log files for report executions | |
| DailyLogSchedules | Prefix of the daily log files for schedules |