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

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

Loads the reseller into session by URL.
public static LoadResellerIntoSessionByUrl ( string url ) : void
url string The URL.
Результат void
        public static void LoadResellerIntoSessionByUrl(string url)
        {
            // Load reseller's data only if it's not present in session.
            if (HttpContext.Current.Session["resellerAccountData"] == null)
            {
                AtomiaBillingPublicService service = GeneralHelper.GetPublicOrderService(HttpContext.Current.ApplicationInstance.Context);
                AccountData resellerAccountData = service.GetResellerDataByUrl(url) ?? service.GetDefaultResellerData();
                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", false);
                    }
                    else
                    {
                        HttpContext.Current.Session["showContactOptions"] = false;
                    }

                    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 for url {0} nor default reseller not found.", url));
                }
            }
        }