Пример #1
0
        private static ulong ParseXProLiveCasinoGameList(ceDomainConfigEx domain)
        {
            try
            {
                using (GamMatrixClient client = new GamMatrixClient())
                {
                    XProGamingAPIRequest request = new XProGamingAPIRequest()
                    {
                        GetGamesListWithLimits           = true,
                        GetGamesListWithLimitsGameType   = (int)XProGaming.GameType.AllGames,
                        GetGamesListWithLimitsOnlineOnly = 0,
                        //GetGamesListWithLimitsUserName = "******"
                    };
                    request = client.SingleRequest <XProGamingAPIRequest>(domain.DomainID, request);

                    if (string.IsNullOrWhiteSpace(request.GetGamesListWithLimitsResponse))
                    {
                        return(0L);
                    }

                    string xml = request.GetGamesListWithLimitsResponse;
                    XProGaming.Game.ParseXml(domain.DomainID, xml);

                    return(CRC64.ComputeAsAsciiString(xml));
                }
            }
            catch (GmException gex)
            {
                if (gex.ReplyResponse.ErrorCode == "SYS_1008")
                {
                    return(0L);
                }
                Logger.Exception(gex);
            }
            catch (Exception ex)
            {
                Logger.Exception(ex);
            }
            return(0L);
        }
Пример #2
0
        private static List <VivoActiveTable> GetRawActiveTables(long domainID, long operatorID, string gameName, string currency)
        {
            List <VivoActiveTable> list = new List <VivoActiveTable>();

            using (GamMatrixClient client = new GamMatrixClient())
            {
                VivoGetActiveTablesRequest request = new VivoGetActiveTablesRequest()
                {
                    GameName        = gameName,
                    OperatorID      = operatorID,
                    PlayerCurrency  = currency,
                    ContextDomainID = domainID,
                };
                request = client.SingleRequest <VivoGetActiveTablesRequest>(domainID, request);
                if (request != null)
                {
                    list = request.ActiveTables;
                }
            }

            return(list);
        }
Пример #3
0
        private StringBuilder GetGreenTubeGameInfo(ceCasinoGameBaseEx game, string lang)
        {
            if (string.IsNullOrWhiteSpace(lang))
            {
                lang = "EN";
            }

            string cacheKey = string.Format("XmlFeedsController.GetGreenTubeGameInfo.{0}.{1}"
                                            , DomainManager.CurrentDomainID
                                            , lang
                                            );

            Dictionary <string, List <Topic> > dic = HttpRuntime.Cache[cacheKey] as Dictionary <string, List <Topic> >;

            if (dic == null)
            {
                using (GamMatrixClient client = new GamMatrixClient())
                {
                    GreenTubeAPIRequest request = new GreenTubeAPIRequest()
                    {
                        ArticlesGetRequest = new GreentubeArticlesGetRequest()
                        {
                            LanguageCode = lang.ToUpperInvariant()
                        }
                    };
                    request = client.SingleRequest <GreenTubeAPIRequest>(DomainManager.CurrentDomainID, request);
                    if (request.ArticlesGetResponse.ErrorCode < 0)
                    {
                        throw new Exception(request.ArticlesGetResponse.Message.Description);
                    }

                    if (request.ArticlesGetResponse.Topic != null &&
                        request.ArticlesGetResponse.Topic.Count > 0)
                    {
                        dic = new Dictionary <string, List <Topic> >(StringComparer.InvariantCultureIgnoreCase);
                        foreach (Topic topic in request.ArticlesGetResponse.Topic)
                        {
                            List <Topic> topics = null;
                            if (!dic.TryGetValue(topic.GameId.ToString(), out topics))
                            {
                                topics = new List <Topic>();
                                dic[topic.GameId.ToString()] = topics;
                            }

                            topics.Add(topic);
                        }
                        HttpRuntime.Cache.Insert(cacheKey, dic, null, DateTime.Now.AddMinutes(20), Cache.NoSlidingExpiration);
                    }
                }
            }

            List <Topic> found = null;

            if (dic != null &&
                dic.TryGetValue(game.GameID, out found))
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("<topics>");

                foreach (Topic t in found)
                {
                    sb.Append("<topic>");

                    sb.AppendFormat(CultureInfo.InvariantCulture, "<id>{0}</id>", t.Id);
                    sb.AppendFormat(CultureInfo.InvariantCulture, "<description>{0}</description>", t.Description.SafeHtmlEncode());

                    {
                        sb.Append("<articles>");
                        foreach (Article article in t.ArticleList)
                        {
                            sb.AppendFormat(CultureInfo.InvariantCulture, "<id>{0}</id>", article.Id);
                            sb.AppendFormat(CultureInfo.InvariantCulture, "<title>{0}</title>", article.Title.SafeHtmlEncode());
                            sb.AppendFormat(CultureInfo.InvariantCulture, "<content>{0}</content>", article.Content.SafeHtmlEncode());
                        }
                        sb.Append("</articles>");
                    }

                    sb.Append("</topic>");
                }

                sb.Append("</topics>");
                return(sb);
            }

            // if the translation is not found, try to search in English
            if (!string.Equals(lang, "en", StringComparison.InvariantCultureIgnoreCase))
            {
                return(GetGreenTubeGameInfo(game, "en"));
            }

            return(null);
        }
