Skip to main content

utils-class

Represents different type conversion functions and other useful procedures

public static class Korzh.EasyQuery.Utils

Assembly: Korzh.EasyQuery.dll

Static Fields

NameTypeDescription
FunctionRegexRegexThe Regex object that matches a function.
MacroRegexRegexThe Regex object that matches a macro value.

Static Methods

NameTypeDescription
ComposeKey(string parent, string child)stringComposes the key (for attributes, entities, etc). Returns "parent.key" if both parent and key are not empty/null
ContainsNonAscii(string s)boolChecks string for inclusion of non-ASCII symbols.
DataKindByName(string kindName)DataKindGets the DataKind value by its text representation.
FormatDateTimeValue(string val, string format, DataType dataType, int timezoneOffset = 0)stringConverts the date/time passed in internal format used in EasyQuery library (yyyy-MM-dd HH:mm:ss by default) to some other date/time format
GenerateId(string prefix)stringGenerates Id with prefix.
GetCurrentCulture()CultureInfoReturns current culture
GetCurrentUICulture()CultureInfoReturns current UI culture
GetElementContentAsString(XmlReader reader)stringReads the content of current XML element (as string)
GetEnumValues(Type oEnumType)IList<int>Gets all values of the enum.
GetSpecialDateByName(string name, bool utc)DateTimeGets the actual date value by its macro name (like "Today", "FirstDayOfMonth", etc).
GetSpecialDateByNameEx(string name, bool utc, DataType& dt, String& text)DateTimeGets the actual date value by its macro name (like "Today", "FirstDayOfMonth", etc).
GetSpecialDateValue(SpecialDateTime sdt, bool utc)DateTimeGets the value of some special date (like Today or FirstDayOfYear) by its enum definition.
GetSpecialDateValueEx(SpecialDateTime sdt, bool utc, DataType& dt, String& text)DateTimeGets the value of some special date (like Today or FirstDayOfYear) by its enum definition.
GetSystemTypeByDataType(DataType type)TypeGets the system type by data type.
GetSystemTypeByDataType(DataType dtype, Type defaultType)TypeGets the system type by data type.
HasTheSameTypeGroup(this DataType type1, DataType type2)boolReturns true if type1 has the same type group (e.g. integer types) as type2.
IsConvertedTo(this DataType type1, DataType type2)boolReturns true if type1 can be converted to type2.
IsSpecialDateTimeMacro(string macroId)boolDetermines whether the string passed in parameter represents a special date/time identifier (like "Today", "FirstDayOfMonth", etc)
MatchMacro(string s, String& macroId)boolMatches the macro in the input string. Returns the name of the macro in "out" parameter if the match was successful
MoveToAttribute(XmlReader reader, string attrName)boolMoves current position of XmlReader into specified attribute.
OldFormatToDateTime(string val)DateTimeConvert string representation in old format to DateTime value.
SafeParseBool(string value, bool defValue = False)boolConverts the string representation of a boolean value. This method does not throw an exception. Instead - it returns some pre-defined value for unsuccessful conversions.
SafeParseInt(string s, int defValue = 0)intConverts the string representation of a number to its 32-bit signed integer equivalent. This method does not throw an exception. Instead - it returns some pre-defined value for unsuccessful conversions.
StrToIdentifier(string s)stringConverts any string to an identifier (changes all symbols like '.' ';' '?' etc to '_')
TextEq(string s1, string s2)boolProvides case-insensitive string comparision
TryGetSpecialDate(string macroId, bool useUtcTime, DateTime& dateVal, DataType& dt, String& text)boolGets the actual date value by its macro name (like "Today", "FirstDayOfMonth", etc). This function returns false if the macro name is not recoginized.