EAPUtil Methods |
The EAPUtil type exposes the following members.
Name | Description | |
---|---|---|
AddStyles |
Apply the specified CSS styles to the specified control.
| |
AnsiQuote(Object) | Quote an object variable for a SQL statement including escaping embedded ticks. | |
AnsiQuote(String) | Quote a string for a SQL statement including escaping embedded ticks. | |
BitsSet(Enum, Enum) |
Determine if the specified set of bits are all set.
| |
BitsSet(Int32, Enum) |
Determine if the specified set of bits are all set.
| |
BlobToBytes |
Extract a BLOB value from the reader into a byte array.
| |
BlobToFile |
Extract a BLOB value from the reader and write to a file.
| |
CalcLatLongDistance |
Calculate the distance between two points on Earth expressed in lattitude and longitude.
| |
CalendarQuarter |
Return then calendar quarter number to which the specified date belongs.
| |
CaptureStackFrames |
Returns a string of the current stack frames. - Use with caution in production as it is an expensive proposition
| |
CleanFilename(String) |
Clean the provided filename replacing any characters that are invalid in Windows
filenames with underbars. Additional cleaning may be added in the future with the
intent of guraranteeing that the returned filename is a valid Windows filename.
Note that this method could reasonably be called SafeFilename().
| |
CleanFilename(BrowserInfo, String) |
Clean the provided filename replacing any characters that are invalid in Windows
filenames with underbars. Additional cleaning may be added in the future with the
intent of guraranteeing that the returned filename is a valid browser download filename.
Note that this method could reasonably be called SafeFilename().
| |
ClearFarmCacheAsync |
Allows asynchronous execution of a clear cache across farm servers
| |
ComposeDateTime |
Compose a new date/time object from the specified date and time.
| |
ConstructExternalLink |
Constructs a URL link from the collection of name value pairs specifically for external usage.
The follwing URL link strings are automatically added to the URL &src=ext&appkey=[app.ID]
| |
ConstructLink(IAppContext, NameValueCollection) |
Constructs a URL link from the collection of name value pairs.
| |
ConstructLink(IAppContext, NameValueCollection, ConstructLinkOptions) |
Constructs a URL link from the collection of name value pairs.
| |
ConstructLink(IAppContext, NameValueCollection, Boolean) |
Constructs a URL link from the collection of name value pairs.
| |
ContainsKey |
Determine if a particular key has an entry in a NameValue collection.
| |
ControlHtml |
Get the raw HTML for a control.
| |
CreateMissingPath |
Will create a full path, if not already present. The function will recursively create any and all sub folders.
| |
DataTableTypeToOleDbType |
Translate a .Net DataTable DataColumn datatype to to its corresponding OleDbType.
| |
DateSQL(DateTime) |
Format a date/time for use in a SQL statement.
The string will be AnsiQuoted and so no additional quoting should be performed.
| |
DateSQL(NullableDateTime) |
Format a nullable date/time for use in a SQL statement.
If non-null the string will be AnsiQuoted and so no additional quoting should be performed.
| |
DefaultHtmlHeader |
Get a default HTML header which includes EAPDefault css and EAPUtils js.
| |
Deserialize |
Deserialize a string to a simple class.
Note that only public fields and public read/write properties are handled.
| |
DevLogUnknownBits |
Check the specified enumeration value against its enumeration in order
to detect use of unknown bits. If unknown bits are detected devlog a warning.
| |
DiagnoseMultipleControlError |
Recurses through the specified control's Controls collection looking for UniqueID collisions.
Helpful in diagnosing "Multiple controls with the same ID 'xxx' were found. FindControl requires that controls have unique IDs."
errors thrown by the .Net Control.FindControl() method.
| |
EqualValue |
Determines if the object value is equal to another object. If the two objects are null, then this returns true.
There is special handling for guid comparisons (since a guid could be a string formatted in up to 3 different ways).
If the special guid handling is not performed, then the object.Equals method is used.
| |
EscapeEmbeddedFunctions |
Escape any embedded functions in the specified string (presumably a filter).
| |
EscapeExpressionBrackets |
EscapeExpressionBrackets
| |
EscapeSQLName |
Escape a column or table/view name for use in a SQL statement in the specified DBMS.
| |
ExtractNestedMessage |
Extracts the inner exception message from the supplied Exception object.
| |
FileExists |
Gets a value indicating whether a file exists.
| |
FileIsReadonly |
Determines whether the specified file exists and is read-only.
| |
FileMakeWriteable |
Clears the read-only setting on the specified file, if it is marked read-only. The file MUST exist.
If the file is not marked read-only then no action is performed.
| |
FileVersion |
Obtains the file version for the specified file, if found.
| |
FindChildControl |
Search the provided control for an immediate child control with the
specified ID.
| |
FixupHoverButton |
The CSS :hover pseudo-style is only supported on IE6 for anchor tags. A workaround
to this is to wrap other tags in an anchor tag putting the :hover style on both the
item and its anchor wrapper. This isn't required on other browsers, but doesn't
cause any problem either.
| |
FormatException(Exception, FormatExceptionOptions) |
Returns a formatted string from an exception based on the provided FormatExceptionOptions.
| |
FormatException(Exception, Boolean) |
Returns a formatted string from an exception.
| |
FormatException(IAppContext, Exception) |
Returns a formatted string from an exception using developer logging when appropriate and
honoring the UserErrorMessages application property.
| |
FormatException(Exception, Boolean, Boolean) |
Returns a formatted string from an exception.
| |
FormatException(Exception, Boolean, Boolean, Boolean) |
Returns a formatted string from an exception.
| |
FormatException(Exception, Boolean, Boolean, Boolean, Boolean) |
Returns a formatted string from an exception.
| |
FormatExceptionForRequestLog |
Returns a formatted string from an exception where that string is intended for logging
to the xot_request_log and is appropriate for developers.
| |
FromHex |
Converts a hex formatted string into an array of bytes.
| |
FtpDeleteFile(String, String, String) |
Delete File from given FTP Server
| |
FtpDeleteFile(String, String, String, Boolean) |
Delete File from given FTP Server
| |
FtpGetFileContents(String, String, String) |
Retrieve information about file located on FTP Server
| |
FtpGetFileContents(String, String, String, Boolean) |
Retrieve information about file located on FTP Server
| |
FtpGetFileList(String, String, String) |
Get List of files from given FTP Server
| |
FtpGetFileList(String, String, String, Boolean) |
Get List of files from given FTP Server
| |
FtpUpload(String, String, String, String) |
Upload File using FTP Protocol to given FTP Server
| |
FtpUpload(String, String, String, String, Boolean) |
Upload File using FTP Protocol to given FTP Server
| |
FtpUpload(String, String, String, String, Byte) |
Upload File using FTP Protocol to given FTP Server
| |
FtpUpload(String, String, String, String, Byte, Boolean) |
Upload File using FTP Protocol to given FTP Server
| |
GetByteBufferFromFile |
Reads the contents of a file into a byte array. Use GetByteBufferFromLogicalFile(IAppContext, String) if you have a logical path.
| |
GetByteBufferFromLogicalFile |
Reads the contents of a file into a byte array. Use GetByteBufferFromFile(IAppContext, String) if you have a physical path.
| |
GetDataRowValue |
Returns the value of a column from the datarow
| |
GetEventsHandled |
Use reflection to determine which events are handled by the final derived type in the provided object.
| |
GetImageFromFile |
GetImageFromFile
| |
GetLogDB |
Get the database to which to log requests (to the xot_request_log table.
The database returned will be based on the following precedence:
| |
GetNextBusinessDay |
Returns the next business day.
| |
GetPageForm |
Gets the Form object on which the specified control resides.
.Net Controls need to be added to the form.
| |
GetTypeFromString |
Returns a System.Type from the named type.
| |
HasExactlyOneBitSet |
Tests whether or not the specified value has more than one bit set.
This is typically used when examining enumeration values from an enumeration
marked with the FlagsAttribute.
For a non-zero value, this is the inverse of IsBitMask(Int32).
| |
HasRows |
Determines if a DataReader has any rows. The purpose of this method is
to virtualize the particular provider. At this time the OleDB and
SqlClient providers are supported.
| |
HelpString |
Get the HelpString attribute for an enum item.
| |
HtmlEncode |
Encode and HTML string. Safe to call in web and client-server.
| |
ImageSize(String) |
Gets the image size of the specified image file specified by virtual path.
| |
ImageSize(String, Boolean) |
Gets the image size of the specified image file specified by virtual path.
| |
InputStreamToBase64 |
Reads a stream and converts it to a base-64 string.
| |
IsBitMask |
Tests whether or not the specified value represents a bit-mask.
This is typically used when examining enumeration values from an enumeration
marked with the FlagsAttribute.
The value is considered a bit-mask if it has more than 1 bit set.
So, for example, 0x000000ff would be a bit-mask, but 0x0000040 would not.
For a non-zero value, this is the inverse of HasExactlyOneBitSet(Int32).
| |
IsClientScriptBlockRegistered |
Determines whether or not the specified client script block has already been registered on the page using
either RegisterClientScriptBlock(Page, String, String) or RegisterClientScriptFile(Page, String, String).
See RegisterClientScriptBlock(Page, String, String) for additional documentation on registering client script blocks.
| |
IsEditorBrowsable |
Returns false if the enum has the EditorBrowsable(EditorBrowsableState.Never) set, otherwise true
| |
IsFileValidateAcceptType |
Validates that a posted back file conforms to the specified ACCEPT types per the
HTML INPUT FILE element's ACCEPT attribute.
See http://www.w3schools.com/jsref/prop_fileupload_accept.asp for more information on accept.
| |
IsFolder |
Determines if the specified path points to a folder. Note that the path must exist.
You can use FileExists(String) to determine if the file or folder exists.
| |
IsGuid |
Determines if a string represents a guid.
A string is a guid if it matches one of three Regex Expressions for standard guid formatting:
A 32 character string a-f0-9,
A 36 character string a-f0-9 with formatting dashes,
A 38 character string a-f0-9 with formatting dashes enclosed in curly braces.
| |
IsNonEmptyString |
Determines if the specified object is a non-empty string.
| |
IsNullObjectOrEmptyString |
Determine if an object is null or a blank string.
A DBNull object is considered null.
Note that this function is identical to IsNullOrBlank(Object).
| |
IsNullOrBlank(Object) |
Determines if an object is null or a blank (empty) string.
A DBNull object is considered null.
Note that this function is identical to IsNullObjectOrEmptyString(Object).
| |
IsNullOrBlank(String) |
Determines if a string is null or blank (empty).
| |
IsNumeric |
Determines if the string expression is a numeric type.
| |
IsReservedDBWord |
Returns true if the word is a reserved SQL word.
| |
IsStartupScriptRegistered |
Determines whether or not the specified client startup script has already been registered via RegisterStartupScript(Page, String, String).
| |
IsTruthy |
Determines whether a string value is "truthy".
Truthy is defined as any string that is not null or empty and not "0" when trimmed.
Note that this is slightly different from the javascript definition of a truthy string where '0' would be considered truthy.
This difference is intended to allow for easy testing of a string that alter will be converted to a numeric value where zero would not be considered truthy.
| |
IsUIHidden |
Determine if the specified enumeration item has its UIHidden attribute set.
| |
IsVersionConstrained(IAppContext, Object, EAPVersionsBaseVersions, Int32, Int32, Int32) |
Determines whether an object type that supports versioning is versioned out.
This method is really intended for internal use only. | |
IsVersionConstrained(IAppContext, Object, EAPVersionsBaseVersions, Int32, Int32, Int32, Int32, Int32) |
Determines whether an object type that supports versioning is versioned out.
This method is really intended for internal use only. | |
JString |
Convert a string to a quoted java string including escaping embedded ticks and certain other characters.
| |
LoadComponent(String, String, String) |
Load a component DLL into the current AppDomain.
| |
LoadComponent(String, String, String, AppDomain) |
Load a component DLL into the specified AppDomain.
| |
LoadComponent(String, String, String, String) |
Load a component DLL into the current AppDomain.
| |
LoadComponent(String, String, String, AppDomain, Boolean) |
Load a component DLL into the specified AppDomain.
| |
LoadComponent(String, String, String, String, AppDomain, Boolean) |
Load a component DLL into the specified AppDomain.
| |
LogApiRequest(IAppContext, String, String, String, String, String, Int32, Object, Double, String) |
Logs an API request to the xot_api_request_log table.
| |
LogApiRequest(IAppContext, String, String, String, String, String, Int32, String, String, String, String, Object, Double) |
Logs an API request
| |
MD5 |
Encode a string into its MD5 representation in the form of a hex string.
| |
MergeStrings |
Merge two (possibly empty) strings using the specified delimiter;
| |
NewGuid |
Generate a new GUID string formatted without hyphens.
| |
NewGuid(String) |
Generate a new GUID string formatted without hyphens.
| |
ObjCompare |
Compare two objects.
| |
PathExists |
Determine if the specified path exists. If the path includes a filename, the
filename portion is ignored and only the path is checked.
| |
PathSplit(String, String, String) |
Split a path into its path and filename parts.
| |
PathSplit(String, String, String, Boolean) |
Split a path into its path and filename parts.
| |
PhysicalPathToRelativePath |
Map a physical path to a root-relative path.
| |
ReaderBlobToFile |
Extract a binary column, using any data reader, to a file. Note that for historical purposes
SqlBlobToFile(SqlDataReader, Int32, String, Int32) is used for SQL-Server databases, but there is little, if any, difference between
that method and this except that SqlBlobToFile(SqlDataReader, Int32, String, Int32) takes a SqlDataReader parameter.
| |
ReadInputStream |
Reads a stream and returns it as a byte array of its binary content.
| |
ReadTextFile |
Read a text file into a string.
Note that this method catches any error and logs it. No error will be thrown if there is a problem reading the file.
| |
RedirectUrl(String) |
Performs a redirect to the specified page.
| |
RedirectUrl(String, Boolean) |
Performs a redirect to the specified page.
| |
RegisterClientHtmlBlock |
Register an HTML block (not script) with the page.
Use RegisterClientScriptBlock(Page, String, String), RegisterClientScriptFile(Page, String, String), and RegisterStartupScript(Page, String, String)
to register javascript on the page.
| |
RegisterClientScriptBlock |
Register a script block (assumed to be javascript) with the page.
This method is normally used to register javascript function definitions, but not code to be executed
immediately, as this code will be injected early in the page's HTML and generally will be executed by
the browser's javascript engine before the page has finished loading. Script that should be executed
once the page finishes loading and the DOM has been rendered should be registered using
RegisterStartupScript(Page, String, String). For registering HTML, use RegisterClientHtmlBlock(Page, String, String).
You can register script residing in a disk file using RegisterClientScriptFile(Page, String, String).
Use IsClientScriptBlockRegistered(Page, String) to determine if the block is aready registered.
| |
RegisterClientScriptFile |
Register an HTML script tag to include a javascript file.
Use RegisterClientScriptBlock(Page, String, String) to register a script from a string and for additional documentation
on registering client script blocks.
| |
RegisterDocReadyScript |
Register jQuery startup javascript with the page.
Uses RegisterStartupScript(Page, String, String) to register a jQuery $(document).ready() call for the specified script.
The script will be wrapped in an anonymous function call.
Use IsStartupScriptRegistered(Page, String) to determine if the block is aready registered.
| |
RegisterHiddenField(Page, String, String) |
Create a hidden control on the page. This method should be used instead
of the .Net Page.RegisterHiddenField() method if the value will need to be
accessed on the client because the .Net method (as of v1.1) does not set
an id attribute on the field. That's OK w/ Internet Explorer, but makes
the field unavailable to javascript in Firefox.
| |
RegisterHiddenField(WebControl, String, String) |
Create a hidden control nested inside the specified control.
This method should be used instead
of the .Net Page.RegisterHiddenField() method if the value will need to be
accessed on the client because the .Net method (as of v1.1) does not set
an id attribute on the field. That's OK w/ Internet Explorer, but makes
the field unavailable to javascript in Firefox.
| |
RegisterStartupScript |
Register startup script (assumed to be javascript) with the page.
Use RegisterClientScriptBlock(Page, String, String) or RegisterClientScriptFile(Page, String, String) to
register blocks of script defining functions and other code that does not require immediate execution.
Use IsStartupScriptRegistered(Page, String) to determine if the block is aready registered.
| |
RemoveInvalidChars |
Removes invalid characters from a string that represents a path or file name
| |
ReplaceCaseInsensitive(String, String, String) |
A fast, case-insensitive string replacement function.
| |
ReplaceCaseInsensitive(String, String, String, ReplaceOptions) |
A fast, case-insensitive string replacement function.
| |
ResizeImage |
Resizes an image
| |
ResolvePath |
Resolve a virtual path, possibly starting with "~", to a standard virtual path without "~".
| |
RetrieveLinkerTimestamp |
Retrieves the linker timestamp for the specified file.
| |
SafeSQLName |
Escapes the object name with square brackets [] if the word is reserved or contains a reserved character.
| |
SavePostedFile(IAppContext, HttpPostedFile, String, String, Boolean, Int32) |
Save the provided posted file as specified. This method is used in response to the
user posting a HtmlInputFile control.
Note that this method validates maxSizeKB and will an error if validation fails.
| |
SavePostedFile(IAppContext, HttpPostedFile, String, String, Boolean, Int32, String) |
Save the provided posted file as specified. This method is used in response to the
user posting a HtmlInputFile control.
Note that this method validates maxSizeKB and accept and will throw an error if validation fails.
| |
Serialize |
Serialize a simple class to a string.
Note that only public fields and public read/write properties are handled.
| |
SetInitialFocus |
Set initial focus on the page to the specified control.
| |
SetNewActionOnQS |
Set, or if already present, replace, the URL's "act" (action) parameter. The "act" parameter is
used primarily in troubleshooting to determine the origin and intention of a request.
| |
SpanIncluding |
Extracts the span of characters at the beginning of the specified string that are
in the set of specified characters. The behaviour is the sames as the C++
CString::SpanIncluding() method.
| |
SqlBlobToFile |
Extract a binary column from a SQL-Server data reader to a file.
See ReaderBlobToFile(IDataReader, Int32, String, Int32) for a general purpose blob-to-file implementation.
| |
SqlDbTypeToOleDbType |
Translate a SqlDbType to its corresponding OleDbType.
| |
SqlExceptionInternals |
Extract additional information, if available, from a SqlException and return in a string.
The result is intended to be made available to developers, but probably not end users.
| |
SqlNativeTypeToOleDbType |
Translate a SQL-Server native type (string) to its corresponding OleDbType.
| |
SQLString(Enum) |
Generate a SQL string for an enumeration item by converting the enum item
to its corresponding integer value and then representing that integer as a string.
| |
SQLString(String) |
Prepare a string for use in a SQL statement. If the string is null or empty then
an unquoted "NULL" is returned, else an AnsiQuoted string is returned.
| |
SQLString(Object, OleDbType, DBMSType) |
Generate a SQL representation of the value for the specified DataType and DBMS.
| |
SQLString(Object, OleDbType, DBMSType, SQLColumnFlags) |
Generate a SQL representation of the value for the specified DataType and DBMS.
| |
StripHTML |
Strip all HTML tags from an HTML string.
| |
TextToHtml |
Escape a string for use in the template.
| |
ToDecimal(Object) |
Convert an object to a decimal value handling the case when the object is DBNull.
When the object is null, the return value will default to zero.
| |
ToDecimal(Object, Decimal) |
Convert an object to a decimal value handling the case when the object is DBNull.
When the object is null, the return value is the value of the defaultValue parameter.
| |
ToDouble(Object) |
Convert an object to a double value handling the case when the object is DBNull.
When the object is null, the return value is the value of the defaultValue parameter.
Note that currently an unparseable value (e.g. "3.5abc") will cause an exception to be thrown.
Use ToDoubleSafe(Object, Double) to guarantee no exception is thrown.
| |
ToDouble(Object, Double) |
Convert an object to a double value handling the case when the object is DBNull.
When the object is null, the return value is the value of the defaultValue parameter.
Note that currently an unparseable value (e.g. "3.5abc") will cause an exception to be thrown.
Use ToDoubleSafe(Object, Double) to guarantee no exception is thrown.
| |
ToDoubleSafe |
Convert an object to a double value handling the case when the object is null or DBNull.
When the object is null or cannot be converted successfully, the return value is the value of the defaultValue parameter.
This method will never throw an exception.
Use ToDouble(Object, Double) if an exception is desired for invalid (non-null) values.
| |
ToHex |
Converts a byte array into a hex string.
| |
ToInt(Object) |
Convert an object to an int handling the case when the object is DBNull.
When the object is null, the return value is 0.
| |
ToInt(Object, Int32) |
Convert an object to an int handling the case when the object is DBNull.
When the object is null, the return value is the value of the defaultValue parameter.
| |
ToString(Object) |
Safely converts an object to a string. If the object is null the return value is an empty string
| |
ToString(Object, String) |
Safely converts an object to a string. If the object is null or empty then the defaultValue is returned.
Note, however, that if both the converted object and defaultValue are null an empty string is returned.
A null value is never returned.
| |
ToStringRaw |
Safely converts an object to a string with special case handling for data types that typically
result in undesirable string values when converted using the default .Net conversions.
At this time the following special conversions are performed:
| |
TypeIsBinary |
Is the specified type a binary data type?
| |
TypeIsBoolean |
Is the specified type a boolean data type?
| |
TypeIsChar |
Is the specified type a character/string data type?
| |
TypeIsDate |
Is the specified type a date and/or time data type?
| |
TypeIsFloat |
Is the specified type a floating point data type?
| |
TypeIsInteger |
Is the specified type an integer data type?
| |
TypeIsLong |
Is the specified type a "long" (large) data type?
| |
TypeIsLongChar |
Is the specified type a "long" (large) character data type?
| |
TypeIsNumeric |
Is the specified type a numeric data type?
| |
TypeIsUnicode |
Is the specified type a Unicode (W -- wide) character data type?
| |
TypeRequiresUnicodeEscape |
Determines if the specified data type requires a Unicode escape character
('N' for SQL-Server).
| |
ValidBits |
Gets the declared ValidBits for the specified enumeration.
| |
WeekNumber |
Determine the ISO 8601 week number for a particular date.
| |
WindowOpenFeatures(WindowOpenOptions, Int32, Int32) |
Generates the "features" string for a javascript window.open() call.
The resulting string is enquoted and ready for use.
Note that use of the WindowOpenFeatures(IAppContext, WindowOpenOptions, Int32, Int32)
overload is preferred because it enforces certain application-wide features, in particular
ForcePopupScrollbars which forces scrollbars on popup windows.
| |
WindowOpenFeatures(IAppContext, WindowOpenOptions, Int32, Int32) |
Generates the "features" string for a javascript window.open() call.
The resulting string is enquoted and ready for use.
Note that this overload taking the cxt parameter enforces certain
application-wide features, in particular ForcePopupScrollbars which
forces scrollbars on popup windows.
| |
WriteBlobToDatabase |
Update a column in a single record in the database with binary data.
| |
WriteExceptionToRequestLog |
Writes exception information to request log.
Normally exceptions are automatically written to the request log in the normal course of events. However, in the
case where an exception is suppressed that exception will not be automatically written to the request log and this
method may be called. Exceptions logged to the request log will be picked up by the RequestLogMonitor.
| |
WriteFileToDatabase |
Reads the contents of the specified file into a byte array and writes the array to the specified
BLOB field in the database in the specified record.
| |
WriteInputStreamToDatabase |
Reads a stream and stores the results in a database BLOB column.
| |
WriteToRequestLog(IAppContext, IDatabase, String, String, Double) |
Writes pertinent information to request log. This method is the more generic version where we're just interested in logging some error information.
| |
WriteToRequestLog(IAppContext, IDatabase, String, String, String, String, Double, String) |
Writes an entry to the xot_request_log. The database to which the entry is written is controlled by either an
application property "PageActivityDatasource", or is written to the database object passed in the argument list (if not null)
or the data database of the application object if the database argument is null.
| |
WriteToRequestLog(IAppContext, IDatabase, String, String, String, String, Double, String, String) |
Writes an entry to the xot_request_log. The database to which the entry is written is controlled by either an
application property "PageActivityDatasource", or is written to the database object passed in the argument list (if not null)
or the data database of the application object if the database argument is null.
| |
WriteToRequestLog(IAppContext, IDatabase, String, String, String, String, Double, String, String, String) |
Writes an entry to the xot_request_log. The database to which the entry is written is controlled by either an
application property "PageActivityDatasource", or is written to the database object passed in the argument list (if not null)
or the data database of the application object if the database argument is null.
| |
WriteToTimingLog |
Log a timing entry to the xot_timing_log table. | |
ZipDistanceCalc |
Calculate the distance between two zip codes.
| |
ZipInfoLookup |
Look up a ZIP code from the xot_zip_codes table.
|