Пример #4
0
        /// <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);
        }
        public ContentResult RawXml(string apiUsername, string vendor, string username)
        {
            if (string.IsNullOrWhiteSpace(apiUsername))
            {
                return(WrapResponse(ResultCode.Error_InvalidParameter, "Operator is NULL!"));
            }

            var domains = DomainManager.GetApiUsername_DomainDictionary();
            ceDomainConfigEx domain;

            if (!domains.TryGetValue(apiUsername.Trim(), out domain))
            {
                return(WrapResponse(ResultCode.Error_InvalidParameter, "Operator is invalid!"));
            }

            if (!IsWhitelistedIPAddress(domain, Request.GetRealUserAddress()))
            {
                return(WrapResponse(ResultCode.Error_BlockedIPAddress, string.Format("IP Address [{0}] is denied!", Request.GetRealUserAddress())));
            }

            try
            {
                if (string.Equals(vendor, "IGT", StringComparison.InvariantCultureIgnoreCase))
                {
                    using (GamMatrixClient client = new GamMatrixClient())
                    {
                        IGTAPIRequest request = new IGTAPIRequest()
                        {
                            GameListV2 = true,
                        };
                        request = client.SingleRequest <IGTAPIRequest>(domain.DomainID, request);

                        return(this.Content(request.GameListV2Response, "text/xml"));
                    }
                }
                else if (string.Equals(vendor, "IGTgames", StringComparison.InvariantCultureIgnoreCase))
                {
                    Dictionary <string, IGTIntegration.Game> games = GamMatrixClient.GetIGTGames(domain.DomainID);

                    StringBuilder output = new StringBuilder();
                    foreach (var game in games)
                    {
                        output.AppendFormat("{0} {1}\n", game.Key, game.Value.Title);
                    }
                    return(this.Content(output.ToString(), "text/plain"));
                }
                else if (string.Equals(vendor, "GTgameInfo", StringComparison.InvariantCultureIgnoreCase))
                {
                    GreenTubeAPIRequest request = new GreenTubeAPIRequest()
                    {
                        ArticlesGetRequest = new GreentubeArticlesGetRequest()
                        {
                            LanguageCode = "EN"
                        }
                    };
                    using (GamMatrixClient client = new GamMatrixClient())
                    {
                        request = client.SingleRequest <GreenTubeAPIRequest>(domain.DomainID, request);
                        DataContractSerializer dcs = new DataContractSerializer(request.ArticlesGetResponse.GetType());

                        using (MemoryStream ms = new MemoryStream())
                        {
                            dcs.WriteObject(ms, request.ArticlesGetResponse);
                            byte[] buffer = ms.ToArray();
                            return(this.Content(Encoding.UTF8.GetString(buffer, 0, buffer.Length)
                                                , "text/xml"
                                                ));
                        }
                    }
                }
                else if (string.Equals(vendor, "XPRO", StringComparison.InvariantCultureIgnoreCase))
                {
                    XProGamingAPIRequest request = new XProGamingAPIRequest()
                    {
                        GetGamesListWithLimits           = true,
                        GetGamesListWithLimitsGameType   = (int)XProGaming.GameType.AllGames,
                        GetGamesListWithLimitsOnlineOnly = 0,
                        GetGamesListWithLimitsUserName   = username,
                        GetUserCurrency         = true,
                        GetUserCurrencyUserName = username,
                    };
                    using (GamMatrixClient client = new GamMatrixClient())
                    {
                        request = client.SingleRequest <XProGamingAPIRequest>(domain.DomainID, request);

                        StringBuilder output = new StringBuilder();
                        output.AppendFormat("XProGamingAPIRequest.GetUserCurrencyResponse = [{0}]"
                                            , request.GetUserCurrencyResponse
                                            );
                        output.AppendLine();
                        output.AppendLine();
                        output.Append("XProGamingAPIRequest.GetGamesListWithLimitsResponse = \n");


                        using (StringWriter sw = new StringWriter())
                        {
                            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                            doc.LoadXml(request.GetGamesListWithLimitsResponse);
                            doc.Save(sw);
                            output.Append(sw.ToString());
                        }

                        return(this.Content(output.ToString(), "text/plain"));
                    }
                }
                //else if (string.Equals(vendor, "BALLY", StringComparison.InvariantCultureIgnoreCase))
                //{
                //    BallyGetGamesListRequest request = new BallyGetGamesListRequest();
                //    using (GamMatrixClient client = new GamMatrixClient())
                //    {
                //        request = client.SingleRequest<BallyGetGamesListRequest>(domain.DomainID, request);

                //        DataContractSerializer formatter = new DataContractSerializer(request.Games.GetType());
                //        using (MemoryStream ms = new MemoryStream())
                //        {
                //            formatter.WriteObject(ms, request.Games);
                //            string xml = Encoding.UTF8.GetString(ms.ToArray());
                //            return this.Content(xml, "text/plain");
                //        }
                //    }
                //}
                //else if (string.Equals(vendor, "ISoftBet", StringComparison.InvariantCultureIgnoreCase))
                //{
                //    List<ISoftBetIntegration.Game> list = ISoftBetIntegration.GameMgt.LoadRawGameFeedsForSpecialLanguage(domain,"en").Values.ToList();
                //    DataContractSerializer formatter = new DataContractSerializer(typeof(List<ISoftBetIntegration.Game>));
                //    using (MemoryStream ms = new MemoryStream())
                //    {
                //        formatter.WriteObject(ms, list);
                //        string xml = Encoding.UTF8.GetString(ms.ToArray());
                //        return this.Content(xml, "text/xml");
                //    }
                //}
                else if (string.Equals(vendor, "Vivo", StringComparison.InvariantCultureIgnoreCase))
                {
                    Dictionary <string, string> dicGameName = new Dictionary <string, string>();
                    dicGameName.Add("Baccarat", "Baccarat");
                    dicGameName.Add("Roulette", "Roulette");
                    dicGameName.Add("Blackjack", "Blackjack");


                    long operatorID = 0;
                    long.TryParse(domain.GetCfg(CE.DomainConfig.Vivo.OperatorID), out operatorID);
                    string vivoWebServiceUrl = domain.GetCfg(CE.DomainConfig.Vivo.VivoWebServiceUrl);
                    List <VivoActiveTable> vivoTables;
                    Type           t          = typeof(VivoActiveTable);
                    PropertyInfo[] properties = t.GetProperties();

                    StringBuilder xml = new StringBuilder();
                    xml.AppendLine(@"<?xml version=""1.0"" encoding=""ISO-8859-1""?>");
                    xml.AppendLine(@"<root>");
                    foreach (string key in dicGameName.Keys)
                    {
                        vivoTables = VivoAPI.LiveCasinoTable.GetActiveTables(vivoWebServiceUrl, domain.DomainID, operatorID, dicGameName[key], "EUR");
                        if (vivoTables != null)
                        {
                            xml.AppendLine(string.Format("<{0}>", key));
                            foreach (VivoActiveTable table in vivoTables)
                            {
                                xml.AppendLine(string.Format("<table-{0}>", table.TableID));
                                foreach (PropertyInfo p in properties)
                                {
                                    xml.AppendLine(string.Format("<{0}>{1}</{0}>", p.Name, p.GetValue(table).ToString()));
                                }
                                xml.AppendLine(string.Format("</table-{0}>", table.TableID));
                            }
                            xml.AppendLine(string.Format("</{0}>", key));
                        }
                    }
                    xml.AppendLine(@"</root>");
                    return(this.Content(xml.ToString(), "text/xml"));
                }
                else if (string.Equals(vendor, "RecentWinners", StringComparison.InvariantCultureIgnoreCase))
                {
                    string sql = DwAccessor.GetCasinoGameRecentWinnersInternalSql(domain, false);
                    return(this.Content(sql, "text/plain"));
                }
                else if (string.Equals(vendor, "GreenTube", StringComparison.InvariantCultureIgnoreCase))
                {
                    using (GamMatrixClient client = new GamMatrixClient())
                    {
                        GreenTubeAPIRequest request = new GreenTubeAPIRequest()
                        {
                            ArticlesGetRequest = new GreentubeArticlesGetRequest()
                            {
                                LanguageCode = "EN"
                            }
                        };
                        request = client.SingleRequest <GreenTubeAPIRequest>(domain.DomainID, request);

                        DataContractSerializer formatter = new DataContractSerializer(request.ArticlesGetResponse.GetType());
                        using (MemoryStream ms = new MemoryStream())
                        {
                            formatter.WriteObject(ms, request.ArticlesGetResponse);
                            string xml = Encoding.UTF8.GetString(ms.ToArray());
                            return(this.Content(xml, "text/xml"));
                        }
                    }
                }
                else
                {
                    throw new NotSupportedException();
                }
            }
            catch (Exception ex)
            {
                return(this.Content(ex.Message));
            }
        }
