Click or drag to resize

Helper Class

Static helper methods (strings, HTML, database connections, types, reflection, logging) that can be used in Razor scripts
Inheritance Hierarchy
SystemObject
  Seal.HelpersHelper

Namespace: Seal.Helpers
Assembly: SealLibrary (in SealLibrary.dll) Version: 10.0.1.0+a44cd3a7f03c2bf3cdbd971a878c679e40bed08a
Syntax
C#
public class Helper

The Helper type exposes the following members.

Constructors
 NameDescription
Public methodHelperInitializes a new instance of the Helper class
Top
Methods
 NameDescription
Public methodStatic memberAddAttribute Returns an HTML attribute string (name='value') if the value is not empty, otherwise an empty string
Public methodStatic memberAddCTE Merge a CTE (Common Table Expression 'WITH' clause) into an existing CTE clause
Public methodStatic memberAddEmailAddresses(InternetAddressList, String) Add email address to a InternetAddressList
Public methodStatic memberAddEmailAddresses(MailAddressCollection, String) Add email address to a MailAddressCollection
Public methodStatic memberAddIfNotEmpty Returns prefix + input + suffix if the input string is not empty, otherwise an empty string
Public methodStatic memberAddIfNotNull Returns prefix + input + suffix if the input object is not null or empty, otherwise an empty string
Public methodStatic memberAddNotEmpty Returns separator + input if the input string is not empty, otherwise an empty string
Public methodStatic memberAddNotEmpty2 Returns input + separator if the input string is not empty, otherwise an empty string
Public methodStatic memberAddValue(String, String, String) Append a value to a string, adding the separator first if the string is not empty
Public methodStatic memberAddValue(StringBuilder, String, String) Append a value to a StringBuilder, adding the separator first if the builder is not empty
Public methodStatic memberAreEqualToSecond Returns true if the two dates differ by less than one second
Public methodStatic memberArePropertiesIdentical Returns true if all writable property values of the two objects are identical (compared as strings)
Public methodStatic memberCleanFileName Remove invalid file name and path characters from a string
Public methodStatic memberClearAllLINQKeywords Replace all Seal enum keywords (enum filters and values) in a LINQ script by 'null'
Public methodStatic memberClearAllSQLKeywords 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')
Public methodStatic memberClearSQLKeywords Replace all occurrences of a keyword expression (keyword followed by a name and a closing '}') in a SQL statement by a given value
Public methodStatic memberClone Clone an object using XML serialization
Public methodStatic memberCompareTrim Compare two strings ignoring leading and trailing spaces (null and empty strings are considered equal)
Public methodStatic memberConcatCellValues Concatenate the display values of result cells using the given separator
Public methodStatic memberConvertDateTimeStandardFormat Convert a DateTimeStandardFormat to its .NET format string (e.g. 'd')
Public methodStatic memberConvertNumericStandardFormat Convert a NumericStandardFormat to its .NET format string (e.g. 'N2')
Public methodStatic memberCopyProperties 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.
Public methodStatic memberCopyPropertiesDifferentObjects Copy the properties having the same name from a source object to a destination object of a different type
Public methodStatic memberCopyPropertiesFromReference Copy the property values of a reference object to a destination object for the properties still having their default value
Public methodStatic memberDatabaseToNetTypeConverter Convert a database column type value (OLE DB type number or type name) to a ColumnType
Public methodStatic memberDbConnectionFromConnectionString Create a DbConnection from a connection type and a connection string
Public methodStatic memberDBNameToDisplayName Convert a database object name to a display name (split camel case, replace underscores with spaces, capitalize the first letter)
Public methodStatic memberDisplayDataTable Write the content of a DataTable to the debug output
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodStatic memberExecutePrePostSQL Parse a SQL statement through the Razor engine and execute it on the connection (used for Pre and Post SQL statements)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodStatic memberFindReplacePattern If the source contains the pattern at the given index, append the replacement to the result, advance the index and return true
Public methodStatic memberFirstNotEmpty Returns the first string that is not null or empty, or an empty string if none
Public methodStatic memberFormatMessage Prefix a message with the current date and time
Public methodStatic memberFromTimeSpan Convert a TimeSpan to a translated display string (e.g. '2 hours'), or a default value if empty
Public methodStatic memberGetApplicationDirectory Returns the directory of the current application executable
Public methodStatic memberGetDatabaseType Determine the DatabaseType from a connection string
Public methodStatic memberGetDataTable Load a DataTable from a SQL statement executed on a database connection
Public methodStatic memberGetEmailAddresses Add email address to a MailAddressCollection
Public methodStatic memberGetEnumDescription(Object) Returns the Description attribute text of an enum value, or the value name if no description is defined
Public methodStatic memberGetEnumDescription(Type, Object) Returns the Description attribute text of an enum value, or the value name if no description is defined
Public methodStatic memberGetEnumFromDescriptionT Returns the enum value having the given Description attribute text (or value name), or the default value if not found
Public methodStatic memberGetExceptionMessage Build a readable error message from a Razor template compilation exception
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodStatic memberGetLicense Decrypt a license text and extract its generation date, version, serial number, name and type
Public methodStatic memberGetLicenseText Read and check a license file, returning a text describing the license (empty if no file or invalid file)
Public methodStatic memberGetMongoConnectionString Replace the %USER% and %PASSWORD% keywords in a Mongo DB connection string
Public methodStatic memberGetMySQLConnectionString Add 'UID' and 'PWD' to a MySQL connection string if they are not already set
Public methodStatic memberGetOdbcConnectionString Add 'UID' and 'PWD' to an ODBC connection string if they are not already set
Public methodStatic memberGetOleDbConnectionString Add 'User ID' and 'Password' to an OLE DB connection string if they are not already set
Public methodStatic memberGetPropertyValue Returns the value of a public instance property of an object by name, or null if the property does not exist
Public methodStatic memberGetSQLKeywordNames Returns the names used with a given keyword in a SQL statement (text between the keyword and the closing '}')
Public methodStatic memberGetStaticPropertyValue Returns the value of a public static property of a type by name, or null if the property does not exist
Public methodStatic memberGetStringList Returns the list of non-empty lines contained in a string
Public methodStatic memberGetSystemDriverList Returns the list of ODBC driver names installed on the machine (read from the registry)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodStatic memberGetUniqueName Returns a name not present in the given list, appending a number to the name if necessary
Public methodStatic memberGetUniqueNameCaseInsensitive Returns a name not present in the given list (case insensitive comparison), appending a number to the name if necessary
Public methodStatic memberGetVals Array of string from a value having CR/LF
Public methodStatic memberHasTimeFormat Returns true if the date/time format contains a time component
Public methodStatic memberHtmlGetFilePath Returns a file path as an HTML encoded 'file:///' URL
Public methodStatic memberHtmlMakeImageSrcData Returns the content of an image file as a base64 data URI to be used in an HTML img src attribute
Public methodStatic memberIfNullOrEmpty Returns the default value if the input string is null or empty, otherwise the input
Public methodStatic memberIsMachineAdministrator Returns true if the current Windows user is an administrator of the machine
Public methodStatic memberIsMatchWildcard Returns true if the input matches the pattern, where '*' is a wildcard
Public methodStatic memberIsPasswordComplex Check if a password is complex enough (at least 8 characters, one uppercase letter, one digit, and one special character)
Public methodStatic memberIsValidOS Returns true if the operating system major version is 6 or greater (Windows Vista/Server 2008 or later)
Public methodStatic memberMaskEmail 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
Public methodStatic memberMaskPhoneNumber Mask a phone number to show only the last 4 digits, replacing the rest with asterisks.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodStatic memberNetTypeConverter Convert a .NET type to a ColumnType (Text, DateTime or Numeric)
Public methodStatic memberNewGUID Returns a new GUID as a string without dashes
Public methodStatic memberODBCToNetTypeConverter Convert an ODBC type name to a ColumnType, returning Text on error
Public methodStatic memberOdbcTypeConverter Convert an ODBC type name (e.g. 'varchar', 'datetime') to a ColumnType
Public methodStatic memberOleDbToNetTypeConverter Convert an OleDbType to the corresponding .NET Type
Public methodStatic memberQuoteDouble Returns the input string enclosed in double quotes, doubling any embedded double quote
Public methodStatic memberQuoteSingle Returns the input string enclosed in single quotes, doubling any embedded single quote
Public methodStatic memberRemoveHTMLTags Removes HTML tags and non-breaking space entities from a string
Public methodStatic memberRemoveWhitespace Removes all white-space characters from the input string
Public methodStatic memberSerialize Serialize an object to an XML file
Public methodStatic memberSetPropertyValue Set a property value on an object by name from a string (enum, boolean, integer and string properties are supported)
Public methodStatic memberToDateFnsFormat Converts a .NET date/time format pattern to a date-fns format string
Public methodStatic memberToDateTime Convert an objet to a datetime, handling DBNull value
Public methodStatic memberToDouble Convert an objet to a double, handling DBNull value
Public methodStatic memberToFlatpickrFormat 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.
Public methodStatic memberToHtml HTML-encode a string, converting new lines to br tags
Public methodStatic memberToHtmlNoBr HTML-encode a string for single-line contexts: new lines are converted to spaces instead of br tags
Public methodStatic memberToJS(Boolean) Convert a boolean to its JavaScript literal ('true' or 'false')
Public methodStatic memberToJS(String) Encode a string to be used in JavaScript
Public methodStatic memberToMomentJSFormat Converts a .NET date/time format pattern to a Moment.js format string
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodStatic memberToString(Object) Convert an objet to a string, handling DBNull value
Public methodStatic memberToTimeSpan Parse a translated display string (e.g. '2 hours') into a TimeSpan
Public methodStatic memberValidateNumeric Try to parse a string as a double, swapping ',' and '.' decimal separators if the first parse fails
Public methodStatic memberWriteDailyLog Append a message to a daily log file in the logs folder, purging log files older than logDays days
Public methodStatic memberWriteEventLogEntry Write an exception message to the Windows Event Log
Public methodStatic memberWriteLogEntry Write a message to the daily log file and to the Windows Event Log
Public methodStatic memberWriteLogEntryScheduler Write a message to the scheduler daily log file and to the Windows Event Log
Public methodStatic memberWriteLogException Log an exception (message and stack trace) to the daily events log file and to the Windows Event Log
Top
Fields
 NameDescription
Public fieldStatic memberDailyLogEvents Prefix of the daily log files for events
Public fieldStatic memberDailyLogExecutions Prefix of the daily log files for report executions
Public fieldStatic memberDailyLogSchedules Prefix of the daily log files for schedules
Top
See Also