Esempio n. 1
0
        public void ActivateKey(string key)
        {
            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentNullException("key");
            }

            var now       = DateTime.UtcNow;
            var actionUrl = "/partnerapi/ActivateKey?code=" + HttpUtility.UrlEncode(key) + "&portal=" + HttpUtility.UrlEncode(TenantManager.GetCurrentTenant().TenantAlias);

            using var webClient = new WebClient();
            webClient.Headers.Add("Authorization", GetPartnerAuthHeader(actionUrl));
            try
            {
                webClient.DownloadData(partnerUrl + actionUrl);
            }
            catch (WebException we)
            {
                var error = GetException(we);
                if (error != null)
                {
                    throw error;
                }
                throw;
            }
            tariffService.ClearCache(TenantManager.GetCurrentTenant().TenantId);

            var timeout = DateTime.UtcNow - now - TimeSpan.FromSeconds(5);

            if (TimeSpan.Zero < timeout)
            {
                // clear tenant cache
                Thread.Sleep(timeout);
            }
            TenantManager.GetTenant(TenantManager.GetCurrentTenant().TenantId);
        }
Esempio n. 2
0
 public void SaveSection <T>(string sectionName, T section) where T : class
 {
     SaveSection(TenantManager.GetCurrentTenant().TenantId, sectionName, section);
 }
Esempio n. 3
0
 public T GetSection <T>(string sectionName) where T : class
 {
     return(GetSection <T>(TenantManager.GetCurrentTenant().TenantId, sectionName));
 }
Esempio n. 4
0
 public Uri GetShoppingUri(int quotaId, bool forCurrentTenant = true, string affiliateId = null, string currency = null, string language = null, string customerId = null)
 {
     return(tariffService.GetShoppingUri(forCurrentTenant ? TenantManager.GetCurrentTenant().TenantId : (int?)null, quotaId, affiliateId, currency, language, customerId));
 }
Esempio n. 5
0
 private int GetTenant()
 {
     return(TenantManager.GetCurrentTenant().TenantId);
 }