AP&C API Reference
|
This class is a container for utilities that are used throughout the system: constants, conversions, messaging, time-related features and similar functions. More...
Static Public Member Functions | |
static bool | CanStop (SupervisableState state) |
Determines whether it is safe to call Stop on the ISupervisable or ISupervisor in the specified state. More... | |
static DbConnection | GetConnection (string name) |
Gets the connection with the given name. More... | |
static string | TranslatePredicateSet (PredicateSet set, IDbCommand cmd, string tableAlias) |
Converts the given PredicateSet into a T-SQL query predicate (without the 'WHERE'). This can be used to compose filtered queries against the targeted table of the data store. In the course of translation, the variables indicated in the set will be converted into query parameters and added to the provided list object. More... | |
static string | TranslatePredicateOperator (PredicateOperators op) |
Translates predicate operators into DB (T-SQL) operators. More... | |
static IDbDataParameter | AddParameter (IDbCommand cmd, string name, object value, System.Data.DbType type) |
Adds the parameter to the provided IDbCommand as and input parameter. More... | |
static IDbDataParameter | AddParameter (IDbCommand cmd, string name, object value, System.Data.DbType type, System.Data.ParameterDirection direction) |
Adds a new parameter to the provided IDbCommand. More... | |
static void | SendEmail (Message message, MessagingAddress sender, System.Collections.Generic.IEnumerable< MessagingAddress > recipients) |
This verion uses our internal messages to get the job done. More... | |
static decimal | ConvertBtuToKilowatts (decimal btu) |
static decimal | ConvertKilowattsToBtu (decimal kW) |
static decimal | ConvertSquareFeetToSquareMeters (decimal squareFeet) |
static decimal | ConvertSquareMetersToSquareFeet (decimal squareMeters) |
static void | SendEmail (System.Net.Mail.MailMessage msg) |
Sends an email. More... | |
static string | GetResourceValue (Type resourceType, string resourceKey) |
Gets the resource value from the given type. More... | |
static AttributeType | GetPluginAttribute< AttributeType > (Type t) |
Gets the plugin attribute from the provided type. More... | |
static bool | IsMeaningfulString (string str) |
Checks a string for empty, null, or only white-space. More... | |
static int | GetNumberOfMonths (DateTime start, TimeSpan span) |
Determines the number of months included in the given timespan, starting at the given date. More... | |
static int | GetNumberOfMonths (DateTime start, DateTime end) |
Determines the number of months included between two given dates. Note that this includes partial months so a 45-day span will return 2. More... | |
static int | GetNumberOfDays (DateTime start, TimeSpan span) |
Determines the number of days included in the given time span. Note that this is not mathematically the number of hours divided by 24 but the number of days that include part of the time range, so a 36-hour range or 5 minute range that crossed midnight will both return 2, More... | |
static int | GetNumberOfDays (DateTime start, DateTime end) |
static bool | SameDay (DateTime lhs, DateTime rhs) |
static string | GetMonthText (int month) |
static int | GetNumberOfYears (DateTime start, TimeSpan span) |
Determines the number of years included in the given time span. Note that this is not mathematically the number of days divided by 365 but the number of years that include part of the time range, so a 13 month time span will reutrn 2. More... | |
static int | GetNumberOfYears (DateTime start, DateTime end) |
static int | GetWeekOfYear (DateTime date) |
Gets the week of the year according to the current culture's calendar week rule and first week of the year. More... | |
static int | GetMonthOfYear (int year, int week, int dayOfWeek) |
Gets the month of year. More... | |
static DateTime | GetFirstDayOfWeek (DateTime date) |
static DateTime | GetLastDayOfWeek (DateTime date) |
static int | GetTotalMinutes (TimeSpan span) |
static int | GetNumberOfBuckets (TimeSpan span) |
static int | GetTotalSeconds (TimeSpan span) |
static int | GetBucket (int hour, int minute) |
static int | GetBucket (DateTime timestamp) |
static DateTime | GetBucketStart (DateTime timestamp) |
Given a time it determines the time when the bucket started in which the given time falls. More... | |
static TimeSpan | GetTimeStamp (int bucket, int offset) |
Given a bucket and offset it determines the time when the bucket started. More... | |
static bool | BucketEndsHour (int bucket) |
Indicates that the bucket is the last of the hour. More... | |
static bool | BucketEndsDay (int bucket) |
Indicates that the bucket is the last of the day. More... | |
static bool | DayEndsMonth (int year, int month, int day) |
Indicates that the given day is the last day in the given month for the given year. More... | |
static int | GetOffsetIntoBucket (DateTime timestamp) |
Determines the offset of a timestamp (in seconds) into the bucket. This function assumes the given timestamp is actually within the bucket and only utilized those portions of the timestamp needed to determine the offset. More... | |
static uint | GetNumberOfSamples (TimeSpan interval, string measurementType, uint subintervalModulus) |
Determines the number of samples that should result from the given time interval for the given type of measurements and subinterval modulus. More... | |
static System.Drawing.Color | ConvertToColor (string color) |
Will convert the given color name or HEX value to a Color object. If the conversion cannot be done, it will return Color.Black. More... | |
static System.Drawing.Color | ConvertToColor (int argb) |
static ZedGraph.SymbolType | ConvertShape (string plotStyle) |
Converts a configured plot style to an enumerated SymbolType. More... | |
static Data.ValueRange | ParseSensorRange (string range) |
Parses a string range of values (eg. 0-20) into a ValueRange instance. More... | |
Static Public Attributes | |
const string | Setting_EmailSsl = "apac.messaging.email.usetls" |
const string | AlertQueue = "Alerts" |
The name of the messaging queue used for sending alert notifications. More... | |
const string | DefaultQueue = "System" |
const string | MarkType_Now = "Now" |
const string | MarkType_LastBucket = "LastBucket" |
const string | MarkType_PreviousBucket = "PreviousBucket" |
const string | MarkType_EvenSamples = "EvenSamples" |
const string | MeasurementType_Measurement = "Measurement" |
const string | MeasurementType_FiveMinAvg = "FiveMinAvg" |
const string | MeasurementType_HourlyAvg = "HourlyAvg" |
const string | MeasurementType_DailyAvg = "DailyAvg" |
const string | MeasurementType_MonthlyAvg = "MonthlyAvg" |
const string | Alerts = "Alerts" |
const decimal | OneTwelfth = .08333M |
const uint | DefaultID = 0 |
static readonly object | Abort = new object() |
static readonly Regex | ValidUserNameRegEx = new Regex(@"^(?=.{3,15}$)([A-Za-z0-9][._-]?)*$", RegexOptions.Compiled) |
The regex for validating user names. More... | |
static readonly Regex | ValidEmailRegEx = new Regex(@"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z") |
The regex for validating email addresses. More... | |
This class is a container for utilities that are used throughout the system: constants, conversions, messaging, time-related features and similar functions.
|
inlinestatic |
Adds the parameter to the provided IDbCommand as and input parameter.
cmd | The command. |
name | The name. |
value | The value. |
type | The type. |
|
inlinestatic |
Adds a new parameter to the provided IDbCommand.
cmd | The IDbCommand. |
name | The name. |
value | The value. |
type | The type. |
direction | The direction. |
|
inlinestatic |
Indicates that the bucket is the last of the day.
bucket | The bucket number to analyze. |
true
if the bucket is the last for the day, false
otherwise.
|
inlinestatic |
Indicates that the bucket is the last of the hour.
bucket | The bucket number to analyze. |
true
if the bucket is the last for the hour, false
otherwise.
|
inlinestatic |
Determines whether it is safe to call Stop on the ISupervisable or ISupervisor in the specified state.
state | The state. |
true
if Stop makes sense, false
if it doesn't.
|
inlinestatic |
Converts a configured plot style to an enumerated SymbolType.
plotStyle | The name of the plot style to be converted. |
|
inlinestatic |
Will convert the given color name or HEX value to a Color object. If the conversion cannot be done, it will return Color.Black.
color | A string color as well-known name or HEX value. |
|
inlinestatic |
Indicates that the given day is the last day in the given month for the given year.
year | The year to analyze. |
month | The month to analyze. |
day | The day to analyze. |
true
if the day is the last for the month, false
otherwise.
|
inlinestatic |
Given a time it determines the time when the bucket started in which the given time falls.
timestamp | The time used for evaluation. |
|
inlinestatic |
Gets the connection with the given name.
name | The name. |
System.Configuration.ConfigurationErrorsException |
|
inlinestatic |
Gets the month of year.
year | The year. |
week | The week. |
dayOfWeek | The day of week. |
|
inlinestatic |
Determines the number of days included in the given time span. Note that this is not mathematically the number of hours divided by 24 but the number of days that include part of the time range, so a 36-hour range or 5 minute range that crossed midnight will both return 2,
start | |
span |
|
inlinestatic |
Determines the number of months included between two given dates. Note that this includes partial months so a 45-day span will return 2.
start | The starting date to be evaluated. |
end | The ending date to be evaluated. |
|
inlinestatic |
Determines the number of months included in the given timespan, starting at the given date.
start | The starting date to be evaluated. |
span | The length of time to evaluate. |
|
inlinestatic |
Determines the number of samples that should result from the given time interval for the given type of measurements and subinterval modulus.
interval | The time interval being evaluated. |
measurementType | The type of measurement being evaluated. |
subintervalModulus | The size of the subinterval to be evaluated. |
|
inlinestatic |
Determines the number of years included in the given time span. Note that this is not mathematically the number of days divided by 365 but the number of years that include part of the time range, so a 13 month time span will reutrn 2.
start | |
span |
|
inlinestatic |
Determines the offset of a timestamp (in seconds) into the bucket. This function assumes the given timestamp is actually within the bucket and only utilized those portions of the timestamp needed to determine the offset.
timestamp | The timestamp to be evaluated. |
bucket | The bucket used as the basis for the evaluation. |
Determines the offset of a timestamp (in seconds) into the bucket.
timestamp | |
bucket |
|
inlinestatic |
Gets the plugin attribute from the provided type.
AttributeType | The type of the Attribute class being sought. This will be PluginAttribute or a subclass thereof. |
t | The type being searched for the attribute. |
null
if an attribute of that type cannot be found.AttributeType | : | PluginAttribute |
|
inlinestatic |
Gets the resource value from the given type.
resourceType | Type of the resource. |
resourceKey | Name of the resource key to retrieve. |
|
inlinestatic |
Given a bucket and offset it determines the time when the bucket started.
bucket | The bucket to be conveted. |
offset | The offset into the bucket to be converted (seconds). Offset values less than 0 are ignored and have no effect on the conversion. |
|
inlinestatic |
Gets the week of the year according to the current culture's calendar week rule and first week of the year.
date | The date for which the the week is needed. |
|
inlinestatic |
Checks a string for empty, null, or only white-space.
str | The string to check. |
true
if the string is not null, empty, or only white-space, false
otherwise.
|
inlinestatic |
Parses a string range of values (eg. 0-20) into a ValueRange instance.
range |
|
inlinestatic |
This verion uses our internal messages to get the job done.
message | |
sender | |
recipients |
|
inlinestatic |
Sends an email.
msg |
|
inlinestatic |
Translates predicate operators into DB (T-SQL) operators.
op | The PredicateOperators to be translated. |
|
inlinestatic |
Converts the given PredicateSet into a T-SQL query predicate (without the 'WHERE'). This can be used to compose filtered queries against the targeted table of the data store. In the course of translation, the variables indicated in the set will be converted into query parameters and added to the provided list object.
set | The PredicateSet to be translated. |
cmd | The DbCommand to which all parameters will be added. This value can be null , but query parameters will not be used in that case and it is not recommended. |
tableAlias | The alias given to the table for the given variables in the predicate set. |
|
static |
The name of the messaging queue used for sending alert notifications.
|
static |
The regex for validating email addresses.
|
static |
The regex for validating user names.