Пример #6
0
        public ActionResult GetFrequentPlayerPoints(string apiUsername, string apiPassword, string _sid)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(apiUsername))
                {
                    return(WrapResponse(ResultCode.Error_InvalidParameter, "OperatorKey cannot be empty!"));
                }

                if (string.IsNullOrWhiteSpace(apiPassword))
                {
                    return(WrapResponse(ResultCode.Error_InvalidParameter, "API password cannot be empty!"));
                }

                if (string.IsNullOrWhiteSpace(_sid))
                {
                    return(WrapResponse(ResultCode.Error_InvalidParameter, "Session ID cannot be empty!"));
                }

                var domains = DomainManager.GetApiUsername_DomainDictionary();
                ceDomainConfigEx domain;
                if (!domains.TryGetValue(apiUsername.Trim(), out domain))
                {
                    return(WrapResponse(ResultCode.Error_InvalidParameter, "Invalid OperatorKey!"));
                }

                if (!string.Equals(domain.ApiPassword, apiPassword.MD5Hash(), StringComparison.InvariantCulture))
                {
                    return(WrapResponse(ResultCode.Error_InvalidParameter, "API password is incorrect!"));
                }

                if (!IsWhitelistedIPAddress(domain, Request.GetRealUserAddress()))
                {
                    return(WrapResponse(ResultCode.Error_BlockedIPAddress, string.Format("IP Address [{0}] is denied!", Request.GetRealUserAddress())));
                }

                SessionPayload sessionPayload = _agentClient.GetSessionByGuid(_sid);

                if (sessionPayload == null || sessionPayload.IsAuthenticated != true)
                {
                    return(WrapResponse(ResultCode.Error_InvalidSession, "Session ID is not available!"));
                }


                ////////////////////////////////////////////////////////////////////////
                using (GamMatrixClient client = new GamMatrixClient())
                {
                    CasinoFPPGetClaimDetailsRequest request = new CasinoFPPGetClaimDetailsRequest()
                    {
                        UserID = sessionPayload.UserID,
                    };

                    request = client.SingleRequest <CasinoFPPGetClaimDetailsRequest>(sessionPayload.DomainID, request);

                    StringBuilder data = new StringBuilder();
                    data.AppendLine("<getFrequentPlayerPoints>");

                    if (request != null && request.ClaimRec != null)
                    {
                        data.AppendFormat(CultureInfo.InvariantCulture, "\t<points>{0:f2}</points>\n", Math.Truncate(request.ClaimRec.Points * 100) / 100.00M);
                        data.AppendFormat(CultureInfo.InvariantCulture, "\t<convertionMinClaimPoints>{0:f0}</convertionMinClaimPoints>\n", request.ClaimRec.CfgConvertionMinClaimPoints);
                        data.AppendFormat(CultureInfo.InvariantCulture, "\t<convertionPoints>{0}</convertionPoints>\n", request.ClaimRec.CfgConvertionPoints);
                        data.AppendFormat(CultureInfo.InvariantCulture, "\t<convertionCurrency>{0}</convertionCurrency>\n", request.ClaimRec.CfgConvertionCurrency.SafeHtmlEncode());
                        data.AppendFormat(CultureInfo.InvariantCulture, "\t<convertionAmount>{0}</convertionAmount>\n", request.ClaimRec.CfgConvertionAmount);
                        data.AppendFormat(CultureInfo.InvariantCulture, "\t<convertionType>{0}</convertionType>\n", request.ClaimRec.CfgConvertionType);
                    }
                    data.AppendLine("</getFrequentPlayerPoints>");
                    return(WrapResponse(ResultCode.Success, null, data));
                }
            }
            catch (Exception ex)
            {
                Logger.Exception(ex);
                return(WrapResponse(ResultCode.Error_SystemFailure, ex.Message));
            }
        }
