ModelGenericExtensions Class

This class contains often-needed extensions for often-used basic constructs (IIdLabel, String, Int32, etc.)

Definition

Namespace: MobileTrack.Common.Extensions
Assembly: MobileTrack.Common (in MobileTrack.Common.dll) Version: 0.7+ce90b2cf6b782b8d7b7fd47b3c546987c652c00f
public static class ModelGenericExtensions
Inheritance
Object    ModelGenericExtensions

Methods

DateTimeOffsetNow Generates a DateTimeOffset based on the current time and the business object's timezone.
DisplayDateTime Converts a DateTimeOffset to a human-readable string. If dto and user's timezone are the same timezone offset (e.g. both are Central Europe Summer Timezone) dto's offset is UTC, the time will be displayed in the user's timezone. Otherwise, the time will be displayed in the user's timezone with a note of the original timezone. The formatting is based on the language of the user.
FillInTemplate Fills in the template with the given parameters.
GetAccountsWithRoles Filter accounts based on roles
GetParameterSectionsInTemplate 
GetRolesWithPermission Returns the RoleDtos that have the entered permission
HasPermission Returns if the role contains any of the entered permission
HasPermissionAll Returns if the role contains all the entered permissions
IdString(Guid) renders ID as a string for frontend purposes.
IdString(IIdLabel) renders ID as a string for frontend brevity.
IsItemLocked return True if the item is locked.
IsItemLockedByAnotherUser return True if user can unlock resource.
IsSoftDeletePermanentExpired Gets the DateTime until a soft-deleted item is to be permanently deleted.
ToDecimalDegreesString(GeoLocation, Boolean) Converts a GeoLocation to a degrees/minutes/seconds string. Altitude is ignored.
ToDecimalDegreesString(GeoLocationWithHeading, Boolean) Converts a GeoLocationWithHeading to a degrees/minutes/seconds string. Altitude is ignored.
ToDmsNotationString(GeoLocation) Converts a GeoLocation to a degrees/minutes/seconds string. Altitude is ignored.
ToDmsNotationString(GeoLocationWithHeading) Converts a GeoLocationWithHeading to a degrees/minutes/seconds string. Altitude is ignored.
ToFileSizeDisplay Gets size of a file based on its length in readable terms
ToIdAndLabelDictionaryT(IDictionaryGuid, T) Turns a list of items with an Id and Label into a DictionaryTKey, TValue for Select (front end) usage
ToIdAndLabelDictionaryT(IReadOnlyCollectionT) Turns a list of items with an Id and Label into a DictionaryTKey, TValue for Select (front end) usage

Fields

BuildInRoleModels Returns the generic roles that can be applied to an AccountDto.
SupportedCultures Currently supported cultures in MobileTrack Nexus. For now, it's only English, French and Dutch, but this will likely be expanded in the future. (e.g. Danish, German, Spanish, etc.)

See Also