Class CommonHelper
Summary description for CommonHelper.
Inheritance
Inherited Members
Namespace: Mediachase.Commerce.Website
Assembly: Mediachase.Commerce.Website.dll
Version: 10.8.0Syntax
public class CommonHelper
Constructors
CommonHelper()
Declaration
public CommonHelper()
Methods
AddLinkedStyleSheet(Page, String)
Adds the linked style sheet.
Declaration
public static void AddLinkedStyleSheet(Page page, string styleSheetUrl)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.Page | page | The page. |
System.String | styleSheetUrl | The style sheet URL. |
AddLinkedStyleSheet(Page, String, Boolean)
Adds the linked style sheet.
Declaration
public static void AddLinkedStyleSheet(Page page, string styleSheetUrl, bool resolveClientUrl)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.Page | page | The page. |
System.String | styleSheetUrl | The style sheet URL. |
System.Boolean | resolveClientUrl | if set to |
ClearCompareCookie()
Removes all products from the cookie.
Declaration
public static void ClearCompareCookie()
ClearCompareCookie(String)
Removes all products from the cookie for a specified metaclass.
Declaration
public static void ClearCompareCookie(string mcId)
Parameters
Type | Name | Description |
---|---|---|
System.String | mcId | Id of the metaclass. |
ClearCookie(String, String)
Clears the cookie.
Declaration
public static void ClearCookie(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
System.String | value | The value. |
CreateAuthenticationCookie(String, Boolean)
Creates the authentication cookie.
Declaration
public static void CreateAuthenticationCookie(string username, bool remember)
Parameters
Type | Name | Description |
---|---|---|
System.String | username | The username. |
System.Boolean | remember | if set to |
FormatQueryString(String, NameValueCollection)
Formats the query string.
Declaration
public static string FormatQueryString(string url, NameValueCollection parameters)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL. |
System.Collections.Specialized.NameValueCollection | parameters | The parameters. |
Returns
Type | Description |
---|---|
System.String |
GetCompareCollection()
Returns a collection of key/value pairs that are contained within a compare cookie
Declaration
public static NameValueCollection GetCompareCollection()
Returns
Type | Description |
---|---|
System.Collections.Specialized.NameValueCollection |
GetCompareGroupedProducts()
Returns products to compare.
Declaration
public static List<EntryGroupCollection> GetCompareGroupedProducts()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<EntryGroupCollection> |
GetCompareMetaClasses()
Returns metaclasses of products added to compare.
Declaration
public static string[] GetCompareMetaClasses()
Returns
Type | Description |
---|---|
System.String[] |
GetCompareProducts()
Returns products to compare.
Declaration
public static Entries GetCompareProducts()
Returns
Type | Description |
---|---|
Entries |
GetCompareProducts(String)
Returns products to compare.
Declaration
public static Entries GetCompareProducts(string mcId)
Parameters
Type | Name | Description |
---|---|---|
System.String | mcId | Id of a metaClass. |
Returns
Type | Description |
---|---|
Entries |
GetCompareProductsAmount(String)
Returns amount of products to compare.
Declaration
public static int GetCompareProductsAmount(string mcId)
Parameters
Type | Name | Description |
---|---|---|
System.String | mcId | Id of a metaClass. |
Returns
Type | Description |
---|---|
System.Int32 |
GetCompareProductsDto(String)
Returns products to compare.
Declaration
public static CatalogEntryDto GetCompareProductsDto(string mcId)
Parameters
Type | Name | Description |
---|---|---|
System.String | mcId | Id of a metaClass. |
Returns
Type | Description |
---|---|
CatalogEntryDto |
GetCompareProductsIds(String)
Returns products to compare.
Declaration
public static List<int> GetCompareProductsIds(string mcId)
Parameters
Type | Name | Description |
---|---|---|
System.String | mcId | Id of a metaClass. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.Int32> |
GetCookie(String)
Gets the cookie.
Declaration
public static NameValueCollection GetCookie(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
Returns
Type | Description |
---|---|
System.Collections.Specialized.NameValueCollection |
GetCookieValue(String)
Gets the cookie.
Declaration
public static string GetCookieValue(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
Returns
Type | Description |
---|---|
System.String |
GetFlagIcon(CultureInfo)
Gets the flag icon.
Declaration
public static string GetFlagIcon(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | culture | The culture. |
Returns
Type | Description |
---|---|
System.String |
GetIcon(String)
Gets the icon.
Declaration
public static string GetIcon(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of the file. |
Returns
Type | Description |
---|---|
System.String |
GetImageUrl(String, Page)
Returns absolute url by given relative url
Declaration
public static string GetImageUrl(string relativeUrl, Page page)
Parameters
Type | Name | Description |
---|---|---|
System.String | relativeUrl | Url, relative to theme folder. |
System.Web.UI.Page | page | The web page. |
Returns
Type | Description |
---|---|
System.String |
GetMoneyString(Decimal, String)
Declaration
public static string GetMoneyString(decimal amount, string currency)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | amount | |
System.String | currency |
Returns
Type | Description |
---|---|
System.String |
GetUserDateTime(DateTime)
Returns converted datetime value based on current user's settings.
Declaration
public static DateTime GetUserDateTime(DateTime dt)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dt | DateTime in UTC. |
Returns
Type | Description |
---|---|
System.DateTime |
GetUserName(Guid)
Gets the name of the user.
Declaration
public static string GetUserName(Guid userGuid)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | userGuid | The user GUID. |
Returns
Type | Description |
---|---|
System.String |
GetValueFromQueryString(String, String)
Gets the value from query string.
Declaration
public static string GetValueFromQueryString(string name, string defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
System.String | defaultValue | The default value. |
Returns
Type | Description |
---|---|
System.String |
MakeCurrentApplicationCookieName(String)
Creates app-specific cookie name.
Declaration
public static string MakeCurrentApplicationCookieName(string baseName)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseName |
Returns
Type | Description |
---|---|
System.String |
RemoveProductFromCookie(String, String)
Removes product from the cookie.
Declaration
public static int RemoveProductFromCookie(string productId, string mcId)
Parameters
Type | Name | Description |
---|---|---|
System.String | productId | |
System.String | mcId | Id of the product's metaclass. |
Returns
Type | Description |
---|---|
System.Int32 |
SafeSelect(ListControl, String)
Safes the select.
Declaration
public static void SafeSelect(ListControl ddl, string val)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.WebControls.ListControl | ddl | The DDL. |
System.String | val | The val. |
SelectListItem(DropDownList, Object)
Selects item in the drop down list
Declaration
public static void SelectListItem(DropDownList list, object val)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.WebControls.DropDownList | list | The list. |
System.Object | val | The val. |
SelectListItem(ListBox, Object, Boolean)
Selects item in the listbox
Declaration
public static void SelectListItem(ListBox list, object val, bool clearSelection)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.WebControls.ListBox | list | The list. |
System.Object | val | The val. |
System.Boolean | clearSelection | if set to |
SelectRadioListItem(RadioButtonList, Object)
Selects item in the radio list
Declaration
public static void SelectRadioListItem(RadioButtonList list, object val)
Parameters
Type | Name | Description |
---|---|---|
System.Web.UI.WebControls.RadioButtonList | list | The list. |
System.Object | val | The val. |
SetCompareCookie(String, String)
Remembers productId in the cookie
Declaration
public static int SetCompareCookie(string productId, string mcId)
Parameters
Type | Name | Description |
---|---|---|
System.String | productId | |
System.String | mcId |
Returns
Type | Description |
---|---|
System.Int32 | Return value >=0 - success, returns amount of products to compare for the specified metaclass; -100 - product is already added; -101 - max number of products reached (=_MaxProductsToCompare) |
SetCookie(String, NameValueCollection, DateTime)
Sets the cookie.
Declaration
public static void SetCookie(string key, NameValueCollection values, DateTime expires)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
System.Collections.Specialized.NameValueCollection | values | The values. |
System.DateTime | expires | The expires. |
SetCookie(String, String, DateTime)
Sets the cookie.
Declaration
public static void SetCookie(string key, string val, DateTime expires)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
System.String | val | The val. |
System.DateTime | expires | The expiration time. |