Пример #7
0
        public ContentResult GetLiveCasinoTableStatus(string apiUsername, string callback)
        {
            if (string.IsNullOrWhiteSpace(apiUsername))
            {
                return(WrapResponse(ResultCode.Error_InvalidParameter, "Operator is NULL!"));
            }

            var domains = DomainManager.GetApiUsername_DomainDictionary();
            ceDomainConfigEx domain;

            if (!domains.TryGetValue(apiUsername.Trim(), out domain))
            {
                return(WrapResponse(ResultCode.Error_InvalidParameter, "Operator is invalid!"));
            }

            Dictionary <string, LiveCasinoSeat> seats = new Dictionary <string, LiveCasinoSeat>();

            DomainManager.CurrentDomainID = domain.DomainID;
            string cacheKey = string.Format("RestfulApiController.GetLiveCasinoTableStatus.LiveCasinoDic.{0}", domain.DomainID);

            List <ceLiveCasinoTableBaseEx> tables = null;
            {
                tables = HttpRuntime.Cache[cacheKey] as List <ceLiveCasinoTableBaseEx>;
                if (tables == null)
                {
                    tables = LiveCasinoTableAccessor.GetDomainTables(domain.DomainID, null, true, true);
                    HttpRuntime.Cache.Insert(cacheKey, tables, null, DateTime.Now.AddMinutes(5), TimeSpan.Zero);
                }
            }


            List <ceLiveCasinoTableBaseEx> xproTables = tables.Where(t => t.VendorID == VendorID.XProGaming).ToList();

            if (xproTables.Count > 0)
            {
                XProGamingAPIRequest request = new XProGamingAPIRequest()
                {
                    GetGamesListWithLimits           = true,
                    GetGamesListWithLimitsGameType   = (int)XProGaming.GameType.AllGames,
                    GetGamesListWithLimitsOnlineOnly = 0,
                    GetGamesListWithLimitsCurrency   = "EUR",
                    //GetGamesListWithLimitsUserName = "******",
                };
                using (GamMatrixClient client = new GamMatrixClient())
                {
                    request = client.SingleRequest <XProGamingAPIRequest>(domain.DomainID, request);
                }

                /*
                 * <response xmlns="apiGamesLimitsListData" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                 * <gamesList>
                 * <game>
                 * <limitSetList>
                 * <limitSet>
                 * <limitSetID>1</limitSetID>
                 * <minBet>0.00</minBet>
                 * <maxBet>800.00</maxBet>
                 * </limitSet>
                 * <limitSet>
                 * <limitSetID>45</limitSetID>
                 * <minBet>1.00</minBet>
                 * <maxBet>5.00</maxBet>
                 * </limitSet>
                 * </limitSetList>
                 * <gameID>3</gameID>
                 * <gameType>1</gameType>
                 * <gameName>Dragon Roulette LCPP</gameName>
                 * <dealerName>Dealer</dealerName>
                 * <dealerImageUrl>http://lcpp.xprogaming.com/LiveGames/Games/dealers/1.jpg</dealerImageUrl>
                 * <isOpen>1</isOpen>
                 * <connectionUrl>https://lcpp.xprogaming.com/LiveGames/GeneralGame.aspx?audienceType=1&amp;gameID=3&amp;operatorID=47&amp;languageID={1}&amp;loginToken={2}&amp;securityCode={3}</connectionUrl>
                 * <winParams>'width=955,height=690,menubar=no, scrollbars=no,toolbar=no,status=no,location=no,directories=no,resizable=yes,left=' + (screen.width - 955) / 2 + ',top=20'</winParams>
                 * <openHour>00:00</openHour>
                 * <closeHour>23:59</closeHour>
                 * <PlayersNumber xsi:nil="true" />
                 * <PlayersNumberInGame xsi:nil="true" />
                 * </game>
                 * <errorCode>0</errorCode>
                 * <description />
                 * </response>
                 */

                XElement   root = XElement.Parse(request.GetGamesListWithLimitsResponse);
                XNamespace ns   = root.GetDefaultNamespace();
                if (root.Element(ns + "errorCode").Value != "0")
                {
                    throw new Exception(root.Element(ns + "description").Value);
                }

                IEnumerable <XElement> games = root.Element(ns + "gamesList").Elements(ns + "game");
                foreach (XElement game in games)
                {
                    string   gameID = game.Element(ns + "gameID").Value;
                    XElement playersNumberElement       = game.Element(ns + "PlayersNumber");
                    XElement playersNumberInGameElement = game.Element(ns + "PlayersNumberInGame");
                    if (playersNumberElement == null ||
                        playersNumberInGameElement == null ||
                        playersNumberElement.Value == null ||
                        playersNumberInGameElement.Value == null)
                    {
                        continue;
                    }

                    int seatTaken = 0, totalSeats = 0;
                    if (!int.TryParse(playersNumberElement.Value, out totalSeats) ||
                        !int.TryParse(playersNumberInGameElement.Value, out seatTaken))
                    {
                        continue;
                    }

                    foreach (ceLiveCasinoTableBaseEx xproTable in xproTables.Where(t => t.GameID == gameID))
                    {
                        seats.Add(xproTable.ID.ToString()
                                  , new LiveCasinoSeat()
                        {
                            TakenSeats = seatTaken, TotalSeats = totalSeats
                        }
                                  );
                    }
                }
            }


            List <ceLiveCasinoTableBaseEx> netentTables = tables.Where(t => t.VendorID == VendorID.NetEnt).ToList();

            if (netentTables.Count > 0)
            {
                string url = domain.GetCfg(CE.DomainConfig.NetEnt.LiveCasinoQueryOpenTablesApiURL);
                url = string.Format(url, "EUR");
                HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest;
                request.Accept      = "application/json";
                request.ContentType = "application/json";
                request.Method      = "POST";

                HttpWebResponse response = request.GetResponse() as HttpWebResponse;
                using (Stream s = response.GetResponseStream())
                {
                    using (StreamReader sr = new StreamReader(s))
                    {
                        string json = sr.ReadToEnd();
                        JavaScriptSerializer jss = new JavaScriptSerializer();
                        NetEntAPI.RawNetEntLiveCasinoTable[] rawTables = jss.Deserialize <NetEntAPI.RawNetEntLiveCasinoTable[]>(json);

                        foreach (var rawTable in rawTables)
                        {
                            if (rawTable.Games.Length == 0 ||
                                rawTable.Slots.Length == 0)
                            {
                                continue;
                            }

                            string gameID = rawTable.Games[0].GameID;
                            ceLiveCasinoTableBaseEx netentTable = netentTables.FirstOrDefault(t => t.GameID == gameID);
                            if (netentTable == null)
                            {
                                continue;
                            }

                            int seatTaken  = rawTable.Slots.Count(slot => slot.Available == false);
                            int totalSeats = rawTable.Slots.Length;

                            seats.Add(netentTable.ID.ToString()
                                      , new LiveCasinoSeat()
                            {
                                TakenSeats = seatTaken, TotalSeats = totalSeats
                            }
                                      );
                        }
                    }
                }
            }

            DataContractJsonSerializer serializer = new DataContractJsonSerializer(seats.GetType()
                                                                                   , new DataContractJsonSerializerSettings()
            {
                UseSimpleDictionaryFormat = true
            }
                                                                                   );

            string jsonp;

            using (MemoryStream ms = new MemoryStream())
            {
                serializer.WriteObject(ms, seats);
                string json = Encoding.UTF8.GetString(ms.ToArray());

                jsonp = string.Format("{0}({1})", callback, json);
            }


            return(this.Content(jsonp));
        }