Class CommerceHelper
Implements helper methods for the CommerceLib project.
Inheritance
Inherited Members
Namespace: Mediachase.Commerce.Shared
Assembly: Mediachase.Commerce.dll
Version: 13.30.0Syntax
public static class CommerceHelper
Fields
CodeValidCharacters
Defines the characters that are valid for a product code.
Declaration
public const string CodeValidCharacters = "\\w\\s-_(),."
Field Value
Type | Description |
---|---|
System. |
Remarks
This is intended to be used as a subset of a Regex - the definition allows regular alphanumerics as well as the symbols -, _, (, ), comma and dot.
Methods
ByteSizeToStr(Int64)
Translates size to string. For instance 1.2 KB instead of 1200, or 200 bytes instead of 200.
Declaration
public static string ByteSizeToStr(long size)
Parameters
Type | Name | Description |
---|---|---|
System. |
size | The size in bytes. |
Returns
Type | Description |
---|---|
System. |
String representation of the size converted to bytes, KB or MB. |
CleanUrlField(String)
Cleans the URL field.
Declaration
public static string CleanUrlField(string input)
Parameters
Type | Name | Description |
---|---|---|
System. |
input | The input. |
Returns
Type | Description |
---|---|
System. |
CleanUrlField(String, IUrlSegmentGenerator)
Cleans the URL field.
Declaration
public static string CleanUrlField(string input, IUrlSegmentGenerator urlSegmentGenerator)
Parameters
Type | Name | Description |
---|---|---|
System. |
input | The input. |
EPi |
urlSegmentGenerator | The URL segment generator. |
Returns
Type | Description |
---|---|
System. |
ConvertToString(StringCollection, String)
Converts to string.
Declaration
public static string ConvertToString(StringCollection collection, string separator)
Parameters
Type | Name | Description |
---|---|---|
System. |
collection | The collection. |
System. |
separator | The separator. |
Returns
Type | Description |
---|---|
System. |
GetAbsolutePath(String)
Returns absolute path for the specified relative url.
Declaration
public static string GetAbsolutePath(string xsPath)
Parameters
Type | Name | Description |
---|---|---|
System. |
xsPath | The xs path. |
Returns
Type | Description |
---|---|
System. |
GetAbsoluteThemedPath(String, String)
Gets the absolute themed path.
Declaration
public static string GetAbsoluteThemedPath(string virtualPath, string themeName)
Parameters
Type | Name | Description |
---|---|---|
System. |
virtualPath | The virtual path. |
System. |
themeName | Name of the theme. |
Returns
Type | Description |
---|---|
System. |
Absolute path. |
GetContextParameter(String)
Returns an object with the given name from the current HttpContext.
Declaration
public static object GetContextParameter(string name)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | The name. |
Returns
Type | Description |
---|---|
System. |
GetContextParameter(String, Object)
Returns an object with the given name from the current HttpContext.
Declaration
public static object GetContextParameter(string name, object defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | The name. |
System. |
defaultValue | The default value. |
Returns
Type | Description |
---|---|
System. |
GetContextParameter<T>(String, T)
Returns an object with the given name from the current HttpContext.
Declaration
public static T GetContextParameter<T>(string name, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | The name. |
T | defaultValue | The default value. |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
HasWriteAccess(DirectoryInfo)
Determines whether [has write access] [the specified index dir].
Declaration
public static bool HasWriteAccess(DirectoryInfo indexDir)
Parameters
Type | Name | Description |
---|---|---|
System. |
indexDir | The index dir. |
Returns
Type | Description |
---|---|
System. |
|
RemoveContextParameter(String)
Removes the context parameter.
Declaration
public static void RemoveContextParameter(string key)
Parameters
Type | Name | Description |
---|---|---|
System. |
key | The key. |
SetContextParameter(String, Object)
Adds specified object to the current HttpContext.
Declaration
public static void SetContextParameter(string name, object value)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | The name. |
System. |
value | The value. |
TryParse<T>(Enum, String, out T)
Tries the parse.
Declaration
public static bool TryParse<T>(this Enum theEnum, string valueToParse, out T returnValue)
Parameters
Type | Name | Description |
---|---|---|
System. |
theEnum | The enum. |
System. |
valueToParse | The value to parse. |
T | returnValue | The return value. |
Returns
Type | Description |
---|---|
System. |
Type Parameters
Name | Description |
---|---|
T |