private Dictionary <string, LimitAmount> GetCurrencyLimitAmount(ceLiveCasinoTableBaseEx table) { Dictionary <string, LimitAmount> dic = new Dictionary <string, LimitAmount>(StringComparer.InvariantCultureIgnoreCase); CurrencyData [] currencies = GamMatrixClient.GetSupportedCurrencies(); if (table.Limit.Type == LiveCasinoTableLimitType.AutoConvertBasingOnCurrencyRate) { foreach (CurrencyData currency in currencies) { dic[currency.ISO4217_Alpha] = new LimitAmount() { MinAmount = GamMatrixClient.TransformCurrency(table.Limit.BaseCurrency, currency.ISO4217_Alpha, table.Limit.BaseLimit.MinAmount), MaxAmount = GamMatrixClient.TransformCurrency(table.Limit.BaseCurrency, currency.ISO4217_Alpha, table.Limit.BaseLimit.MaxAmount), }; } } else if (table.Limit.Type == LiveCasinoTableLimitType.SameForAllCurrency) { foreach (CurrencyData currency in currencies) { dic[currency.ISO4217_Alpha] = new LimitAmount() { MinAmount = table.Limit.BaseLimit.MinAmount, MaxAmount = table.Limit.BaseLimit.MaxAmount, }; } } else if (table.Limit.Type == LiveCasinoTableLimitType.SpecificForEachCurrency) { foreach (var limit in table.Limit.CurrencyLimits) { if (limit.Value.MaxAmount == 0.00M) { continue; } dic[limit.Key] = new LimitAmount() { MinAmount = limit.Value.MinAmount, MaxAmount = limit.Value.MaxAmount, }; } } return(dic); }
public static Dictionary <string, JackpotInfo> GetIGTJackpots(long domainID, string customUrl = null) { string filepath = Path.Combine(FileSystemUtility.GetWebSiteTempDirectory() , string.Format("IGTJackpotsFeeds.{0}.cache", domainID) ); Dictionary <string, JackpotInfo> cached = HttpRuntime.Cache[filepath] as Dictionary <string, JackpotInfo>; if (cached != null && string.IsNullOrEmpty(customUrl)) { return(cached); } Func <Dictionary <string, JackpotInfo> > func = () => { try { Dictionary <string, JackpotInfo> jackpots = new Dictionary <string, JackpotInfo>(StringComparer.InvariantCultureIgnoreCase); var domain = DomainManager.GetDomains().FirstOrDefault(d => d.DomainID == domainID); if (domain == null && DomainManager.GetSysDomain().DomainID == domainID) { domain = DomainManager.GetSysDomain(); } if (domain == null) { throw new Exception("domain can't be found"); } string jackpotBaseURL = domain.GetCfg(IGT.JackpotBaseURL); string url; if (string.IsNullOrWhiteSpace(jackpotBaseURL)) { url = customUrl ?? string.Format(IGT_URL, "0001"); } else { url = customUrl ?? string.Format(jackpotBaseURL, "0001"); } XDocument xDoc = XDocument.Load(url); JackpotInfo jackpot = new JackpotInfo() { ID = xDoc.Root.Element("jackpotid").Value, Name = xDoc.Root.Element("jackpotid").Value, VendorID = VendorID.IGT, }; // Only 1 IGT jackpot Dictionary <string, CurrencyExchangeRateRec> currencies = GamMatrixClient.GetCurrencyRates(Constant.SystemDomainID); string currency = "EUR"; decimal amout = decimal.Parse(xDoc.Root.Element("currentvalue").Value, CultureInfo.InvariantCulture); foreach (string key in currencies.Keys) { jackpot.Amounts[key] = GamMatrixClient.TransformCurrency(currency, key, amout); } jackpots[jackpot.ID] = jackpot; if (jackpots.Count > 0 && string.IsNullOrEmpty(customUrl)) { ObjectHelper.BinarySerialize <Dictionary <string, JackpotInfo> >(jackpots, filepath); } return(jackpots); } catch (Exception ex) { Logger.Exception(ex); throw; } }; if (!string.IsNullOrEmpty(customUrl)) { cached = func(); } else if (!DelayUpdateCache <Dictionary <string, JackpotInfo> > .TryGetValue(filepath, out cached, func, 120)) { cached = ObjectHelper.BinaryDeserialize <Dictionary <string, JackpotInfo> >(filepath, new Dictionary <string, JackpotInfo>()); } return(cached); }
public static Dictionary <string, JackpotInfo> GetPlaynGOJackpots(long domainID, string customUrl = null) { string filepath = Path.Combine(FileSystemUtility.GetWebSiteTempDirectory() , string.Format("PlaynGOJackpotsFeeds.{0}.cache", domainID) ); Dictionary <string, JackpotInfo> cached = HttpRuntime.Cache[filepath] as Dictionary <string, JackpotInfo>; if (cached != null && string.IsNullOrEmpty(customUrl)) { return(cached); } Func <Dictionary <string, JackpotInfo> > func = () => { string url = null; try { Dictionary <string, JackpotInfo> jackpots = new Dictionary <string, JackpotInfo>(StringComparer.InvariantCultureIgnoreCase); DomainConfigAccessor dca = DomainConfigAccessor.CreateInstance <DomainConfigAccessor>(); ceDomainConfigEx config = dca.GetByDomainID(domainID); if (config != null) { url = customUrl ?? string.Format(PlaynGO_URL, config.GetCfg(PlaynGO.PID).DefaultIfNullOrEmpty("71")); PlaynGOJackpot[] objects = null; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.Timeout = 50000; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) using (Stream stream = response.GetResponseStream()) using (StreamReader sr = new StreamReader(stream)) { string json = sr.ReadToEnd(); JavaScriptSerializer jss = new JavaScriptSerializer(); objects = jss.Deserialize <PlaynGOJackpot[]>(json); } if (objects != null) { foreach (PlaynGOJackpot obj in objects) { JackpotInfo jackpot = new JackpotInfo() { ID = obj.JackpotId.ToString(), Name = obj.Description, VendorID = VendorID.PlaynGO, }; // Only 1 IGT jackpot Dictionary <string, CurrencyExchangeRateRec> currencies = GamMatrixClient.GetCurrencyRates(Constant.SystemDomainID); string currency = obj.Currency; decimal amout = obj.BaseAmount; foreach (string key in currencies.Keys) { jackpot.Amounts[key] = GamMatrixClient.TransformCurrency(currency, key, amout); } jackpots[jackpot.ID] = jackpot; } } } if (jackpots.Count > 0 && string.IsNullOrEmpty(customUrl)) { ObjectHelper.BinarySerialize <Dictionary <string, JackpotInfo> >(jackpots, filepath); } return(jackpots); } catch (Exception ex) { Logger.Exception(ex, string.Format(@" PlaynGO - Jackpots URL : {0}", url)); throw; } }; if (!string.IsNullOrEmpty(customUrl)) { cached = func(); } else if (!DelayUpdateCache <Dictionary <string, JackpotInfo> > .TryGetValue(filepath, out cached, func, 120)) { cached = ObjectHelper.BinaryDeserialize <Dictionary <string, JackpotInfo> >(filepath, new Dictionary <string, JackpotInfo>()); } return(cached); }
/// <summary> /// Get NetEnt Jackpots /// </summary> /// <returns></returns> public static Dictionary <string, JackpotInfo> GetNetEntJackpots(long domainID) { string filepath = Path.Combine(FileSystemUtility.GetWebSiteTempDirectory() , "NetEntJackpotFeeds.cache" ); Dictionary <string, JackpotInfo> cached = HttpRuntime.Cache[filepath] as Dictionary <string, JackpotInfo>; if (cached != null) { return(cached); } Func <Dictionary <string, JackpotInfo> > func = () => { try { Dictionary <string, JackpotInfo> jackpots = new Dictionary <string, JackpotInfo>(StringComparer.InvariantCultureIgnoreCase); using (GamMatrixClient client = new GamMatrixClient()) { NetEntAPIRequest request = new NetEntAPIRequest() { GetIndividualJackpotInfo = true, GetIndividualJackpotInfoCurrency = "EUR", }; request = client.SingleRequest <NetEntAPIRequest>(domainID, request); foreach (GamMatrixAPI.Jackpot j in request.GetIndividualJackpotInfoResponse) { if (!j.currentJackpotValueField.amountField.HasValue) { continue; } JackpotInfo jackpot = new JackpotInfo() { ID = j.jackpotNameField, Name = j.jackpotNameField, VendorID = VendorID.Neteller, }; // For NetEnt jackpots, the amount is always converted from the primary currency Dictionary <string, CurrencyExchangeRateRec> currencies = GamMatrixClient.GetCurrencyRates(Constant.SystemDomainID); string currency = j.currentJackpotValueField.amountCurrencyISOCodeField; decimal amout = j.currentJackpotValueField.amountField.Value; foreach (string key in currencies.Keys) { jackpot.Amounts[key] = GamMatrixClient.TransformCurrency(currency, key, amout); } jackpots[jackpot.ID] = jackpot; } } if (jackpots.Count > 0) { ObjectHelper.BinarySerialize <Dictionary <string, JackpotInfo> >(jackpots, filepath); } return(jackpots); } catch (Exception ex) { Logger.Exception(ex); throw; } }; if (!DelayUpdateCache <Dictionary <string, JackpotInfo> > .TryGetValue(filepath, out cached, func, 120)) { cached = ObjectHelper.BinaryDeserialize <Dictionary <string, JackpotInfo> >(filepath, new Dictionary <string, JackpotInfo>()); } return(cached); }