private StringBuilder GetMetadataGameInfo(ceDomainConfigEx domain, ceCasinoGameBaseEx game, string lang) { var gameInformation = CasinoGame.GetGameInformation(domain, game.ID, string.IsNullOrWhiteSpace(lang) ? "en" : lang); if (string.IsNullOrWhiteSpace(gameInformation)) { return(null); } var md = new MarkdownDeep.Markdown { SafeMode = false, ExtraMode = true, AutoHeadingIDs = false, MarkdownInHtml = true, NewWindowForExternalLinks = true }; var html = md.Transform(gameInformation.Replace("<", "<").Replace(">", ">")); var sb = new StringBuilder(); sb.Append("<topics>"); sb.Append("<topic>"); sb.AppendFormat(CultureInfo.InvariantCulture, "<id>{0}</id>", game.ID); sb.AppendFormat(CultureInfo.InvariantCulture, "<description>{0}</description>", game.GameName.SafeHtmlEncode()); { sb.Append("<articles>"); sb.AppendFormat(CultureInfo.InvariantCulture, "<id>{0}</id>", game.ID); sb.AppendFormat(CultureInfo.InvariantCulture, "<title>{0}</title>", game.GameName.SafeHtmlEncode()); sb.AppendFormat(CultureInfo.InvariantCulture, "<content>{0}</content>", html.SafeHtmlEncode()); sb.Append("</articles>"); } sb.Append("</topic>"); sb.Append("</topics>"); return(sb); }
public ActionResult Information(long domainID, string id, string language) { List <ceDomainConfigEx> domains = DomainManager.GetDomains(); ceDomainConfigEx domain = domains.FirstOrDefault(d => d.DomainID == domainID); if (domain == null) { this.ViewData["ErrorMessage"] = "Invalid Url Parameter(s)!"; return(this.View("Error")); } Dictionary <string, ceCasinoGameBaseEx> games = CacheManager.GetGameDictionary(domain.DomainID); ceCasinoGameBaseEx game = null; if (!games.TryGetValue(id, out game)) { this.ViewData["ErrorMessage"] = "Error, cannot find the game!"; return(this.View("Error")); } language = GetISO639LanguageCode(language); var gameInformation = CasinoGame.GetGameInformation(domain, game.ID, string.IsNullOrWhiteSpace(language) ? "en" : language); if (!string.IsNullOrWhiteSpace(gameInformation)) { var md = new MarkdownDeep.Markdown { SafeMode = false, ExtraMode = true, AutoHeadingIDs = false, MarkdownInHtml = true, NewWindowForExternalLinks = true }; var html = md.Transform(gameInformation.Replace("<", "<").Replace(">", ">")); this.ViewData["Domain"] = domain; this.ViewData["Language"] = language; this.ViewData["Html"] = html; return(this.View("MetadataInfo", game)); } switch (game.VendorID) { case VendorID.NetEnt: this.ViewData["Domain"] = domain; this.ViewData["Language"] = language; return(this.View("NetEntInfo", game)); case VendorID.GreenTube: try { //DomainManager.CurrentDomainID = domainID; //var sb = GetGreenTubeGameInfo(game, language); //var root = XDocument.Parse(sb.ToString()); //var descriptionElement = root.Elements("topics").Elements("topic").Elements("description").FirstOrDefault(); //var contentElement = root.Elements("topics").Elements("topic").Elements("articles").Elements("content").FirstOrDefault(); //if (descriptionElement == null || contentElement == null) // throw new Exception("The content is not available now"); //this.ViewData["Description"] = descriptionElement.Value; //this.ViewData["Content"] = contentElement.Value; this.ViewData["Domain"] = domain; this.ViewData["Language"] = language; return(this.View("GreenTubeInfo", game)); } catch { this.ViewData["ErrorMessage"] = "The content is not available now"; return(this.View("Error")); } default: this.ViewData["ErrorMessage"] = "The content is not available now"; return(this.View("Error")); } }
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); }
// PopulateGameBasicProperties private void PopulateGameBasicPropertiesV2(StringBuilder data , ceDomainConfigEx domain , ceCasinoGameBaseEx game , List <dwGamePopularity> popularity , bool enableScalableThumbnail , bool includeMoreFields , string restrictedTerritories , string loaderUrl , string helpUrl ) { data.AppendFormat("\t\t<vendor>{0}</vendor>\n", Enum.GetName(typeof(VendorID), game.VendorID).SafeHtmlEncode()); VendorID originalVendorID = game.OriginalVendorID; if (originalVendorID == VendorID.Unknown) { originalVendorID = game.VendorID; } data.AppendFormat("\t\t<originalVendor>{0}</originalVendor>\n", Enum.GetName(typeof(VendorID), originalVendorID).SafeHtmlEncode()); if (game.ContentProviderID > 0 && ContentProviders.Exists(p => p.ID == game.ContentProviderID)) { ceContentProviderBase provider = ContentProviders.FirstOrDefault(p => p.ID == game.ContentProviderID); data.AppendFormat("\t\t<contentProvider>{0}</contentProvider>\n", provider.Identifying.SafeHtmlEncode()); //data.AppendFormat("\t\t<contentProviderLogo>"); //if (!string.IsNullOrWhiteSpace(provider.Logo)) // data.Append(string.Format("//{0}{1}", domain.GameResourceDomain, provider.Logo).SafeHtmlEncode()); //data.Append("</contentProviderLogo>\n"); } else { data.AppendFormat("\t\t<contentProvider>{0}</contentProvider>\n", Enum.GetName(typeof(VendorID), game.VendorID).SafeHtmlEncode()); } data.AppendFormat("\t\t<name>{0}</name>\n", game.GameName.SafeHtmlEncode()); if (!string.IsNullOrEmpty(game.Slug)) { data.AppendFormat("\t\t<slug>{0}</slug>\n", game.Slug.SafeHtmlEncode()); } data.AppendFormat("\t\t<shortName>{0}</shortName>\n", game.ShortName.SafeHtmlEncode()); data.AppendFormat("\t\t<description>{0}</description>\n", game.Description.SafeHtmlEncode()); data.AppendFormat("\t\t<anonymousFunMode>{0}</anonymousFunMode>\n", game.AnonymousFunMode.ToString().ToLowerInvariant()); data.AppendFormat("\t\t<funMode>{0}</funMode>\n", game.FunMode.ToString().ToLowerInvariant()); data.AppendFormat("\t\t<realMode>{0}</realMode>\n", game.RealMode.ToString().ToLowerInvariant()); data.AppendFormat("\t\t<newGame>{0}</newGame>\n", (game.NewGame && game.NewGameExpirationDate > DateTime.Now.Date).ToString().ToLowerInvariant()); data.AppendFormat("\t\t<license>{0}</license>\n", game.License.ToString().ToLowerInvariant()); //data.AppendFormat("\t\t<popularity>{0}</popularity>\n", (popularity + 1) * game.PopularityCoefficient); if ((popularity != null && popularity.Count > 0 && game != null)) { data.AppendFormat("\t\t<popularity>{0}</popularity>\n", (popularity.Sum(p => p.Popularity) + 1) * game.PopularityCoefficient); } else { data.AppendFormat("\t\t<popularity>{0}</popularity>\n", "1"); //data.Append("\t\t<popularityDetails/>\n"); } if (game.Width > 0 && game.Height > 0) { data.AppendFormat("\t\t<width>{0}</width>\n", game.Width); data.AppendFormat("\t\t<height>{0}</height>\n", game.Height); } data.AppendFormat("\t\t<thumbnail>"); if (!enableScalableThumbnail) { if (!string.IsNullOrWhiteSpace(game.Thumbnail)) { data.Append(string.Format("//{0}{1}", domain.GameResourceDomain, game.Thumbnail).SafeHtmlEncode()); } } else { if (!string.IsNullOrWhiteSpace(game.ScalableThumbnailPath)) { data.Append(string.Format("//{0}{1}", domain.GameResourceDomain, game.ScalableThumbnailPath).SafeHtmlEncode()); } } data.Append("</thumbnail>\n"); data.AppendFormat("\t\t<logo>"); if (!string.IsNullOrWhiteSpace(game.Logo)) { data.Append(string.Format("//{0}{1}", domain.GameResourceDomain, game.Logo).SafeHtmlEncode()); } data.Append("</logo>\n"); data.AppendFormat("\t\t<backgroundImage>"); if (!string.IsNullOrWhiteSpace(game.BackgroundImage)) { data.Append(string.Format("//{0}{1}", domain.GameResourceDomain, game.BackgroundImage).SafeHtmlEncode()); } data.Append("</backgroundImage>\n"); if (!string.IsNullOrEmpty(game.Icon)) { data.AppendFormat("\t\t<icons format=\"//{0}{1}\">\n" , domain.GameResourceDomain , game.Icon.SafeHtmlEncode() ); int[] sizes = new int[] { 114, 88, 72, 57, 44, 22 }; foreach (int size in sizes) { data.AppendFormat("\t\t\t<icon size=\"{2}\">//{0}{1}</icon>" , domain.GameResourceDomain , string.Format(game.Icon, size).SafeHtmlEncode() , size ); } data.AppendLine("\t\t</icons>"); } data.AppendFormat("\t\t<url>{0}</url>\n", loaderUrl.SafeHtmlEncode()); if (!string.IsNullOrEmpty(helpUrl)) { data.AppendFormat("\t\t<helpUrl>{0}/</helpUrl>\n", helpUrl.SafeHtmlEncode()); } data.Append("\t\t<categories>"); string[] categories = game.GameCategories.DefaultIfNullOrEmpty(string.Empty).Split(','); foreach (string category in categories) { if (!string.IsNullOrWhiteSpace(category)) { data.AppendFormat("<category>{0}</category>", category.SafeHtmlEncode()); } } data.Append("</categories>\n"); data.Append("\t\t<tags>"); string[] tags = game.Tags.DefaultIfNullOrEmpty(string.Empty).Split(','); foreach (string tag in tags) { if (!string.IsNullOrWhiteSpace(tag)) { data.AppendFormat("<tag>{0}</tag>", tag.SafeHtmlEncode()); } } data.Append("</tags>\n"); data.Append("\t\t<restrictedTerritories>"); { string[] vendorTerritories = null; if (!string.IsNullOrWhiteSpace(restrictedTerritories)) { vendorTerritories = restrictedTerritories.Split(','); foreach (string territory in vendorTerritories) { if (!string.IsNullOrWhiteSpace(territory)) { data.AppendFormat("<restrictedTerritory>{0}</restrictedTerritory>", territory.SafeHtmlEncode()); } } } if (!string.IsNullOrWhiteSpace(game.RestrictedTerritories)) { string[] gameTerritories = game.RestrictedTerritories.Split(',').Where(t => !string.IsNullOrWhiteSpace(t)).ToArray(); foreach (string territory in gameTerritories) { if (vendorTerritories != null && vendorTerritories.Contains(territory)) { continue; } data.AppendFormat("<restrictedTerritory>{0}</restrictedTerritory>", territory.SafeHtmlEncode()); } } } data.Append("</restrictedTerritories>\n"); if (includeMoreFields) { data.AppendFormat("\t\t<thirdPartyFee>{0:f5}</thirdPartyFee>\n", game.ThirdPartyFee); data.AppendFormat("\t\t<theoreticalPayOut>{0:f5}</theoreticalPayOut>\n", game.TheoreticalPayOut); data.AppendFormat("\t\t<bonusContribution>{0:f5}</bonusContribution>\n", game.BonusContribution); data.AppendFormat("\t\t<jackpotContribution>{0:f5}</jackpotContribution>\n", game.JackpotContribution); data.AppendFormat("\t\t<fpp>{0:f5}</fpp>\n", game.FPP); data.AppendFormat("\t\t<reportCategory>{0}</reportCategory>\n", game.ReportCategory.SafeHtmlEncode()); data.AppendFormat("\t\t<invoicingGroup>{0:f}</invoicingGroup>\n", game.InvoicingGroup.SafeHtmlEncode()); } }// PopulateGameBasicProperties
private Dictionary <string, CasinoGameLimitAmount> GetCurrencyLimitAmountForGame(ceCasinoGameBaseEx casinoGame) { Dictionary <string, CasinoGameLimitAmount> dic = new Dictionary <string, CasinoGameLimitAmount>(StringComparer.InvariantCultureIgnoreCase); if (!string.IsNullOrWhiteSpace(casinoGame.LimitationXml)) { Dictionary <string, CasinoGameLimitAmount> limitAmounts = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, CasinoGameLimitAmount> >(casinoGame.LimitationXml); foreach (string currency in limitAmounts.Keys) { if (limitAmounts[currency].MaxAmount == 0.00M) { continue; } dic.Add(currency, new CasinoGameLimitAmount() { MinAmount = limitAmounts[currency].MinAmount, MaxAmount = limitAmounts[currency].MaxAmount, }); } } return(dic); }
public ActionResult SaveTable(ceLiveCasinoTableBaseEx updatedTable , HttpPostedFileBase thumbnailFile ) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } try { string imageFileName; byte[] imageBuffer; if (ImageAsset.ParseImage(thumbnailFile, out imageFileName, out imageBuffer)) { imageFileName = ImageAsset.GetImageFtpFilePath(imageFileName); FTP.UploadFile(DomainManager.CurrentDomainID, imageFileName, imageBuffer); } SqlQuery <ceLiveCasinoTableBase> query = new SqlQuery <ceLiveCasinoTableBase>(); ceLiveCasinoTableBase baseTable = query.SelectByKey(updatedTable.ID); ceCasinoGameBaseEx game = CasinoGameAccessor.GetDomainGame(Constant.SystemDomainID, baseTable.CasinoGameBaseID); if (CurrentUserSession.IsSystemUser && DomainManager.CurrentDomainID == Constant.SystemDomainID) { baseTable.TableName = updatedTable.TableName; baseTable.Category = updatedTable.Category; baseTable.ExtraParameter1 = updatedTable.ExtraParameter1; baseTable.ExtraParameter2 = updatedTable.ExtraParameter2; baseTable.ExtraParameter3 = updatedTable.ExtraParameter3; baseTable.ExtraParameter4 = updatedTable.ExtraParameter4; baseTable.LaunchParams = updatedTable.LaunchParams; baseTable.OpenHoursStart = updatedTable.OpenHoursStart; baseTable.OpenHoursEnd = updatedTable.OpenHoursEnd; baseTable.OpenHoursTimeZone = updatedTable.OpenHoursTimeZone; baseTable.Limit = ParseLimit(); baseTable.VIPTable = updatedTable.VIPTable; baseTable.NewTable = updatedTable.NewTable; baseTable.NewTableExpirationDate = updatedTable.NewTable ? updatedTable.NewTableExpirationDate : DateTime.Now.AddDays(-1); baseTable.ExcludeFromRandomLaunch = updatedTable.ExcludeFromRandomLaunch; baseTable.TurkishTable = updatedTable.TurkishTable; baseTable.BetBehindAvailable = updatedTable.BetBehindAvailable; baseTable.SeatsUnlimited = updatedTable.SeatsUnlimited; baseTable.DealerGender = updatedTable.DealerGender; baseTable.DealerOrigin = updatedTable.DealerOrigin; baseTable.TableStudioUrl = updatedTable.TableStudioUrl; //if (game.VendorID == VendorID.EvolutionGaming) { baseTable.ClientCompatibility = updatedTable.ClientCompatibility; } if (!string.IsNullOrWhiteSpace(imageFileName)) { baseTable.Thumbnail = imageFileName; } query.Update(baseTable); //updating properties that are inherited from basetable and disabled for edit in child tables var propertiesValues = new Dictionary <string, object> { { "BetBehindAvailable", updatedTable.BetBehindAvailable }, { "SeatsUnlimited", updatedTable.SeatsUnlimited }, { "DealerGender", updatedTable.DealerGender }, { "DealerOrigin", updatedTable.DealerOrigin } }; LiveCasinoTableAccessor.UpdateChildTablesProperties(propertiesValues, baseTable.ID); } else if (DomainManager.CurrentDomainID != Constant.SystemDomainID) { LiveCasinoTableAccessor lta = LiveCasinoTableAccessor.CreateInstance <LiveCasinoTableAccessor>(); ceLiveCasinoTable table = lta.GetTable(DomainManager.CurrentDomainID, updatedTable.ID); bool isExist = table != null; bool isModified = false; if (!isExist) { table = new ceLiveCasinoTable() { DomainID = DomainManager.CurrentDomainID, LiveCasinoTableBaseID = updatedTable.ID }; table.Ins = DateTime.Now; table.SessionUserID = CurrentUserSession.UserID; table.SessionID = CurrentUserSession.UserSessionID; table.OpVisible = baseTable.OpVisible; table.ClientCompatibility = null; table.NewTableExpirationDate = baseTable.NewTableExpirationDate == DateTime.MinValue ? DateTime.Now.Date.AddDays(-1) : baseTable.NewTableExpirationDate; table.BetBehindAvailable = baseTable.BetBehindAvailable; table.SeatsUnlimited = baseTable.SeatsUnlimited; table.DealerGender = baseTable.DealerGender; table.DealerOrigin = baseTable.DealerOrigin; } table.ShortName = null; table.Logo = null; table.BackgroundImage = null; if (!string.IsNullOrWhiteSpace(updatedTable.ExtraParameter1) && !string.Equals(baseTable.ExtraParameter1, updatedTable.ExtraParameter1)) { isModified = true; table.ExtraParameter1 = updatedTable.ExtraParameter1; } else { table.ExtraParameter1 = null; } if (!string.IsNullOrWhiteSpace(updatedTable.ExtraParameter2) && !string.Equals(baseTable.ExtraParameter2, updatedTable.ExtraParameter2)) { isModified = true; table.ExtraParameter2 = updatedTable.ExtraParameter2; } else { table.ExtraParameter2 = null; } if (!string.IsNullOrWhiteSpace(updatedTable.ExtraParameter3) && !string.Equals(baseTable.ExtraParameter3, updatedTable.ExtraParameter3)) { isModified = true; table.ExtraParameter3 = updatedTable.ExtraParameter3; } else { table.ExtraParameter3 = null; } if (!string.IsNullOrWhiteSpace(updatedTable.ExtraParameter4) && !string.Equals(baseTable.ExtraParameter4, updatedTable.ExtraParameter4)) { isModified = true; table.ExtraParameter4 = updatedTable.ExtraParameter4; } else { table.ExtraParameter4 = null; } if (!string.IsNullOrEmpty(updatedTable.LaunchParams) && !string.Equals(baseTable.LaunchParams, updatedTable.LaunchParams)) { isModified = true; table.LaunchParams = updatedTable.LaunchParams; } else { table.LaunchParams = null; } if (!string.IsNullOrWhiteSpace(updatedTable.TableName) && !string.Equals(baseTable.TableName, updatedTable.TableName)) { isModified = true; table.TableName = updatedTable.TableName; } else { table.TableName = null; } if (!string.IsNullOrWhiteSpace(updatedTable.Category) && !string.Equals(baseTable.Category, updatedTable.Category)) { isModified = true; table.Category = updatedTable.Category; } else { table.Category = null; } if (!string.IsNullOrWhiteSpace(imageFileName) && !string.Equals(baseTable.Thumbnail, updatedTable.Thumbnail)) { isModified = true; table.Thumbnail = imageFileName; } else { table.Thumbnail = null; } //if (game.VendorID == VendorID.EvolutionGaming) { if (updatedTable.ClientCompatibility != null && !string.Equals(table.ClientCompatibility, updatedTable.ClientCompatibility)) { isModified = true; if (!string.Equals(baseTable.ClientCompatibility, updatedTable.ClientCompatibility)) { table.ClientCompatibility = updatedTable.ClientCompatibility; } else { table.ClientCompatibility = null; } } } string limitationXml = table.LimitationXml; LiveCasinoTableLimit limit = table.Limit; table.Limit = ParseLimit(); if (table.Limit.Equals(baseTable.Limit)) { table.LimitationXml = null; } if (!(string.IsNullOrWhiteSpace(table.LimitationXml) && string.IsNullOrWhiteSpace(limitationXml))) { if (table.LimitationXml == null) { isModified = true; } else if (!table.LimitationXml.Equals(limitationXml, StringComparison.InvariantCultureIgnoreCase)) { isModified = true; } } if (table.VIPTable != updatedTable.VIPTable) { table.VIPTable = updatedTable.VIPTable; isModified = true; } if (table.NewTable != updatedTable.NewTable || table.NewTableExpirationDate.CompareTo(updatedTable.NewTableExpirationDate) != 0) { table.NewTable = updatedTable.NewTable; table.NewTableExpirationDate = updatedTable.NewTable ? updatedTable.NewTableExpirationDate : DateTime.Now.AddDays(-1); isModified = true; } if (table.TurkishTable != updatedTable.TurkishTable) { table.TurkishTable = updatedTable.TurkishTable; isModified = true; } if (table.ExcludeFromRandomLaunch != updatedTable.ExcludeFromRandomLaunch) { table.ExcludeFromRandomLaunch = updatedTable.ExcludeFromRandomLaunch; isModified = true; } if (table.TableStudioUrl != updatedTable.TableStudioUrl) { table.TableStudioUrl = updatedTable.TableStudioUrl; isModified = true; } if (isModified) { SqlQuery <ceLiveCasinoTable> query2 = new SqlQuery <ceLiveCasinoTable>(); if (isExist) { query2.Update(table); } else { query2.Insert(table); } } } return(this.Json(new { success = true }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Logger.Exception(ex); return(this.Json(new { success = false, error = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult RegisterTable(long gameID , string extraParameter1 , string extraParameter2 , string extraParameter3 , string extraParameter4 , string ClientCompatibility , string launchParams ) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } try { var domain = DomainManager.GetDomains().FirstOrDefault(d => d.DomainID == DomainManager.CurrentDomainID); if (domain == null && DomainManager.GetSysDomain().DomainID == DomainManager.CurrentDomainID) { domain = DomainManager.GetSysDomain(); } using (DbManager db = new DbManager()) { ceCasinoGameBaseEx game = CasinoGameAccessor.GetDomainGame(Constant.SystemDomainID, gameID); SqlQuery <ceLiveCasinoTableBase> query = new SqlQuery <ceLiveCasinoTableBase>(db); ceLiveCasinoTableBase table = new ceLiveCasinoTableBase(); table.CasinoGameBaseID = gameID; table.Enabled = true; table.NewTableExpirationDate = DateTime.Now.AddDays(domain.NewStatusLiveCasinoGameExpirationDays); table.Ins = DateTime.Now; table.SessionUserID = CurrentUserSession.UserID; table.SessionID = CurrentUserSession.SessionID; table.TableName = game.GameName; table.ExtraParameter1 = extraParameter1; table.ExtraParameter2 = extraParameter2; table.ExtraParameter3 = extraParameter3; table.ExtraParameter4 = extraParameter4; table.LaunchParams = launchParams; table.OpenHoursStart = 0; table.OpenHoursEnd = 0; table.ClientCompatibility = ClientCompatibility ?? ",PC,"; #region TableID switch (game.VendorID) { case VendorID.Microgaming: table.ID = gameID; break; case VendorID.XProGaming: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.EvolutionGaming: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.Tombala: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.NetEnt: { table.ID = gameID * 1000000 + int.Parse(extraParameter1); table.Limit = NetEntAPI.LiveCasinoTable.Get(DomainManager.CurrentDomainID, game.GameID, table.ExtraParameter1).Limitation; break; } case VendorID.Ezugi: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.ISoftBet: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.Vivo: { int l = 999999; int.TryParse(extraParameter2, out l); if (l > 1000000) { l = l % 1000000; } Random r = new Random(); int i = r.Next(l); table.ID = gameID * 1000000 + int.Parse(extraParameter1) + l; break; } case VendorID.BetGames: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.PokerKlas: table.ID = gameID; break; case VendorID.LuckyStreak: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.Authentic: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.ViG: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.HoGaming: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.TTG: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.LiveGames: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.Entwine: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } default: Random rnd = new Random(); table.ID = gameID * 1000000 + rnd.Next(100000); break; } #endregion query.Insert(table); } return(this.Json(new { success = true }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Logger.Exception(ex); return(this.Json(new { success = false, error = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ContentResult GameInfo(string apiUsername, string gameID, string language) { 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()))); } DomainManager.CurrentDomainID = domain.DomainID; Dictionary <string, ceCasinoGameBaseEx> games = CacheManager.GetGameDictionary(domain.DomainID); ceCasinoGameBaseEx game = null; games.TryGetValue(gameID, out game); try { if (game == null) { throw new HttpException(404, "Game is not available!"); } language = GetISO639LanguageCode(language); string cacheKey = string.Format("XmlFeedsController.GameInfo.{0}.{1}.{2}" , DomainManager.CurrentDomainID , gameID , language ); StringBuilder sb = HttpRuntime.Cache[cacheKey] as StringBuilder; if (sb == null) { sb = GetMetadataGameInfo(domain, game, language); if (sb == null) { switch (game.VendorID) { case VendorID.GreenTube: sb = GetGreenTubeGameInfo(game, language); break; default: break; } } if (sb != null) { HttpRuntime.Cache.Insert(cacheKey , sb , null , DateTime.Now.AddMinutes(10) , Cache.NoSlidingExpiration ); } } return(WrapResponse(ResultCode.Success, string.Empty, sb)); } catch (Exception ex) { Logger.Exception(ex); return(WrapResponse(ResultCode.Error_SystemFailure, ex.Message)); } }