public JsonResult SaveVendors(VendorID[] enabledVendors , VendorID[] liveCasinoVendors , string cashierUrl , string lobbyUrl , string accountHistoryUrl , string mobileCashierUrl , string mobileLobbyUrl , string mobileAccountHistoryUrl , string domainDefaultCurrencyCode , string googleAnalyticsAccount , string gameLoaderDomain , string gameResourceDomain , short newStatusCasinoGameExpirationDays , short newStatusLiveCasinoGameExpirationDays ) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } CasinoVendorAccessor.SetEnabledVendors(DomainManager.CurrentDomainID , Constant.SystemDomainID , enabledVendors , liveCasinoVendors ); if (enabledVendors != null && enabledVendors.Length > 0) { SqlQuery<ceDomainConfig> query = new SqlQuery<ceDomainConfig>(); ceDomainConfig config = EnsureDomainConfigExists(); config.MobileCashierUrl = mobileCashierUrl; config.MobileLobbyUrl = mobileLobbyUrl; config.MobileAccountHistoryUrl = mobileAccountHistoryUrl; config.CashierUrl = cashierUrl; config.LobbyUrl = lobbyUrl; config.AccountHistoryUrl = accountHistoryUrl; config.DomainDefaultCurrencyCode = domainDefaultCurrencyCode; config.GoogleAnalyticsAccount = googleAnalyticsAccount; config.GameLoaderDomain = gameLoaderDomain; config.GameResourceDomain = gameResourceDomain; config.NewStatusCasinoGameExpirationDays = newStatusCasinoGameExpirationDays; config.NewStatusLiveCasinoGameExpirationDays = newStatusLiveCasinoGameExpirationDays; query.Update(config); } //CacheManager.ClearCache(Constant.GameListCachePrefix); //CacheManager.ClearCache(Constant.JackpotListCachePrefix); //CacheManager.ClearCache(Constant.VendorListCachePrefix); //CacheManager.ClearCache(Constant.DomainCacheKey); return this.Json(new { @success = true }); }
public static bool IsVendorEnabled(VendorID vendorID) { if (DomainManager.CurrentDomainID == Constant.SystemDomainID) { return(true); } CasinoVendorAccessor cva = CasinoVendorAccessor.CreateInstance <CasinoVendorAccessor>(); List <VendorID> enabledVendors = cva.GetEnabledVendors(DomainManager.CurrentDomainID); return(enabledVendors.Exists(v => v == vendorID)); }
private bool IsDomainNonSeamless() { CasinoVendorAccessor cva = DataAccessor.CreateInstance <CasinoVendorAccessor>(); List <VendorID> enabledVendors = cva.GetEnabledVendors(_domainId); foreach (var vendor in enabledVendors) { if (GlobalConstant.NonSeamlessVendors.Contains(vendor)) { return(true); } } return(false); }
private string GetVendorRestrictedCountries(long domainID, VendorID vendor) { string cacheKey = string.Format("LoaderController.GetVendorRestrictedCountries.{0}", domainID); Dictionary <VendorID, string> dic = HttpRuntime.Cache[cacheKey] as Dictionary <VendorID, string>; if (dic == null) { CasinoVendorAccessor cva = CasinoVendorAccessor.CreateInstance <CasinoVendorAccessor>(); dic = cva.GetRestrictedTerritoriesDictionary(domainID); HttpRuntime.Cache.Insert(cacheKey, dic, null, DateTime.Now.AddMinutes(5), Cache.NoSlidingExpiration); } string restrictedCountries = null; dic.TryGetValue(vendor, out restrictedCountries); return(restrictedCountries); }
public static Dictionary <int, ceCasinoVendor> GetVendorDictionary(long domainID) { string cacheKey = string.Format(GAME_CACHE_KEY_FORMAT, Constant.DomainVendorsCachePrefix, domainID); Dictionary <int, ceCasinoVendor> vendors = HttpRuntime.Cache[cacheKey] as Dictionary <int, ceCasinoVendor>; if (vendors != null) { return(vendors); } CasinoVendorAccessor cva = CasinoVendorAccessor.CreateInstance <CasinoVendorAccessor>(); List <ceCasinoVendor> ceCasinoVendors = cva.GetEnabledVendorList(DomainManager.CurrentDomainID, Constant.SystemDomainID); vendors = ceCasinoVendors.ToDictionary(v => v.VendorID, v => v); CacheManager.AddCache(cacheKey, vendors); return(vendors); }
private StringBuilder GetLiveCasinoTableListXml(ceDomainConfigEx domain, List <ceCasinoGameBaseEx> games, bool includeMoreFields) { StringBuilder data = new StringBuilder(); data.AppendLine("<tableList>"); CasinoVendorAccessor cva = CasinoVendorAccessor.CreateInstance <CasinoVendorAccessor>(); Dictionary <VendorID, string> dic = cva.GetRestrictedTerritoriesDictionary(DomainManager.CurrentDomainID); List <ceLiveCasinoTableBaseEx> allTables = LiveCasinoTableAccessor.GetDomainTables(domain.DomainID, null, true, true); Dictionary <long, long> popularities = GetGamePopularity(domain); foreach (ceCasinoGameBaseEx game in games) { List <ceLiveCasinoTableBaseEx> tables = allTables.Where(t => t.CasinoGameBaseID == game.ID && t.Enabled).ToList(); if (tables.Count == 0) { continue; } long popularity = 0L; popularities.TryGetValue(game.ID, out popularity); string helperUrl = GetHelpUrl(domain, game); string restrictedTerritories; dic.TryGetValue(game.VendorID, out restrictedTerritories); foreach (ceLiveCasinoTableBaseEx table in tables) { string loaderUrl = string.Format(CultureInfo.InvariantCulture, "{0}/?tableID={1:D}" , GetLoaderUrl(domain, game.ID, game.Slug, game.VendorID) , table.ID ); data.AppendLine("\t<table>"); bool isOpen = table.IsOpen(domain.DomainID); if (!string.IsNullOrWhiteSpace(table.TableName)) { game.GameName = table.TableName; game.ShortName = table.TableName; } game.Thumbnail = table.Thumbnail; data.AppendFormat("\t\t<id>{0:D}</id>\n", table.ID); data.AppendFormat("\t\t<category>{0}</category>\n", table.Category.SafeHtmlEncode()); data.AppendFormat("\t\t<gameId>{0}</gameId>\n", game.ID); data.AppendFormat("\t\t<isOpen>{0}</isOpen>\n", isOpen ? "true" : "false"); data.AppendFormat("\t\t<vipTable>{0}</vipTable>\n", table.VIPTable ? "true" : "false"); data.AppendFormat("\t\t<newTable>{0}</newTable>\n", (table.NewTable && table.NewTableExpirationDate > DateTime.Now.Date) ? "true" : "false"); data.AppendFormat("\t\t<turkishTable>{0}</turkishTable>\n", table.TurkishTable ? "true" : "false"); data.AppendFormat("\t\t<betBehindAvailable>{0}</betBehindAvailable>\n", table.BetBehindAvailable ? "true" : "false"); data.AppendFormat("\t\t<excludeFromRandomLaunch>{0}</excludeFromRandomLaunch>\n", table.ExcludeFromRandomLaunch ? "true" : "false"); data.AppendFormat("\t\t<seatsUnlimited>{0}</seatsUnlimited>\n", table.SeatsUnlimited ? "true" : "false"); data.AppendFormat("\t\t<dealerGender>{0}</dealerGender>\n", table.DealerGender); data.AppendFormat("\t\t<dealerOrigin>{0}</dealerOrigin>\n", table.DealerOrigin); if (!string.IsNullOrWhiteSpace(table.OpenHoursTimeZone)) { data.Append("\t\t<openingTime>\n"); if (table.OpenHoursStart != table.OpenHoursEnd) { data.Append("\t\t\t<is24HoursOpen>false</is24HoursOpen>\n"); data.AppendFormat("\t\t\t<timeZone>{0}</timeZone>\n", table.OpenHoursTimeZone.SafeHtmlEncode()); data.AppendFormat("\t\t\t<startTime>{0:D2}:{1:D2}</startTime>\n", table.OpenHoursStart / 60, table.OpenHoursStart % 60); data.AppendFormat("\t\t\t<endTime>{0:D2}:{1:D2}</endTime>\n", table.OpenHoursEnd / 60, table.OpenHoursEnd % 60); } else { data.Append("\t\t\t<is24HoursOpen>true</is24HoursOpen>\n"); } data.Append("\t\t</openingTime>\n"); } if (table.Limit.Type != LiveCasinoTableLimitType.None) { Dictionary <string, LimitAmount> items = GetCurrencyLimitAmount(table); if (items.Count > 0) { data.Append("\t\t<limits>\n"); foreach (var item in items) { data.AppendFormat("\t\t\t<limit currency=\"{0}\">\n", item.Key.SafeHtmlEncode()); data.AppendFormat("\t\t\t\t<min>{0:0.##}</min>\n", item.Value.MinAmount); data.AppendFormat("\t\t\t\t<max>{0:0.##}</max>\n", item.Value.MaxAmount); data.Append("\t\t\t</limit>\n"); } data.Append("\t\t</limits>\n"); } } data.Append("\t\t<platforms>"); string[] platforms = (table.ClientCompatibility ?? string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (platforms == null || platforms.Length == 0) { platforms = (game.ClientCompatibility ?? string.Empty).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } foreach (string platform in platforms) { if (!string.IsNullOrWhiteSpace(platform)) { data.AppendFormat("<platform>{0}</platform>", platform.SafeHtmlEncode()); } } data.Append("</platforms>\n"); PopulateGameBasicProperties(data , domain , game , popularity , false , includeMoreFields , restrictedTerritories , loaderUrl , helperUrl ); data.AppendLine("\t</table>"); } } data.AppendLine("</tableList>"); return(data); }
private StringBuilder GetGameListXml(ceDomainConfigEx domain, List <ceCasinoGameBaseEx> games, bool includeMoreFields, bool allowCache = true, int gameType = 0) { StringBuilder data = new StringBuilder(); data.AppendLine("<gameList>"); CasinoVendorAccessor cva = CasinoVendorAccessor.CreateInstance <CasinoVendorAccessor>(); Dictionary <VendorID, string> dic = cva.GetRestrictedTerritoriesDictionary(DomainManager.CurrentDomainID); Dictionary <VendorID, string> dicLanguages = cva.GetLanguagesDictionary(DomainManager.CurrentDomainID); Dictionary <VendorID, string> dicCurrencies = cva.GetCurrenciesDictionary(DomainManager.CurrentDomainID); //Dictionary<long, List<dwGamePopularity>> popularities = GetGamePopularityV2(domain , allowCache, gameType); Dictionary <long, long> popularities = GetGamePopularity(domain); foreach (ceCasinoGameBaseEx game in games) { if (game.IsLiveCasinoGame()) { continue; } long popularity = 0L; popularities.TryGetValue(game.ID, out popularity); string loaderUrl = GetLoaderUrl(domain, game.ID, game.Slug, game.VendorID) + "/"; string helperUrl = GetHelpUrl(domain, game); string restrictedTerritories; dic.TryGetValue(game.VendorID, out restrictedTerritories); string vendorLanguages; dicLanguages.TryGetValue(game.VendorID, out vendorLanguages); string vendorCurrencies; dicCurrencies.TryGetValue(game.VendorID, out vendorCurrencies); data.AppendLine("\t<game>"); data.AppendFormat("\t\t<id>{0}</id>\n", game.ID); PopulateGameBasicProperties(data , domain , game , popularity , domain.EnableScalableThumbnail , includeMoreFields , restrictedTerritories , loaderUrl , helperUrl ); data.Append("\t\t<platforms>"); string[] platforms = game.ClientCompatibility.DefaultIfNullOrEmpty(string.Empty).Split(','); if (platforms.Contains("PC") && !platforms.Contains("Windows81")) { data.AppendFormat("<platform>Windows81</platform>"); } foreach (string platform in platforms) { if (!string.IsNullOrWhiteSpace(platform)) { data.AppendFormat("<platform>{0}</platform>", platform.SafeHtmlEncode()); } } data.Append("</platforms>\n"); data.Append("\t\t<languages>"); string[] languages = null; string strLanguages = game.Languages.DefaultIfNullOrEmpty(string.Empty); if ("All".Equals(strLanguages)) { strLanguages = Language.getAllLanguagesToString(); } else if (string.IsNullOrEmpty(strLanguages)) { strLanguages = vendorLanguages; } if (!string.IsNullOrWhiteSpace(strLanguages)) { languages = strLanguages.Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries); foreach (string language in languages) { data.AppendFormat("<language>{0}</language>", language.SafeHtmlEncode()); } } data.Append("</languages>\n"); data.Append("\t\t<currencies>"); string[] currencies = null; string strCurrencies = vendorCurrencies.DefaultIfNullOrEmpty(string.Empty); if (!string.IsNullOrWhiteSpace(strCurrencies)) { currencies = strCurrencies.Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries); foreach (string currency in currencies) { data.AppendFormat("<currency>{0}</currency>", currency.SafeHtmlEncode()); } } data.Append("</currencies>\n"); Dictionary <string, CasinoGameLimitAmount> items = GetCurrencyLimitAmountForGame(game); if (items.Count > 0) { data.Append("\t\t<limits>\n"); foreach (var item in items) { data.AppendFormat("\t\t\t<limit currency=\"{0}\">\n", item.Key.SafeHtmlEncode()); data.AppendFormat("\t\t\t\t<min>{0:0.##}</min>\n", item.Value.MinAmount); data.AppendFormat("\t\t\t\t<max>{0:0.##}</max>\n", item.Value.MaxAmount); data.Append("\t\t\t</limit>\n"); } data.Append("\t\t</limits>\n"); } data.AppendLine("\t</game>"); } data.AppendLine("</gameList>"); return(data); }
private static bool UpdateOriginalFeeds() { try { string iSoftBetHash = string.Empty; List <string> listISoftBetHash = new List <string>(); ceDomainConfigEx systemDomain = new ceDomainConfigEx() { DomainID = Constant.SystemDomainID, }; ParseXProLiveCasinoGameList(systemDomain); //iSoftBetHash = ISoftBetIntegration.GameMgt.GetFeedsIdentifier(systemDomain); //ISoftBetIntegration.GameMgt.LoadRawGameFeeds(systemDomain); //if (!string.IsNullOrWhiteSpace(iSoftBetHash)) // listISoftBetHash.Add(iSoftBetHash); List <ceDomainConfigEx> domains = DomainManager.GetDomains(); CasinoVendorAccessor cva = CasinoVendorAccessor.CreateInstance <CasinoVendorAccessor>(); ChangeNotificationAccessor cna = ChangeNotificationAccessor.CreateInstance <ChangeNotificationAccessor>(); List <VendorID> liveCasinoVendors = new List <VendorID>() { VendorID.EvolutionGaming, VendorID.XProGaming }; foreach (ceDomainConfigEx domain in domains) { if (domain.DomainID == Constant.SystemDomainID) { continue; } List <VendorID> vendors = cva.GetLiveCasinoVendors(domain.DomainID); if (!vendors.Exists(v => liveCasinoVendors.Contains(v))) { continue; } //iSoftBetHash = ISoftBetIntegration.GameMgt.GetFeedsIdentifier(domain); //if (!string.IsNullOrWhiteSpace(iSoftBetHash) && !listISoftBetHash.Exists(h => h == iSoftBetHash)) //{ // ISoftBetIntegration.GameMgt.LoadRawGameFeeds(domain); // listISoftBetHash.Add(iSoftBetHash); //} long xproGamesHash = 0L; if (vendors.Exists(v => v == VendorID.XProGaming)) { xproGamesHash = (long)ParseXProLiveCasinoGameList(domain); } long tableStatusHash = (long)GetLiveCasinoTableStatusHash(domain); if (tableStatusHash > 0L || xproGamesHash > 0L) { ceChangeNotification notification = cna.GetLastSuccessfulChangeNotification(domain.DomainID , ChangeType.LiveCasinoTableList.ToString() , DateTime.Now.AddHours(-1) ); if (notification != null && notification.HashValue1 == xproGamesHash && notification.HashValue2 == tableStatusHash) { continue; } string error; bool success = Send(domain, ChangeType.LiveCasinoTableList, out error); SqlQuery <ceChangeNotification> query = new SqlQuery <ceChangeNotification>(); notification = new ceChangeNotification(); notification.Ins = DateTime.Now; notification.DomainID = domain.DomainID; notification.Succeeded = success; notification.Type = ChangeType.LiveCasinoTableList.ToString(); notification.HashValue1 = xproGamesHash; notification.HashValue2 = tableStatusHash; query.Insert(notification); } } } catch (Exception ex) { Logger.Exception(ex); return(false); } return(true); }
private static bool ReloadNetentOriginalFeeds() { try { ulong netentFeedURLHash = 0; Dictionary <ulong, bool> dicNetentFeedURLHash = new Dictionary <ulong, bool>(); ceDomainConfigEx systemDomain = new ceDomainConfigEx() { DomainID = Constant.SystemDomainID, }; ParseNetEntLiveCasinoTableList(systemDomain); netentFeedURLHash = CRC64.ComputeAsUtf8String(systemDomain.GetCfg(CE.DomainConfig.NetEnt.LiveCasinoQueryOpenTablesApiURL)); dicNetentFeedURLHash.Add(netentFeedURLHash, true); List <ceDomainConfigEx> domains = DomainManager.GetDomains(); CasinoVendorAccessor cva = CasinoVendorAccessor.CreateInstance <CasinoVendorAccessor>(); ChangeNotificationAccessor cna = ChangeNotificationAccessor.CreateInstance <ChangeNotificationAccessor>(); foreach (ceDomainConfigEx domain in domains) { if (domain.DomainID == Constant.SystemDomainID) { continue; } List <VendorID> vendors = cva.GetLiveCasinoVendors(domain.DomainID); if (!vendors.Exists(v => v == VendorID.NetEnt)) { continue; } long hash1 = (long)CRC64.ComputeAsUtf8String(VendorID.NetEnt.ToString()); long hash2 = 0L; netentFeedURLHash = CRC64.ComputeAsUtf8String(domain.GetCfg(CE.DomainConfig.NetEnt.LiveCasinoQueryOpenTablesApiURL)); if (!dicNetentFeedURLHash.Keys.Contains(netentFeedURLHash)) { dicNetentFeedURLHash.Add(netentFeedURLHash, true); ParseNetEntLiveCasinoTableList(domain); hash2 = domain.DomainID; } if (hash1 > 0L || hash2 > 0L) { ceChangeNotification notification = cna.GetLastSuccessfulChangeNotification(domain.DomainID , ChangeType.LiveCasinoTableList.ToString() , DateTime.Now.AddHours(-1) ); if (notification != null && notification.HashValue1 == hash1 && notification.HashValue2 == hash2) { continue; } string error; bool success = Send(domain, ChangeType.LiveCasinoTableList, out error); SqlQuery <ceChangeNotification> query = new SqlQuery <ceChangeNotification>(); notification = new ceChangeNotification(); notification.Ins = DateTime.Now; notification.DomainID = domain.DomainID; notification.Succeeded = success; notification.Type = ChangeType.LiveCasinoTableList.ToString(); notification.HashValue1 = hash1; notification.HashValue2 = hash2; query.Insert(notification); } } } catch (Exception ex) { Logger.Exception(ex); return(false); } return(true); }
public JsonResult Save() { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } if (!CurrentUserSession.IsSuperUser) { throw new HttpException(503, "Access Denied"); } using (DbManager db = new DbManager()) { CasinoVendorAccessor cva = CasinoVendorAccessor.CreateInstance <CasinoVendorAccessor>(db); List <ceCasinoVendor> vendors = cva.GetEnabledVendorList(DomainManager.CurrentDomainID, Constant.SystemDomainID); List <ceCasinoVendor> enabledGmGamingAPI = new List <ceCasinoVendor>(); List <ceCasinoVendor> enabledLogging = new List <ceCasinoVendor>(); foreach (string key in Request.Form.AllKeys) { Match m = Regex.Match(key, @"^(BonusDeduction_)(?<VendorID>\d+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); if (m.Success) { ceCasinoVendor vendor = vendors.FirstOrDefault(v => (int)v.VendorID == int.Parse(m.Groups["VendorID"].Value)); decimal bonusDeduction = 0.00M; if (vendor != null && decimal.TryParse(Request.Form[key], out bonusDeduction)) { vendor.BonusDeduction = bonusDeduction; } continue; } m = Regex.Match(key, @"^(RestrictedTerritories_)(?<VendorID>\d+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); if (m.Success) { ceCasinoVendor vendor = vendors.FirstOrDefault(v => (int)v.VendorID == int.Parse(m.Groups["VendorID"].Value)); if (vendor != null) { vendor.RestrictedTerritories = Request.Form[key]; } continue; } m = Regex.Match(key, @"^(Languages_)(?<VendorID>\d+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); if (m.Success) { ceCasinoVendor vendor = vendors.FirstOrDefault(v => (int)v.VendorID == int.Parse(m.Groups["VendorID"].Value)); if (vendor != null) { vendor.Languages = Request.Form[key]; } continue; } m = Regex.Match(key, @"^(Currencies_)(?<VendorID>\d+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); if (m.Success) { ceCasinoVendor vendor = vendors.FirstOrDefault(v => (int)v.VendorID == int.Parse(m.Groups["VendorID"].Value)); if (vendor != null) { vendor.Currencies = Request.Form[key]; } continue; } m = Regex.Match(key, @"^(EnableGmGamingAPI_)(?<VendorID>\d+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); if (m.Success) { ceCasinoVendor vendor = vendors.FirstOrDefault(v => (int)v.VendorID == int.Parse(m.Groups["VendorID"].Value)); if (vendor != null) { vendor.EnableGmGamingAPI = true; enabledGmGamingAPI.Add(vendor); } continue; } m = Regex.Match(key, @"^(EnableLogging_)(?<VendorID>\d+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); if (m.Success) { ceCasinoVendor vendor = vendors.FirstOrDefault(v => (int)v.VendorID == int.Parse(m.Groups["VendorID"].Value)); if (vendor != null) { vendor.EnableLogging = true; enabledLogging.Add(vendor); } continue; } } SqlQuery <ceCasinoVendor> query = new SqlQuery <ceCasinoVendor>(); foreach (ceCasinoVendor vendor in vendors) { if (!enabledGmGamingAPI.Exists(v => v.VendorID == vendor.VendorID)) { vendor.EnableGmGamingAPI = false; } if (!enabledLogging.Exists(v => v.VendorID == vendor.VendorID)) { vendor.EnableLogging = false; } query.Update(vendor); } CacheManager.ClearCache(Constant.VendorListCachePrefix); CacheManager.ClearCache(Constant.DomainVendorsCachePrefix); } return(this.Json(new { @success = true })); }