Atomia.Web.Plugin.PublicOrder.Helpers.ResellerHelper.LoadResellerIntoSessionByHash C# (CSharp) Метод

LoadResellerIntoSessionByHash() публичный статический Метод

Loads the reseller into session by hash.
public static LoadResellerIntoSessionByHash ( string resellerHash ) : void
resellerHash string The reseller hash.
Результат void
        public static void LoadResellerIntoSessionByHash(string resellerHash)
        {
            // Load reseller's data only if it's not present in session.
            if (HttpContext.Current.Session["resellerAccountData"] == null
                || ((AccountData)HttpContext.Current.Session["resellerAccountData"]).Hash != resellerHash)
            {
                var service = GeneralHelper.GetPublicOrderService(HttpContext.Current.ApplicationInstance.Context);
                AccountData resellerAccountData = service.GetAccountDataByHash(resellerHash);
                if (resellerAccountData != null)
                {
                    if (HttpContext.Current.Session["resellerAccountData"] == null)
                    {
                        HttpContext.Current.Session.Add("resellerAccountData", resellerAccountData);
                    }
                    else
                    {
                        HttpContext.Current.Session["resellerAccountData"] = resellerAccountData;
                    }

                    if (HttpContext.Current.Session["showContactOptions"] == null)
                    {
                        HttpContext.Current.Session.Add("showContactOptions", true);
                    }
                    else
                    {
                        HttpContext.Current.Session["showContactOptions"] = true;
                    }

                    if (HttpContext.Current.Session["CurrencyDecimalPlaces"] == null)
                    {
                        HttpContext.Current.Session.Add("CurrencyDecimalPlaces", resellerAccountData.CurrencyDecimalPlaces);
                    }
                    else
                    {
                        HttpContext.Current.Session["CurrencyDecimalPlaces"] = resellerAccountData.CurrencyDecimalPlaces;
                    }
                }
                else
                {
                    throw new ApplicationException(string.Format("Reseller with hash {0} not found.", resellerHash));
                }
            }
        }